annotate src/pt-assign.cc @ 14138:72c96de7a403 stable

maint: update copyright notices for 2012
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2012 14:25:41 -0500
parents fafd2f45bfa5
children 000cd393f3c1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
1 /*
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14048
diff changeset
3 Copyright (C) 1996-2012 John W. Eaton
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
4
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
6
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
10 option) any later version.
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
11
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
15 for more details.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
16
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
19 <http://www.gnu.org/licenses/>.
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
20
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
21 */
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
22
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
24 #include <config.h>
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
25 #endif
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
26
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3448
diff changeset
27 #include <iostream>
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
28 #include <set>
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
29
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
30 #include "defun.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
31 #include "error.h"
10030
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
32 #include "gripes.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
33 #include "input.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
34 #include "oct-obj.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
35 #include "oct-lvalue.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
36 #include "pager.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
37 #include "ov.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents: 2980
diff changeset
38 #include "pt-arg-list.h"
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3536
diff changeset
39 #include "pt-bp.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
40 #include "pt-assign.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
41 #include "pt-walk.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
42 #include "utils.h"
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5775
diff changeset
43 #include "variables.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
44
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
45 // Simple assignment expressions.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
46
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
47 // FIXME -- the following variable and the function that uses it
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
48 // should be removed from some future version of Octave.
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
49
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
50 static const char *former_built_in_variables[] =
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
51 {
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
52 "DEFAULT_EXEC_PATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
53 "DEFAULT_LOADPATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
54 "EDITOR",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
55 "EXEC_PATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
56 "FFTW_WISDOM_PROGRAM",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
57 "IMAGEPATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
58 "INFO_FILE",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
59 "INFO_PROGRAM",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
60 "LOADPATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
61 "MAKEINFO_PROGRAM",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
62 "PAGER",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
63 "PS1",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
64 "PS2",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
65 "PS4",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
66 "__kluge_procbuf_delay__",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
67 "automatic_replot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
68 "beep_on_error",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
69 "completion_append_char",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
70 "crash_dumps_octave_core",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
71 "current_script_file_name",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
72 "debug_on_error",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
73 "debug_on_interrupt",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
74 "debug_on_warning",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
75 "debug_symtab_lookups",
14048
fafd2f45bfa5 Change "default_save_format" to "default_save_options" in former_built_in_variables list.
Kris Thielemans <kris.f.thielemans@gmail.com>
parents: 13867
diff changeset
76 "default_save_options",
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
77 "echo_executing_commands",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
78 "fixed_point_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
79 "gnuplot_binary",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
80 "gnuplot_command_axes",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
81 "gnuplot_command_end",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
82 "gnuplot_command_plot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
83 "gnuplot_command_replot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
84 "gnuplot_command_splot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
85 "gnuplot_command_title",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
86 "gnuplot_command_using",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
87 "gnuplot_command_with",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
88 "gnuplot_has_frames",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
89 "history_file",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
90 "history_size",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
91 "ignore_function_time_stamp",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
92 "max_recursion_depth",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
93 "octave_core_file_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
94 "octave_core_file_limit",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
95 "octave_core_file_name",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
96 "output_max_field_width",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
97 "output_precision",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
98 "page_output_immediately",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
99 "page_screen_output",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
100 "print_answer_id_name",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
101 "print_empty_dimensions",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
102 "print_rhs_assign_val",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
103 "save_header_format_string",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
104 "save_precision",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
105 "saving_history",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
106 "sighup_dumps_octave_core",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
107 "sigterm_dumps_octave_core",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
108 "silent_functions",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
109 "split_long_rows",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
110 "string_fill_char",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
111 "struct_levels_to_print",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
112 "suppress_verbose_help_message",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
113 "variables_can_hide_functions",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
114 "warn_assign_as_truth_value",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
115 "warn_associativity_change",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
116 "warn_divide_by_zero",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
117 "warn_empty_list_elements",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
118 "warn_fortran_indexing",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
119 "warn_function_name_clash",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
120 "warn_future_time_stamp",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
121 "warn_imag_to_real",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
122 "warn_matlab_incompatible",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
123 "warn_missing_semicolon",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
124 "warn_neg_dim_as_zero",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
125 "warn_num_to_str",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
126 "warn_precedence_change",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
127 "warn_reload_forces_clear",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
128 "warn_resize_on_range_error",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
129 "warn_separator_insert",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
130 "warn_single_quote_string",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
131 "warn_str_to_num",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
132 "warn_undefined_return_values",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
133 "warn_variable_switch_label",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
134 "whos_line_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
135 0,
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
136 };
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
137
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
138 static void
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
139 maybe_warn_former_built_in_variable (const std::string& nm)
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
140 {
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
141 static bool initialized = false;
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
142
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
143 static std::set<std::string> vars;
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
144
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
145 if (! initialized)
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
146 {
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
147 const char **p = former_built_in_variables;
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
148
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
149 while (*p)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
150 vars.insert (*p++);
9224
a6422d81bee7 pt-assign.cc (maybe_warn_former_built_in_variable): set initialized to true on first call
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
151
a6422d81bee7 pt-assign.cc (maybe_warn_former_built_in_variable): set initialized to true on first call
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
152 initialized = true;
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
153 }
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
154
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
155 if (vars.find (nm) != vars.end ())
9421
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
156 {
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
157 const char *nm_c_str = nm.c_str ();
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
158
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
159 warning_with_id ("Octave:built-in-variable-assignment",
13867
922bfdd80413 Clean up help about old flags for debug variables
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11523
diff changeset
160 "\
922bfdd80413 Clean up help about old flags for debug variables
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11523
diff changeset
161 In recent versions of Octave, %s is a function instead\n\
922bfdd80413 Clean up help about old flags for debug variables
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11523
diff changeset
162 of a built-in variable.\n\n\
922bfdd80413 Clean up help about old flags for debug variables
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11523
diff changeset
163 By assigning to %s, you have created a variable that hides\n\
922bfdd80413 Clean up help about old flags for debug variables
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11523
diff changeset
164 the function %s. To remove the variable and restore the \n\
922bfdd80413 Clean up help about old flags for debug variables
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11523
diff changeset
165 function, type \"clear %s\"\n",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
166 nm_c_str, nm_c_str, nm_c_str, nm_c_str);
9421
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
167 }
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
168 }
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
169
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
170 tree_simple_assignment::tree_simple_assignment
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
171 (tree_expression *le, tree_expression *re,
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
172 bool plhs, int l, int c, octave_value::assign_op t)
8038
aa6484781a5b fix typo in last commit
John W. Eaton <jwe@octave.org>
parents: 8037
diff changeset
173 : tree_expression (l, c), lhs (le), rhs (re), preserve (plhs), etype (t),
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
174 first_execution (true) { }
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
175
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
176 tree_simple_assignment::~tree_simple_assignment (void)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
177 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
178 if (! preserve)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
179 delete lhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
180
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
181 delete rhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
182 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
183
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
184 octave_value_list
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
185 tree_simple_assignment::rvalue (int nargout)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
186 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
187 octave_value_list retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
188
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
189 if (nargout > 1)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
190 error ("invalid number of output arguments for expression X = RHS");
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
191 else
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
192 retval = rvalue1 (nargout);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
193
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
194 return retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
195 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
196
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
197 octave_value
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
198 tree_simple_assignment::rvalue1 (int)
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
199 {
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
200 octave_value retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
201
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
202 if (first_execution && lhs)
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
203 maybe_warn_former_built_in_variable (lhs->name ());
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
204
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
205 if (error_state)
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
206 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
207
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
208 if (rhs)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
209 {
8905
24dd61b36591 assign rvalue1 result to octave_value object, not octave_value_list object
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
210 octave_value rhs_val = rhs->rvalue1 ();
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
211
8905
24dd61b36591 assign rvalue1 result to octave_value object, not octave_value_list object
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
212 if (! error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
213 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
214 if (rhs_val.is_undefined ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
215 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
216 error ("value on right hand side of assignment is undefined");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
217 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
218 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
219 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
220 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
221 if (rhs_val.is_cs_list ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
222 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
223 const octave_value_list lst = rhs_val.list_value ();
7389
4d0d6c357bc6 [project @ 2008-01-16 08:32:13 by jwe]
jwe
parents: 7336
diff changeset
224
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
225 if (! lst.empty ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
226 rhs_val = lst(0);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
227 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
228 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
229 error ("invalid number of elements on RHS of assignment");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
230 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
231 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
232 }
7389
4d0d6c357bc6 [project @ 2008-01-16 08:32:13 by jwe]
jwe
parents: 7336
diff changeset
233
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
234 octave_lvalue ult = lhs->lvalue ();
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
235
10030
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
236 if (ult.numel () != 1)
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
237 gripe_nonbraced_cs_list_assignment ();
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
238
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
239 if (! error_state)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
240 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
241 ult.assign (etype, rhs_val);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
242
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
243 if (! error_state)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
244 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
245 if (etype == octave_value::op_asn_eq)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
246 retval = rhs_val;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
247 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
248 retval = ult.value ();
2984
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2982
diff changeset
249
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
250 if (print_result ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
251 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
252 // We clear any index here so that we can
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
253 // get the new value of the referenced
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
254 // object below, instead of the indexed
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
255 // value (which should be the same as the
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
256 // right hand side value).
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
257
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
258 ult.clear_index ();
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
259
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
260 octave_value lhs_val = ult.value ();
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
261
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
262 if (! error_state)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
263 lhs_val.print_with_name (octave_stdout,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
264 lhs->name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
265 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
266 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
267 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
268 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
269 }
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
270 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
271
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
272 first_execution = false;
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
273
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
274 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
275 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
276
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
277 std::string
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
278 tree_simple_assignment::oper (void) const
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
279 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
280 return octave_value::assign_op_as_string (etype);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
281 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
282
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
283 tree_expression *
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
284 tree_simple_assignment::dup (symbol_table::scope_id scope,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
285 symbol_table::context_id context) const
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
286 {
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
287 tree_simple_assignment *new_sa
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
288 = new tree_simple_assignment (lhs ? lhs->dup (scope, context) : 0,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
289 rhs ? rhs->dup (scope, context) : 0,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
290 preserve, etype);
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
291
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
292 new_sa->copy_base (*this);
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
293
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
294 return new_sa;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
295 }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
296
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
297 void
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
298 tree_simple_assignment::accept (tree_walker& tw)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
299 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
300 tw.visit_simple_assignment (*this);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
301 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
302
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
303 // Multi-valued assignment expressions.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
304
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
305 tree_multi_assignment::tree_multi_assignment
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
306 (tree_argument_list *lst, tree_expression *r,
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
307 bool plhs, int l, int c)
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
308 : tree_expression (l, c), lhs (lst), rhs (r), preserve (plhs),
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
309 first_execution (true) { }
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
310
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
311 tree_multi_assignment::~tree_multi_assignment (void)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
312 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
313 if (! preserve)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
314 delete lhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
315
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
316 delete rhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
317 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
318
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
319 octave_value
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
320 tree_multi_assignment::rvalue1 (int nargout)
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
321 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
322 octave_value retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
323
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
324 const octave_value_list tmp = rvalue (nargout);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
325
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
326 if (! tmp.empty ())
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
327 retval = tmp(0);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
328
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
329 return retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
330 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
331
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5750
diff changeset
332 // FIXME -- this works, but it would look a little better if
2984
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2982
diff changeset
333 // it were broken up into a couple of separate functions.
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2982
diff changeset
334
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
335 octave_value_list
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
336 tree_multi_assignment::rvalue (int)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
337 {
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
338 octave_value_list retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
339
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
340 if (error_state)
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
341 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
342
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
343 if (first_execution)
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
344 {
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
345 for (tree_argument_list::iterator p = lhs->begin (); p != lhs->end (); p++)
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
346 {
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
347 tree_expression *lhs_expr = *p;
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
348
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
349 if (lhs_expr)
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
350 maybe_warn_former_built_in_variable (lhs_expr->name ());
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
351 }
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
352 }
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
353
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
354 if (rhs)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
355 {
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
356 std::list<octave_lvalue> lvalue_list = lhs->lvalue_list ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
357
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
358 if (error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
359 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
360
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
361 octave_idx_type n_out = 0;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
362
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
363 for (std::list<octave_lvalue>::const_iterator p = lvalue_list.begin ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
364 p != lvalue_list.end ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
365 p++)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
366 n_out += p->numel ();
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
367
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8313
diff changeset
368 // The following trick is used to keep rhs_val constant.
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
369 const octave_value_list rhs_val1 = rhs->rvalue (n_out, &lvalue_list);
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8313
diff changeset
370 const octave_value_list rhs_val = (rhs_val1.length () == 1 && rhs_val1(0).is_cs_list ()
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8313
diff changeset
371 ? rhs_val1(0).list_value () : rhs_val1);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
372
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
373 if (error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
374 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
375
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
376 octave_idx_type k = 0;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
377
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
378 octave_idx_type n = rhs_val.length ();
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
379
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
380 // To avoid copying per elements and possible optimizations, we
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
381 // postpone joining the final values.
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
382 std::list<octave_value_list> retval_list;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
383
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
384 tree_argument_list::iterator q = lhs->begin ();
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
385
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
386 for (std::list<octave_lvalue>::iterator p = lvalue_list.begin ();
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
387 p != lvalue_list.end ();
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
388 p++)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
389 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
390 tree_expression *lhs_elt = *q++;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
391
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
392 octave_lvalue ult = *p;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
393
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
394 octave_idx_type nel = ult.numel ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
395
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
396 if (nel != 1)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
397 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
398 if (k + nel <= n)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
399 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
400 // This won't do a copy.
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
401 octave_value_list ovl = rhs_val.slice (k, nel);
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
402
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
403 ult.assign (octave_value::op_asn_eq, octave_value (ovl, true));
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
404
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
405 if (! error_state)
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
406 {
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
407 retval_list.push_back (ovl);
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
408
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
409 k += nel;
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
410 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
411 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
412 else
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
413 error ("some elements undefined in return list");
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
414 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
415 else
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
416 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
417 if (k < n)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
418 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
419 ult.assign (octave_value::op_asn_eq, rhs_val(k));
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
420
10227
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
421 if (ult.is_black_hole ())
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
422 {
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
423 k++;
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
424 continue;
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
425 }
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
426 else if (! error_state)
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
427 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
428 retval_list.push_back (rhs_val(k));
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
429
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
430 k++;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
431 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
432 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
433 else
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
434 error ("element number %d undefined in return list", k+1);
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
435 }
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
436
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
437 if (error_state)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
438 break;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
439 else if (print_result ())
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
440 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
441 // We clear any index here so that we can get
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
442 // the new value of the referenced object below,
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
443 // instead of the indexed value (which should be
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
444 // the same as the right hand side value).
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
445
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
446 ult.clear_index ();
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
447
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
448 octave_value lhs_val = ult.value ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
449
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
450 if (! error_state)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
451 lhs_val.print_with_name (octave_stdout,
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
452 lhs_elt->name ());
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
453 }
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
454
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
455 if (error_state)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
456 break;
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
457
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
458 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
459
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
460 // Concatenate return values.
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
461 retval = retval_list;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
462
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
463 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
464
8037
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
465 first_execution = false;
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
466
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
467 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
468 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
469
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
470 std::string
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
471 tree_multi_assignment::oper (void) const
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
472 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
473 return octave_value::assign_op_as_string (op_type ());
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
474 }
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
475
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
476 tree_expression *
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
477 tree_multi_assignment::dup (symbol_table::scope_id scope,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
478 symbol_table::context_id context) const
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
479 {
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
480 tree_multi_assignment *new_ma
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
481 = new tree_multi_assignment (lhs ? lhs->dup (scope, context) : 0,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
482 rhs ? rhs->dup (scope, context) : 0,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
483 preserve);
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
484
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
485 new_ma->copy_base (*this);
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
486
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
487 return new_ma;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
488 }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
489
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
490 void
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
491 tree_multi_assignment::accept (tree_walker& tw)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
492 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
493 tw.visit_multi_assignment (*this);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
494 }