comparison tools/mb_c_source.m4 @ 67:3f2872a1a2fe

clear objects in *_free() for generated code
author Thinker K.F. Li <thinker@branda.to>
date Wed, 13 Aug 2008 08:05:50 +0800
parents 309f1eefbec0
children 018546012798
comparison
equal deleted inserted replaced
66:309f1eefbec0 67:3f2872a1a2fe
112 SIMPORT([STROKE_SHAPE]) 112 SIMPORT([STROKE_SHAPE])
113 SIMPORT([FILL_SHAPE_WITH_PAINT]) 113 SIMPORT([FILL_SHAPE_WITH_PAINT])
114 SIMPORT([STROKE_SHAPE_WITH_PAINT]) 114 SIMPORT([STROKE_SHAPE_WITH_PAINT])
115 divert[]]) 115 divert[]])
116 116
117 define([F_ADD_LINEAR_PAINT],[[
118 stops = paint_linear_stops(obj->$1, 0, NULL);
119 free(stops);
120 obj->$1->free(obj->$1);
121 ]])
122
123 define([F_ADD_RADIAL_PAINT],[[
124 stops = paint_radial_stops(obj->$1, 0, NULL);
125 free(stops);
126 obj->$1->free(obj->$1);
127 ]])
128
129 define([F_ADD_PATH],[[
130 sh_path_free(obj->$1);
131 ]]);
132
133 define([F_ADD_RECT],[[
134 sh_rect_free(obj->$1);
135 ]]);
136
137 define([F_FILL_SHAPE],[[
138 obj->$1->free(obj->$1);
139 ]])
140
141 define([F_STROKE_SHAPE],[[
142 obj->$1->free(obj->$1);
143 ]])
144
145 define([CLEAR_VARS],[divert([-1])
146 define([FIMPORT],[IMPORT(]QUOTE($[]1)[,[F_])])
147 FIMPORT([ADD_LINEAR_PAINT])
148 FIMPORT([ADD_RADIAL_PAINT])
149 define([COLOR_STOP])
150 define([REF_STOPS])
151 FIMPORT([ADD_PATH],)
152 FIMPORT([ADD_RECT])
153 define([ADD_COORD])
154 FIMPORT([FILL_SHAPE])
155 FIMPORT([STROKE_SHAPE])
156 define([FILL_SHAPE_WITH_PAINT])
157 define([STROKE_SHAPE_WITH_PAINT])
158 divert[]])
159
117 define([MADBUTTERFLY],[dnl 160 define([MADBUTTERFLY],[dnl
118 [#include <stdio.h> 161 [#include <stdio.h>
119 #include "mb_types.h" 162 #include "mb_types.h"
120 #include "redraw_man.h" 163 #include "redraw_man.h"
121 #include "shapes.h" 164 #include "shapes.h"
131 if(obj == NULL) return NULL; 174 if(obj == NULL) return NULL;
132 ]SETUP_VARS 175 ]SETUP_VARS
133 obj->root_coord = rdman->root_coord; 176 obj->root_coord = rdman->root_coord;
134 $2 177 $2
135 [ return obj; 178 [ return obj;
136 }] 179 }
180
181 void $1_free($1_t *obj) {
182 grad_stop_t *stops;
183 ]CLEAR_VARS[]$2[
184 free(obj);
185 }
186 ]dnl
137 ]) 187 ])
138 divert[]dnl 188 divert[]dnl