Mercurial > MadButterfly
annotate tools/mb_c_source.m4 @ 232:527894c2ad39
Add functions for collision test.
- mb_obj_pos_is_in() test if two coords and their descendants are overlaid.
- mb_objs_is_overlay() test if a point is covered by another mb_obj_t.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 21 Dec 2008 23:30:00 +0800 |
parents | a0a3196b1a05 |
children | 104d83378582 |
rev | line source |
---|---|
63 | 1 changequote(`[', `]')dnl |
2 include([foreach.m4])dnl | |
3 divert([-1]) | |
4 | |
64 | 5 define([UNQUOTE], [$*]) |
6 | |
7 define([QUOTE], [[[$*]]]) | |
63 | 8 |
64 | 9 define([COUNT],[ifelse([$*],[],0,[$#])]) |
63 | 10 |
64 | 11 define([IMPORT],[define([$1],[$2$1(]$[]@[)])]) |
63 | 12 |
64 | 13 define([D_COLOR_STOP],[ |
14 {$6,$2,$3,$4,$5}]) | |
63 | 15 |
16 define([D_ADD_LINEAR_PAINT],[dnl | |
64 | 17 ifelse(COUNT($6),0,,[dnl |
18 static const int n_$1_stops = COUNT($6); | |
19 static const grad_stop_t $1_stops[[]] = {UNQUOTE($6)}; | |
63 | 20 ])dnl |
21 ]) | |
22 | |
23 define([D_ADD_RADIAL_PAINT],[dnl | |
64 | 24 ifelse(COUNT($5),0,,[dnl |
25 static const int n_$1_stops = COUNT($5); | |
26 static const grad_stop_t $1_stops[[]] = {UNQUOTE($5)}; | |
63 | 27 ])dnl |
28 ]) | |
29 | |
30 define([DECLARE_VARS], [divert([-1]) | |
64 | 31 define([DIMPORT],[IMPORT(]QUOTE($[]1)[,[D_])]) |
32 DIMPORT([ADD_LINEAR_PAINT]) | |
33 DIMPORT([ADD_RADIAL_PAINT]) | |
34 DIMPORT([COLOR_STOP]) | |
78 | 35 define([REF_STOPS_RADIAL]) |
36 define([REF_STOPS_LINEAR]) | |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
69
diff
changeset
|
37 define([ADD_PATH]) |
64 | 38 define([ADD_RECT]) |
39 define([ADD_COORD]) | |
83 | 40 define([ADD_TEXT],) |
64 | 41 define([FILL_SHAPE]) |
42 define([STROKE_SHAPE]) | |
43 define([FILL_SHAPE_WITH_PAINT]) | |
44 define([STROKE_SHAPE_WITH_PAINT]) | |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
45 define([STROKE_WIDTH]) |
81 | 46 define([GROUP_HIDE],) |
47 define([RECT_HIDE],) | |
48 define([PATH_HIDE],) | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
49 define([COORD_TRANSLATE],) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
50 define([COORD_MATRIX],) |
100
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
51 define([SHAPE_TRANSLATE],) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
52 define([SHAPE_MATRIX],) |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
53 define([ADD_SYMBOL],) |
63 | 54 divert[]]) |
55 | |
56 define([S_ADD_LINEAR_PAINT],[ | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
57 obj->$1 = rdman_paint_linear_new(rdman, $2, $3, $4, $5); |
64 | 58 ifelse(COUNT($6),0,,[dnl |
59 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); | |
60 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); | |
61 paint_linear_stops(obj->$1, n_$1_stops, stops); | |
62 ])dnl | |
63 | 63 ]) |
64 | 64 |
63 | 65 define([S_ADD_RADIAL_PAINT],[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
66 obj->$1 = rdman_paint_radial_new(rdman, $2, $3, $4); |
64 | 67 ifelse(COUNT($5),0,,[ |
68 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); | |
69 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); | |
70 paint_radial_stops(obj->$1, n_$1_stops, stops); | |
71 ])dnl | |
63 | 72 ]) |
73 | |
64 | 74 define([S_COLOR_STOP],[]) |
78 | 75 |
76 define([S_REF_STOPS_RADIAL],[dnl | |
64 | 77 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops); |
78 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); | |
79 paint_radial_stops(obj->$1, n_$2_stops, stops); | |
80 ]]) | |
81 | |
78 | 82 define([S_REF_STOPS_LINEAR],[dnl |
83 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops); | |
84 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); | |
85 paint_linear_stops(obj->$1, n_$2_stops, stops); | |
86 ]]) | |
87 | |
64 | 88 define([S_ADD_RECT],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
89 obj->$1 = rdman_shape_rect_new(rdman, $2, $3, $4, $5, $6, $7); |
197
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
90 |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
91 rdman_add_shape(rdman, obj->$1, obj->$8); |
64 | 92 ]]) |
93 | |
94 define([S_ADD_PATH],[[ | |
197
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
95 { |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
96 char _cmds[] = "$3"; |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
97 float _args[] = {$4}; |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
98 int _fix_args[] = {$6}; |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
99 obj->$1 = rdman_shape_path_new_from_binary(rdman, _cmds,_args,$5,_fix_args,$7); |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
100 rdman_add_shape(rdman, obj->$1, obj->$2); |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
101 } |
64 | 102 ]]) |
103 | |
104 define([S_ADD_COORD],[[ | |
66
309f1eefbec0
create new coords from redraw_man
Thinker K.F. Li <thinker@branda.to>
parents:
64
diff
changeset
|
105 obj->$1 = rdman_coord_new(rdman, obj->$2); |
64 | 106 ]]) |
107 | |
83 | 108 define([S_ADD_TEXT],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
109 obj->$1 = rdman_shape_text_new(rdman, "$2", $3, $4, $5, |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
110 cairo_get_font_face(rdman->cr)); |
83 | 111 rdman_add_shape(rdman, obj->$1, obj->$6); |
112 ]]) | |
113 | |
64 | 114 define([S_FILL_SHAPE_WITH_PAINT],[dnl |
115 [ rdman_paint_fill(rdman, obj->$2, obj->$1); | |
116 ]]) | |
117 | |
118 define([S_STROKE_SHAPE_WITH_PAINT],[dnl | |
119 [ rdman_paint_stroke(rdman, obj->$2, obj->$1); | |
120 ]]) | |
121 | |
122 define([S_FILL_SHAPE],[dnl | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
123 [ obj->$1_fill = rdman_paint_color_new(rdman, $2, $3, $4, $5); |
64 | 124 rdman_paint_fill(rdman, obj->$1_fill, obj->$1); |
125 ]]) | |
126 | |
127 define([S_STROKE_SHAPE],[dnl | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
128 [ obj->$1_stroke = rdman_paint_color_new(rdman, $2, $3, $4, $5); |
64 | 129 rdman_paint_stroke(rdman, obj->$1_stroke, obj->$1); |
130 ]]) | |
131 | |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
132 define([S_STROKE_WIDTH],[dnl |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
133 [ obj->$1->stroke_width = $2; |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
134 ]]) |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
135 |
81 | 136 define([S_GROUP_HIDE],[dnl |
137 [ coord_hide(obj->$1); | |
138 ]]) | |
139 | |
140 define([S_RECT_HIDE],[dnl | |
141 [ sh_hide(obj->$1); | |
142 ]]) | |
143 | |
144 define([S_PATH_HIDE],[dnl | |
145 [ sh_hide(obj->$1); | |
146 ]]) | |
147 | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
148 define([S_COORD_TRANSLATE],[dnl |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
149 [ memset(obj->$1->matrix, 0, sizeof(obj->$1->matrix)); |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
150 obj->$1->matrix[0] = 1; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
151 obj->$1->matrix[2] = $2; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
152 obj->$1->matrix[4] = 1; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
153 obj->$1->matrix[5] = $3; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
154 rdman_coord_changed(rdman, obj->$1); |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
155 ]]) |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
156 |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
157 define([S_COORD_MATRIX],[dnl |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
158 [ obj->$1->matrix[0] = $2; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
159 obj->$1->matrix[3] = $3; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
160 obj->$1->matrix[1] = $4; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
161 obj->$1->matrix[4] = $5; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
162 obj->$1->matrix[2] = $6; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
163 obj->$1->matrix[5] = $7; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
164 rdman_coord_changed(rdman, obj->$1); |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
165 ]]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
166 |
100
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
167 define([S_SHAPE_TRANSLATE],[dnl |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
168 [ memset(obj->$1->matrix, 0, sizeof(obj->$1->matrix)); |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
169 obj->$1->matrix[0] = 1; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
170 obj->$1->matrix[2] = $2; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
171 obj->$1->matrix[4] = 1; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
172 obj->$1->matrix[5] = $3; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
173 rdman_coord_changed(rdman, obj->$1); |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
174 ]]) |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
175 |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
176 define([S_SHAPE_MATRIX],[dnl |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
177 [ obj->$1->matrix[0] = $2; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
178 obj->$1->matrix[3] = $3; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
179 obj->$1->matrix[1] = $4; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
180 obj->$1->matrix[4] = $5; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
181 obj->$1->matrix[2] = $6; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
182 obj->$1->matrix[5] = $7; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
183 rdman_coord_changed(rdman, obj->$1); |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
184 ]]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
185 |
63 | 186 define([SETUP_VARS],[divert([-1]) |
64 | 187 define([SIMPORT],[IMPORT(]QUOTE($[]1)[,[S_])]) |
188 SIMPORT([ADD_LINEAR_PAINT]) | |
189 SIMPORT([ADD_RADIAL_PAINT]) | |
190 SIMPORT([COLOR_STOP]) | |
78 | 191 SIMPORT([REF_STOPS_RADIAL]) |
192 SIMPORT([REF_STOPS_LINEAR]) | |
64 | 193 SIMPORT([ADD_PATH],) |
194 SIMPORT([ADD_RECT]) | |
195 SIMPORT([ADD_COORD]) | |
83 | 196 SIMPORT([ADD_TEXT]) |
64 | 197 SIMPORT([FILL_SHAPE]) |
198 SIMPORT([STROKE_SHAPE]) | |
199 SIMPORT([FILL_SHAPE_WITH_PAINT]) | |
200 SIMPORT([STROKE_SHAPE_WITH_PAINT]) | |
81 | 201 SIMPORT([STROKE_WIDTH]) |
202 SIMPORT([GROUP_HIDE]) | |
203 SIMPORT([RECT_HIDE]) | |
204 SIMPORT([PATH_HIDE]) | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
205 SIMPORT([COORD_TRANSLATE]) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
206 SIMPORT([COORD_MATRIX]) |
100
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
207 SIMPORT([SHAPE_TRANSLATE]) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
208 SIMPORT([SHAPE_MATRIX]) |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
209 define([ADD_SYMBOL],) |
63 | 210 divert[]]) |
211 | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
212 define([F_ADD_LINEAR_PAINT],[[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
213 stops = paint_linear_stops(obj->$1, 0, NULL); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
214 free(stops); |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
215 rdman_paint_free(rdman, obj->$1); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
216 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
217 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
218 define([F_ADD_RADIAL_PAINT],[[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
219 stops = paint_radial_stops(obj->$1, 0, NULL); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
220 free(stops); |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
221 rdman_paint_free(rdman, obj->$1); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
222 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
223 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
224 define([F_ADD_PATH],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
225 rdman_shape_free(rdman, obj->$1); |
83 | 226 ]]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
227 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
228 define([F_ADD_RECT],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
229 rdman_shape_free(rdman, obj->$1); |
83 | 230 ]]) |
231 | |
232 define([F_ADD_TEXT],[[ | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
233 rdman_shape_free(rdman, obj->$1); |
83 | 234 ]]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
235 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
236 define([F_FILL_SHAPE],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
237 rdman_paint_free(rdman, obj->$1_fill); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
238 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
239 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
240 define([F_STROKE_SHAPE],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
241 rdman_paint_free(rdman, obj->$1_stroke); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
242 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
243 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
244 define([CLEAR_VARS],[divert([-1]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
245 define([FIMPORT],[IMPORT(]QUOTE($[]1)[,[F_])]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
246 FIMPORT([ADD_LINEAR_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
247 FIMPORT([ADD_RADIAL_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
248 define([COLOR_STOP]) |
78 | 249 define([REF_STOPS_RADIAL]) |
250 define([REF_STOPS_LINEAR]) | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
251 FIMPORT([ADD_PATH],) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
252 FIMPORT([ADD_RECT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
253 define([ADD_COORD]) |
83 | 254 FIMPORT([ADD_TEXT]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
255 FIMPORT([FILL_SHAPE]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
256 FIMPORT([STROKE_SHAPE]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
257 define([FILL_SHAPE_WITH_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
258 define([STROKE_SHAPE_WITH_PAINT]) |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
259 define([STROKE_WIDTH]) |
81 | 260 define([GROUP_HIDE],) |
261 define([RECT_HIDE],) | |
262 define([PATH_HIDE],) | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
263 define([COORD_TRANSLATE],) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
264 define([COORD_MATRIX],) |
100
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
265 define([SHAPE_TRANSLATE],) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
266 define([SHAPE_MATRIX],) |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
267 define([ADD_SYMBOL],) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
268 divert[]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
269 |
154 | 270 define([REVERSE_VARS],[divert([-1]) |
271 define([__REV_VAR],[]) | |
272 define([PUSH_REV], [ | |
273 pushdef([__REV_VAR]) | |
274 define([__REV_VAR], ]QUOTE(QUOTE($[]1))[)]) | |
275 define([POP_ALL_REV], [dnl | |
276 ifelse(__REV_VAR, [], ,[UNQUOTE(__REV_VAR)[]dnl | |
277 popdef([__REV_VAR])[]POP_ALL_REV[]])]) | |
278 define([RIMPORT], [ | |
279 define(]QUOTE($[]1)[, | |
280 [PUSH_REV(]]QUOTE(QUOTE($[]1))[[(]QUOTE($[]@)[))]) | |
281 ]) | |
282 RIMPORT([ADD_LINEAR_PAINT]) | |
283 RIMPORT([ADD_RADIAL_PAINT]) | |
284 RIMPORT([COLOR_STOP]) | |
285 RIMPORT([REF_STOPS_RADIAL]) | |
286 RIMPORT([REF_STOPS_LINEAR]) | |
287 RIMPORT([ADD_PATH]) | |
288 RIMPORT([ADD_RECT]) | |
289 RIMPORT([ADD_COORD]) | |
290 RIMPORT([ADD_TEXT]) | |
291 RIMPORT([FILL_SHAPE]) | |
292 RIMPORT([STROKE_SHAPE]) | |
293 RIMPORT([FILL_SHAPE_WITH_PAINT]) | |
294 RIMPORT([STROKE_SHAPE_WITH_PAINT]) | |
295 RIMPORT([STROKE_WIDTH]) | |
296 RIMPORT([GROUP_HIDE]) | |
297 RIMPORT([RECT_HIDE]) | |
298 RIMPORT([PATH_HIDE]) | |
299 RIMPORT([COORD_TRANSLATE]) | |
300 RIMPORT([COORD_MATRIX]) | |
301 RIMPORT([SHAPE_TRANSLATE]) | |
302 RIMPORT([SHAPE_MATRIX]) | |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
303 define([ADD_SYMBOL],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
304 divert[]dnl |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
305 ]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
306 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
307 define([Y_ADD_SYMBOL],[[{"$1", MB_SPRITE_OFFSET($1)},]]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
308 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
309 define([DECLARE_SYMS], [divert([-1]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
310 define([YIMPORT],[IMPORT(]QUOTE($[]1)[,[Y_])]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
311 define([ADD_LINEAR_PAINT]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
312 define([ADD_RADIAL_PAINT]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
313 define([COLOR_STOP]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
314 define([REF_STOPS_RADIAL]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
315 define([REF_STOPS_LINEAR]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
316 define([ADD_PATH]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
317 define([ADD_RECT]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
318 define([ADD_COORD]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
319 define([ADD_TEXT],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
320 define([FILL_SHAPE]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
321 define([STROKE_SHAPE]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
322 define([FILL_SHAPE_WITH_PAINT]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
323 define([STROKE_SHAPE_WITH_PAINT]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
324 define([STROKE_WIDTH]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
325 define([GROUP_HIDE],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
326 define([RECT_HIDE],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
327 define([PATH_HIDE],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
328 define([COORD_TRANSLATE],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
329 define([COORD_MATRIX],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
330 define([SHAPE_TRANSLATE],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
331 define([SHAPE_MATRIX],) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
332 YIMPORT([ADD_SYMBOL]) |
154 | 333 divert[]dnl |
334 ]) | |
335 | |
63 | 336 define([MADBUTTERFLY],[dnl |
337 [#include <stdio.h> | |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
338 #include <stdlib.h> |
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
339 #include <string.h> |
186
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
340 #include <mb_types.h> |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
341 #include <mb_redraw_man.h> |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
342 #include <mb_shapes.h> |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
343 #include <mb_paint.h> |
63 | 344 #include "$1.h" |
345 | |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
346 #ifdef MB_SPRITE_OFFSET |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
347 #undef MB_SPRITE_OFFSET |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
348 #endif |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
349 #define MB_SPRITE_OFFSET(x) ((int)&((($1_t *)0)->x)) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
350 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
351 static |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
352 mb_sprite_lsym_entry_t $1_symbols[] = {]DECLARE_SYMS |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
353 $2[ |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
354 }; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
355 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
356 #ifndef MB_LSYM_GET_OBJ_WITH_NAME |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
357 #define MB_LSYM_GET_OBJ_WITH_NAME |
213
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
358 |
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
359 #define MB_SPRITE_OFF_2_PTR(x, off) (((void *)(x)) + (off)) |
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
360 |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
361 static |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
362 mb_obj_t *mb_lsym_get_obj_with_name(mb_sprite_lsym_t *lsym, const char *sym) { |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
363 int i; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
364 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
365 for(i = 0; i < lsym->num_entries; i++) { |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
366 if(strcmp(lsym->entries[i].sym, sym) != 0) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
367 continue; |
213
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
368 return *(mb_obj_t **)MB_SPRITE_OFF_2_PTR(lsym, |
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
369 lsym->entries[i].offset); |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
370 } |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
371 return NULL; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
372 } |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
373 #endif /* MB_LSYM_GET_OBJ_WITH_NAME */ |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
374 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
375 void $1_free($1_t *); |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
376 |
130
3a4d6179e6a9
change mb_c_source.m4 and mb_c_header.m4 to specify parent for SVG object
Thinker K.F. Li <thinker@branda.to>
parents:
113
diff
changeset
|
377 $1_t *$1_new(redraw_man_t *rdman, coord_t *parent_coord) { |
64 | 378 $1_t *obj; |
379 grad_stop_t *stops = NULL;]DECLARE_VARS | |
63 | 380 $2[]dnl |
381 [ | |
382 obj = ($1_t *)malloc(sizeof($1_t)); | |
383 if(obj == NULL) return NULL; | |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
384 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
385 obj->lsym.sprite.free = (void (*)(mb_sprite_t))$1_free; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
386 obj->lsym.sprite.get_obj_with_name = |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
387 (mb_obj_t *(*)(mb_sprite_t *, const char *))mb_lsym_get_obj_with_name; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
388 obj->lsym.num_entries = |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
389 sizeof($1_symbols) / sizeof(mb_sprite_lsym_entry_t); |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
390 obj->lsym.entries = $1_symbols; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
391 |
154 | 392 obj->rdman = rdman; |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
393 ]SETUP_VARS[ |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
394 obj->root_coord = rdman_coord_new(rdman, parent_coord);] |
63 | 395 $2 |
396 [ return obj; | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
397 } |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
398 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
399 void $1_free($1_t *obj) { |
68 | 400 grad_stop_t *stops = NULL; |
154 | 401 redraw_man_t *rdman; |
402 | |
403 rdman = obj->rdman; | |
404 ]REVERSE_VARS[]dnl | |
405 divert([-1])dnl | |
406 $2[]dnl | |
407 divert[]dnl | |
408 CLEAR_VARS[]dnl | |
409 POP_ALL_REV[ | |
410 rdman_coord_subtree_free(rdman, obj->root_coord); | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
411 free(obj); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
412 } |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
413 ]dnl |
63 | 414 ]) |
415 divert[]dnl |