Mercurial > hg > octave-lyh
annotate src/genprops.awk @ 9585:06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 28 Aug 2009 18:37:31 -0400 |
parents | 0fcbfddaa87f |
children | 2093499ec9f4 |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2007, 2008, 2009 John W. Eaton |
7019 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by the | |
7 ## Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 ## for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 ## | |
6874 | 19 ## This script is used to generate the graphics.h file from graphics.h.in. |
20 ## | |
21 ## Lines between the BEGIN_PROPERTIES and END_PROPERTIES markers have | |
22 ## one of the following formats: | |
23 ## | |
24 ## TYPE NAME | |
25 ## TYPE NAME QUALIFIERS | |
26 ## mutable TYPE NAME | |
27 ## mutable TYPE NAME QUALIFIERS | |
28 ## | |
29 ## For each property, we generate a declaration for the property. | |
30 ## | |
31 ## If QUALIFIERS is omitted, we generate the following functions directly | |
32 ## in the class declaration: | |
33 ## | |
6875 | 34 ## TYPE |
35 ## get_NAME (void) const | |
36 ## { | |
37 ## return NAME; | |
38 ## } | |
39 ## | |
40 ## void | |
41 ## set_NAME (const TYPE& val) | |
42 ## { | |
43 ## if (! error_state) | |
44 ## NAME = val; | |
45 ## } | |
46 ## | |
47 ## void | |
48 ## set_NAME (const octave_value& val) | |
49 ## { | |
50 ## set_NAME (TYPE (val)); | |
51 ## } | |
6874 | 52 ## |
53 ## If present, the QUALIFIERS string may include any of the characters | |
7379 | 54 ## g, G, m, s, S, o, O, h, which have the following meanings: |
6874 | 55 ## |
56 ## g: There is a custom inline definition for the get function, | |
57 ## so we don't emit one. | |
58 ## | |
59 ## G: There is a custom extern definition for the get function, | |
60 ## so we emit only the declaration. | |
61 ## | |
62 ## s: There is a custom inline definition for the type-specific set | |
63 ## function, so we don't emit one. | |
64 ## | |
65 ## S: There is a custom extern definition for the type-specific set | |
66 ## function, so we emit only the declaration. | |
67 ## | |
68 ## o: There is a custom inline definition for the octave_value version | |
69 ## of the set function, so we don't emit one. | |
70 ## | |
71 ## O: There is a custom extern definition for the octave_value version | |
72 ## of the set function, so we emit only the declaration. | |
73 ## | |
6904 | 74 ## a: The octave_value version of the set function will use assignment: |
75 ## | |
76 ## void | |
77 ## set_NAME (const octave_value& val) | |
78 ## { | |
79 ## TYPE tmp (NAME); | |
80 ## tmp = val; | |
81 ## set_NAME (tmp); | |
82 ## } | |
83 ## | |
84 ## This is useful for things like the radio_value classes which | |
85 ## use an overloaded assignment operator of the form | |
86 ## | |
87 ## radio_property& operator = (const octave_value& val); | |
88 ## | |
89 ## that preserves the list of possible values, which is different | |
90 ## from what would happen if we simply used the | |
91 ## | |
92 ## TYPE (const octave_value&) | |
93 ## | |
94 ## constructor, which creates a new radio_property and so cannot | |
95 ## preserve the old list of possible values. | |
96 ## | |
7214 | 97 ## l: Add the line |
98 ## | |
99 ## update_axis_limits ("NAME"); | |
100 ## | |
101 ## to the type-specific set function. | |
102 ## | |
6874 | 103 ## m: Add the line |
104 ## | |
105 ## set_NAMEmode ("manual"); | |
106 ## | |
107 ## to the type-specific set function. | |
108 ## | |
7379 | 109 ## h: Make the property hidden |
110 ## | |
7427 | 111 ## r: Make the property read-only. A read-only property is not |
112 ## settable from the global set (caseless_str, octave_value) | |
113 ## method, but still has set_X accessor. | |
114 ## | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
115 ## u: The property has an inline updater method. This effectively |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
116 ## add the line |
7427 | 117 ## |
118 ## update_NAME (); | |
119 ## | |
120 ## to the type-specific set function. This line is added before | |
121 ## any other update call (like those added by the 'l' or 'm' | |
122 ## modifiers. | |
123 ## | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
124 ## U: Like 'u' modifier except that the updater is not inline. |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
125 ## A declaration for the updater function will be emitted. |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
126 ## |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
127 ## f: The property does not have any factory default value. |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
128 ## |
6874 | 129 ## The 'o' and 'O' qualifiers are only useful when the the property type |
130 ## is something other than octave_value. | |
131 | |
7363 | 132 ## simple accessor |
133 | |
134 function emit_get_accessor (i, rtype, faccess) | |
135 { | |
136 printf (" %s get_%s (void) const", rtype, name[i]); | |
137 | |
138 if (emit_get[i] == "definition") | |
139 printf (" { return %s.%s (); }\n", name[i], faccess); | |
140 else | |
141 printf (";\n"); | |
142 } | |
143 | |
144 ## bool_property | |
145 | |
146 function emit_get_bool (i) | |
147 { | |
148 printf (" bool is_%s (void) const", name[i]); | |
149 | |
150 if (emit_get[i] == "definition") | |
151 printf (" { return %s.is_on (); }\n", name[i]); | |
152 else | |
153 printf (";\n"); | |
154 | |
155 emit_get_accessor(i, "std::string", "current_value"); | |
156 } | |
157 | |
158 ## radio_property | |
159 | |
160 function emit_get_radio (i) | |
161 { | |
162 printf (" bool %s_is (const std::string& v) const", name[i]); | |
163 | |
164 if (emit_get[i] == "definition") | |
165 printf (" { return %s.is (v); }\n", name[i]); | |
166 else | |
167 printf (";\n"); | |
168 | |
169 emit_get_accessor(i, "std::string", "current_value"); | |
170 } | |
171 | |
172 ## color_property | |
173 | |
174 function emit_get_color (i) | |
175 { | |
176 printf (" bool %s_is_rgb (void) const { return %s.is_rgb (); }\n", name[i], name[i]); | |
177 | |
178 printf (" bool %s_is (const std::string& v) const", name[i]); | |
179 | |
180 if (emit_get[i] == "definition") | |
181 printf (" { return %s.is (v); }\n", name[i]); | |
182 else | |
183 printf (";\n"); | |
184 | |
185 printf (" Matrix get_%s_rgb (void) const", name[i]); | |
186 | |
187 if (emit_get[i] == "definition") | |
188 printf (" { return (%s.is_rgb () ? %s.rgb () : Matrix ()); }\n", name[i], name[i]); | |
189 else | |
190 printf (";\n"); | |
191 | |
192 emit_get_accessor(i, "octave_value", "get"); | |
193 } | |
194 | |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
195 ## double_radio_property |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
196 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
197 function emit_get_double_radio (i) |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
198 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
199 printf (" bool %s_is_double (void) const { return %s.is_double (); }\n", name[i], name[i]); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
200 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
201 printf (" bool %s_is (const std::string& v) const", name[i]); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
202 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
203 if (emit_get[i] == "definition") |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
204 printf (" { return %s.is (v); }\n", name[i]); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
205 else |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
206 printf (";\n"); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
207 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
208 printf (" double get_%s_double (void) const", name[i]); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
209 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
210 if (emit_get[i] == "definition") |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
211 printf (" { return (%s.is_double () ? %s.double_value () : 0); }\n", name[i], name[i]); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
212 else |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
213 printf (";\n"); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
214 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
215 emit_get_accessor(i, "octave_value", "get"); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
216 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
217 |
7363 | 218 ## callback_property |
219 | |
220 function emit_get_callback (i) | |
221 { | |
7367 | 222 printf (" void execute_%s (const octave_value& data = octave_value ()) const", name[i]); |
7363 | 223 |
224 if (emit_get[i] == "definition") | |
7367 | 225 printf (" { %s.execute (data); }\n", name[i]); |
7363 | 226 else |
227 printf (";\n"); | |
228 | |
229 emit_get_accessor(i, "octave_value", "get"); | |
230 } | |
231 | |
7836
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
232 ## array_property |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
233 |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
234 function emit_get_array (i) |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
235 { |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
236 emit_get_accessor(i, "octave_value", "get"); |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
237 } |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
238 |
7363 | 239 ## common section |
240 | |
241 function emit_common_declarations () | |
242 { | |
243 printf ("public:\n"); | |
244 printf (" properties (const graphics_handle& mh, const graphics_handle& p);\n\n"); | |
245 printf (" ~properties (void) { }\n\n"); | |
7406 | 246 printf (" void set (const caseless_str& pname, const octave_value& val);\n\n"); |
7379 | 247 printf (" octave_value get (bool all = false) const;\n\n"); |
7406 | 248 printf (" octave_value get (const caseless_str& pname) const;\n\n"); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
249 printf (" property get_property (const caseless_str& pname);\n\n"); |
7363 | 250 printf (" std::string graphics_object_name (void) const { return go_name; }\n\n"); |
251 printf (" static property_list::pval_map_type factory_defaults (void);\n\n"); | |
252 printf ("private:\n static std::string go_name;\n\n"); | |
253 } | |
254 | |
7225 | 255 function emit_declarations () |
6874 | 256 { |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
257 if (class_name && ! base) |
7363 | 258 emit_common_declarations(); |
259 | |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
260 printf ("public:\n\n\n static std::set<std::string> core_property_names (void);\n\n static bool has_core_property (const caseless_str& pname);\n\n std::set<std::string> all_property_names ("); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
261 if (base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
262 printf ("const std::string& cname"); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
263 else |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
264 printf ("void"); |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
265 printf (") const;\n\n"); |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
266 |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
267 if (! base) |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
268 printf (" bool has_property (const caseless_str& pname) const;\n\n"); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
269 |
6874 | 270 if (idx > 0) |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
271 print (base ? "protected:\n" : "private:\n"); |
6874 | 272 |
273 for (i = 1; i <= idx; i++) | |
7363 | 274 printf (" %s%s %s;\n", mutable[i] ? "mutable " : "", type[i], name[i]); |
6874 | 275 |
276 if (idx > 0) | |
7363 | 277 print "\npublic:\n"; |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
278 |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
279 if (idx > 0) |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
280 { |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
281 printf (" enum\n {"); |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
282 for (i = 1; i <= idx; i++) |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
283 { |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
284 printf ("%s\n %s = %d", (i == 1 ? "" : ","), toupper(name[i]), pcount); |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
285 pcount++; |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
286 } |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
287 printf ("\n };\n\n"); |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
288 pcount = (int(pcount/1000)+1)*1000; |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
289 } |
6874 | 290 |
291 for (i = 1; i <= idx; i++) | |
292 { | |
7363 | 293 if (emit_get[i]) |
294 { | |
7836
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
295 if (type[i] == "any_property") |
7363 | 296 emit_get_accessor(i, "octave_value", "get"); |
297 else if (type[i] == "handle_property") | |
298 emit_get_accessor(i, "graphics_handle", "handle_value"); | |
299 else if (type[i] == "string_property") | |
300 emit_get_accessor(i, "std::string", "string_value"); | |
301 else if (type[i] == "double_property") | |
302 emit_get_accessor(i, "double", "double_value"); | |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
303 else if (type[i] == "double_radio_property") |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
304 emit_get_double_radio(i); |
7836
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
305 else if (type[i] == "array_property" \ |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
306 || type[i] == "row_vector_property") |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
307 emit_get_array(i); |
7363 | 308 else if (type[i] == "bool_property") |
309 emit_get_bool(i); | |
310 else if (type[i] == "radio_property") | |
311 emit_get_radio(i); | |
312 else if (type[i] == "color_property") | |
313 emit_get_color(i); | |
314 else if (type[i] == "callback_property") | |
315 emit_get_callback(i); | |
316 else | |
6874 | 317 { |
7363 | 318 printf (" %s get_%s (void) const", type[i], name[i]); |
6874 | 319 |
7363 | 320 if (emit_get[i] == "definition") |
321 printf (" { return %s; }\n", name[i]); | |
322 else | |
323 printf (";\n"); | |
6874 | 324 } |
7363 | 325 printf ("\n"); |
326 } | |
6874 | 327 } |
328 | |
329 if (idx > 0) | |
7363 | 330 printf ("\n"); |
6874 | 331 |
332 for (i = 1; i <= idx; i++) | |
333 { | |
7363 | 334 if (emit_set[i]) |
335 { | |
336 printf (" void set_%s (const octave_value& val)", name[i], type[i]); | |
6874 | 337 |
7363 | 338 if (emit_set[i] == "definition") |
339 { | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
340 if (updaters[i] || limits[i] || mode[i]) |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
341 has_builtin_listeners = 1; |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
342 else |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
343 has_builtin_listeners = 0; |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
344 |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
345 printf ("\n {\n if (! error_state)\n {\n if (%s.set (val, %s))\n {\n", |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
346 name[i], (has_builtin_listeners ? "false" : "true")); |
8139
6b3a965b6c7d
genprops.awk: emit set_mode calls before updaters
John W. Eaton <jwe@octave.org>
parents:
8063
diff
changeset
|
347 if (mode[i]) |
6b3a965b6c7d
genprops.awk: emit set_mode calls before updaters
John W. Eaton <jwe@octave.org>
parents:
8063
diff
changeset
|
348 printf (" set_%smode (\"manual\");\n", name[i]); |
7427 | 349 if (updater[i]) |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
350 printf (" update_%s ();\n", name[i]); |
7363 | 351 if (limits[i]) |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
352 printf (" update_axis_limits (\"%s\");\n", name[i]); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
353 if (has_builtin_listeners) |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
354 printf (" %s.run_listeners (POSTSET);\n", name[i]); |
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
355 printf (" mark_modified ();\n"); |
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
356 printf (" }\n"); |
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
357 if (mode[i]) |
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
358 printf (" else\n set_%smode (\"manual\");\n", name[i]); |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
359 printf (" }\n }\n\n"); |
6874 | 360 } |
7363 | 361 else |
362 printf (";\n\n"); | |
363 } | |
6874 | 364 |
7826
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
365 if (updater[i] == "extern") |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
366 { |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
367 printf (" void update_%s (void);\n\n", name[i]); |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
368 } |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
369 |
7363 | 370 ## if (emit_ov_set[i]) |
371 ## { | |
372 ## printf (" void set_%s (const octave_value& val)", name[i]); | |
373 ## | |
374 ## if (emit_ov_set[i] == "definition") | |
375 ## printf (" { set_%s (%s (val)); }\n\n", name[i], type[i]); | |
376 ## else if (emit_ov_set[i] == "assignment") | |
377 ## { | |
378 ## printf ("\n {\n %s tmp (%s);\n tmp = val;\n set_%s (tmp);\n };\n\n", | |
379 ## type[i], name[i], name[i], name[i]); | |
380 ## } | |
381 ## else | |
382 ## printf (";\n"); | |
383 ## } | |
6874 | 384 } |
385 | |
7363 | 386 ## if (idx > 0) |
387 ## print "\nprivate:"; | |
388 } | |
389 | |
390 function emit_source () | |
391 { | |
392 if (class_name) | |
393 { | |
394 printf ("// ******** %s ********\n\n", class_name) >> filename; | |
395 | |
396 ## constructor | |
397 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
398 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
399 printf ("base_properties::base_properties (const std::string& ty, const graphics_handle& mh, const graphics_handle& p)\n : ") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
400 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
401 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
402 printf ("%s::properties::properties (const graphics_handle& mh, const graphics_handle& p)\n", class_name) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
403 printf (" : base_properties (go_name, mh, p),\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
404 } |
7363 | 405 |
406 for (i = 1; i <= idx; i++) | |
407 { | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
408 if (ptype[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
409 printf (" %s (\"%s\", mh, %s)", name[i], name[i], defval[i]) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
410 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
411 printf (" %s (%s)", name[i], defval[i]) >> filename; |
7363 | 412 if (i < idx) |
413 printf (",") >> filename; | |
414 printf ("\n") >> filename; | |
415 } | |
416 | |
7379 | 417 printf ("{\n") >> filename; |
7363 | 418 |
7379 | 419 for (i = 1; i <= idx; i++) |
420 { | |
421 ## printf (" insert_static_property (\"%s\", %s);\n", name[i], name[i]) >> filename; | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
422 if (ptype[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
423 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
424 printf (" %s.set_id (%s);\n", name[i], toupper(name[i])) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
425 if (hidden[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
426 printf (" %s.set_hidden (true);\n", name[i]) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
427 } |
7379 | 428 } |
7363 | 429 |
7379 | 430 printf (" init ();\n}\n\n") >> filename; |
7363 | 431 |
432 ## set method | |
433 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
434 if (base) |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
435 printf ("void\nbase_properties::set (const caseless_str& pname, const std::string& cname, const octave_value& val)\n{\n") >> filename; |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
436 else |
9584
0fcbfddaa87f
allow abbreviated graphics property names to match, with optional warning
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
437 printf ("void\n%s::properties::set (const caseless_str& pname_arg, const octave_value& val)\n{\n", |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
438 class_name) >> filename; |
7363 | 439 |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
440 if (! base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
441 printf (" const std::set<std::string>& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n if (error_state)\n return;\n\n") >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
442 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
443 first = 1; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
444 |
7363 | 445 for (i = 1; i <= idx; i++) |
446 { | |
7403 | 447 if (! readonly[i]) |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
448 { |
7406 | 449 printf (" %sif (pname.compare (\"%s\"))\n set_%s (val);\n", |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
450 (first == 0 ? "else " : ""), name[i], name[i]) >> filename; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
451 first = 0; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
452 } |
7363 | 453 } |
454 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
455 if (base) |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
456 printf (" else\n set_dynamic (pname, cname, val);\n}\n\n") >> filename; |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
457 else |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
458 printf (" else\n base_properties::set (pname, \"%s\", val);\n}\n\n", class_name) >> filename; |
7363 | 459 |
460 ## get "all" method | |
461 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
462 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
463 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
464 printf ("octave_value\nbase_properties::get (bool all) const\n{\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
465 printf (" Octave_map m = get_dynamic (all).map_value ();\n\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
466 } |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
467 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
468 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
469 printf ("octave_value\n%s::properties::get (bool all) const\n{\n", class_name) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
470 printf (" Octave_map m = base_properties::get (all).map_value ();\n\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
471 } |
7363 | 472 |
473 for (i = 1; i <= idx; i++) | |
474 { | |
7379 | 475 if (hidden[i]) |
476 printf (" if (all)\n m.assign (\"%s\", get_%s ()%s);\n", name[i], name[i], | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
477 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")) >> filename; |
7379 | 478 else |
479 printf (" m.assign (\"%s\", get_%s ()%s);\n", name[i], name[i], | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
480 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")) >> filename; |
7363 | 481 } |
482 | |
483 printf ("\n return m;\n}\n\n") >> filename; | |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
484 |
7363 | 485 ## get "one" method |
486 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
487 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
488 printf ("octave_value\nbase_properties::get (const caseless_str& pname) const\n{\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
489 else |
9584
0fcbfddaa87f
allow abbreviated graphics property names to match, with optional warning
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
490 printf ("octave_value\n%s::properties::get (const caseless_str& pname_arg) const\n{\n", |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
491 class_name) >> filename; |
7363 | 492 printf (" octave_value retval;\n\n") >> filename; |
493 | |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
494 if (! base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
495 printf (" const std::set<std::string>& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n if (error_state)\n return retval;\n\n") >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
496 |
7363 | 497 for (i = 1; i<= idx; i++) |
498 { | |
7406 | 499 printf (" %sif (pname.compare (\"%s\"))\n", |
7363 | 500 (i > 1 ? "else " : ""), name[i]) >> filename; |
501 printf (" retval = get_%s ()%s;\n", name[i], | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
502 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")) >> filename; |
7363 | 503 } |
504 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
505 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
506 printf (" else\n retval = get_dynamic (pname);\n\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
507 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
508 printf (" else\n retval = base_properties::get (pname);\n\n") >> filename; |
7363 | 509 printf (" return retval;\n}\n\n") >> filename; |
510 | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
511 ## get_property method |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
512 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
513 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
514 printf ("property\nbase_properties::get_property (const caseless_str& pname)\n{\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
515 else |
9584
0fcbfddaa87f
allow abbreviated graphics property names to match, with optional warning
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
516 printf ("property\n%s::properties::get_property (const caseless_str& pname_arg)\n{\n", |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
517 class_name) >> filename; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
518 |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
519 if (! base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
520 printf (" const std::set<std::string>& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"get\", go_name, pnames, pname_arg);\n\n if (error_state)\n return property ();\n\n") >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
521 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
522 for (i = 1; i<= idx; i++) |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
523 { |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
524 if (ptype[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
525 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
526 printf (" %sif (pname.compare (\"%s\"))\n", |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
527 (i > 1 ? "else " : ""), name[i]) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
528 printf (" return property (&%s, true);\n", name[i]) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
529 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
530 } |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
531 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
532 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
533 printf (" else\n return get_property_dynamic (pname);\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
534 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
535 printf (" else\n return base_properties::get_property (pname);\n") >> filename; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
536 printf ("}\n\n") >> filename; |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
537 |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
538 |
7363 | 539 ## factory defaults method |
540 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
541 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
542 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
543 printf ("property_list::pval_map_type\nbase_properties::factory_defaults (void)\n{\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
544 printf (" property_list::pval_map_type m;\n\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
545 } |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
546 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
547 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
548 printf ("property_list::pval_map_type\n%s::properties::factory_defaults (void)\n{\n", |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
549 class_name) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
550 printf (" property_list::pval_map_type m = base_properties::factory_defaults ();\n\n") >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
551 } |
7363 | 552 |
553 for (i = 1; i <= idx; i++) | |
554 { | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
555 if (factory[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
556 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
557 dval = defval[i]; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
558 if (type[i] == "radio_property" || type[i] == "color_property") |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
559 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
560 k = index (dval, "{"); |
8766
8cb2a144f321
genprops.awk (emit_source): don't use + to concatenate strings
John W. Eaton <jwe@octave.org>
parents:
8247
diff
changeset
|
561 dval = substr (dval, k+1); |
8cb2a144f321
genprops.awk (emit_source): don't use + to concatenate strings
John W. Eaton <jwe@octave.org>
parents:
8247
diff
changeset
|
562 l = index (dval, "}"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
563 if (k > 0 && l > 0) |
8766
8cb2a144f321
genprops.awk (emit_source): don't use + to concatenate strings
John W. Eaton <jwe@octave.org>
parents:
8247
diff
changeset
|
564 dval = "\"" substr (dval, 1, l-1) "\""; |
8cb2a144f321
genprops.awk (emit_source): don't use + to concatenate strings
John W. Eaton <jwe@octave.org>
parents:
8247
diff
changeset
|
565 else |
8cb2a144f321
genprops.awk (emit_source): don't use + to concatenate strings
John W. Eaton <jwe@octave.org>
parents:
8247
diff
changeset
|
566 dval = "octave_value ()"; |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
567 } |
7895
f1a1f6dd7fac
avoid using gensub in genprops.awk
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
568 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
569 printf (" m[\"%s\"] = %s%s;\n", name[i], dval, |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
570 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")) >> filename; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
571 } |
7363 | 572 } |
573 | |
574 printf ("\n return m;\n}\n\n") >> filename; | |
575 | |
576 ## go_name static field | |
577 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
578 if (! base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
579 printf ("std::string %s::properties::go_name (\"%s\");\n\n", |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
580 class_name, object_name) >> filename; |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
581 |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
582 printf ("std::set<std::string>\n") >> filename; |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
583 if (base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
584 printf ("base_properties") >> filename; |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
585 else |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
586 printf ("%s::properties", class_name) >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
587 printf ("::core_property_names (void)\n{\n static std::set<std::string> all_pnames;\n\n static bool initialized = false;\n\n if (! initialized)\n {\n") >> filename; |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
588 for (i = 1; i <= idx; i++) |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
589 printf (" all_pnames.insert (\"%s\");\n", name[i]) >> filename; |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
590 if (! base) |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
591 printf ("\n std::set<std::string> base_pnames = base_properties::core_property_names ();\n all_pnames.insert (base_pnames.begin (), base_pnames.end ());\n") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
592 printf ("\n initialized = true;\n }\n\n return all_pnames;\n}\n\n") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
593 |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
594 printf ("bool\n") >> filename; |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
595 if (base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
596 printf ("base_properties") >> filename; |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
597 else |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
598 printf ("%s::properties", class_name) >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
599 printf ("::has_core_property (const caseless_str& pname)\n{\n std::set<std::string> pnames = core_property_names ();\n\n return pnames.find (pname) != pnames.end ();\n}\n\n", class_name) >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
600 |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
601 printf ("std::set<std::string>\n") >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
602 if (base) |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
603 printf ("base_properties") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
604 else |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
605 printf ("%s::properties", class_name) >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
606 printf ("::all_property_names (") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
607 if (base) |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
608 printf ("const std::string& cname") >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
609 else |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
610 printf ("void") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
611 printf (") const\n{\n static std::set<std::string> all_pnames = core_property_names ();\n\n") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
612 if (base) |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
613 printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> dyn_props = dynamic_property_names (cname);\n retval.insert (dyn_props.begin (), dyn_props.end ());\n for (std::map<caseless_str, property, cmp_caseless_str>::const_iterator p = all_props.begin ();\n p != all_props.end (); p++)\n retval.insert (p->first);\n\n return retval;\n}\n\n") >> filename; |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
614 else |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
615 printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> base_props = base_properties::all_property_names (\"%s\");\n retval.insert (base_props.begin (), base_props.end ());\n\n return retval;\n}\n\n", class_name) >> filename; |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
616 |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
617 if (! base) |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
618 printf ("bool\n%s::properties::has_property (const caseless_str& pname) const\n{\n std::set<std::string> pnames = all_property_names ();\n\n return pnames.find (pname) != pnames.end ();\n}\n\n", class_name) >> filename; |
7363 | 619 } |
6874 | 620 } |
621 | |
622 BEGIN { | |
7363 | 623 filename = "graphics-props.cc"; |
624 printf ("// DO NOT EDIT! Generated automatically by genprops.awk.\n\n"); | |
625 printf ("// DO NOT EDIT! Generated automatically by genprops.awk.\n\n") > filename; | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
626 pcount = 0; |
7363 | 627 } |
628 | |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
629 /BEGIN_PROPERTIES *\(.*\)/ { |
7363 | 630 gather = 1; |
631 idx = 0; | |
7895
f1a1f6dd7fac
avoid using gensub in genprops.awk
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
632 str = $0; |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
633 beg = index (str, "(") + 1; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
634 len = index (str, ")") - beg; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
635 args = substr (str, beg, len); |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
636 n = split (args, arg_list, ","); |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
637 if (n > 0) |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
638 class_name = arg_list[1]; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
639 if (n > 1) |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
640 object_name = arg_list[2]; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
641 else |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
642 object_name = class_name; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
643 gsub (/ /, "", class_name); |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
644 gsub (/ /, "", object_name); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
645 base = 0; |
7363 | 646 next; |
6874 | 647 } |
648 | |
649 /BEGIN_PROPERTIES/ { | |
7363 | 650 gather = 1; |
651 idx = 0; | |
652 class_name = ""; | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
653 base = 0; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
654 next; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
655 } |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
656 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
657 /BEGIN_BASE_PROPERTIES/ { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
658 gather = 1; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
659 idx = 0; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
660 class_name = "base"; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
661 base = 1; |
7363 | 662 next; |
6874 | 663 } |
664 | |
665 /END_PROPERTIES/ { | |
7363 | 666 emit_declarations(); |
667 emit_source(); | |
668 gather = 0; | |
669 next; | |
6874 | 670 } |
671 | |
672 { | |
673 if (gather) | |
7363 | 674 { |
7403 | 675 if (NF < 2 || /^[ \t]*\/\//) |
7363 | 676 next; |
6874 | 677 |
7363 | 678 idx++; |
6874 | 679 |
7363 | 680 field = 1; |
6874 | 681 |
7363 | 682 if ($field == "mutable") |
683 { | |
684 mutable[idx] = 1; | |
685 field++; | |
686 } | |
687 else | |
688 mutable[idx] = 0; | |
6874 | 689 |
7363 | 690 type[idx] = $(field++); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
691 ptype[idx] = (type[idx] ~ /^.*_property$/); |
7363 | 692 name[idx] = $(field++); |
6874 | 693 |
7363 | 694 limits[idx] = 0; |
695 mode[idx] = 0; | |
7403 | 696 hidden[idx] = 0; |
697 readonly[idx] = 0; | |
7363 | 698 emit_get[idx] = "definition"; |
699 emit_set[idx] = "definition"; | |
7397 | 700 defval[idx] = ""; |
7427 | 701 updater[idx] = ""; |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
702 factory[idx] = 1; |
7363 | 703 ## if (type[idx] == "octave_value") |
704 ## emit_ov_set[idx] = ""; | |
705 ## else | |
706 ## emit_ov_set[idx] = "definition"; | |
6874 | 707 |
7363 | 708 if (NF >= field) |
709 { | |
710 if ($field != ",") | |
711 { | |
712 quals = $(field++); | |
7214 | 713 |
7363 | 714 if (index (quals, "l")) |
715 limits[idx] = 1; | |
6874 | 716 |
7363 | 717 if (index (quals, "m")) |
718 mode[idx] = 1; | |
719 | |
720 ## There is a custom inline definition for the get function, | |
721 ## so we don't emit anything. | |
722 if (index (quals, "g")) | |
723 emit_get[idx] = ""; | |
6874 | 724 |
7363 | 725 ## There is a custom extern definition for the get function, |
726 ## but we still emit the declaration. | |
727 if (index (quals, "G")) | |
728 emit_get[idx] = "declaration"; | |
6874 | 729 |
7363 | 730 ## There is a custom inline definition for the set function, |
731 ## so we don't emit anything. | |
732 if (index (quals, "s")) | |
733 emit_set[idx] = ""; | |
6874 | 734 |
7363 | 735 ## There is a custom extern definition for the set function, |
736 ## but we still emit the declaration. | |
737 if (index (quals, "S")) | |
738 emit_set[idx] = "declaration"; | |
7379 | 739 |
7403 | 740 ## The property is hidden |
741 if (index (quals, "h")) | |
742 hidden[idx] = 1; | |
743 | |
744 ## The property is read-only | |
745 if (index (quals, "r")) | |
746 readonly[idx] = 1; | |
6904 | 747 |
7826
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
748 ## There is an inline updater method that should be called |
7427 | 749 ## from the set method |
750 if (index (quals, "u")) | |
7826
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
751 updater[idx] = "inline"; |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
752 |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
753 ## There is an extern updater method that should be called |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
754 ## from the set method |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
755 if (index (quals, "U")) |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
756 updater[idx] = "extern"; |
7427 | 757 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
758 ## There is not factory default value |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
759 if (index (quals, "f")) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
760 factory[idx] = 0; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
761 |
7363 | 762 ## ## emmit an asignment set function |
763 ## if (index (quals, "a")) | |
764 ## emit_ov_set[idx] = "assignment"; | |
765 ## | |
766 ## if (type[idx] != "octave_value") | |
767 ## { | |
768 ## ## The 'o' and 'O' qualifiers are only useful when the | |
769 ## ## the property type is something other than an | |
770 ## ## octave_value. | |
771 ## | |
772 ## ## There is a custom inline definition for the | |
773 ## ## octave_value version of the set function, so we | |
774 ## ## don't emit anything. | |
775 ## if (index (quals, "o")) | |
776 ## emit_ov_set[idx] = ""; | |
777 ## | |
778 ## ## There is a custom extern definition for the | |
779 ## ## octave_value version of the set function, but we | |
780 ## ## still emit the declaration. | |
781 ## if (index (quals, "O")) | |
782 ## emit_ov_set[idx] = "declaration"; | |
783 ## } | |
784 } | |
6874 | 785 |
7363 | 786 if (NF > field && $field == ",") |
787 { | |
788 field++; | |
6874 | 789 |
7363 | 790 for (i = field; i <= NF; i++) |
7397 | 791 defval[idx] = (defval[idx] (i > field ? " " : "") $i); |
7363 | 792 } |
6874 | 793 } |
7363 | 794 |
795 } | |
6874 | 796 else |
7363 | 797 print $0; |
6883 | 798 } |