1 | GOTO main |
---|
2 | |
---|
3 | FUNCTION struct_contents |
---|
4 | CREATE $(pre) |
---|
5 | CREATE $(suf) |
---|
6 | |
---|
7 | FOR $({/TYPE) |
---|
8 | IF $(TYPE) = dllh |
---|
9 | # dllh is "added" as base class by caller |
---|
10 | ELSEIF $(REF) ~ % |
---|
11 | ELSE |
---|
12 | SET $(pre) |
---|
13 | SET $(suf) |
---|
14 | IF $(REF) ~ * |
---|
15 | SET $(pre) * |
---|
16 | ELSEIF $(REF) ~ v |
---|
17 | SET $(suf) [$(SIZE|NO SIZE DEFINED)] |
---|
18 | ENDIF |
---|
19 | IF $(REF) ~ d |
---|
20 | P dll_public$| p$(IDENT); |
---|
21 | ENDIF |
---|
22 | IF $(REF) ~ d,r,l,o |
---|
23 | SET $(pre) $(pre)* |
---|
24 | ENDIF |
---|
25 | P $(TYPE|NO TYPE FOUND)$\ |
---|
26 | # align ' name' ' *name' '**name' |
---|
27 | SET $(pre) '$(pre)' |
---|
28 | P $|$(pre:''= :'*'= *:'**'=**:'=)$(IDENT)$(suf);$\ |
---|
29 | P $| // $(DOCU| *** ) |
---|
30 | ENDIF |
---|
31 | ENDFOR |
---|
32 | RETURN |
---|
33 | |
---|
34 | FUNCTION define_type |
---|
35 | P struct $(STRUCT) $\ |
---|
36 | FOR $({/TYPE.dllh) |
---|
37 | P : public dll<$(STRUCT)> $\ |
---|
38 | ENDFOR |
---|
39 | P { // $(SDOCU|$(STRUCT)) |
---|
40 | INDENT +1 |
---|
41 | CALL struct_contents |
---|
42 | INDENT -1 |
---|
43 | P }; |
---|
44 | RETURN |
---|
45 | |
---|
46 | FUNCTION datatypes |
---|
47 | P // forward decl dll types |
---|
48 | P struct dllpublic_ext; |
---|
49 | P struct dllheader_ext; |
---|
50 | -- |
---|
51 | |
---|
52 | FOR $(STRUCT.dll_public) |
---|
53 | NEXT |
---|
54 | ERROR mandatory STRUCT 'dll_public' is missing |
---|
55 | ENDFOR |
---|
56 | FOR $(STRUCT.dll_header) |
---|
57 | NEXT |
---|
58 | ERROR mandatory STRUCT 'dll_header' is missing |
---|
59 | ENDFOR |
---|
60 | |
---|
61 | P // "public" version of dll |
---|
62 | FOR $(STRUCT.dll_public) |
---|
63 | CALL define_type |
---|
64 | ENDFOR |
---|
65 | FOR $(STRUCT.dll_header) |
---|
66 | CALL define_type |
---|
67 | ENDFOR |
---|
68 | -- |
---|
69 | |
---|
70 | P template <typename USERTYPE> |
---|
71 | P struct dll { |
---|
72 | INDENT +1 |
---|
73 | P dll_header mh; // ***ANOTHEROLIHACK** |
---|
74 | P USERTYPE *previous, *next; |
---|
75 | P int get_count() const { return mh.parent ? mh.parent->cnt : 0; } |
---|
76 | INDENT -1 |
---|
77 | P }; |
---|
78 | -- |
---|
79 | |
---|
80 | P // "private" (i.e. real) version of dll (DoubledLinkedList) |
---|
81 | P struct dllpublic_ext : public dll_public { |
---|
82 | INDENT +1 |
---|
83 | P dllheader_ext$| *first; |
---|
84 | INDENT -1 |
---|
85 | P }; |
---|
86 | P // pseudo-base-class of dll<USERTYPE> (bit-equal) |
---|
87 | P struct dllheader_ext : dll<dllheader_ext> {}; // pseudo-base-class of dll<USERTYPE> (bit-equal) |
---|
88 | -- |
---|
89 | |
---|
90 | P // forward decl user datatypes |
---|
91 | FOR $(STRUCT) |
---|
92 | IF $(STRUCT) ~ dll_header,dll_public |
---|
93 | ELSE |
---|
94 | P struct $(STRUCT); |
---|
95 | ENDIF |
---|
96 | ENDFOR |
---|
97 | -- |
---|
98 | |
---|
99 | P // user defined datatypes |
---|
100 | FOR $(STRUCT) |
---|
101 | IF $(STRUCT) ~ dll_header,dll_public |
---|
102 | ELSE |
---|
103 | CALL define_type |
---|
104 | ENDIF |
---|
105 | ENDFOR |
---|
106 | -- |
---|
107 | |
---|
108 | RETURN |
---|
109 | |
---|
110 | FUNCTION constants |
---|
111 | IF $(CONST) |
---|
112 | P // some constants |
---|
113 | FOR $(CONST) |
---|
114 | P #define $(CONST) $|$(VALUE) $|// $(DOCU) |
---|
115 | ENDFOR |
---|
116 | -- |
---|
117 | ENDIF |
---|
118 | RETURN |
---|
119 | |
---|
120 | FUNCTION enums |
---|
121 | IF $(ENUM) |
---|
122 | ERROR never used before - please check generated code |
---|
123 | P // the enums |
---|
124 | FOR $(ENUM) |
---|
125 | P $n// $(SDOCU|$(ENUM)) |
---|
126 | P typedef enum enum_$(ENUM) { |
---|
127 | INDENT +1 |
---|
128 | FOR $({/VAR) |
---|
129 | IF $(VAL) |
---|
130 | P $(VAR)$| = $|$(VAL),$\ |
---|
131 | ELSE |
---|
132 | P $(VAR),$|$\ |
---|
133 | ENDIF |
---|
134 | IF $(DOCU) |
---|
135 | P $|// $(DOCU) |
---|
136 | ELSE |
---|
137 | P |
---|
138 | ENDIF |
---|
139 | ENDFOR |
---|
140 | INDENT -1 |
---|
141 | P } $(ENUM); |
---|
142 | ENDFOR |
---|
143 | -- |
---|
144 | ENDIF |
---|
145 | RETURN |
---|
146 | |
---|
147 | FUNCTION keys |
---|
148 | P // the keys |
---|
149 | P typedef enum enum_t_key { |
---|
150 | INDENT +1 |
---|
151 | FOR $(STRUCT) |
---|
152 | IF $(JOINED) |
---|
153 | ELSEIF $(SKEY) |
---|
154 | P KEY_$(OBJECT_KEY)_$(SKEY)$| = $|0x10000*$(SKEYC), |
---|
155 | ENDIF |
---|
156 | ENDFOR |
---|
157 | P KEY_MAX |
---|
158 | INDENT -1 |
---|
159 | P } t_key; |
---|
160 | -- |
---|
161 | RETURN |
---|
162 | |
---|
163 | # -------------------------------------------------------------------------------- |
---|
164 | |
---|
165 | LABEL main |
---|
166 | IF $(argc) != 4 |
---|
167 | ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc.pa xxx.aisc outfile |
---|
168 | ENDIF |
---|
169 | |
---|
170 | DATA AISC { $(#FILE $(argv[2])) }; |
---|
171 | DUMPDATA DUMP/aisc.pa__$(argv[2]).dump |
---|
172 | MOVETO $(/AISC/DATA/.) |
---|
173 | |
---|
174 | OPEN save $(argv[3]) |
---|
175 | OUT save |
---|
176 | |
---|
177 | P // ----------------------------------------------------------------- |
---|
178 | P // Created automagically from ../$(argv[2]) |
---|
179 | P // using aisc-script '../AISC/aisc.pa' |
---|
180 | P // DO NOT EDIT THIS FILE!!! |
---|
181 | P // ----------------------------------------------------------------- |
---|
182 | -- |
---|
183 | P #ifndef AISC_GEN_SERVER_INCLUDED |
---|
184 | P #define AISC_GEN_SERVER_INCLUDED |
---|
185 | -- |
---|
186 | P typedef char *aisc_string; |
---|
187 | P typedef const char *aisc_cstring; |
---|
188 | -- |
---|
189 | P #ifndef AISC_GLOBAL_H |
---|
190 | P #include <aisc_global.h> |
---|
191 | P #endif |
---|
192 | P $(INCLUDE_INCLUDES) |
---|
193 | -- |
---|
194 | CALL constants |
---|
195 | CALL enums |
---|
196 | CALL keys |
---|
197 | CALL datatypes |
---|
198 | P extern const char *aisc_server_error; |
---|
199 | -- |
---|
200 | |
---|
201 | P #else |
---|
202 | P #error header included twice |
---|
203 | P #endif // AISC_GEN_SERVER_INCLUDED |
---|
204 | CLOSE save |
---|
205 | EXIT |
---|
206 | |
---|