# HG changeset patch # User jwe # Date 1149541165 0 # Node ID fb4dea2184bfc1883c76eb20b9024b1c4e8a93a6 # Parent 257643fc806be0f83fdbe1b44375628b915e5347 [project @ 2006-06-05 20:59:25 by jwe] diff -r 257643fc806b -r fb4dea2184bf doc/interpreter/expr.txi --- a/doc/interpreter/expr.txi Thu Jun 01 22:08:00 2006 +0000 +++ b/doc/interpreter/expr.txi Mon Jun 05 20:59:25 2006 +0000 @@ -907,8 +907,6 @@ programs hard to read. Except in a one-shot program, you should rewrite it to get rid of such nesting of assignments. This is never very hard. -@DOCSTRING(print_rhs_assign_val) - @cindex increment operator @cindex decrement operator @cindex operators, increment diff -r 257643fc806b -r fb4dea2184bf src/ChangeLog --- a/src/ChangeLog Thu Jun 01 22:08:00 2006 +0000 +++ b/src/ChangeLog Mon Jun 05 20:59:25 2006 +0000 @@ -1,3 +1,19 @@ +2006-06-05 John W. Eaton + + * pt-assign.cc (Vprint_rhs_assign_val): Delete variable. + (Fprint_rhs_assign_val): Delete function. + tree_simple_assignment::rvalue, tree_multi_assignment::rvalue): + No special case for Vprint_rhs_assign_val. + +2006-06-02 John W. Eaton + + * pt-arg-list.h (tree_argument_list::mark_as_simple_assign_lhs, + tree_argument_list::is_simple_assign_lhs): New functions. + (tree_argument_list::simple_assign_lhs): New data member. + * parse.y (assign_lhs): Classify LHS here. + (make_assign_op): Create simple or multi assign op based on + classification of LHS, not its length. + 2006-06-01 John W. Eaton * Makefile.in (DLD_XSRC): Add __pchip_deriv__.cc to the list. diff -r 257643fc806b -r fb4dea2184bf src/parse.y --- a/src/parse.y Thu Jun 01 22:08:00 2006 +0000 +++ b/src/parse.y Mon Jun 05 20:59:25 2006 +0000 @@ -832,7 +832,10 @@ // one token for an assignment op. assign_lhs : simple_expr - { $$ = new tree_argument_list ($1); } + { + $$ = new tree_argument_list ($1); + $$->mark_as_simple_assign_lhs (); + } | '[' arg_list CLOSE_BRACE { $$ = $2; @@ -2424,7 +2427,7 @@ int l = eq_tok->line (); int c = eq_tok->column (); - if (lhs->length () == 1) + if (lhs->is_simple_assign_lhs ()) { tree_expression *tmp = lhs->remove_front (); diff -r 257643fc806b -r fb4dea2184bf src/pt-arg-list.h --- a/src/pt-arg-list.h Thu Jun 01 22:08:00 2006 +0000 +++ b/src/pt-arg-list.h Mon Jun 05 20:59:25 2006 +0000 @@ -45,10 +45,11 @@ typedef tree_expression* element_type; tree_argument_list (void) - : list_includes_magic_end (false) { } + : list_includes_magic_end (false), simple_assign_lhs (false) { } tree_argument_list (tree_expression *t) - : list_includes_magic_end (false) { append (t); } + : list_includes_magic_end (false), simple_assign_lhs (false) + { append (t); } ~tree_argument_list (void); @@ -66,6 +67,10 @@ int nargout_count (void) const; + void mark_as_simple_assign_lhs (void) { simple_assign_lhs = true; } + + bool is_simple_assign_lhs (void) { return simple_assign_lhs; } + bool all_elements_are_constant (void) const; octave_value_list convert_to_const_vector (const octave_value *object = 0); @@ -78,6 +83,8 @@ bool list_includes_magic_end; + bool simple_assign_lhs; + // No copying! tree_argument_list (const tree_argument_list&); diff -r 257643fc806b -r fb4dea2184bf src/pt-assign.cc --- a/src/pt-assign.cc Thu Jun 01 22:08:00 2006 +0000 +++ b/src/pt-assign.cc Mon Jun 05 20:59:25 2006 +0000 @@ -41,10 +41,6 @@ #include "utils.h" #include "variables.h" -// TRUE means print the right hand side of an assignment instead of -// the left. -static bool Vprint_rhs_assign_val = false; - // Simple assignment expressions. tree_simple_assignment::~tree_simple_assignment (void) @@ -118,25 +114,19 @@ if (print_result ()) { - if (Vprint_rhs_assign_val) - retval.print_with_name (octave_stdout, - lhs->str_print_code ()); - else - { - // We clear any index here so that we can - // get the new value of the referenced - // object below, instead of the indexed - // value (which should be the same as the - // right hand side value). + // We clear any index here so that we can + // get the new value of the referenced + // object below, instead of the indexed + // value (which should be the same as the + // right hand side value). - ult.clear_index (); + ult.clear_index (); - octave_value lhs_val = ult.value (); + octave_value lhs_val = ult.value (); - if (! error_state) - lhs_val.print_with_name (octave_stdout, - lhs->name ()); - } + if (! error_state) + lhs_val.print_with_name (octave_stdout, + lhs->name ()); } } else @@ -283,25 +273,18 @@ } else if (print_result ()) { - if (Vprint_rhs_assign_val) - retval(k).print_with_name - (octave_stdout, lhs_elt->str_print_code ()); - else - { - // We clear any index here so that we can - // get the new value of the referenced - // object below, instead of the indexed - // value (which should be the same as the - // right hand side value). + // We clear any index here so that we can get + // the new value of the referenced object below, + // instead of the indexed value (which should be + // the same as the right hand side value). - ult.clear_index (); + ult.clear_index (); - octave_value lhs_val = ult.value (); + octave_value lhs_val = ult.value (); - if (! error_state) - lhs_val.print_with_name (octave_stdout, - lhs_elt->name ()); - } + if (! error_state) + lhs_val.print_with_name (octave_stdout, + lhs_elt->name ()); } } else @@ -343,19 +326,6 @@ tw.visit_multi_assignment (*this); } -DEFUN (print_rhs_assign_val, args, nargout, - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} print_rhs_assign_val ()\n\ -@deftypefnx {Built-in Function} {@var{old_val} =} print_rhs_assign_val (@var{new_val})\n\ -Query or set the internal variable that controls whether Octave will\n\ -print the value of the right hand side of assignment expressions\n\ -instead of the value of the left hand side (after the assignment).\n\ -@end deftypefn") -{ - return SET_INTERNAL_VARIABLE (print_rhs_assign_val); -} - - /* ;;; Local Variables: *** ;;; mode: C++ ***