annotate tools/mb_c_source.m4 @ 83:ea758bb3bbe2

example
author Thinker K.F. Li <thinker@branda.to>
date Fri, 22 Aug 2008 00:12:04 +0800
parents 13fdf205047b
children 42698de1f653
rev   line source
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 changequote(`[', `]')dnl
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 include([foreach.m4])dnl
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 divert([-1])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
5 define([UNQUOTE], [$*])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
6
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
7 define([QUOTE], [[[$*]]])
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
9 define([COUNT],[ifelse([$*],[],0,[$#])])
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
11 define([IMPORT],[define([$1],[$2$1(]$[]@[)])])
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
13 define([D_COLOR_STOP],[
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
14 {$6,$2,$3,$4,$5}])
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 define([D_ADD_LINEAR_PAINT],[dnl
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
17 ifelse(COUNT($6),0,,[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
18 static const int n_$1_stops = COUNT($6);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
19 static const grad_stop_t $1_stops[[]] = {UNQUOTE($6)};
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 ])dnl
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 ])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 define([D_ADD_RADIAL_PAINT],[dnl
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
24 ifelse(COUNT($5),0,,[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
25 static const int n_$1_stops = COUNT($5);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
26 static const grad_stop_t $1_stops[[]] = {UNQUOTE($5)};
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 ])dnl
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 ])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 define([DECLARE_VARS], [divert([-1])
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
31 define([DIMPORT],[IMPORT(]QUOTE($[]1)[,[D_])])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
32 DIMPORT([ADD_LINEAR_PAINT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
33 DIMPORT([ADD_RADIAL_PAINT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
34 DIMPORT([COLOR_STOP])
78
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
35 define([REF_STOPS_RADIAL])
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
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
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
38 define([ADD_RECT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
39 define([ADD_COORD])
83
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
40 define([ADD_TEXT],)
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
41 define([FILL_SHAPE])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
42 define([STROKE_SHAPE])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
43 define([FILL_SHAPE_WITH_PAINT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
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
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
46 define([GROUP_HIDE],)
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
47 define([RECT_HIDE],)
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
48 define([PATH_HIDE],)
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 divert[]])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51 define([S_ADD_LINEAR_PAINT],[
69
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
52 obj->$1 = paint_linear_new(rdman, $2, $3, $4, $5);
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
53 ifelse(COUNT($6),0,,[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
54 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
55 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
56 paint_linear_stops(obj->$1, n_$1_stops, stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
57 ])dnl
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 ])
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
59
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
60 define([S_ADD_RADIAL_PAINT],[
69
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
61 obj->$1 = paint_radial_new(rdman, $2, $3, $4);
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
62 ifelse(COUNT($5),0,,[
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
63 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
64 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
65 paint_radial_stops(obj->$1, n_$1_stops, stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
66 ])dnl
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
67 ])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
68
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
69 define([S_COLOR_STOP],[])
78
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
70
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
71 define([S_REF_STOPS_RADIAL],[dnl
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
72 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
73 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
74 paint_radial_stops(obj->$1, n_$2_stops, stops);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
75 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
76
78
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
77 define([S_REF_STOPS_LINEAR],[dnl
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
78 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops);
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
79 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops);
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
80 paint_linear_stops(obj->$1, n_$2_stops, stops);
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
81 ]])
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
82
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
83 define([S_ADD_RECT],[[
80
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
84 obj->$1 = sh_rect_new($2, $3, $4, $5, $6, $7);
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
85 rdman_add_shape(rdman, obj->$1, obj->$8);
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
86 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
87
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
88 define([S_ADD_PATH],[[
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
89 obj->$1 = sh_path_new("$2");
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
90 rdman_add_shape(rdman, obj->$1, obj->$3);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
91 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
92
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
93 define([S_ADD_COORD],[[
66
309f1eefbec0 create new coords from redraw_man
Thinker K.F. Li <thinker@branda.to>
parents: 64
diff changeset
94 obj->$1 = rdman_coord_new(rdman, obj->$2);
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
95 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
96
83
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
97 define([S_ADD_TEXT],[[
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
98 obj->$1 = sh_text_new("$2", $3, $4, $5, cairo_get_font_face(rdman->cr));
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
99 rdman_add_shape(rdman, obj->$1, obj->$6);
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
100 ]])
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
101
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
102 define([S_FILL_SHAPE_WITH_PAINT],[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
103 [ rdman_paint_fill(rdman, obj->$2, obj->$1);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
104 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
105
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
106 define([S_STROKE_SHAPE_WITH_PAINT],[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
107 [ rdman_paint_stroke(rdman, obj->$2, obj->$1);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
108 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
109
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
110 define([S_FILL_SHAPE],[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
111 [ obj->$1_fill = paint_color_new(rdman, $2, $3, $4, $5);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
112 rdman_paint_fill(rdman, obj->$1_fill, obj->$1);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
113 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
114
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
115 define([S_STROKE_SHAPE],[dnl
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
116 [ obj->$1_stroke = paint_color_new(rdman, $2, $3, $4, $5);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
117 rdman_paint_stroke(rdman, obj->$1_stroke, obj->$1);
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
118 ]])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
119
80
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
120 define([S_STROKE_WIDTH],[dnl
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
121 [ obj->$1->stroke_width = $2;
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
122 ]])
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
123
81
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
124 define([S_GROUP_HIDE],[dnl
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
125 [ coord_hide(obj->$1);
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
126 ]])
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
127
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
128 define([S_RECT_HIDE],[dnl
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
129 [ sh_hide(obj->$1);
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
130 ]])
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
131
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
132 define([S_PATH_HIDE],[dnl
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
133 [ sh_hide(obj->$1);
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
134 ]])
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
135
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
136 define([SETUP_VARS],[divert([-1])
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
137 define([SIMPORT],[IMPORT(]QUOTE($[]1)[,[S_])])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
138 SIMPORT([ADD_LINEAR_PAINT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
139 SIMPORT([ADD_RADIAL_PAINT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
140 SIMPORT([COLOR_STOP])
78
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
141 SIMPORT([REF_STOPS_RADIAL])
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
142 SIMPORT([REF_STOPS_LINEAR])
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
143 SIMPORT([ADD_PATH],)
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
144 SIMPORT([ADD_RECT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
145 SIMPORT([ADD_COORD])
83
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
146 SIMPORT([ADD_TEXT])
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
147 SIMPORT([FILL_SHAPE])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
148 SIMPORT([STROKE_SHAPE])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
149 SIMPORT([FILL_SHAPE_WITH_PAINT])
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
150 SIMPORT([STROKE_SHAPE_WITH_PAINT])
81
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
151 SIMPORT([STROKE_WIDTH])
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
152 SIMPORT([GROUP_HIDE])
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
153 SIMPORT([RECT_HIDE])
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
154 SIMPORT([PATH_HIDE])
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
155 divert[]])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
156
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
157 define([F_ADD_LINEAR_PAINT],[[
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
158 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
159 free(stops);
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
160 obj->$1->free(obj->$1);
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
161 ]])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
162
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
163 define([F_ADD_RADIAL_PAINT],[[
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
164 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
165 free(stops);
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
166 obj->$1->free(obj->$1);
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
167 ]])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
168
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
169 define([F_ADD_PATH],[[
73
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 69
diff changeset
170 obj->$1->free(obj->$1);
83
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
171 ]])
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
172
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
173 define([F_ADD_RECT],[[
73
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 69
diff changeset
174 obj->$1->free(obj->$1);
83
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
175 ]])
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
176
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
177 define([F_ADD_TEXT],[[
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
178 obj->$1->free(obj->$1);
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
179 ]])
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
180
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
181 define([F_FILL_SHAPE],[[
69
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
182 obj->$1_fill->free(obj->$1_fill);
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
183 ]])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
184
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
185 define([F_STROKE_SHAPE],[[
69
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
186 obj->$1_stroke->free(obj->$1_stroke);
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
187 ]])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
188
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
189 define([CLEAR_VARS],[divert([-1])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
190 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
191 FIMPORT([ADD_LINEAR_PAINT])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
192 FIMPORT([ADD_RADIAL_PAINT])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
193 define([COLOR_STOP])
78
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
194 define([REF_STOPS_RADIAL])
3645e29e4986 Add runtime for Xlib.
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
195 define([REF_STOPS_LINEAR])
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
196 FIMPORT([ADD_PATH],)
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
197 FIMPORT([ADD_RECT])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
198 define([ADD_COORD])
83
ea758bb3bbe2 example
Thinker K.F. Li <thinker@branda.to>
parents: 81
diff changeset
199 FIMPORT([ADD_TEXT])
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
200 FIMPORT([FILL_SHAPE])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
201 FIMPORT([STROKE_SHAPE])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
202 define([FILL_SHAPE_WITH_PAINT])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
203 define([STROKE_SHAPE_WITH_PAINT])
80
e548221c04eb svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents: 78
diff changeset
204 define([STROKE_WIDTH])
81
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
205 define([GROUP_HIDE],)
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
206 define([RECT_HIDE],)
13fdf205047b Hide shapes and groups
Thinker K.F. Li <thinker@branda.to>
parents: 80
diff changeset
207 define([PATH_HIDE],)
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
208 divert[]])
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
209
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
210 define([MADBUTTERFLY],[dnl
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
211 [#include <stdio.h>
69
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
212 #include <stdlib.h>
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
213 #include <string.h>
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
214 #include "mb_types.h"
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
215 #include "redraw_man.h"
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
216 #include "shapes.h"
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
217 #include "paint.h"
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
218 #include "$1.h"
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
219
69
a6150b4e0667 Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents: 68
diff changeset
220 $1_t *$1_new(redraw_man_t *rdman) {
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
221 $1_t *obj;
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
222 grad_stop_t *stops = NULL;]DECLARE_VARS
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
223 $2[]dnl
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
224 [
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
225 obj = ($1_t *)malloc(sizeof($1_t));
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
226 if(obj == NULL) return NULL;
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
227 ]SETUP_VARS
64
c668c5c3ceae M4 macro for C binding.
Thinker K.F. Li <thinker@branda.to>
parents: 63
diff changeset
228 obj->root_coord = rdman->root_coord;
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
229 $2
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
230 [ return obj;
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
231 }
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
232
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
233 void $1_free($1_t *obj) {
68
Thinker K.F. Li <thinker@branda.to>
parents: 67
diff changeset
234 grad_stop_t *stops = NULL;
67
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
235 ]CLEAR_VARS[]$2[
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
236 free(obj);
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
237 }
3f2872a1a2fe clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents: 66
diff changeset
238 ]dnl
63
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
239 ])
f4b792afa74e m4 translator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
240 divert[]dnl