1 | # It is very important, that you set the TABSTOP to the correct tabsize of your editor, |
---|
2 | # overwise the PRINT Command will probably make some errors |
---|
3 | IF $(argc) = 4 |
---|
4 | ELSE |
---|
5 | ERROR Falsche Parameteranzahl: Syntax aisc xxx.pa xxx.aisc outfile |
---|
6 | ENDIF |
---|
7 | |
---|
8 | DATA AISC { $(#FILE $(argv[2])) }; |
---|
9 | MOVETO $(AISC/PROJECT) |
---|
10 | |
---|
11 | OPEN save $(argv[3]) |
---|
12 | # *********************************** IDENTS *************** |
---|
13 | CREATE $(i) |
---|
14 | CREATE $(replace) |
---|
15 | IF $(MYTABSTOP) |
---|
16 | TABSTOP $(MYTABSTOP) |
---|
17 | ELSE |
---|
18 | TABSTOP 8 |
---|
19 | ENDIF |
---|
20 | TAB 0 0 |
---|
21 | TAB 1 8 |
---|
22 | TAB 2 16 |
---|
23 | TAB 3 24 |
---|
24 | TAB 4 32 |
---|
25 | TAB 5 40 |
---|
26 | TAB 6 48 |
---|
27 | TAB 7 56 |
---|
28 | TAB 8 64 |
---|
29 | TAB 9 72 |
---|
30 | |
---|
31 | |
---|
32 | OUT save |
---|
33 | MOVETO $(DATA/.) |
---|
34 | |
---|
35 | P /********************************************************************* |
---|
36 | P * Created automagically from $(argv[2]) |
---|
37 | P * using aisc-script 'aisc.pa' |
---|
38 | P * DO NOT EDIT THIS FILE!!! |
---|
39 | P *********************************************************************/$n |
---|
40 | |
---|
41 | P #ifndef AISC_GEN_SERVER_INCLUDED |
---|
42 | P #define AISC_GEN_SERVER_INCLUDED$n |
---|
43 | |
---|
44 | P typedef int hash; |
---|
45 | P typedef char *aisc_string; |
---|
46 | P typedef const char *aisc_cstring; |
---|
47 | P #define _AISC_BYTESTRING |
---|
48 | P typedef struct struct_bytestring { |
---|
49 | P char *data; |
---|
50 | P int size; |
---|
51 | P } bytestring; |
---|
52 | |
---|
53 | P $(INCLUDE_INCLUDES) |
---|
54 | |
---|
55 | P /******************* SOME CONSTANTS *******************/ |
---|
56 | FOR $(CONST) |
---|
57 | P #define $(CONST) $3$(VALUE) $6/* $(DOCU) $8*/ |
---|
58 | ENDFOR |
---|
59 | P |
---|
60 | P /******************* THE ENUMS *******************/ |
---|
61 | FOR $(ENUM) |
---|
62 | P $n$1/************** $(SDOCU|$(ENUM)) **************/ |
---|
63 | P typedef enum enum_$(ENUM) { |
---|
64 | FOR $({/VAR) |
---|
65 | IF $(VAL) |
---|
66 | P $2$(VAR)$3=$4 $(VAL),$\ |
---|
67 | ELSE |
---|
68 | P $2$(VAR),$\ |
---|
69 | ENDIF |
---|
70 | IF $(DOCU) |
---|
71 | P $6/* $(DOCU)$8*/ |
---|
72 | ELSE |
---|
73 | P |
---|
74 | ENDIF |
---|
75 | ENDFOR |
---|
76 | P } $(ENUM);$n |
---|
77 | ENDFOR |
---|
78 | P /******************* THE KEYS *******************/ |
---|
79 | P typedef enum enum_t_key { |
---|
80 | FOR $(STRUCT) |
---|
81 | IF $(JOINED) |
---|
82 | ELSEIF $(SKEY) |
---|
83 | P $1KEY_$(OBJECT_KEY)_$(SKEY) = $(SKEYC)*0x10000, |
---|
84 | ENDIF |
---|
85 | ENDFOR |
---|
86 | P $1KEY_MAX$n} t_key; |
---|
87 | CREATE $(pre) |
---|
88 | CREATE $(suf) |
---|
89 | |
---|
90 | FOR $(STRUCT) |
---|
91 | P $n$1/************** $(SDOCU|$(STRUCT)) **************/ |
---|
92 | CALL pre_structh |
---|
93 | P typedef struct struct_$(STRUCT) { |
---|
94 | SET $(replace) |
---|
95 | CALL structh |
---|
96 | P } $(STRUCT); |
---|
97 | ENDFOR |
---|
98 | P $n/************************** some privat structures **************/ |
---|
99 | FOR $(STRUCT.dll_public) |
---|
100 | CALL pre_structh |
---|
101 | P typedef struct struct_dllpublic_ext { |
---|
102 | SET $(replace) :dll_header=dllheader_ext:dll_public=dllpublic_ext |
---|
103 | CALL structh |
---|
104 | P $2struct struct_dllheader_ext $5*first; |
---|
105 | P }$1dllpublic_ext; |
---|
106 | NEXT |
---|
107 | ERROR struct dll_public is missing |
---|
108 | ENDFOR |
---|
109 | |
---|
110 | FOR $(STRUCT.dll_header) |
---|
111 | CALL pre_structh |
---|
112 | P typedef struct struct_dllheader_ext { |
---|
113 | SET $(replace) :dll_header=dllheader_ext:dll_public=dllpublic_ext |
---|
114 | CALL structh |
---|
115 | P $2struct struct_dllheader_ext $5*previous, *next; |
---|
116 | P } dllheader_ext; |
---|
117 | NEXT |
---|
118 | ERROR struct dll_header is missing |
---|
119 | ENDFOR |
---|
120 | |
---|
121 | P extern const char *aisc_server_error; |
---|
122 | |
---|
123 | P #else |
---|
124 | P #error header included twice |
---|
125 | P #endif /* AISC_GEN_SERVER_INCLUDED */ |
---|
126 | CLOSE save |
---|
127 | EXIT |
---|
128 | |
---|
129 | |
---|
130 | FUNCTION structh |
---|
131 | FOR $({/TYPE) |
---|
132 | SET $(pre) |
---|
133 | SET $(suf) |
---|
134 | IF $(TYPE) = dllh |
---|
135 | P $2dll_header$4mh; |
---|
136 | P $2struct struct_$(STRUCT)$4*previous, *next; |
---|
137 | ELSEIF $(REF) ~ % |
---|
138 | ELSE |
---|
139 | IF $(REF) ~ * |
---|
140 | SET $(pre) * |
---|
141 | ELSEIF $(REF) ~ v |
---|
142 | SET $(suf) [$(SIZE|NO SIZE DEFINED)] |
---|
143 | ENDIF |
---|
144 | IF $(REF) ~ d |
---|
145 | P $2dll_public$4p$(IDENT); |
---|
146 | ENDIF |
---|
147 | IF $(REF) ~ d,r,l,o |
---|
148 | SET $(pre) $(pre)* |
---|
149 | ENDIF |
---|
150 | IF $(REF) ~ f |
---|
151 | P $2struct struct_$(TYPE|NO TYPE FOUND$(replace)) $4$\ |
---|
152 | ELSE |
---|
153 | P $2$(TYPE|NO TYPE FOUND$(replace)) $4$\ |
---|
154 | ENDIF |
---|
155 | P $(pre)$(IDENT)$(suf)$\ |
---|
156 | P ;$6/* $(DOCU| *** )$8*/ |
---|
157 | ENDIF |
---|
158 | ENDFOR |
---|
159 | RETURN |
---|
160 | |
---|
161 | FUNCTION pre_structh |
---|
162 | FOR $({/TYPE) |
---|
163 | IF $(TYPE) = dllh |
---|
164 | ELSEIF $(REF) ~ % |
---|
165 | ELSE |
---|
166 | IF $(REF) ~ f |
---|
167 | P struct struct_$(TYPE|NO TYPE FOUND$(replace)); |
---|
168 | ENDIF |
---|
169 | ENDIF |
---|
170 | ENDFOR |
---|
171 | RETURN |
---|
172 | |
---|