Mercurial > octave
annotate libinterp/corefcn/genprops.awk @ 23709:3b68aeeabc40
rename some build scripts for consistency and move them to where they are used
* libgui/mk-default-qt-settings.in.sh: Rename from
build-aux/mk-default-qt-settings.in.sh.
* libinterp/mk-doc.pl: Rename from libinterp/gendoc.pl.
* libinterp/operators/mk-ops.sh: Rename from libinterp/mkops.
* scripts/mk-doc.pl: Rename from scripts/mkdoc.pl.
* libinterp/mk-builtins.pl: Rename from build-aux/mk-builtins.pl.
* liboctave/external/mk-f77-def.in.sh: Rename from
build-aux/mk-f77-def.in.sh.
* libinterp/corefcn/mk-mxarray-h.in.sh: Rename from
build-aux/mk-mxarray-h.in.sh.
* libinterp/mk-version-h.in.sh: Rename from
build-aux/mk-version-h.in.sh.
* libinterp/corefcn/genprops.awk: Rename from libinterp/genprops.awk.
* libinterp/corefcn/mk-errno-list.sh: Rename from
libinterp/mk-errno-list.
* libinterp/mk-pkg-add.sh: Rename from libinterp/mk-pkg-add.
* scripts/mk-pkg-add.sh: Rename from scripts/mk-pkg-add.
* Makefile.am, build-aux/module.mk, configure.ac, libgui/module.mk,
libinterp/corefcn/module.mk, libinterp/dldfcn/config-module.awk,
libinterp/module.mk, libinterp/operators/module.mk,
liboctave/external/module.mk, liboctave/external/ranlib/module.mk,
scripts/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 27 Jun 2017 15:10:58 -0400 |
parents | libinterp/genprops.awk@614d71cdf614 |
children | 0d446e938f1f |
rev | line source |
---|---|
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1 ## Copyright (C) 2007-2017 John W. Eaton |
7019 | 2 ## |
3 ## This file is part of Octave. | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
4 ## |
7019 | 5 ## Octave is free software; you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
8 ## (at your option) any later version. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
9 ## |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## GNU General Public License for more details. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
14 ## |
7019 | 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 ## | |
9906 | 19 ## Generate the graphics.h file from graphics.h.in and write the |
20 ## output to stdout. | |
21 ## | |
22 ## If the variable emit_graphics_props is set on the command line, | |
23 ## generate the graphics-props.cc file from graphics.h.in and write | |
24 ## the output to stdout. | |
6874 | 25 ## |
26 ## Lines between the BEGIN_PROPERTIES and END_PROPERTIES markers have | |
27 ## one of the following formats: | |
28 ## | |
29 ## TYPE NAME | |
30 ## TYPE NAME QUALIFIERS | |
31 ## mutable TYPE NAME | |
32 ## mutable TYPE NAME QUALIFIERS | |
33 ## | |
34 ## For each property, we generate a declaration for the property. | |
35 ## | |
36 ## If QUALIFIERS is omitted, we generate the following functions directly | |
37 ## in the class declaration: | |
38 ## | |
6875 | 39 ## TYPE |
40 ## get_NAME (void) const | |
41 ## { | |
42 ## return NAME; | |
43 ## } | |
44 ## | |
45 ## void | |
46 ## set_NAME (const TYPE& val) | |
47 ## { | |
20733
c6464d78da69
eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
48 ## NAME = val; |
6875 | 49 ## } |
50 ## | |
51 ## void | |
52 ## set_NAME (const octave_value& val) | |
53 ## { | |
54 ## set_NAME (TYPE (val)); | |
55 ## } | |
6874 | 56 ## |
57 ## If present, the QUALIFIERS string may include any of the characters | |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
58 ## g, G, m, s, S, o, O, h, d which have the following meanings: |
6874 | 59 ## |
60 ## g: There is a custom inline definition for the get function, | |
61 ## so we don't emit one. | |
62 ## | |
63 ## G: There is a custom extern definition for the get function, | |
64 ## so we emit only the declaration. | |
65 ## | |
66 ## s: There is a custom inline definition for the type-specific set | |
67 ## function, so we don't emit one. | |
68 ## | |
69 ## S: There is a custom extern definition for the type-specific set | |
70 ## function, so we emit only the declaration. | |
71 ## | |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
72 ## d: The property is deprecated and a warning is emitted when accessing it. |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
73 ## |
16838
f68b0f51c896
genprops.awk: Add comment about 'o','O', 'a' options no longer being processed.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
74 ################################################################################ |
f68b0f51c896
genprops.awk: Add comment about 'o','O', 'a' options no longer being processed.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
75 ## 'o','O','a' are currently not processed. They are commented out in code. |
f68b0f51c896
genprops.awk: Add comment about 'o','O', 'a' options no longer being processed.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
76 ################################################################################ |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
77 ## |
6874 | 78 ## o: There is a custom inline definition for the octave_value version |
79 ## of the set function, so we don't emit one. | |
80 ## | |
81 ## O: There is a custom extern definition for the octave_value version | |
82 ## of the set function, so we emit only the declaration. | |
83 ## | |
6904 | 84 ## a: The octave_value version of the set function will use assignment: |
85 ## | |
86 ## void | |
87 ## set_NAME (const octave_value& val) | |
88 ## { | |
89 ## TYPE tmp (NAME); | |
90 ## tmp = val; | |
91 ## set_NAME (tmp); | |
92 ## } | |
93 ## | |
94 ## This is useful for things like the radio_value classes which | |
95 ## use an overloaded assignment operator of the form | |
96 ## | |
97 ## radio_property& operator = (const octave_value& val); | |
98 ## | |
99 ## that preserves the list of possible values, which is different | |
100 ## from what would happen if we simply used the | |
101 ## | |
102 ## TYPE (const octave_value&) | |
103 ## | |
104 ## constructor, which creates a new radio_property and so cannot | |
105 ## preserve the old list of possible values. | |
16838
f68b0f51c896
genprops.awk: Add comment about 'o','O', 'a' options no longer being processed.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
106 ################################################################################ |
6904 | 107 ## |
7214 | 108 ## l: Add the line |
109 ## | |
110 ## update_axis_limits ("NAME"); | |
111 ## | |
112 ## to the type-specific set function. | |
113 ## | |
6874 | 114 ## m: Add the line |
115 ## | |
116 ## set_NAMEmode ("manual"); | |
117 ## | |
118 ## to the type-specific set function. | |
119 ## | |
7379 | 120 ## h: Make the property hidden |
121 ## | |
7427 | 122 ## r: Make the property read-only. A read-only property is not |
123 ## settable from the global set (caseless_str, octave_value) | |
124 ## method, but still has set_X accessor. | |
125 ## | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
126 ## 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
|
127 ## add the line |
7427 | 128 ## |
129 ## update_NAME (); | |
130 ## | |
131 ## to the type-specific set function. This line is added before | |
132 ## any other update call (like those added by the 'l' or 'm' | |
133 ## modifiers. | |
134 ## | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
135 ## 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
|
136 ## A declaration for the updater function will be emitted. |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
137 ## |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
138 ## 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
|
139 ## |
6874 | 140 ## The 'o' and 'O' qualifiers are only useful when the the property type |
141 ## is something other than octave_value. | |
142 | |
7363 | 143 ## simple accessor |
144 | |
145 function emit_get_accessor (i, rtype, faccess) | |
146 { | |
147 printf (" %s get_%s (void) const", rtype, name[i]); | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
148 |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
149 if (emit_get[i] == "definition" && deprecated[i]) |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
150 printf ("\n{\n warning_with_id (\"Octave:deprecated-property\",\"'%s' is deprecated and will be removed from a future version of Octave\");\n return %s.%s ();\n}\n", name[i], name[i], faccess); |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
151 else if (emit_get[i] == "definition") |
7363 | 152 printf (" { return %s.%s (); }\n", name[i], faccess); |
153 else | |
154 printf (";\n"); | |
155 } | |
156 | |
157 ## bool_property | |
158 | |
159 function emit_get_bool (i) | |
160 { | |
161 printf (" bool is_%s (void) const", name[i]); | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
162 |
7363 | 163 if (emit_get[i] == "definition") |
164 printf (" { return %s.is_on (); }\n", name[i]); | |
165 else | |
166 printf (";\n"); | |
167 | |
168 emit_get_accessor(i, "std::string", "current_value"); | |
169 } | |
170 | |
171 ## radio_property | |
172 | |
173 function emit_get_radio (i) | |
174 { | |
175 printf (" bool %s_is (const std::string& v) const", name[i]); | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
176 |
7363 | 177 if (emit_get[i] == "definition") |
178 printf (" { return %s.is (v); }\n", name[i]); | |
179 else | |
180 printf (";\n"); | |
181 | |
182 emit_get_accessor(i, "std::string", "current_value"); | |
183 } | |
184 | |
185 ## color_property | |
186 | |
187 function emit_get_color (i) | |
188 { | |
189 printf (" bool %s_is_rgb (void) const { return %s.is_rgb (); }\n", name[i], name[i]); | |
190 | |
191 printf (" bool %s_is (const std::string& v) const", name[i]); | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
192 |
7363 | 193 if (emit_get[i] == "definition") |
194 printf (" { return %s.is (v); }\n", name[i]); | |
195 else | |
196 printf (";\n"); | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
197 |
7363 | 198 printf (" Matrix get_%s_rgb (void) const", name[i]); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
199 |
7363 | 200 if (emit_get[i] == "definition") |
201 printf (" { return (%s.is_rgb () ? %s.rgb () : Matrix ()); }\n", name[i], name[i]); | |
202 else | |
203 printf (";\n"); | |
204 | |
205 emit_get_accessor(i, "octave_value", "get"); | |
206 } | |
207 | |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
208 ## double_radio_property |
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 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
|
211 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
212 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
|
213 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
214 printf (" bool %s_is (const std::string& v) const", name[i]); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
215 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
216 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
|
217 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
|
218 else |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
219 printf (";\n"); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
220 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
221 printf (" double get_%s_double (void) const", name[i]); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
222 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
223 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
|
224 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
|
225 else |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
226 printf (";\n"); |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
227 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
228 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
|
229 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7836
diff
changeset
|
230 |
7363 | 231 ## callback_property |
232 | |
233 function emit_get_callback (i) | |
234 { | |
7367 | 235 printf (" void execute_%s (const octave_value& data = octave_value ()) const", name[i]); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
236 |
7363 | 237 if (emit_get[i] == "definition") |
7367 | 238 printf (" { %s.execute (data); }\n", name[i]); |
7363 | 239 else |
240 printf (";\n"); | |
241 | |
242 emit_get_accessor(i, "octave_value", "get"); | |
243 } | |
244 | |
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
|
245 ## 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
|
246 |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
247 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
|
248 { |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
249 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
|
250 } |
4fb2db9c87dd
Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7826
diff
changeset
|
251 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
252 ## string_array_property |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
253 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
254 function emit_get_string_array (i) |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
255 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
256 printf (" std::string get_%s_string (void) const", name[i]); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
257 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
258 if (emit_get[i] == "definition") |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
259 printf (" { return %s.string_value (); }\n", name[i]); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
260 else |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
261 printf (";\n"); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
262 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
263 printf (" string_vector get_%s_vector (void) const", name[i]); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
264 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
265 if (emit_get[i] == "definition") |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
266 printf (" { return %s.string_vector_value (); }\n", name[i]); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
267 else |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
268 printf (";\n"); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
269 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
270 emit_get_accessor(i, "octave_value", "get"); |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
271 } |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
272 |
7363 | 273 ## common section |
274 | |
275 function emit_common_declarations () | |
276 { | |
277 printf ("public:\n"); | |
278 printf (" properties (const graphics_handle& mh, const graphics_handle& p);\n\n"); | |
279 printf (" ~properties (void) { }\n\n"); | |
7406 | 280 printf (" void set (const caseless_str& pname, const octave_value& val);\n\n"); |
7379 | 281 printf (" octave_value get (bool all = false) const;\n\n"); |
7406 | 282 printf (" octave_value get (const caseless_str& pname) const;\n\n"); |
9620
b00af0da85dd
graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents:
9616
diff
changeset
|
283 printf (" octave_value get (const std::string& pname) const\n {\n return get (caseless_str (pname));\n }\n\n"); |
b00af0da85dd
graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents:
9616
diff
changeset
|
284 printf (" octave_value get (const char *pname) const\n {\n return get (caseless_str (pname));\n }\n\n"); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
285 printf (" property get_property (const caseless_str& pname);\n\n"); |
7363 | 286 printf (" std::string graphics_object_name (void) const { return go_name; }\n\n"); |
287 printf (" static property_list::pval_map_type factory_defaults (void);\n\n"); | |
288 printf ("private:\n static std::string go_name;\n\n"); | |
289 } | |
290 | |
7225 | 291 function emit_declarations () |
6874 | 292 { |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
293 if (class_name && ! base) |
7363 | 294 emit_common_declarations(); |
295 | |
18567
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
296 printf ("public:\n\n\n static std::set<std::string> core_property_names (void);\n\n static std::set<std::string> readonly_property_names (void);\n\n static bool has_core_property (const caseless_str& pname);\n\n static bool has_readonly_property (const caseless_str& pname);\n\n std::set<std::string> all_property_names (void) const;\n\n"); |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
297 |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
298 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
|
299 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
|
300 |
6874 | 301 if (idx > 0) |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
302 print (base ? "protected:\n" : "private:\n"); |
6874 | 303 |
304 for (i = 1; i <= idx; i++) | |
7363 | 305 printf (" %s%s %s;\n", mutable[i] ? "mutable " : "", type[i], name[i]); |
6874 | 306 |
307 if (idx > 0) | |
7363 | 308 print "\npublic:\n"; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
309 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
310 if (idx > 0) |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
311 { |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
312 printf (" enum\n {"); |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
313 for (i = 1; i <= idx; i++) |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
314 { |
11239
5fa7667f90e5
Add prefix ID_ to property ids to avoid name clash on windows
Kai Habel <kai.habel@gmx.de>
parents:
11074
diff
changeset
|
315 printf ("%s\n ID_%s = %d", (i == 1 ? "" : ","), toupper(name[i]), pcount); |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
316 pcount++; |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
317 } |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
318 printf ("\n };\n\n"); |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
319 pcount = (int(pcount/1000)+1)*1000; |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
7895
diff
changeset
|
320 } |
6874 | 321 |
322 for (i = 1; i <= idx; i++) | |
323 { | |
7363 | 324 if (emit_get[i]) |
325 { | |
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
|
326 if (type[i] == "any_property") |
7363 | 327 emit_get_accessor(i, "octave_value", "get"); |
328 else if (type[i] == "handle_property") | |
329 emit_get_accessor(i, "graphics_handle", "handle_value"); | |
330 else if (type[i] == "string_property") | |
331 emit_get_accessor(i, "std::string", "string_value"); | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
332 else if (type[i] == "text_label_property") |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
333 emit_get_accessor(i, "octave_value", "get"); |
7363 | 334 else if (type[i] == "double_property") |
335 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
|
336 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
|
337 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
|
338 else if (type[i] == "array_property" \ |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
339 || type[i] == "row_vector_property") |
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
|
340 emit_get_array(i); |
7363 | 341 else if (type[i] == "bool_property") |
342 emit_get_bool(i); | |
343 else if (type[i] == "radio_property") | |
344 emit_get_radio(i); | |
345 else if (type[i] == "color_property") | |
346 emit_get_color(i); | |
347 else if (type[i] == "callback_property") | |
348 emit_get_callback(i); | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
349 else if (type[i] == "string_array_property") |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
12959
diff
changeset
|
350 emit_get_string_array(i); |
7363 | 351 else |
6874 | 352 { |
7363 | 353 printf (" %s get_%s (void) const", type[i], name[i]); |
6874 | 354 |
7363 | 355 if (emit_get[i] == "definition") |
356 printf (" { return %s; }\n", name[i]); | |
357 else | |
358 printf (";\n"); | |
6874 | 359 } |
7363 | 360 printf ("\n"); |
361 } | |
6874 | 362 } |
363 | |
364 if (idx > 0) | |
7363 | 365 printf ("\n"); |
6874 | 366 |
367 for (i = 1; i <= idx; i++) | |
368 { | |
7363 | 369 if (emit_set[i]) |
370 { | |
21684
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
371 ## Allow mutable properties to be set from const methods by |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
372 ## declaring the corresponding set method const. The idea here is |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
373 ## to allow "constant" properties to be set after initialization. |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
374 ## For example, info about the OpenGL context for a figure can |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
375 ## only be set once the context is established, and that happens |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
376 ## after the figure object is created. Properties handled this |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
377 ## way should probably also be declared read only. |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
378 |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
379 printf (" void set_%s (const octave_value& val)%s", |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
380 name[i], mutable[i] ? " const" : ""); |
6874 | 381 |
7363 | 382 if (emit_set[i] == "definition") |
383 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
384 if (updaters[i] || limits[i] || mode[i]) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
385 has_builtin_listeners = 1; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
386 else |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
387 has_builtin_listeners = 0; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
388 |
20733
c6464d78da69
eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
389 printf ("\n {\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
|
390 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
|
391 if (mode[i]) |
6b3a965b6c7d
genprops.awk: emit set_mode calls before updaters
John W. Eaton <jwe@octave.org>
parents:
8063
diff
changeset
|
392 printf (" set_%smode (\"manual\");\n", name[i]); |
7427 | 393 if (updater[i]) |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
394 printf (" update_%s ();\n", name[i]); |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
395 if (deprecated[i]) |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
396 printf (" warning_with_id (\"Octave:deprecated-property\",\"'%s' is deprecated and will be removed from a future version of Octave\");\n", name[i]); |
7363 | 397 if (limits[i]) |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
398 printf (" update_axis_limits (\"%s\");\n", name[i]); |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
399 if (has_builtin_listeners) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
400 printf (" %s.run_listeners (POSTSET);\n", name[i]); |
21684
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
401 if (! mutable[i]) |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
20733
diff
changeset
|
402 printf (" mark_modified ();\n"); |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
403 printf (" }\n"); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
404 if (mode[i]) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
405 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
|
406 printf (" }\n }\n\n"); |
6874 | 407 } |
7363 | 408 else |
409 printf (";\n\n"); | |
410 } | |
6874 | 411 |
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
|
412 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
|
413 { |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
414 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
|
415 } |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7523
diff
changeset
|
416 |
7363 | 417 ## if (emit_ov_set[i]) |
418 ## { | |
419 ## printf (" void set_%s (const octave_value& val)", name[i]); | |
420 ## | |
421 ## if (emit_ov_set[i] == "definition") | |
422 ## printf (" { set_%s (%s (val)); }\n\n", name[i], type[i]); | |
423 ## else if (emit_ov_set[i] == "assignment") | |
424 ## { | |
425 ## printf ("\n {\n %s tmp (%s);\n tmp = val;\n set_%s (tmp);\n };\n\n", | |
426 ## type[i], name[i], name[i], name[i]); | |
427 ## } | |
428 ## else | |
429 ## printf (";\n"); | |
430 ## } | |
6874 | 431 } |
432 | |
7363 | 433 ## if (idx > 0) |
434 ## print "\nprivate:"; | |
435 } | |
436 | |
437 function emit_source () | |
438 { | |
439 if (class_name) | |
440 { | |
9906 | 441 printf ("// ******** %s ********\n\n", class_name); |
7363 | 442 |
443 ## constructor | |
444 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
445 if (base) |
9906 | 446 printf ("base_properties::base_properties (const std::string& ty, const graphics_handle& mh, const graphics_handle& p)\n : "); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
447 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
448 { |
9906 | 449 printf ("%s::properties::properties (const graphics_handle& mh, const graphics_handle& p)\n", class_name); |
450 printf (" : base_properties (go_name, mh, p),\n"); | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
451 } |
7363 | 452 |
453 for (i = 1; i <= idx; i++) | |
454 { | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
455 if (ptype[i]) |
9906 | 456 printf (" %s (\"%s\", mh, %s)", name[i], name[i], defval[i]); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
457 else |
9906 | 458 printf (" %s (%s)", name[i], defval[i]); |
7363 | 459 if (i < idx) |
9906 | 460 printf (","); |
461 printf ("\n"); | |
7363 | 462 } |
463 | |
9906 | 464 printf ("{\n"); |
7363 | 465 |
7379 | 466 for (i = 1; i <= idx; i++) |
467 { | |
9906 | 468 ## printf (" insert_static_property (\"%s\", %s);\n", name[i], name[i]); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
469 if (ptype[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
470 { |
11239
5fa7667f90e5
Add prefix ID_ to property ids to avoid name clash on windows
Kai Habel <kai.habel@gmx.de>
parents:
11074
diff
changeset
|
471 printf (" %s.set_id (ID_%s);\n", name[i], toupper(name[i])); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
472 if (hidden[i]) |
9906 | 473 printf (" %s.set_hidden (true);\n", name[i]); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
474 } |
7379 | 475 } |
7363 | 476 |
9906 | 477 printf (" init ();\n}\n\n"); |
7363 | 478 |
479 ## set method | |
480 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
481 if (base) |
9972 | 482 printf ("void\nbase_properties::set (const caseless_str& pname, const octave_value& val)\n{\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
483 else |
9584
0fcbfddaa87f
allow abbreviated graphics property names to match, with optional warning
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
484 printf ("void\n%s::properties::set (const caseless_str& pname_arg, const octave_value& val)\n{\n", |
9906 | 485 class_name); |
7363 | 486 |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
487 if (! base) |
20733
c6464d78da69
eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
488 printf (" const std::set<std::string>& pnames = all_property_names ();\n\n caseless_str pname = validate_property_name (\"set\", go_name, pnames, pname_arg);\n\n if (has_readonly_property (pname))\n {\n error (\"set: \\\"%%s\\\" is read-only\", pname.c_str ());\n return;\n }\n\n"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
489 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
490 first = 1; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
491 |
7363 | 492 for (i = 1; i <= idx; i++) |
493 { | |
7403 | 494 if (! readonly[i]) |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
495 { |
7406 | 496 printf (" %sif (pname.compare (\"%s\"))\n set_%s (val);\n", |
9906 | 497 (first == 0 ? "else " : ""), name[i], name[i]); |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
498 first = 0; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
499 } |
7363 | 500 } |
501 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
502 if (base) |
9972 | 503 printf (" else\n set_dynamic (pname, val);\n}\n\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
504 else |
9972 | 505 printf (" else\n base_properties::set (pname, val);\n}\n\n"); |
7363 | 506 |
507 ## get "all" method | |
508 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
509 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
510 { |
9906 | 511 printf ("octave_value\nbase_properties::get (bool all) const\n{\n"); |
11074
8a3b7e8fcbbc
graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10709
diff
changeset
|
512 printf (" octave_map m = get_dynamic (all).map_value ();\n\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
513 } |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
514 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
515 { |
9906 | 516 printf ("octave_value\n%s::properties::get (bool all) const\n{\n", class_name); |
11074
8a3b7e8fcbbc
graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10709
diff
changeset
|
517 printf (" octave_map m = base_properties::get (all).map_value ();\n\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
518 } |
7363 | 519 |
520 for (i = 1; i <= idx; i++) | |
521 { | |
7379 | 522 if (hidden[i]) |
11074
8a3b7e8fcbbc
graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10709
diff
changeset
|
523 printf (" if (all)\n m.assign (\"%s\", octave_value (get_%s ()%s));\n", name[i], name[i], |
9906 | 524 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")); |
7379 | 525 else |
11074
8a3b7e8fcbbc
graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10709
diff
changeset
|
526 printf (" m.assign (\"%s\", octave_value (get_%s ()%s));\n", name[i], name[i], |
9906 | 527 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")); |
7363 | 528 } |
529 | |
9906 | 530 printf ("\n return m;\n}\n\n"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
531 |
7363 | 532 ## get "one" method |
533 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
534 if (base) |
9906 | 535 printf ("octave_value\nbase_properties::get (const caseless_str& pname) const\n{\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
536 else |
9584
0fcbfddaa87f
allow abbreviated graphics property names to match, with optional warning
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
537 printf ("octave_value\n%s::properties::get (const caseless_str& pname_arg) const\n{\n", |
9906 | 538 class_name); |
539 printf (" octave_value retval;\n\n"); | |
7363 | 540 |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
541 if (! base) |
20733
c6464d78da69
eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
542 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"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
543 |
7363 | 544 for (i = 1; i<= idx; i++) |
545 { | |
7406 | 546 printf (" %sif (pname.compare (\"%s\"))\n", |
9906 | 547 (i > 1 ? "else " : ""), name[i]); |
7363 | 548 printf (" retval = get_%s ()%s;\n", name[i], |
9906 | 549 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")); |
7363 | 550 } |
551 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
552 if (base) |
9906 | 553 printf (" else\n retval = get_dynamic (pname);\n\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
554 else |
9906 | 555 printf (" else\n retval = base_properties::get (pname);\n\n"); |
556 printf (" return retval;\n}\n\n"); | |
7363 | 557 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
558 ## get_property method |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
559 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
560 if (base) |
9906 | 561 printf ("property\nbase_properties::get_property (const caseless_str& pname)\n{\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
562 else |
9584
0fcbfddaa87f
allow abbreviated graphics property names to match, with optional warning
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
563 printf ("property\n%s::properties::get_property (const caseless_str& pname_arg)\n{\n", |
9906 | 564 class_name); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
565 |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
566 if (! base) |
20733
c6464d78da69
eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
567 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"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
568 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
569 for (i = 1; i<= idx; i++) |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
570 { |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
571 if (ptype[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
572 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
573 printf (" %sif (pname.compare (\"%s\"))\n", |
9906 | 574 (i > 1 ? "else " : ""), name[i]); |
575 printf (" return property (&%s, true);\n", name[i]); | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
576 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
577 } |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
578 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
579 if (base) |
9906 | 580 printf (" else\n return get_property_dynamic (pname);\n"); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
581 else |
9906 | 582 printf (" else\n return base_properties::get_property (pname);\n"); |
583 printf ("}\n\n"); | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
584 |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
585 |
7363 | 586 ## factory defaults method |
587 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
588 if (base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
589 { |
9906 | 590 printf ("property_list::pval_map_type\nbase_properties::factory_defaults (void)\n{\n"); |
591 printf (" property_list::pval_map_type m;\n\n"); | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
592 } |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
593 else |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
594 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
595 printf ("property_list::pval_map_type\n%s::properties::factory_defaults (void)\n{\n", |
9906 | 596 class_name); |
597 printf (" property_list::pval_map_type m = base_properties::factory_defaults ();\n\n"); | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
598 } |
7363 | 599 |
600 for (i = 1; i <= idx; i++) | |
601 { | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
602 if (factory[i]) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
603 { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
604 dval = defval[i]; |
10709
92a85ed5b86e
Don't special case color_property type when emitting factory default (bug #30118)
David Bateman <dbateman@free.fr>
parents:
10317
diff
changeset
|
605 if (type[i] == "radio_property") |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
606 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
607 k = index (dval, "{"); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
608 dval = substr (dval, k+1); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
609 l = index (dval, "}"); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
610 if (k > 0 && l > 0) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
611 dval = "\"" substr (dval, 1, l-1) "\""; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
612 else |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
613 dval = "octave_value ()"; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
614 } |
7895
f1a1f6dd7fac
avoid using gensub in genprops.awk
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
615 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
616 printf (" m[\"%s\"] = %s%s;\n", name[i], dval, |
9906 | 617 (type[i] == "handle_property" || type[i] == "graphics_handle" ? ".as_octave_value ()" : "")); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
618 } |
7363 | 619 } |
620 | |
9906 | 621 printf ("\n return m;\n}\n\n"); |
7363 | 622 |
623 ## go_name static field | |
624 | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
625 if (! base) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
626 printf ("std::string %s::properties::go_name (\"%s\");\n\n", |
9906 | 627 class_name, object_name); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
628 |
18567
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
629 ## core_property_names |
9906 | 630 printf ("std::set<std::string>\n"); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
631 if (base) |
9906 | 632 printf ("base_properties"); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
633 else |
9906 | 634 printf ("%s::properties", class_name); |
635 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"); | |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
636 for (i = 1; i <= idx; i++) |
9906 | 637 printf (" all_pnames.insert (\"%s\");\n", name[i]); |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
638 if (! base) |
9906 | 639 printf ("\n std::set<std::string> base_pnames = base_properties::core_property_names ();\n all_pnames.insert (base_pnames.begin (), base_pnames.end ());\n"); |
640 printf ("\n initialized = true;\n }\n\n return all_pnames;\n}\n\n"); | |
18567
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
641 ## has_core_property |
9906 | 642 printf ("bool\n"); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
643 if (base) |
9906 | 644 printf ("base_properties"); |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
645 else |
9906 | 646 printf ("%s::properties", class_name); |
647 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); | |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
648 |
18567
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
649 ## readonly_property_names |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
650 printf ("std::set<std::string>\n"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
651 if (base) |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
652 printf ("base_properties"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
653 else |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
654 printf ("%s::properties", class_name); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
655 printf ("::readonly_property_names (void)\n{\n static std::set<std::string> all_pnames;\n\n static bool initialized = false;\n\n if (! initialized)\n {\n"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
656 for (i = 1; i <= idx; i++) |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
657 if (readonly[i]) |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
658 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
659 printf (" all_pnames.insert (\"%s\");\n", name[i]); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
660 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
661 if (! base) |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
662 printf ("\n std::set<std::string> base_pnames = base_properties::readonly_property_names ();\n all_pnames.insert (base_pnames.begin (), base_pnames.end ());\n"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
663 printf ("\n initialized = true;\n }\n\n return all_pnames;\n}\n\n"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
664 ## has_readonly_property |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
665 printf ("bool\n"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
666 if (base) |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
667 printf ("base_properties"); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
668 else |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
669 printf ("%s::properties", class_name); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
670 printf ("::has_readonly_property (const caseless_str& pname)\n{\n std::set<std::string> pnames = readonly_property_names ();\n\n return pnames.find (pname) != pnames.end ();\n}\n\n", class_name); |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
671 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
672 ## all_property_names |
9906 | 673 printf ("std::set<std::string>\n"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
674 if (base) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
675 printf ("base_properties"); |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
676 else |
9906 | 677 printf ("%s::properties", class_name); |
9972 | 678 printf ("::all_property_names (void) const\n{\n static std::set<std::string> all_pnames = core_property_names ();\n\n"); |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
679 if (base) |
9972 | 680 printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> dyn_props = dynamic_property_names ();\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"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
681 else |
9972 | 682 printf (" std::set<std::string> retval = all_pnames;\n std::set<std::string> base_props = base_properties::all_property_names ();\n retval.insert (base_props.begin (), base_props.end ());\n\n return retval;\n}\n\n"); |
9582
bdcfb756d721
improve error messages for ambiguous graphics property names
John W. Eaton <jwe@octave.org>
parents:
9185
diff
changeset
|
683 |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9584
diff
changeset
|
684 if (! base) |
9906 | 685 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); |
7363 | 686 } |
6874 | 687 } |
688 | |
689 BEGIN { | |
9906 | 690 printf ("// DO NOT EDIT! Generated automatically by genprops.awk.\n\n") |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
691 pcount = 0; |
7363 | 692 } |
693 | |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
694 /BEGIN_PROPERTIES *\(.*\)/ { |
7363 | 695 gather = 1; |
696 idx = 0; | |
7895
f1a1f6dd7fac
avoid using gensub in genprops.awk
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
697 str = $0; |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
698 beg = index (str, "(") + 1; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
699 len = index (str, ")") - beg; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
700 args = substr (str, beg, len); |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
701 n = split (args, arg_list, ","); |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
702 if (n > 0) |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
703 class_name = arg_list[1]; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
704 if (n > 1) |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
705 object_name = arg_list[2]; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
706 else |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
707 object_name = class_name; |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
708 gsub (/ /, "", class_name); |
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8139
diff
changeset
|
709 gsub (/ /, "", object_name); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
710 base = 0; |
7363 | 711 next; |
6874 | 712 } |
713 | |
714 /BEGIN_PROPERTIES/ { | |
7363 | 715 gather = 1; |
716 idx = 0; | |
717 class_name = ""; | |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
718 base = 0; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
719 next; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
720 } |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
721 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
722 /BEGIN_BASE_PROPERTIES/ { |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
723 gather = 1; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
724 idx = 0; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
725 class_name = "base"; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
726 base = 1; |
7363 | 727 next; |
6874 | 728 } |
729 | |
730 /END_PROPERTIES/ { | |
9906 | 731 if (emit_graphics_props) |
732 emit_source(); | |
733 else | |
734 emit_declarations(); | |
7363 | 735 gather = 0; |
736 next; | |
6874 | 737 } |
738 | |
739 { | |
740 if (gather) | |
7363 | 741 { |
7403 | 742 if (NF < 2 || /^[ \t]*\/\//) |
7363 | 743 next; |
6874 | 744 |
7363 | 745 idx++; |
6874 | 746 |
7363 | 747 field = 1; |
6874 | 748 |
7363 | 749 if ($field == "mutable") |
750 { | |
751 mutable[idx] = 1; | |
752 field++; | |
753 } | |
754 else | |
755 mutable[idx] = 0; | |
6874 | 756 |
7363 | 757 type[idx] = $(field++); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
758 ptype[idx] = (type[idx] ~ /^.*_property$/); |
7363 | 759 name[idx] = $(field++); |
6874 | 760 |
7363 | 761 limits[idx] = 0; |
762 mode[idx] = 0; | |
7403 | 763 hidden[idx] = 0; |
764 readonly[idx] = 0; | |
7363 | 765 emit_get[idx] = "definition"; |
766 emit_set[idx] = "definition"; | |
7397 | 767 defval[idx] = ""; |
7427 | 768 updater[idx] = ""; |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
769 deprecated[idx] = 0; |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
770 factory[idx] = 1; |
7363 | 771 ## if (type[idx] == "octave_value") |
772 ## emit_ov_set[idx] = ""; | |
773 ## else | |
774 ## emit_ov_set[idx] = "definition"; | |
6874 | 775 |
7363 | 776 if (NF >= field) |
777 { | |
778 if ($field != ",") | |
779 { | |
780 quals = $(field++); | |
7214 | 781 |
7363 | 782 if (index (quals, "l")) |
783 limits[idx] = 1; | |
6874 | 784 |
7363 | 785 if (index (quals, "m")) |
786 mode[idx] = 1; | |
787 | |
788 ## There is a custom inline definition for the get function, | |
789 ## so we don't emit anything. | |
790 if (index (quals, "g")) | |
791 emit_get[idx] = ""; | |
6874 | 792 |
7363 | 793 ## There is a custom extern definition for the get function, |
794 ## but we still emit the declaration. | |
795 if (index (quals, "G")) | |
796 emit_get[idx] = "declaration"; | |
6874 | 797 |
7363 | 798 ## There is a custom inline definition for the set function, |
799 ## so we don't emit anything. | |
800 if (index (quals, "s")) | |
801 emit_set[idx] = ""; | |
6874 | 802 |
7363 | 803 ## There is a custom extern definition for the set function, |
804 ## but we still emit the declaration. | |
805 if (index (quals, "S")) | |
806 emit_set[idx] = "declaration"; | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
807 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
808 ## The property is hidden |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
809 if (index (quals, "h")) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
810 hidden[idx] = 1; |
7403 | 811 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
812 ## The property is read-only |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
813 if (index (quals, "r")) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
814 readonly[idx] = 1; |
6904 | 815 |
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
|
816 ## There is an inline updater method that should be called |
7427 | 817 ## from the set method |
818 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
|
819 updater[idx] = "inline"; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
820 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
821 ## There is an extern updater method that should be called |
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
|
822 ## 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
|
823 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
|
824 updater[idx] = "extern"; |
7427 | 825 |
23563
614d71cdf614
maint: Strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
826 ## The property is deprecated |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
827 if (index (quals, "d")) |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
828 deprecated[idx] = 1; |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
829 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10135
diff
changeset
|
830 ## There is not factory default value |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
831 if (index (quals, "f")) |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
832 factory[idx] = 0; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
833 |
7363 | 834 ## ## emmit an asignment set function |
835 ## if (index (quals, "a")) | |
836 ## emit_ov_set[idx] = "assignment"; | |
837 ## | |
838 ## if (type[idx] != "octave_value") | |
839 ## { | |
840 ## ## The 'o' and 'O' qualifiers are only useful when the | |
841 ## ## the property type is something other than an | |
842 ## ## octave_value. | |
843 ## | |
844 ## ## There is a custom inline definition for the | |
845 ## ## octave_value version of the set function, so we | |
846 ## ## don't emit anything. | |
847 ## if (index (quals, "o")) | |
848 ## emit_ov_set[idx] = ""; | |
849 ## | |
850 ## ## There is a custom extern definition for the | |
851 ## ## octave_value version of the set function, but we | |
852 ## ## still emit the declaration. | |
853 ## if (index (quals, "O")) | |
854 ## emit_ov_set[idx] = "declaration"; | |
855 ## } | |
856 } | |
6874 | 857 |
7363 | 858 if (NF > field && $field == ",") |
859 { | |
860 field++; | |
6874 | 861 |
7363 | 862 for (i = field; i <= NF; i++) |
7397 | 863 defval[idx] = (defval[idx] (i > field ? " " : "") $i); |
7363 | 864 } |
6874 | 865 } |
7363 | 866 |
867 } | |
9906 | 868 else if (! emit_graphics_props) |
7363 | 869 print $0; |
6883 | 870 } |