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

Last change on this file was 8744, checked in by westram, 12 years ago
  • AISC clients
    • client-handles for server-side objects are distinguishable types now (esp. can no longer be confounded w/o compiler messages)
    • main server object has to be passed to aisc_close
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 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  * ----------------------------------------------------------------- */$n
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 #ifndef AISC_MAX_OBJECT
28P # define AISC_MAX_OBJECT         $(MAX_OBJECT)
29P # define AISC_MAX_ATTR           $(MAX_KEY)
30P # define MAX_AISC_SET_GET        $(MAX_PAR_CNT)
31P # define AISC_MAX_STRING_LEN     $(MAX_STRING_LEN)
32P # define AISC_MESSAGE_BUFFER_LEN ((AISC_MAX_STRING_LEN/4+3)*($(MAX_PAR_CNT)+2))
33P # define AISC_MAGIC_NUMBER       $(MAGIC_NUMBER)00
34--
35P struct aisc_com;
36--
37P const int AISC_GET $|= AISC_MAGIC_NUMBER+0;
38P const int AISC_SET $|= AISC_MAGIC_NUMBER+1;
39P const int AISC_NSET $|= AISC_MAGIC_NUMBER+2;
40P const int AISC_CREATE $|= AISC_MAGIC_NUMBER+3;
41P const int AISC_FIND $|= AISC_MAGIC_NUMBER+4;
42P const int AISC_COPY $|= AISC_MAGIC_NUMBER+5;
43P const int AISC_DELETE $|= AISC_MAGIC_NUMBER+6;
44P const int AISC_INIT $|= AISC_MAGIC_NUMBER+7;
45P const int AISC_DEBUG_INFO $|= AISC_MAGIC_NUMBER+8;
46--
47P const int AISC_CCOM_OK $|= AISC_MAGIC_NUMBER+0;
48P const int AISC_CCOM_ERROR $|= AISC_MAGIC_NUMBER+1;
49P const int AISC_CCOM_MESSAGE $|= AISC_MAGIC_NUMBER+2;
50--
51P #endif
52--
53FOR $(ENUM)
54    IF $(SKEY)
55        CREATE $(my_attribute[$(ENUM)]) $(OBJECT_KEY)_ATTR_$(SKEY)
56    ENDIF
57ENDFOR
58--
59P #define $(OBJECT_KEY)_ATTR_INT(a,b) $|(((a)+(b))|0x1000000)
60FOR $(ENUM)
61    IF $(SKEY)
62        P #define $(OBJECT_KEY)_ATTR_$(SKEY)(a,b) $|(((a)+(b))|0x1000000)
63    ENDIF
64ENDFOR
65P #define $(OBJECT_KEY)_ATTR_DOUBLE(a,b) $|(((a)+(b))|0x2000000)
66P #define $(OBJECT_KEY)_ATTR_STRING(a,b) $|(((a)+(b))|0x3000000)
67CREATE $(my_attribute[char]) $(OBJECT_KEY)_ATTR_INT
68CREATE $(my_attribute[int]) $(OBJECT_KEY)_ATTR_INT
69CREATE $(my_attribute[func]) $(OBJECT_KEY)_ATTR_INT
70CREATE $(my_attribute[t_key]) $(OBJECT_KEY)_ATTR_INT
71CREATE $(my_attribute[dllheader_ext]) $(OBJECT_KEY)_ATTR_INT
72CREATE $(my_attribute[double]) $(OBJECT_KEY)_ATTR_DOUBLE
73CREATE $(my_attribute[aisc_string]) $(OBJECT_KEY)_ATTR_STRING
74CREATE $(my_attribute[bytestring]) $(OBJECT_KEY)_ATTR_BYTES
75FOR $(STRUCT)
76    IF $(JOINED)
77    ELSEIF $(SKEY)
78        P #define $(OBJECT_KEY)_ATTR_$(SKEY)(a,b) $|(((a)+(b))|0x4000000)
79        CREATE $(my_attribute[$(STRUCT)]) $(OBJECT_KEY)_ATTR_$(SKEY)
80    ENDIF
81ENDFOR
82P #define $(OBJECT_KEY)_ATTR_BYTES(a,b) $|(((a)+(b))|0x5000000)
83--
84P enum Aisc_Object_Type {
85INDENT +1
86    FOR $(STRUCT)
87        IF $(JOINED)
88        ELSEIF $(SKEY)
89            P $(OBJECT_KEY)_$(SKEY) $|= 0x10000*$(SKEYC),
90        ENDIF
91    ENDFOR
92    P $(OBJECT_KEY)_MAX $|= 0x10000*$(MAX_OBJECT),
93    P $(OBJECT_KEY)_INDEX $|= 0x10000*0x1ff
94INDENT -1
95P };
96--
97FOR $(STRUCT)
98    IF $(JOINED)
99    ELSEIF $(SKEY)
100        P struct T_$(OBJECT_KEY)_$(SKEY) : public AISC_Object {
101        INDENT +1
102        P T_$(OBJECT_KEY)_$(SKEY)() : AISC_Object($(OBJECT_KEY)_$(SKEY)) {}
103        P void assign(const T_$(OBJECT_KEY)_$(SKEY)& o) { set(o.type(), o.get()); }
104        INDENT -1
105        P };
106    ENDIF
107ENDFOR
108--
109
110CREATE $(A)
111CREATE $(add) 0
112CREATE $(str) 0
113CREATE $(skey) 0
114CREATE $(struct) 0
115CREATE $(com)
116
117FOR $(STRUCT)
118    IF $(SKEY)
119        PUSH
120        IF $(JOINED)
121        ELSE
122            P enum $(OBJECT_KEY)_$(SKEY)_Attribute { // $(SKEY)
123            INDENT +1
124        ENDIF
125        SET $(skey) $(SKEY)
126        SET $(struct) $(STRUCT)
127        CALL insert_struct_attributes,0,$(SKEY)_,//
128        IF $(JOIN_NEXT)
129        ELSE
130            P $(SKEY)_FORCELONG $|= LONG_MAX
131            INDENT -1
132            P };
133            --
134        ENDIF
135        POP
136    ENDIF
137ENDFOR
138CLOSE save
139
140EXIT
141
142FUNCTION insert_struct_attributes,a,s,c
143    FOR $({/TYPE)
144        IF $(KEY)
145            IF $(TYPE) = dllh
146                P $(s)PRED $|= $\
147                P $(my_attribute[$(struct)])$\
148                P $|($(OBJECT_KEY)_$(skey), $(+ $(a)+$(KEYC))), $|// DO
149
150                P $(s)NEXT $|= $\
151                P $(my_attribute[$(struct)])$\
152                P $|($(OBJECT_KEY)_$(skey), $(+ 1+$(+ $(a)+$(KEYC)))), $|$(c)
153
154                SET $(add) $(+ $(a)+$(KEYC))
155                SET $(add) $(+ 2+$(add))
156                SET $(str) $(s)$(KEY)
157                PUSH
158                MOVETO $(/AISC/DATA/STRUCT.dll_header)
159                CALL insert_struct_attributes,$(add),$(str),$(c) H
160                POP
161            ELSEIF $(REF) ~ s
162                SET $(add) $(+ $(a),$(KEYC))
163                SET $(str) $(s)$(KEY)
164                SET $(com) $(c) S
165                PUSH
166                MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
167                CALL insert_struct_attributes,$(add),$(str),$(com)
168                POP
169            ELSE
170                IF $(REF) ~ d
171                    SET $(com) $(c) DL
172                ELSEIF $(REF) ~ v
173                    SET $(com) $(c) [$(SIZE)]
174                ELSEIF $(REF) ~ *
175                    SET $(com) $(c) []
176                ELSEIF $(TYPE) = func
177                    SET $(com) $(c) FUNC
178                ELSE
179                    SET $(com) $(c)
180                ENDIF
181                IF $(my_attribute[$(TYPE)])
182                    P $(s)$(KEY) $|= $\
183                    P $(my_attribute[$(TYPE)])$\
184                    P $|($(OBJECT_KEY)_$(skey), $(+ $(a)+$(KEYC))), $|$(com)
185                ELSE
186                    ERROR TYPE $(TYPE) unknown, no key build
187                ENDIF
188                IF $(REF) ~ d
189                    P $(s)$(KEY)_CNT $|= $\
190                    P $(my_attribute[int])$\
191                    P $|($(OBJECT_KEY)_$(skey), $(+ 1,$(+ $(a)+$(KEYC)))), $|$(com)
192                ENDIF
193            ENDIF
194        ENDIF
195    ENDFOR
196RETURN
Note: See TracBrowser for help on using the repository browser.