Mercurial > octave-nkf
comparison libinterp/genprops.awk @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | 43f50a269cbc 446c46af4b42 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19626:37d37297acf8 | 19630:0e1f5a750d00 |
---|---|
1 ## Copyright (C) 2007-2013 John W. Eaton | 1 ## Copyright (C) 2007-2013 John W. Eaton |
2 ## | 2 ## |
3 ## This file is part of Octave. | 3 ## This file is part of Octave. |
4 ## | 4 ## |
5 ## Octave is free software; you can redistribute it and/or modify it | 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 | 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 | 7 ## Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | 8 ## your option) any later version. |
9 ## | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT | 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 | 11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13 ## for more details. | 13 ## for more details. |
14 ## | 14 ## |
15 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
16 ## along with Octave; see the file COPYING. If not, see | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | 17 ## <http://www.gnu.org/licenses/>. |
18 ## | 18 ## |
19 ## Generate the graphics.h file from graphics.h.in and write the | 19 ## Generate the graphics.h file from graphics.h.in and write the |
71 ## function, so we emit only the declaration. | 71 ## function, so we emit only the declaration. |
72 ## | 72 ## |
73 ################################################################################ | 73 ################################################################################ |
74 ## 'o','O','a' are currently not processed. They are commented out in code. | 74 ## 'o','O','a' are currently not processed. They are commented out in code. |
75 ################################################################################ | 75 ################################################################################ |
76 ## | 76 ## |
77 ## o: There is a custom inline definition for the octave_value version | 77 ## o: There is a custom inline definition for the octave_value version |
78 ## of the set function, so we don't emit one. | 78 ## of the set function, so we don't emit one. |
79 ## | 79 ## |
80 ## O: There is a custom extern definition for the octave_value version | 80 ## O: There is a custom extern definition for the octave_value version |
81 ## of the set function, so we emit only the declaration. | 81 ## of the set function, so we emit only the declaration. |
142 ## simple accessor | 142 ## simple accessor |
143 | 143 |
144 function emit_get_accessor (i, rtype, faccess) | 144 function emit_get_accessor (i, rtype, faccess) |
145 { | 145 { |
146 printf (" %s get_%s (void) const", rtype, name[i]); | 146 printf (" %s get_%s (void) const", rtype, name[i]); |
147 | 147 |
148 if (emit_get[i] == "definition") | 148 if (emit_get[i] == "definition") |
149 printf (" { return %s.%s (); }\n", name[i], faccess); | 149 printf (" { return %s.%s (); }\n", name[i], faccess); |
150 else | 150 else |
151 printf (";\n"); | 151 printf (";\n"); |
152 } | 152 } |
154 ## bool_property | 154 ## bool_property |
155 | 155 |
156 function emit_get_bool (i) | 156 function emit_get_bool (i) |
157 { | 157 { |
158 printf (" bool is_%s (void) const", name[i]); | 158 printf (" bool is_%s (void) const", name[i]); |
159 | 159 |
160 if (emit_get[i] == "definition") | 160 if (emit_get[i] == "definition") |
161 printf (" { return %s.is_on (); }\n", name[i]); | 161 printf (" { return %s.is_on (); }\n", name[i]); |
162 else | 162 else |
163 printf (";\n"); | 163 printf (";\n"); |
164 | 164 |
168 ## radio_property | 168 ## radio_property |
169 | 169 |
170 function emit_get_radio (i) | 170 function emit_get_radio (i) |
171 { | 171 { |
172 printf (" bool %s_is (const std::string& v) const", name[i]); | 172 printf (" bool %s_is (const std::string& v) const", name[i]); |
173 | 173 |
174 if (emit_get[i] == "definition") | 174 if (emit_get[i] == "definition") |
175 printf (" { return %s.is (v); }\n", name[i]); | 175 printf (" { return %s.is (v); }\n", name[i]); |
176 else | 176 else |
177 printf (";\n"); | 177 printf (";\n"); |
178 | 178 |
184 function emit_get_color (i) | 184 function emit_get_color (i) |
185 { | 185 { |
186 printf (" bool %s_is_rgb (void) const { return %s.is_rgb (); }\n", name[i], name[i]); | 186 printf (" bool %s_is_rgb (void) const { return %s.is_rgb (); }\n", name[i], name[i]); |
187 | 187 |
188 printf (" bool %s_is (const std::string& v) const", name[i]); | 188 printf (" bool %s_is (const std::string& v) const", name[i]); |
189 | 189 |
190 if (emit_get[i] == "definition") | 190 if (emit_get[i] == "definition") |
191 printf (" { return %s.is (v); }\n", name[i]); | 191 printf (" { return %s.is (v); }\n", name[i]); |
192 else | 192 else |
193 printf (";\n"); | 193 printf (";\n"); |
194 | 194 |
195 printf (" Matrix get_%s_rgb (void) const", name[i]); | 195 printf (" Matrix get_%s_rgb (void) const", name[i]); |
196 | 196 |
197 if (emit_get[i] == "definition") | 197 if (emit_get[i] == "definition") |
198 printf (" { return (%s.is_rgb () ? %s.rgb () : Matrix ()); }\n", name[i], name[i]); | 198 printf (" { return (%s.is_rgb () ? %s.rgb () : Matrix ()); }\n", name[i], name[i]); |
199 else | 199 else |
200 printf (";\n"); | 200 printf (";\n"); |
201 | 201 |
207 function emit_get_double_radio (i) | 207 function emit_get_double_radio (i) |
208 { | 208 { |
209 printf (" bool %s_is_double (void) const { return %s.is_double (); }\n", name[i], name[i]); | 209 printf (" bool %s_is_double (void) const { return %s.is_double (); }\n", name[i], name[i]); |
210 | 210 |
211 printf (" bool %s_is (const std::string& v) const", name[i]); | 211 printf (" bool %s_is (const std::string& v) const", name[i]); |
212 | 212 |
213 if (emit_get[i] == "definition") | 213 if (emit_get[i] == "definition") |
214 printf (" { return %s.is (v); }\n", name[i]); | 214 printf (" { return %s.is (v); }\n", name[i]); |
215 else | 215 else |
216 printf (";\n"); | 216 printf (";\n"); |
217 | 217 |
218 printf (" double get_%s_double (void) const", name[i]); | 218 printf (" double get_%s_double (void) const", name[i]); |
219 | 219 |
220 if (emit_get[i] == "definition") | 220 if (emit_get[i] == "definition") |
221 printf (" { return (%s.is_double () ? %s.double_value () : 0); }\n", name[i], name[i]); | 221 printf (" { return (%s.is_double () ? %s.double_value () : 0); }\n", name[i], name[i]); |
222 else | 222 else |
223 printf (";\n"); | 223 printf (";\n"); |
224 | 224 |
228 ## callback_property | 228 ## callback_property |
229 | 229 |
230 function emit_get_callback (i) | 230 function emit_get_callback (i) |
231 { | 231 { |
232 printf (" void execute_%s (const octave_value& data = octave_value ()) const", name[i]); | 232 printf (" void execute_%s (const octave_value& data = octave_value ()) const", name[i]); |
233 | 233 |
234 if (emit_get[i] == "definition") | 234 if (emit_get[i] == "definition") |
235 printf (" { %s.execute (data); }\n", name[i]); | 235 printf (" { %s.execute (data); }\n", name[i]); |
236 else | 236 else |
237 printf (";\n"); | 237 printf (";\n"); |
238 | 238 |
301 for (i = 1; i <= idx; i++) | 301 for (i = 1; i <= idx; i++) |
302 printf (" %s%s %s;\n", mutable[i] ? "mutable " : "", type[i], name[i]); | 302 printf (" %s%s %s;\n", mutable[i] ? "mutable " : "", type[i], name[i]); |
303 | 303 |
304 if (idx > 0) | 304 if (idx > 0) |
305 print "\npublic:\n"; | 305 print "\npublic:\n"; |
306 | 306 |
307 if (idx > 0) | 307 if (idx > 0) |
308 { | 308 { |
309 printf (" enum\n {"); | 309 printf (" enum\n {"); |
310 for (i = 1; i <= idx; i++) | 310 for (i = 1; i <= idx; i++) |
311 { | 311 { |
786 | 786 |
787 ## There is a custom extern definition for the set function, | 787 ## There is a custom extern definition for the set function, |
788 ## but we still emit the declaration. | 788 ## but we still emit the declaration. |
789 if (index (quals, "S")) | 789 if (index (quals, "S")) |
790 emit_set[idx] = "declaration"; | 790 emit_set[idx] = "declaration"; |
791 | 791 |
792 ## The property is hidden | 792 ## The property is hidden |
793 if (index (quals, "h")) | 793 if (index (quals, "h")) |
794 hidden[idx] = 1; | 794 hidden[idx] = 1; |
795 | 795 |
796 ## The property is read-only | 796 ## The property is read-only |
799 | 799 |
800 ## There is an inline updater method that should be called | 800 ## There is an inline updater method that should be called |
801 ## from the set method | 801 ## from the set method |
802 if (index (quals, "u")) | 802 if (index (quals, "u")) |
803 updater[idx] = "inline"; | 803 updater[idx] = "inline"; |
804 | 804 |
805 ## There is an extern updater method that should be called | 805 ## There is an extern updater method that should be called |
806 ## from the set method | 806 ## from the set method |
807 if (index (quals, "U")) | 807 if (index (quals, "U")) |
808 updater[idx] = "extern"; | 808 updater[idx] = "extern"; |
809 | 809 |