Rev 1206 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1166 | hidnplayr | 1 | |
2 | |||
3 | |||
4 | { virtual at 0 |
||
2563 | hidnplayr | 5 | fields@struct equ name |
6 | match child parent, name \{ fields@struct equ child,fields@\#parent \} |
||
1166 | hidnplayr | 7 | sub@struct equ |
8 | struc db [val] \{ \common define field@struct .,db, |
||
2563 | hidnplayr | 9 | fields@struct equ fields@struct,field@struct \} |
10 | struc dw [val] \{ \common define field@struct .,dw, |
||
11 | fields@struct equ fields@struct,field@struct \} |
||
12 | struc du [val] \{ \common define field@struct .,du, |
||
13 | fields@struct equ fields@struct,field@struct \} |
||
14 | struc dd [val] \{ \common define field@struct .,dd, |
||
15 | fields@struct equ fields@struct,field@struct \} |
||
16 | struc dp [val] \{ \common define field@struct .,dp, |
||
17 | fields@struct equ fields@struct,field@struct \} |
||
18 | struc dq [val] \{ \common define field@struct .,dq, |
||
19 | fields@struct equ fields@struct,field@struct \} |
||
20 | struc dt [val] \{ \common define field@struct .,dt, |
||
21 | fields@struct equ fields@struct,field@struct \} |
||
22 | struc rb count \{ define field@struct .,db,count dup (?) |
||
23 | fields@struct equ fields@struct,field@struct \} |
||
24 | struc rw count \{ define field@struct .,dw,count dup (?) |
||
25 | fields@struct equ fields@struct,field@struct \} |
||
26 | struc rd count \{ define field@struct .,dd,count dup (?) |
||
27 | fields@struct equ fields@struct,field@struct \} |
||
28 | struc rp count \{ define field@struct .,dp,count dup (?) |
||
29 | fields@struct equ fields@struct,field@struct \} |
||
30 | struc rq count \{ define field@struct .,dq,count dup (?) |
||
31 | fields@struct equ fields@struct,field@struct \} |
||
32 | struc rt count \{ define field@struct .,dt,count dup (?) |
||
33 | fields@struct equ fields@struct,field@struct \} |
||
34 | macro db [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 35 | define field@struct anonymous,db, |
2563 | hidnplayr | 36 | fields@struct equ fields@struct,field@struct \} |
37 | macro dw [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 38 | define field@struct anonymous,dw, |
2563 | hidnplayr | 39 | fields@struct equ fields@struct,field@struct \} |
40 | macro du [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 41 | define field@struct anonymous,du, |
2563 | hidnplayr | 42 | fields@struct equ fields@struct,field@struct \} |
43 | macro dd [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 44 | define field@struct anonymous,dd, |
2563 | hidnplayr | 45 | fields@struct equ fields@struct,field@struct \} |
46 | macro dp [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 47 | define field@struct anonymous,dp, |
2563 | hidnplayr | 48 | fields@struct equ fields@struct,field@struct \} |
49 | macro dq [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 50 | define field@struct anonymous,dq, |
2563 | hidnplayr | 51 | fields@struct equ fields@struct,field@struct \} |
52 | macro dt [val] \{ \common \local anonymous |
||
1166 | hidnplayr | 53 | define field@struct anonymous,dt, |
2563 | hidnplayr | 54 | fields@struct equ fields@struct,field@struct \} |
55 | macro rb count \{ \local anonymous |
||
1166 | hidnplayr | 56 | define field@struct anonymous,db,count dup (?) |
2563 | hidnplayr | 57 | fields@struct equ fields@struct,field@struct \} |
58 | macro rw count \{ \local anonymous |
||
1166 | hidnplayr | 59 | define field@struct anonymous,dw,count dup (?) |
2563 | hidnplayr | 60 | fields@struct equ fields@struct,field@struct \} |
61 | macro rd count \{ \local anonymous |
||
1166 | hidnplayr | 62 | define field@struct anonymous,dd,count dup (?) |
2563 | hidnplayr | 63 | fields@struct equ fields@struct,field@struct \} |
64 | macro rp count \{ \local anonymous |
||
1166 | hidnplayr | 65 | define field@struct anonymous,dp,count dup (?) |
2563 | hidnplayr | 66 | fields@struct equ fields@struct,field@struct \} |
67 | macro rq count \{ \local anonymous |
||
1166 | hidnplayr | 68 | define field@struct anonymous,dq,count dup (?) |
2563 | hidnplayr | 69 | fields@struct equ fields@struct,field@struct \} |
70 | macro rt count \{ \local anonymous |
||
1166 | hidnplayr | 71 | define field@struct anonymous,dt,count dup (?) |
2563 | hidnplayr | 72 | fields@struct equ fields@struct,field@struct \} |
73 | macro union \{ fields@struct equ fields@struct,,union,< |
||
1166 | hidnplayr | 74 | sub@struct equ union \} |
2563 | hidnplayr | 75 | macro struct \{ fields@struct equ fields@struct,,substruct,< |
1166 | hidnplayr | 76 | sub@struct equ substruct \} } |
2563 | hidnplayr | 77 | |
1166 | hidnplayr | 78 | |
79 | { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt |
||
80 | restruc rb,rw,rd,rp,rq,rt |
||
2563 | hidnplayr | 81 | purge db,dw,du,dd,dp,dq,dt |
82 | purge rb,rw,rd,rp,rq,rt |
||
83 | purge union,struct |
||
84 | match name tail,fields@struct, \\{ if $ |
||
85 | display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah |
||
86 | err |
||
87 | end if \\} |
||
88 | match name=,fields,fields@struct \\{ fields@struct equ |
||
89 | make@struct name,fields |
||
90 | define fields@\\#name fields \\} |
||
91 | end virtual \} |
||
92 | match any, sub@struct \{ fields@struct equ fields@struct> \} |
||
1166 | hidnplayr | 93 | restore sub@struct } |
94 | |||
95 | |||
96 | { common |
||
97 | local define |
||
98 | define equ name |
||
99 | forward |
||
100 | local sub |
||
101 | match , field \{ make@substruct type,name,sub def |
||
102 | define equ define,.,sub, \} |
||
2563 | hidnplayr | 103 | match any, field \{ define equ define,.#field,type, |
1166 | hidnplayr | 104 | common |
105 | match fields, define \{ define@struct fields \} } |
||
106 | |||
107 | |||
108 | { common |
||
109 | virtual |
||
2563 | hidnplayr | 110 | db `name |
111 | load initial@struct byte from 0 |
||
112 | if initial@struct = '.' |
||
113 | display 'Error: name of structure should not begin with a dot.',0Dh,0Ah |
||
114 | err |
||
115 | end if |
||
116 | end virtual |
||
117 | local list |
||
1166 | hidnplayr | 118 | list equ |
119 | forward |
||
120 | if ~ field eq . |
||
121 | name#field type def |
||
122 | sizeof.#name#field = $ - name#field |
||
123 | else |
||
124 | label name#.#type |
||
2563 | hidnplayr | 125 | rb sizeof.#type |
1166 | hidnplayr | 126 | end if |
127 | local value |
||
128 | match any, list \{ list equ list, \} |
||
129 | list equ list |
||
130 | common |
||
131 | sizeof.#name = $ |
||
132 | restruc name |
||
133 | match values, list \{ |
||
134 | struc name value \\{ \\local \\..base |
||
2563 | hidnplayr | 135 | match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, |
1166 | hidnplayr | 136 | match , fields@struct \\\{ label \\..base |
2563 | hidnplayr | 137 | forward |
1166 | hidnplayr | 138 | match , value \\\\{ field type def \\\\} |
139 | match any, value \\\\{ field type value |
||
140 | if ~ field eq . |
||
2563 | hidnplayr | 141 | rb sizeof.#name#field - ($-field) |
142 | end if \\\\} |
||
143 | common label . at \\..base \\\} |
||
144 | \\} |
||
145 | macro name value \\{ |
||
146 | match any, fields@struct \\\{ \\\local anonymous |
||
147 | fields@struct equ fields@struct,anonymous,name, |
||
148 | match , fields@struct \\\{ |
||
149 | forward |
||
150 | match , value \\\\{ type def \\\\} |
||
151 | match any, value \\\\{ \\\\local ..field |
||
152 | ..field = $ |
||
153 | type value |
||
154 | if ~ field eq . |
||
155 | rb sizeof.#name#field - ($-..field) |
||
156 | end if \\\\} |
||
157 | common \\\} \\} \} } |
||
1166 | hidnplayr | 158 | |
159 | |||
160 | { macro make@substruct substruct,parent,name,[field,type,def] |
||
161 | \{ \common |
||
162 | \local define |
||
2563 | hidnplayr | 163 | define equ parent,name |
164 | \forward |
||
1166 | hidnplayr | 165 | \local sub |
2563 | hidnplayr | 166 | match , field \\{ match any, type \\\{ enable@substruct |
167 | make@substruct type,parent,sub def |
||
168 | purge make@substruct |
||
169 | define equ define,.,sub, \\\} \\} |
||
170 | match any, field \\{ define equ define,.\#field,type, |
||
171 | \common |
||
1166 | hidnplayr | 172 | match fields, define \\{ define@\#substruct fields \\} \} } |
2563 | hidnplayr | 173 | |
1166 | hidnplayr | 174 | |
175 | |||
176 | |||
177 | { common |
||
178 | virtual at parent#.#name |
||
2563 | hidnplayr | 179 | forward |
1166 | hidnplayr | 180 | if ~ field eq . |
181 | virtual at parent#.#name |
||
2563 | hidnplayr | 182 | parent#field type def |
1166 | hidnplayr | 183 | sizeof.#parent#field = $ - parent#field |
184 | end virtual |
||
185 | if sizeof.#parent#field > $ - parent#.#name |
||
2563 | hidnplayr | 186 | rb sizeof.#parent#field - ($ - parent#.#name) |
187 | end if |
||
1166 | hidnplayr | 188 | else |
2563 | hidnplayr | 189 | virtual at parent#.#name |
190 | label parent#.#type |
||
191 | type def |
||
192 | end virtual |
||
193 | label name#.#type at parent#.#name |
||
194 | if sizeof.#type > $ - parent#.#name |
||
195 | rb sizeof.#type - ($ - parent#.#name) |
||
196 | end if |
||
197 | end if |
||
1166 | hidnplayr | 198 | common |
199 | sizeof.#name = $ - parent#.#name |
||
2563 | hidnplayr | 200 | end virtual |
1166 | hidnplayr | 201 | struc name [value] \{ \common |
202 | label .\#name |
||
203 | last@union equ |
||
204 | forward |
||
205 | match any, last@union \\{ virtual at .\#name |
||
206 | field type def |
||
2563 | hidnplayr | 207 | end virtual \\} |
208 | match , last@union \\{ match , value \\\{ field type def \\\} |
||
1166 | hidnplayr | 209 | match any, value \\\{ field type value \\\} \\} |
2563 | hidnplayr | 210 | last@union equ field |
1166 | hidnplayr | 211 | common rb sizeof.#name - ($ - .\#name) \} |
2563 | hidnplayr | 212 | macro name [value] \{ \common \local ..anonymous |
213 | ..anonymous name value \} } |
||
214 | |||
1166 | hidnplayr | 215 | |
216 | { common |
||
217 | virtual at parent#.#name |
||
2563 | hidnplayr | 218 | forward |
1166 | hidnplayr | 219 | if ~ field eq . |
220 | parent#field type def |
||
221 | sizeof.#parent#field = $ - parent#field |
||
222 | else |
||
223 | label parent#.#type |
||
2563 | hidnplayr | 224 | rb sizeof.#type |
1166 | hidnplayr | 225 | end if |
226 | common |
||
227 | sizeof.#name = $ - parent#.#name |
||
2563 | hidnplayr | 228 | end virtual |
1166 | hidnplayr | 229 | struc name value \{ |
230 | label .\#name |
||
231 | forward |
||
232 | match , value \\{ field type def \\} |
||
233 | match any, value \\{ field type value |
||
234 | if ~ field eq . |
||
2563 | hidnplayr | 235 | rb sizeof.#parent#field - ($-field) |
236 | end if \\} |
||
237 | common \} |
||
238 | macro name value \{ \local ..anonymous |
||
239 | ..anonymous name \} } |
||
240 | > |