annotate src/pt.cc @ 3534:096ad38d7ab5

[project @ 2000-02-02 11:52:05 by jwe]
author jwe
date Wed, 02 Feb 2000 11:52:11 +0000
parents b80bbb43a1a9
children e8fbc8c3d6d9
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
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 2991
diff changeset
31 #include <iostream>
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 2991
diff changeset
32 #include <strstream>
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
33 #include <string>
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
34
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
35 #include "pt.h"
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
36 #include "pt-pr-code.h"
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
37
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
38 // 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
39 // create a memory leak.
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
40
3534
096ad38d7ab5 [project @ 2000-02-02 11:52:05 by jwe]
jwe
parents: 3523
diff changeset
41 std:string
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
42 tree::str_print_code (void)
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
43 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
44 std::ostrstream buf;
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
45
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
46 tree_print_code tpc (buf);
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
47
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
48 accept (tpc);
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
49
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
50 buf << ends;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
51
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
52 const char *s = buf.str ();
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
53
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
54 std::string retval = s;
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
55
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
56 delete [] s;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
57
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
58 return retval;
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
59 }
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 ;;; Local Variables: ***
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
63 ;;; mode: C++ ***
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
64 ;;; End: ***
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents:
diff changeset
65 */