2991
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if defined (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
3503
|
31 #include <iostream> |
|
32 #include <strstream> |
2991
|
33 #include <string> |
|
34 |
|
35 #include "pt.h" |
|
36 #include "pt-pr-code.h" |
|
37 |
3772
|
38 // If true, stop executing at the next possible point. |
|
39 bool tree::break_next = false; |
|
40 |
3805
|
41 // The line where dbg_next was executed. |
|
42 int tree::last_line = 0; |
|
43 |
|
44 // The function where the last breakpoint occurred. |
|
45 const octave_user_function *tree::break_function = 0; |
|
46 |
|
47 // The statement where the last breakpoint occurred. |
3806
|
48 const tree *tree::break_statement = 0; |
3805
|
49 |
2991
|
50 // Hide the details of the string buffer so that we are less likely to |
|
51 // create a memory leak. |
|
52 |
3536
|
53 std::string |
2991
|
54 tree::str_print_code (void) |
|
55 { |
3523
|
56 std::ostrstream buf; |
2991
|
57 |
|
58 tree_print_code tpc (buf); |
|
59 |
|
60 accept (tpc); |
|
61 |
3538
|
62 buf << std::ends; |
2991
|
63 |
|
64 const char *s = buf.str (); |
|
65 |
3523
|
66 std::string retval = s; |
2991
|
67 |
|
68 delete [] s; |
|
69 |
|
70 return retval; |
|
71 } |
|
72 |
|
73 /* |
|
74 ;;; Local Variables: *** |
|
75 ;;; mode: C++ *** |
|
76 ;;; End: *** |
|
77 */ |