Mercurial > hg > octave-terminal
changeset 2530:64f403ef483d
[project @ 1996-11-19 18:06:02 by jwe]
author | jwe |
---|---|
date | Tue, 19 Nov 1996 18:11:18 +0000 |
parents | 90fa35bd0216 |
children | d21eb2d6e135 |
files | src/Makefile.in src/pt-exp-base.cc src/pt-exp-base.h src/pt-fcn.cc src/pt-misc.cc src/pt-pr-code.cc src/pt-pr-code.h |
diffstat | 7 files changed, 29 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -294,12 +294,7 @@ if [ "$$linkdir" = $(octincludedir) ] ; then \ true ; \ else \ - if [ -d $$linkdir ] ; then \ - true ; \ - else \ - rm -f $$linkdir ; \ - $(LN_S) $(octincludedir) $$linkdir ; \ - fi ; \ + rm -f $$linkdir && $(LN_S) $(octincludedir) $$linkdir ; \ fi .PHONY: install-lib
--- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -28,6 +28,8 @@ #include <config.h> #endif +#include <string> + #include <iostream.h> #include <strstream.h> @@ -72,6 +74,12 @@ return octave_value (); } +string +tree_expression::original_text (void) const +{ + return string (); +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/pt-exp-base.h +++ b/src/pt-exp-base.h @@ -27,6 +27,8 @@ #pragma interface #endif +#include <string> + class octave_value; #include "pt-base.h" @@ -59,9 +61,6 @@ virtual bool is_matrix_constant (void) const { return false; } - virtual bool is_range_constant (void) const - { return false; } - virtual bool is_multi_val_ret_expression (void) const { return false; } @@ -92,6 +91,8 @@ virtual char *oper (void) const { return "<unknown>"; } + virtual string original_text (void) const; + protected: // Nonzero if this expression appears inside parentheses.
--- a/src/pt-fcn.cc +++ b/src/pt-fcn.cc @@ -35,6 +35,7 @@ #include "error.h" #include "gripes.h" #include "help.h" +#include "input.h" #include "pager.h" #include "symtab.h" #include "toplev.h" @@ -395,7 +396,7 @@ void tree_function::print_code_function_header (void) { - tree_print_code tpc (octave_stdout); + tree_print_code tpc (octave_stdout, Vps4); tpc.visit_function_header (*this); } @@ -403,7 +404,7 @@ void tree_function::print_code_function_trailer (void) { - tree_print_code tpc (octave_stdout); + tree_print_code tpc (octave_stdout, Vps4); tpc.visit_function_trailer (*this); }
--- a/src/pt-misc.cc +++ b/src/pt-misc.cc @@ -38,6 +38,7 @@ #endif #include "error.h" +#include "input.h" #include "oct-obj.h" #include "pager.h" #include "toplev.h" @@ -87,7 +88,7 @@ if (in_function_body && (Vecho_executing_commands & ECHO_FUNCTIONS)) { - tree_print_code tpc (octave_stdout); + tree_print_code tpc (octave_stdout, Vps4); accept (tpc); }
--- a/src/pt-pr-code.cc +++ b/src/pt-pr-code.cc @@ -31,7 +31,6 @@ #include <iostream.h> #include "error.h" -#include "input.h" #include "pr-output.h" #include "pt-pr-code.h" @@ -569,7 +568,7 @@ if (in_parens) os << "("; - val.print (os, true); + val.print (os, true, print_original_text); if (in_parens) os << ")"; @@ -1080,7 +1079,7 @@ if (beginning_of_line) { - os.form ("%s%*s", Vps4.c_str (), curr_print_indent_level, ""); + os.form ("%s%*s", prefix.c_str (), curr_print_indent_level, ""); beginning_of_line = false; } }
--- a/src/pt-pr-code.h +++ b/src/pt-pr-code.h @@ -27,6 +27,8 @@ #pragma interface #endif +#include <string> + #include "pt-walk.h" // How to print the code that the parse trees represent. @@ -36,7 +38,9 @@ { public: - tree_print_code (ostream& os_arg) : os (os_arg) { } + tree_print_code (ostream& os_arg, const string& pfx = string (), + bool pr_orig_txt = true) + : os (os_arg), prefix (pfx), print_original_text (pr_orig_txt) { } ~tree_print_code (void) { } @@ -130,6 +134,10 @@ ostream& os; + string prefix; + + bool print_original_text; + static int curr_print_indent_level; static bool beginning_of_line;