annotate src/genprops.awk @ 7334:274d9642ac10 release-3-0-0

[project @ 2007-12-22 01:42:45 by jwe]
author jwe
date Sat, 22 Dec 2007 01:42:46 +0000
parents 1f3e360c1bba
children c31e5dab4f85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6904
diff changeset
1 ## Copyright (C) 2007 John W. Eaton
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
54 ## g, G, m, s, S, o, O, which have the following meanings:
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 ##
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
109 ## 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
110 ## is something other than octave_value.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
111
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
112 function emit_declarations ()
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
113 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
114 if (idx > 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
115 print "private:\n";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
116
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
117 for (i = 1; i <= idx; i++)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
118 printf (" %s%s %s;\n", mutable[i] ? "mutable " : "", type[i], name[i]);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
119
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
120 if (idx > 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
121 print "\npublic:\n";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
122
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
123 for (i = 1; i <= idx; i++)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
124 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
125 if (emit_get[i])
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
126 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
127 printf (" %s get_%s (void) const", type[i], name[i]);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
128
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
129 if (emit_get[i] == "definition")
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
130 printf (" { return %s; }\n", name[i]);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
131 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
132 printf (";\n");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
133 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
134 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
135
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
136 if (idx > 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
137 printf ("\n");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
138
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
139 for (i = 1; i <= idx; i++)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
140 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
141 if (emit_set[i])
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
142 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
143 printf (" void set_%s (const %s& val)", name[i], type[i]);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
144
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
145 if (emit_set[i] == "definition")
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
146 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
147 printf ("\n {\n if (! error_state)\n {\n %s = val;\n",
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
148 name[i]);
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7019
diff changeset
149 if (limits[i])
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7019
diff changeset
150 printf (" update_axis_limits (\"%s\");\n", name[i]);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
151 if (mode[i])
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
152 printf (" set_%smode (\"manual\");\n", name[i]);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
153 printf (" mark_modified ();\n }\n }\n\n");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
154 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
155 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
156 printf (";\n");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
157 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
158
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
159 if (emit_ov_set[i])
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
160 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
161 printf (" void set_%s (const octave_value& val)", name[i]);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
162
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
163 if (emit_ov_set[i] == "definition")
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
164 printf (" { set_%s (%s (val)); }\n\n", name[i], type[i]);
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
165 else if (emit_ov_set[i] == "assignment")
6904
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
166 {
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
167 printf ("\n {\n %s tmp (%s);\n tmp = val;\n set_%s (tmp);\n };\n\n",
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
168 type[i], name[i], name[i], name[i]);
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
169 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
170 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
171 printf (";\n");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
172 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
173 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
174
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
175 if (idx > 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
176 print "\nprivate:";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
177 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
178
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
179 BEGIN {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
180 printf ("// DO NOT EDIT! Generated automatically by genprops.awk.\n\n");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
181 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
182
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
183 /BEGIN_PROPERTIES/ {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
184 gather = 1;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
185 idx = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
186 next;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
187 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
188
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
189 /END_PROPERTIES/ {
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
190 emit_declarations();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
191 gather = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
192 next;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
193 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
194
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
195 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
196 if (gather)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
197 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
198 if (NF < 2 || NF > 4)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
199 next;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
200
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
201 idx++;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
202
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
203 field = 1;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
204
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
205 if ($field == "mutable")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
206 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
207 mutable[idx] = 1;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
208 field++;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
209 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
210 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
211 mutable[idx] = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
212
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
213 type[idx] = $(field++);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
214 name[idx] = $(field++);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
215
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7019
diff changeset
216 limits[idx] = 0;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
217 mode[idx] = 0;
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
218 emit_get[idx] = "definition";
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
219 emit_set[idx] = "definition";
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
220 if (type[idx] == "octave_value")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
221 emit_ov_set[idx] = "";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
222 else
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
223 emit_ov_set[idx] = "definition";
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
224
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
225 if (NF == field)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
226 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
227 quals = $field;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
228
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7019
diff changeset
229 if (index (quals, "l"))
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7019
diff changeset
230 limits[idx] = 1;
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7019
diff changeset
231
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
232 if (index (quals, "m"))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
233 mode[idx] = 1;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
234
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
235 ## There is a custom inline definition for the get function,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
236 ## so we don't emit anything.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
237 if (index (quals, "g"))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
238 emit_get[idx] = "";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
239
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
240 ## There is a custom extern definition for the get function,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
241 ## but we still emit the declaration.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
242 if (index (quals, "G"))
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
243 emit_get[idx] = "declaration";
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
244
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
245 ## There is a custom inline definition for the set function,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
246 ## so we don't emit anything.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
247 if (index (quals, "s"))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
248 emit_set[idx] = "";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
249
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
250 ## There is a custom extern definition for the set function,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
251 ## but we still emit the declaration.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
252 if (index (quals, "S"))
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
253 emit_set[idx] = "declaration";
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
254
6904
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
255 ## emmit an asignment set function
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
256 if (index (quals, "a"))
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
257 emit_ov_set[idx] = "assignment";
6904
1758d3d3d266 [project @ 2007-09-14 20:08:56 by jwe]
jwe
parents: 6883
diff changeset
258
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
259 if (type[idx] != "octave_value")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
260 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
261 ## The 'o' and 'O' qualifiers are only useful when the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
262 ## the property type is something other than an
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
263 ## octave_value.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
264
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
265 ## There is a custom inline definition for the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
266 ## octave_value version of the set function, so we
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
267 ## don't emit anything.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
268 if (index (quals, "o"))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
269 emit_ov_set[idx] = "";
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
270
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
271 ## There is a custom extern definition for the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
272 ## octave_value version of the set function, but we
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
273 ## still emit the declaration.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
274 if (index (quals, "O"))
7225
1f3e360c1bba [project @ 2007-11-30 06:50:34 by jwe]
jwe
parents: 7214
diff changeset
275 emit_ov_set[idx] = "declaration";
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
276 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
277 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
278
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
279 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
280 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
281 print $0;
6883
037c8b622a01 [project @ 2007-09-10 20:13:27 by jwe]
jwe
parents: 6875
diff changeset
282 }