annotate src/genprops.awk @ 12013:587d268cf64e release-3-2-x

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