source: branches/port5/AISC_COM/AISC/aisc_global.pa

Last change on this file was 5390, checked in by westram, 17 years ago
  • TAB-Ex
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
1IF $(argc) = 5,6
2ELSE
3        ERROR   Falsche Parameteranzahl: Syntax aisc xxx.pa xxx.aisc outfile extern_file
4ENDIF
5
6DATA AISC { $(#FILE $(argv[2])) };
7OPEN save $(argv[3])
8
9TABSTOP 8
10TAB     0       0
11TAB     1       8
12TAB     2       16
13TAB     3       24
14TAB     4       32
15TAB     5       40
16TAB     6       48
17TAB     7       56
18TAB     8       64
19TAB     9       72
20
21
22MOVETO $(AISC/PROJECT)
23CREATE $(pre) = $(OBJECT_KEY)_
24CREATE $(max_key) = $(MAX_KEY)
25CREATE $(max_obj) = $(MAX_OBJECT)
26
27OUT save
28
29MOVETO $(DATA/.)
30
31P /*********************************************************************
32P  * Created automagically from $(argv[2]) and $(argv[4])
33P  * using aisc-script 'aisc_global.pa'
34P  * DO NOT EDIT THIS FILE!!!
35P  *********************************************************************/$n
36
37P #include "aisc_func_types.h"$n
38
39P #ifdef __cplusplus
40P #define __P(destroy_func) extern "C" aisc_callback_func_proto(destroy_func);
41P #else
42P #define __P(destroy_func) aisc_callback_func_proto(destroy_func);
43P #endif
44
45########### generate object names struct ###########
46CREATE $(i)
47FOR $(i) = 0 TO $(max_obj)
48        CREATE $(list2[$(i)]) = $10,
49ENDFOR
50FOR $(i) = 0 TO $(max_key)
51        CREATE $(list[$(i)]) = $10,
52ENDFOR
53P const char *aisc_object_names[] = {
54FOR $(STRUCT)
55        IF $(SKEY)
56                SET $(list2[$(SKEYC)]) = $1"$(pre)$(SKEY)",
57        ENDIF
58ENDFOR
59FOR $(i) = 0 TO $(max_obj)
60        P $(list2[$(i)])
61ENDFOR
62P $10$n};$n
63
64############# generate attribute names structs #################
65CREATE $(nummer)
66CREATE $(aisc_string)
67FOR $(STRUCT)
68        IF $(SKEY)
69                GOSUB clearlist
70                SET $(nummer) = 0
71                SET $(aisc_string) = $(pre)$(SKEY)_
72                P static const char *$(pre)$(STRUCT)_attribut_names[] = {
73                GOSUB make_attr_names
74                GOSUB printlist
75                P $10$n};$n
76        ENDIF
77ENDFOR
78P $n
79
80############## generate attribut names struct list #############
81GOSUB clearobjlist
82P const char *aisc_attribut_names_list[] = {
83FOR $(STRUCT)
84        IF $(SKEY)
85             SET $(list2[$(SKEYC)]) = $1(const char *)$(pre)$(STRUCT)_attribut_names
86        ENDIF
87ENDFOR
88GOSUB printobjlist
89P $10$n};$n
90
91############# generate function structs ###################
92
93P typedef int* (*talking_function)(int *x, ...);
94P typedef talking_function *talking_function_ptr;
95
96FOR $(STRUCT)
97    P extern talking_function aisc_talking_functions_create_$(STRUCT)[];
98    P //extern int *((*(aisc_talking_functions_create_$(STRUCT)[]))());
99    P extern int *((*(aisc_talking_functions_get_$(STRUCT)[]))());
100    P extern int *((*(aisc_talking_functions_find_$(STRUCT)[]))());
101    P extern int *((*(aisc_talking_functions_copy_$(STRUCT)[]))());
102    P extern int ((*(aisc_talking_functions_set_$(STRUCT)[]))());
103    P __P(destroy_$(STRUCT))$n
104ENDFOR
105
106################## generate d flags #####################
107P int aisc_d_flags[] = {
108FOR $(i) = 0 TO $(max_key)
109        SET $(list[$(i)]) = $10,
110ENDFOR
111FOR $(STRUCT)
112        IF $(SKEY)
113                SET $(i) = 0
114                FOR $({/TYPE)
115                        IF $(TYPE) = dllh
116                                SET $(i) = 1
117                        ENDIF
118                ENDFOR
119                SET $(list[$(SKEYC)]) = $1$(i),$6/* $(SKEY) */
120        ENDIF
121ENDFOR
122FOR $(i) = 0 TO $(max_key)
123        P $(list[$(i)])
124ENDFOR
125P $10$n};$n
126
127################## generate get tables #####################
128P int *((**(aisc_talking_functions_get[]))()) = {
129FOR $(i) = 0 TO $(max_key)
130        SET $(list[$(i)]) = $10,
131ENDFOR
132FOR $(STRUCT)
133        IF $(SKEY)
134                SET $(list[$(SKEYC)]) = $1aisc_talking_functions_get_$(STRUCT),
135        ENDIF
136ENDFOR
137FOR $(i) = 0 TO $(max_key)
138        P $(list[$(i)])
139ENDFOR
140P $10$n};$n
141
142################## generate set tables #####################
143P int ((**(aisc_talking_functions_set[]))()) = {
144FOR $(i) = 0 TO $(max_key)
145        SET $(list[$(i)]) = $10,
146ENDFOR
147FOR $(STRUCT)
148        IF $(SKEY)
149                SET $(list[$(SKEYC)]) = $1aisc_talking_functions_set_$(STRUCT),
150        ENDIF
151ENDFOR
152FOR $(i) = 0 TO $(max_key)
153        P $(list[$(i)])
154ENDFOR
155P $10$n};$n
156
157################## generate find tables #####################
158P int *((**(aisc_talking_functions_find[]))()) = {
159FOR $(i) = 0 TO $(max_key)
160        SET $(list[$(i)]) = $10,
161ENDFOR
162FOR $(STRUCT)
163        IF $(SKEY)
164        SET $(list[$(SKEYC)]) = $1aisc_talking_functions_find_$(STRUCT),
165        ENDIF
166ENDFOR
167FOR $(i) = 0 TO $(max_key)
168        P $(list[$(i)])
169ENDFOR
170P $10$n};$n
171
172################## generate copy tables #####################
173P int *((**(aisc_talking_functions_copy[]))()) = {
174FOR $(i) = 0 TO $(max_key)
175        SET $(list[$(i)]) = $10,
176ENDFOR
177FOR $(STRUCT)
178        IF $(SKEY)
179        SET $(list[$(SKEYC)]) = $1aisc_talking_functions_copy_$(STRUCT),
180        ENDIF
181ENDFOR
182FOR $(i) = 0 TO $(max_key)
183        P $(list[$(i)])
184ENDFOR
185P $10$n};$n
186
187################## generate create tables #####################
188#P int *((**(aisc_talking_functions_create[]))()) = {
189P talking_function* aisc_talking_functions_create[] = {
190FOR $(i) = 0 TO $(max_key)
191        SET $(list[$(i)]) = $10,
192ENDFOR
193FOR $(STRUCT)
194        IF $(SKEY)
195        SET $(list[$(SKEYC)]) = $1aisc_talking_functions_create_$(STRUCT),
196        ENDIF
197ENDFOR
198FOR $(i) = 0 TO $(max_key)
199        P $(list[$(i)])
200ENDFOR
201P $10$n};$n
202
203################## generate delete tables #####################
204#P int ((*(aisc_talking_functions_delete[]))()) = {
205P aisc_callback_func aisc_talking_functions_delete[] = {
206FOR $(i) = 0 TO $(max_key)
207        SET $(list[$(i)]) = $10,
208ENDFOR
209FOR $(STRUCT)
210        IF $(SKEY)
211        SET $(list[$(SKEYC)]) = $1destroy_$(STRUCT),
212        ENDIF
213ENDFOR
214FOR $(i) = 0 TO $(max_key)
215        P $(list[$(i)])
216ENDFOR
217P $10$n};$n
218
219##################### FINISH ##########################
220
221P #undef __P
222
223CLOSE save
224EXIT
225
226###################### FUNCTIONS ############################
227###################### FUNCTIONS ############################
228###################### FUNCTIONS ############################
229
230################ make_attr_names (rek.) ####################
231FUNCTION make_attr_names
232        CREATE $(nr) = $(nummer)
233        CREATE $(s) = $(aisc_string)
234        FOR $({/TYPE)
235                IF $(KEY)
236                  IF $(REF) ~ s
237                        PUSH
238                        SET $(nummer) = $(+ $(nr)+$(KEYC) )
239                        SET $(aisc_string) = $(s)$(KEY)_
240                        MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
241                        GOSUB make_attr_names
242                        POP
243                  ELSEIF $(REF) ~ d
244                        SET $(list[$(+ $(+ $(nr)+1)+$(KEYC))])=$1"$(s)$(KEY)CNT"
245                        SET $(list[$(+ $(nr)+$(KEYC))]) = $1"$(s)$(KEY)"
246                  ELSEIF $(TYPE) = dllh
247                        PUSH
248                        SET $(nummer) = $(+ 2+$(+ $(nr)+$(KEYC) ))
249                        SET $(aisc_string) = $(s)$(KEY)
250                        MOVETO $(/AISC/DATA/STRUCT.dll_header)
251                        GOSUB make_attr_names
252                        POP
253                        SET $(list[$(+ $(nr)+0)]) = $1"$(s)PREVIOUS"
254                        SET $(list[$(+ $(nr)+1)]) = $1"$(s)NEXT"
255                  ELSE
256                        SET $(list[$(+ $(nr)+$(KEYC))]) = $1"$(s)$(KEY)"
257                  ENDIF
258                ENDIF
259        ENDFOR
260RETURN
261
262############### SUB CLEAR LIST #########################
263FUNCTION clearlist
264                FOR $(i) = 0 TO $(max_key)
265                        SET $(list[$(i)]) = $10
266                ENDFOR
267RETURN
268############### SUB PRINT LIST #########################
269FUNCTION printlist
270        FOR $(i) = 0 TO $(max_key)
271                P $1$(list[$(i)]),
272        ENDFOR
273RETURN
274
275############### SUB CLEAR LIST #########################
276FUNCTION clearobjlist
277                FOR $(i) = 0 TO $(max_obj)
278                        SET $(list2[$(i)]) = $10
279                ENDFOR
280RETURN
281############### SUB PRINT OBJ LIST #########################
282FUNCTION printobjlist
283        FOR $(i) = 0 TO $(max_obj)
284                P $1$(list2[$(i)]),
285        ENDFOR
286RETURN
287
Note: See TracBrowser for help on using the repository browser.