annotate src/pt.cc @ 3162:7c96e85c76db

[project @ 1998-04-08 18:19:35 by jwe]
author jwe
date Wed, 08 Apr 1998 18:21:04 +0000
parents fc751d2a99fd
children d14c483b3c12
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
1 /*
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
2
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
4
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
6
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
10 later version.
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
11
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
15 for more details.
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
16
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
20
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
21 */
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
22
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
23 #if defined (__GNUG__)
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
24 #pragma implementation
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
25 #endif
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
26
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
27 #ifdef HAVE_CONFIG_H
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
28 #include <config.h>
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
29 #endif
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
30
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
31 #include <string>
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
32
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
33 #include <iostream.h>
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
34 #include <strstream.h>
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
35
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
36 #include "pt.h"
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
37 #include "pt-pr-code.h"
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
38
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
39 // Hide the details of the string buffer so that we are less likely to
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
40 // create a memory leak.
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
41
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
42 string
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
43 tree::str_print_code (void)
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
44 {
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
45 ostrstream buf;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
46
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
47 tree_print_code tpc (buf);
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
48
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
49 accept (tpc);
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
50
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
51 buf << ends;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
52
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
53 const char *s = buf.str ();
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
54
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
55 string retval = s;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
56
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
57 delete [] s;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
58
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
59 return retval;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
60 }
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
61
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
62 /*
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
63 ;;; Local Variables: ***
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
64 ;;; mode: C++ ***
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
65 ;;; End: ***
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
66 */