Subversion Repositories Kolibri OS

Rev

Rev 31 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
 
2
3
 
4
 { fields@struct equ name
5
   match child parent, name \{ fields@struct equ child,fields@\#parent \}
6
   sub@struct equ
7
   struc db [val] \{ \common fields@struct equ fields@struct,.,db, \}
8
   struc dw [val] \{ \common fields@struct equ fields@struct,.,dw, \}
9
   struc du [val] \{ \common fields@struct equ fields@struct,.,du, \}
10
   struc dd [val] \{ \common fields@struct equ fields@struct,.,dd, \}
11
   struc dp [val] \{ \common fields@struct equ fields@struct,.,dp, \}
12
   struc dq [val] \{ \common fields@struct equ fields@struct,.,dq, \}
13
   struc dt [val] \{ \common fields@struct equ fields@struct,.,dt, \}
14
   struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
15
   struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
16
   struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
17
   struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
18
   struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
19
   struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
20
   macro db [val] \{ \common \local anonymous
21
		     fields@struct equ fields@struct,anonymous,db, \}
22
   macro dw [val] \{ \common \local anonymous
23
		     fields@struct equ fields@struct,anonymous,dw, \}
24
   macro du [val] \{ \common \local anonymous
25
		     fields@struct equ fields@struct,anonymous,du, \}
26
   macro dd [val] \{ \common \local anonymous
27
		     fields@struct equ fields@struct,anonymous,dd, \}
28
   macro dp [val] \{ \common \local anonymous
29
		     fields@struct equ fields@struct,anonymous,dp, \}
30
   macro dq [val] \{ \common \local anonymous
31
		     fields@struct equ fields@struct,anonymous,dq, \}
32
   macro dt [val] \{ \common \local anonymous
33
		     fields@struct equ fields@struct,anonymous,dt, \}
34
   macro rb count \{ \local anonymous
35
		     fields@struct equ fields@struct,anonymous,db,count dup (?) \}
36
   macro rw count \{ \local anonymous
37
		     fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
38
   macro rd count \{ \local anonymous
39
		     fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
40
   macro rp count \{ \local anonymous
41
		     fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
42
   macro rq count \{ \local anonymous
43
		     fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
44
   macro rt count \{ \local anonymous
45
		     fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
46
   macro union \{ fields@struct equ fields@struct,,union,<
47
		  sub@struct equ union \}
48
   macro struct \{ fields@struct equ fields@struct,,substruct,<
49
		  sub@struct equ substruct \}
50
   virtual at 0 }
51
52
 
53
 { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
54
			 restruc rb,rw,rd,rp,rq,rt
55
			 purge db,dw,du,dd,dp,dq,dt
56
			 purge rb,rw,rd,rp,rq,rt
57
			 purge union,struct
58
			 match name=,fields,fields@struct \\{ fields@struct equ
59
							      make@struct name,fields
60
							      fields@\\#name equ fields \\}
61
			 end virtual \}
62
   match any, sub@struct \{ fields@struct equ fields@struct> \}
63
   restore sub@struct }
64
65
 
66
 { common
67
    if $
68
     display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
69
     err
70
    end if
71
    local define
72
    define equ name
73
   forward
74
    local sub
75
    match , field \{ make@substruct type,name,sub def
76
		     define equ define,.,sub, \}
77
    match any, field \{ define equ define,.#field,type, \}
78
   common
79
    match fields, define \{ define@struct fields \} }
80
81
 
82
 { common
83
    local list
84
    list equ
85
   forward
86
    if ~ field eq .
87
     name#field type def
88
     sizeof.#name#field = $ - name#field
89
    else
90
     label name#.#type
91
     rb sizeof.#type
92
    end if
93
    local value
94
    match any, list \{ list equ list, \}
95
    list equ list 
96
   common
97
    sizeof.#name = $
98
    restruc name
99
    match values, list \{
100
    struc name value \\{
101
    match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\}
102
    match , fields@struct \\\{ label .
103
   forward
104
     match , value \\\\{ field type def \\\\}
105
     match any, value \\\\{ field type value
106
			   if ~ field eq .
107
			    rb sizeof.#name#field - ($-field)
108
			   end if \\\\}
109
   common \\\} \\} \} }
110
111
 
112
 { macro make@substruct substruct,parent,name,[field,type,def]
113
    \{ \common
114
	\local define
115
	define equ parent,name
116
       \forward
117
	\local sub
118
	match , field \\{ match any, type \\\{ enable@substruct
119
					       make@substruct type,name,sub def
120
					       purge make@substruct
121
					       define equ define,.,sub, \\\} \\}
122
	match any, field \\{ define equ define,.\#field,type, \\}
123
       \common
124
	match fields, define \\{ define@\#substruct fields \\} \} }
125
126
 
127
128
 
129
 { common
130
    virtual at parent#.#name
131
   forward
132
    if ~ field eq .
133
     virtual at parent#.#name
134
      parent#field type def
135
      sizeof.#parent#field = $ - parent#field
136
     end virtual
137
     if sizeof.#parent#field > $ - parent#.#name
138
      rb sizeof.#parent#field - ($ - parent#.#name)
139
     end if
140
    else
141
     label name#.#type at parent#.#name
142
     if sizeof.#type > $ - parent#.#name
143
      rb sizeof.#type - ($ - parent#.#name)
144
     end if
145
    end if
146
   common
147
    sizeof.#name = $ - parent#.#name
148
    end virtual
149
    struc name [value] \{ \common
150
    label .\#name
151
    last@union equ
152
   forward
153
    match any, last@union \\{ virtual at .\#name
154
			       field type def
155
			      end virtual \\}
156
    match , last@union \\{ match , value \\\{ field type def \\\}
157
			   match any, value \\\{ field type value \\\} \\}
158
    last@union equ field
159
   common rb sizeof.#name - ($ - .\#name) \} }
160
161
 
162
 { common
163
    virtual at parent#.#name
164
   forward
165
    if ~ field eq .
166
     parent#field type def
167
     sizeof.#parent#field = $ - parent#field
168
    else
169
     label name#.#type
170
     rb sizeof.#type
171
    end if
172
   common
173
    sizeof.#name = $ - parent#.#name
174
    end virtual
175
    struc name value \{
176
    label .\#name
177
   forward
178
     match , value \\{ field type def \\}
179
     match any, value \\{ field type value
180
			  if ~ field eq .
181
			   rb sizeof.#parent#field - ($-field)
182
			  end if \\}
183
   common \} }
184
>