annotate libinterp/genprops.awk @ 20733:c6464d78da69

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