source: branches/nameserver/AISC_COM/AISC/aisc_com.pa

Last change on this file was 17135, checked in by westram, 7 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1IF $(argc) != 4
2    ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc_com.pa xxx.aisc outfile
3ENDIF
4
5DATA AISC { $(#FILE $(argv[2])) };
6DUMPDATA DUMP/aisc_com.pa__$(argv[2]).dump
7
8OPEN save $(argv[3])
9MOVETO $(AISC/PROJECT)
10
11OUT save
12MOVETO $(DATA/.)
13
14P /* -----------------------------------------------------------------
15P  * Created automagically from ../$(argv[2])
16P  * using aisc-script '../AISC/aisc_com.pa'
17P  * DO NOT EDIT THIS FILE!!!
18P  * ----------------------------------------------------------------- */
19--
20P #ifndef _LIMITS_H
21P #include <limits.h>
22P #endif
23P #ifndef AISC_GLOBAL_H
24P #include <aisc_global.h>
25P #endif
26--
27P struct aisc_com;
28--
29P namespace $(OBJECT_KEY) {
30INDENT +1
31P const int AISC_MAX_OBJECT         $|= $(MAX_OBJECT);
32P const int AISC_MAX_ATTR           $|= $(MAX_KEY);
33P const int MAX_AISC_SET_GET        $|= $(MAX_PAR_CNT);
34P const int AISC_MAX_STRING_LEN     $|= $(MAX_STRING_LEN);
35P const int AISC_MESSAGE_BUFFER_LEN $|= ((AISC_MAX_STRING_LEN/4+3)*($(MAX_PAR_CNT)+2));
36P const int AISC_MAGIC_NUMBER       $|= $(MAGIC_NUMBER)*256; // = shift 1 byte left
37--
38P const int AISC_GET        $|= AISC_MAGIC_NUMBER+0;
39P const int AISC_SET        $|= AISC_MAGIC_NUMBER+1;
40P const int AISC_NSET       $|= AISC_MAGIC_NUMBER+2;
41P const int AISC_CREATE     $|= AISC_MAGIC_NUMBER+3;
42P const int AISC_FIND       $|= AISC_MAGIC_NUMBER+4;
43P const int AISC_COPY       $|= AISC_MAGIC_NUMBER+5;
44P const int AISC_DELETE     $|= AISC_MAGIC_NUMBER+6;
45P const int AISC_INIT       $|= AISC_MAGIC_NUMBER+7;
46P const int AISC_DEBUG_INFO $|= AISC_MAGIC_NUMBER+8;
47--
48P const int AISC_CCOM_OK      $|= AISC_MAGIC_NUMBER+0;
49P const int AISC_CCOM_ERROR   $|= AISC_MAGIC_NUMBER+1;
50P const int AISC_CCOM_MESSAGE $|= AISC_MAGIC_NUMBER+2;
51INDENT -1
52P };
53--
54FOR $(ENUM)
55    IF $(SKEY)
56        CREATE $(my_attribute[$(ENUM)]) $(OBJECT_KEY)_ATTR_$(SKEY)
57    ENDIF
58ENDFOR
59--
60P #define $(OBJECT_KEY)_ATTR_INT(a,b) $|(((a)+(b))|0x1000000)
61FOR $(ENUM)
62    IF $(SKEY)
63        P #define $(OBJECT_KEY)_ATTR_$(SKEY)(a,b) $|(((a)+(b))|0x1000000)
64    ENDIF
65ENDFOR
66P #define $(OBJECT_KEY)_ATTR_DOUBLE(a,b) $|(((a)+(b))|0x2000000)
67P #define $(OBJECT_KEY)_ATTR_STRING(a,b) $|(((a)+(b))|0x3000000)
68CREATE $(my_attribute[char]) $(OBJECT_KEY)_ATTR_INT
69CREATE $(my_attribute[int]) $(OBJECT_KEY)_ATTR_INT
70CREATE $(my_attribute[func]) $(OBJECT_KEY)_ATTR_INT
71CREATE $(my_attribute[t_key]) $(OBJECT_KEY)_ATTR_INT
72CREATE $(my_attribute[dllheader_ext]) $(OBJECT_KEY)_ATTR_INT
73CREATE $(my_attribute[double]) $(OBJECT_KEY)_ATTR_DOUBLE
74CREATE $(my_attribute[aisc_string]) $(OBJECT_KEY)_ATTR_STRING
75CREATE $(my_attribute[bytestring]) $(OBJECT_KEY)_ATTR_BYTES
76FOR $(STRUCT)
77    IF $(JOINED)
78    ELSEIF $(SKEY)
79        P #define $(OBJECT_KEY)_ATTR_$(SKEY)(a,b) $|(((a)+(b))|0x4000000)
80        CREATE $(my_attribute[$(STRUCT)]) $(OBJECT_KEY)_ATTR_$(SKEY)
81    ENDIF
82ENDFOR
83P #define $(OBJECT_KEY)_ATTR_BYTES(a,b) $|(((a)+(b))|0x5000000)
84--
85P enum $(OBJECT_KEY)_Aisc_Object_Type {
86INDENT +1
87    FOR $(STRUCT)
88        IF $(JOINED)
89        ELSEIF $(SKEY)
90            P $(OBJECT_KEY)_$(SKEY) $|= 0x10000*$(SKEYC),
91        ENDIF
92    ENDFOR
93    P $(OBJECT_KEY)_MAX $|= 0x10000*$(MAX_OBJECT),
94    P $(OBJECT_KEY)_INDEX $|= 0x10000*0x1ff
95INDENT -1
96P };
97--
98FOR $(STRUCT)
99    IF $(JOINED)
100    ELSEIF $(SKEY)
101        P struct T_$(OBJECT_KEY)_$(SKEY) : public AISC_Object {
102        INDENT +1
103        P T_$(OBJECT_KEY)_$(SKEY)() : AISC_Object($(OBJECT_KEY)_$(SKEY)) {}
104        P void assign(const T_$(OBJECT_KEY)_$(SKEY)& o) { set(o.type(), o.get()); }
105        INDENT -1
106        P };
107    ENDIF
108ENDFOR
109--
110
111CREATE $(A)
112CREATE $(add) 0
113CREATE $(str) 0
114CREATE $(skey) 0
115CREATE $(struct) 0
116CREATE $(com)
117
118FOR $(STRUCT)
119    IF $(SKEY)
120        IF $(SKEY) !~ COMMON
121            PUSH
122            IF $(JOINED)
123            ELSE
124                P enum $(OBJECT_KEY)_$(SKEY)_Attribute { // $(SKEY)
125                INDENT +1
126            ENDIF
127            SET $(skey) $(SKEY)
128            SET $(struct) $(STRUCT)
129            CALL insert_struct_attributes,0,$(SKEY)_,//
130            IF $(JOIN_NEXT)
131            ELSE
132                P $(SKEY)_FORCELONG $|= LONG_MAX
133                INDENT -1
134                P };
135                --
136            ENDIF
137            POP
138        ENDIF
139    ENDIF
140ENDFOR
141CLOSE save
142
143EXIT
144
145FUNCTION insert_struct_attributes,a,s,c
146    FOR $({/TYPE)
147        IF $(KEY)
148            IF $(TYPE) = dllh
149                P $(s)PRED $|= $\
150                P $(my_attribute[$(struct)])$\
151                P $|($(OBJECT_KEY)_$(skey), $(+ $(a)+$(KEYC))), $|// DO
152
153                P $(s)NEXT $|= $\
154                P $(my_attribute[$(struct)])$\
155                P $|($(OBJECT_KEY)_$(skey), $(+ 1+$(+ $(a)+$(KEYC)))), $|$(c)
156
157                SET $(add) $(+ $(a)+$(KEYC))
158                SET $(add) $(+ 2+$(add))
159                SET $(str) $(s)$(KEY)
160                PUSH
161                MOVETO $(/AISC/DATA/STRUCT.dll_header)
162                CALL insert_struct_attributes,$(add),$(str),$(c) H
163                POP
164            ELSEIF $(REF) ~ s
165                SET $(add) $(+ $(a),$(KEYC))
166                SET $(str) $(s)$(KEY)
167                SET $(com) $(c) S
168                PUSH
169                MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
170                CALL insert_struct_attributes,$(add),$(str),$(com)
171                POP
172            ELSE
173                IF $(REF) ~ d
174                    SET $(com) $(c) DL
175                ELSEIF $(REF) ~ v
176                    SET $(com) $(c) [$(SIZE)]
177                ELSEIF $(REF) ~ *
178                    SET $(com) $(c) []
179                ELSEIF $(TYPE) = func
180                    SET $(com) $(c) FUNC
181                ELSE
182                    SET $(com) $(c)
183                ENDIF
184                IF $(my_attribute[$(TYPE)])
185                    P $(s)$(KEY) $|= $\
186                    P $(my_attribute[$(TYPE)])$\
187                    P $|($(OBJECT_KEY)_$(skey), $(+ $(a)+$(KEYC))), $|$(com)
188                ELSE
189                    ERROR TYPE $(TYPE) unknown, no key build
190                ENDIF
191                IF $(REF) ~ d
192                    P $(s)$(KEY)_CNT $|= $\
193                    P $(my_attribute[int])$\
194                    P $|($(OBJECT_KEY)_$(skey), $(+ 1,$(+ $(a)+$(KEYC)))), $|$(com)
195                ENDIF
196            ENDIF
197        ENDIF
198    ENDFOR
199RETURN
Note: See TracBrowser for help on using the repository browser.