source: branches/port5/AISC_COM/AISC/aisc.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: 4.8 KB
Line 
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
3IF $(argc) = 4
4ELSE
5        ERROR   Falsche Parameteranzahl: Syntax aisc xxx.pa xxx.aisc outfile
6ENDIF
7
8DATA AISC { $(#FILE $(argv[2])) };
9MOVETO $(AISC/PROJECT)
10
11OPEN save $(argv[3])
12# *********************************** IDENTS ***************
13CREATE $(i)
14CREATE $(replace)
15IF $(MYTABSTOP)
16        TABSTOP $(MYTABSTOP)
17ELSE
18        TABSTOP 8
19ENDIF
20TAB     0       0
21TAB     1       8
22TAB     2       16
23TAB     3       24
24TAB     4       32
25TAB     5       40
26TAB     6       48
27TAB     7       56
28TAB     8       64
29TAB     9       72
30
31
32OUT save
33MOVETO $(DATA/.)
34
35P /*********************************************************************
36P  * Created automagically from $(argv[2])
37P  * using aisc-script 'aisc.pa'
38P  * DO NOT EDIT THIS FILE!!!
39P  *********************************************************************/$n
40
41P #ifndef AISC_GEN_SERVER_INCLUDED
42P #define AISC_GEN_SERVER_INCLUDED$n
43
44P typedef int   hash;
45P typedef char *aisc_string;
46P typedef const char *aisc_cstring;
47P #define _AISC_BYTESTRING
48P typedef struct struct_bytestring {
49P       char    *data;
50P       int     size;
51P       } bytestring;
52
53P $(INCLUDE_INCLUDES)
54
55P /******************* SOME CONSTANTS *******************/
56FOR $(CONST)
57        P       #define $(CONST) $3$(VALUE) $6/* $(DOCU) $8*/
58ENDFOR
59        P       
60P /******************* THE ENUMS *******************/
61FOR $(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
77ENDFOR
78P /******************* THE KEYS *******************/
79        P       typedef enum enum_t_key {
80FOR $(STRUCT)
81        IF $(JOINED)
82        ELSEIF $(SKEY)
83                P $1KEY_$(OBJECT_KEY)_$(SKEY) = $(SKEYC)*0x10000,
84        ENDIF
85ENDFOR
86        P       $1KEY_MAX$n} t_key;
87CREATE $(pre)
88CREATE $(suf)
89
90FOR $(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);
97ENDFOR
98        P $n/************************** some privat structures **************/
99FOR $(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;
106NEXT
107        ERROR struct dll_public is missing
108ENDFOR
109
110FOR $(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;
117NEXT
118        ERROR struct dll_header is missing
119ENDFOR
120
121P extern const char *aisc_server_error;
122
123P #else
124P #error header included twice
125P #endif /* AISC_GEN_SERVER_INCLUDED */
126CLOSE save
127EXIT
128
129
130FUNCTION 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
159RETURN
160
161FUNCTION 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
171RETURN
172
Note: See TracBrowser for help on using the repository browser.