1 | IF $(argc) < 5 |
---|
2 | ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc_global.pa xxx.aisc outfile extern_file |
---|
3 | ENDIF |
---|
4 | |
---|
5 | DATA AISC { $(#FILE $(argv[2])) }; |
---|
6 | DUMPDATA DUMP/aisc_global.pa__$(argv[2]).dump |
---|
7 | OPEN save $(argv[3]) |
---|
8 | |
---|
9 | MOVETO $(AISC/PROJECT) |
---|
10 | CREATE $(pre) = $(OBJECT_KEY)_ |
---|
11 | CREATE $(max_key) = $(MAX_KEY) |
---|
12 | CREATE $(max_obj) = $(MAX_OBJECT) |
---|
13 | CREATE $(i) |
---|
14 | CREATE $(termptrlist) = $1NULp$n};$n |
---|
15 | CREATE $(termflaglist) = $10$n};$n |
---|
16 | |
---|
17 | OUT save |
---|
18 | |
---|
19 | MOVETO $(DATA/.) |
---|
20 | |
---|
21 | P /* ----------------------------------------------------------------- |
---|
22 | P * Created automagically from ../$(argv[2]) |
---|
23 | P * and ../$(argv[4]) |
---|
24 | P * using aisc-script '../AISC/aisc_global.pa' |
---|
25 | P * DO NOT EDIT THIS FILE!!! |
---|
26 | P * ----------------------------------------------------------------- */ |
---|
27 | -- |
---|
28 | P #include <aisc_server.h> |
---|
29 | -- |
---|
30 | |
---|
31 | # create and clear obj and key list |
---|
32 | FOR $(i) = 0 TO $(max_obj) |
---|
33 | CREATE $(obj[$(i)]) = NULp, |
---|
34 | ENDFOR |
---|
35 | FOR $(i) = 0 TO $(max_key) |
---|
36 | CREATE $(key[$(i)]) = NULp, |
---|
37 | ENDFOR |
---|
38 | |
---|
39 | # generate object names struct |
---|
40 | FOR $(STRUCT) |
---|
41 | IF $(SKEY) |
---|
42 | IF $(obj[$(SKEYC)]) |
---|
43 | SET $(obj[$(SKEYC)]) = "$(pre)$(SKEY)", |
---|
44 | ELSE |
---|
45 | ERROR Increase definition of MAX_OBJECT to $(SKEYC) |
---|
46 | ENDIF |
---|
47 | ENDIF |
---|
48 | ENDFOR |
---|
49 | |
---|
50 | P const char *aisc_object_names[] = { |
---|
51 | GOSUB printobjlist |
---|
52 | P $(termptrlist) |
---|
53 | |
---|
54 | # generate attribute names structs |
---|
55 | CREATE $(nummer) |
---|
56 | CREATE $(aisc_string) |
---|
57 | FOR $(STRUCT) |
---|
58 | IF $(SKEY) |
---|
59 | GOSUB clearkeylist |
---|
60 | SET $(nummer) = 0 |
---|
61 | SET $(aisc_string) = $(pre)$(SKEY)_ |
---|
62 | P static const char *$(pre)$(STRUCT)_attribute_names[] = { |
---|
63 | GOSUB make_attr_names |
---|
64 | GOSUB printkeylist |
---|
65 | P $(termptrlist) |
---|
66 | ENDIF |
---|
67 | ENDFOR |
---|
68 | P $n |
---|
69 | |
---|
70 | # generate attribute names struct list |
---|
71 | GOSUB clearobjlist |
---|
72 | P const char *aisc_attribute_names_list[] = { |
---|
73 | FOR $(STRUCT) |
---|
74 | IF $(SKEY) |
---|
75 | SET $(obj[$(SKEYC)]) = (const char *)$(pre)$(STRUCT)_attribute_names, |
---|
76 | ENDIF |
---|
77 | ENDFOR |
---|
78 | GOSUB printobjlist |
---|
79 | P $(termptrlist) |
---|
80 | |
---|
81 | # generate function structs |
---|
82 | P typedef int* (*talking_function)(int *x, ...); |
---|
83 | P typedef talking_function *talking_function_ptr; |
---|
84 | -- |
---|
85 | FOR $(STRUCT) |
---|
86 | P extern talking_function aisc_talking_functions_create_$(STRUCT)[]; |
---|
87 | P extern int* (*aisc_talking_functions_get_$(STRUCT)[])(); |
---|
88 | P extern int* (*aisc_talking_functions_find_$(STRUCT)[])(); |
---|
89 | P extern int* (*aisc_talking_functions_copy_$(STRUCT)[])(); |
---|
90 | P extern int (*aisc_talking_functions_set_$(STRUCT)[])(); |
---|
91 | -- |
---|
92 | ENDFOR |
---|
93 | |
---|
94 | # generate d flags |
---|
95 | P int aisc_d_flags[] = { |
---|
96 | GOSUB clearobjflaglist |
---|
97 | FOR $(STRUCT) |
---|
98 | IF $(SKEY) |
---|
99 | SET $(i) = 0 |
---|
100 | FOR $({/TYPE) |
---|
101 | IF $(TYPE) = dllh |
---|
102 | SET $(i) = 1 |
---|
103 | ENDIF |
---|
104 | ENDFOR |
---|
105 | SET $(key[$(SKEYC)]) = $(i),$6// $(SKEY) |
---|
106 | ENDIF |
---|
107 | ENDFOR |
---|
108 | GOSUB printobjlist |
---|
109 | P $(termflaglist) |
---|
110 | |
---|
111 | # generate callback tables |
---|
112 | P int* (**aisc_talking_functions_get[])() = { |
---|
113 | GOSUB print_talking_table,aisc_talking_functions_get_ |
---|
114 | |
---|
115 | P int (**aisc_talking_functions_set[])() = { |
---|
116 | GOSUB print_talking_table,aisc_talking_functions_set_ |
---|
117 | |
---|
118 | P int* (**aisc_talking_functions_find[])() = { |
---|
119 | GOSUB print_talking_table,aisc_talking_functions_find_ |
---|
120 | |
---|
121 | P int* (**aisc_talking_functions_copy[])() = { |
---|
122 | GOSUB print_talking_table,aisc_talking_functions_copy_ |
---|
123 | |
---|
124 | P talking_function* aisc_talking_functions_create[] = { |
---|
125 | GOSUB print_talking_table,aisc_talking_functions_create_ |
---|
126 | |
---|
127 | P aisc_destroy_callback aisc_talking_functions_delete[] = { |
---|
128 | GOSUB print_talking_table_casted,destroy_,aisc_destroy_callback |
---|
129 | |
---|
130 | # FINISH |
---|
131 | P #undef __P |
---|
132 | CLOSE save |
---|
133 | EXIT |
---|
134 | |
---|
135 | # ----------------- |
---|
136 | # FUNCTIONS |
---|
137 | |
---|
138 | FUNCTION print_talking_table,name |
---|
139 | CALL print_talking_table_casted,$(name), |
---|
140 | RETURN |
---|
141 | |
---|
142 | FUNCTION print_talking_table_casted,name,cast |
---|
143 | GOSUB clearkeylist |
---|
144 | FOR $(STRUCT) |
---|
145 | IF $(SKEY) |
---|
146 | IF $(cast)_ != _ |
---|
147 | SET $(key[$(SKEYC)]) = AISC_CASTSIG($(cast),$(name)$(STRUCT)), |
---|
148 | ELSE |
---|
149 | SET $(key[$(SKEYC)]) = $(name)$(STRUCT), |
---|
150 | ENDIF |
---|
151 | ENDIF |
---|
152 | ENDFOR |
---|
153 | GOSUB printkeylist |
---|
154 | P $(termptrlist) |
---|
155 | RETURN |
---|
156 | |
---|
157 | FUNCTION make_attr_names |
---|
158 | CREATE $(nr) = $(nummer) |
---|
159 | CREATE $(s) = $(aisc_string) |
---|
160 | FOR $({/TYPE) |
---|
161 | IF $(KEY) |
---|
162 | IF $(REF) ~ s |
---|
163 | PUSH |
---|
164 | SET $(nummer) = $(+ $(nr)+$(KEYC) ) |
---|
165 | SET $(aisc_string) = $(s)$(KEY)_ |
---|
166 | MOVETO $(/AISC/DATA/STRUCT.$(TYPE)) |
---|
167 | GOSUB make_attr_names |
---|
168 | POP |
---|
169 | ELSEIF $(REF) ~ d |
---|
170 | SET $(key[$(+ $(+ $(nr)+1)+$(KEYC))])="$(s)$(KEY)CNT", |
---|
171 | SET $(key[$(+ $(nr)+$(KEYC))]) = "$(s)$(KEY)", |
---|
172 | ELSEIF $(TYPE) = dllh |
---|
173 | PUSH |
---|
174 | SET $(nummer) = $(+ 2+$(+ $(nr)+$(KEYC) )) |
---|
175 | SET $(aisc_string) = $(s)$(KEY) |
---|
176 | MOVETO $(/AISC/DATA/STRUCT.dll_header) |
---|
177 | GOSUB make_attr_names |
---|
178 | POP |
---|
179 | SET $(key[$(+ $(nr)+0)]) = "$(s)PREVIOUS", |
---|
180 | SET $(key[$(+ $(nr)+1)]) = "$(s)NEXT", |
---|
181 | ELSE |
---|
182 | SET $(key[$(+ $(nr)+$(KEYC))]) = "$(s)$(KEY)", |
---|
183 | ENDIF |
---|
184 | ENDIF |
---|
185 | ENDFOR |
---|
186 | RETURN |
---|
187 | |
---|
188 | FUNCTION clearkeylist |
---|
189 | FOR $(i) = 0 TO $(max_key) |
---|
190 | SET $(key[$(i)]) = NULp, |
---|
191 | ENDFOR |
---|
192 | RETURN |
---|
193 | FUNCTION clearobjlist |
---|
194 | FOR $(i) = 0 TO $(max_obj) |
---|
195 | SET $(obj[$(i)]) = NULp, |
---|
196 | ENDFOR |
---|
197 | RETURN |
---|
198 | FUNCTION clearobjflaglist |
---|
199 | FOR $(i) = 0 TO $(max_obj) |
---|
200 | SET $(obj[$(i)]) = 0, |
---|
201 | ENDFOR |
---|
202 | RETURN |
---|
203 | FUNCTION printkeylist |
---|
204 | FOR $(i) = 0 TO $(max_key) |
---|
205 | P $1$(key[$(i)]) |
---|
206 | ENDFOR |
---|
207 | RETURN |
---|
208 | FUNCTION printobjlist |
---|
209 | FOR $(i) = 0 TO $(max_obj) |
---|
210 | P $1$(obj[$(i)]) |
---|
211 | ENDFOR |
---|
212 | RETURN |
---|
213 | |
---|