comparison src/shape_path.c @ 7:569f3168ba53

Clear background & tranform relative pos into absolute ones
author Thinker K.F. Li <thinker@branda.to>
date Sat, 26 Jul 2008 02:53:08 +0800
parents 772511b8b9be
children 94b4b5bd8810
comparison
equal deleted inserted replaced
6:772511b8b9be 7:569f3168ba53
176 } 176 }
177 177
178 static int sh_path_cmd_arg_fill(char *data, sh_path_t *path) { 178 static int sh_path_cmd_arg_fill(char *data, sh_path_t *path) {
179 char *p, *old; 179 char *p, *old;
180 char *cmds; 180 char *cmds;
181 char cmd;
181 co_aix *args; 182 co_aix *args;
182 183
183 cmds = path->user_data; 184 cmds = path->user_data;
184 args = (co_aix *)(cmds + path->cmd_len); 185 args = (co_aix *)(cmds + path->cmd_len);
185 p = data; 186 p = data;
186 while(*p) { 187 while(*p) {
187 SKIP_SPACE(p); 188 SKIP_SPACE(p);
188 189
189 /* TODO: transform all relative to absolute, */ 190 /* Transform all relative to absolute, */
190 *cmds++ = *p; 191 *cmds++ = toupper(*p);
191 switch(*p++) { 192 switch((cmd = *p++)) {
192 case 'c': 193 case 'c':
193 case 'C': 194 case 'C':
194 while(*p) { 195 while(*p) {
195 old = p; 196 old = p;
196 SKIP_SPACE(p); 197 SKIP_SPACE(p);
197 old = p; 198 old = p;
198 SKIP_NUM(p); 199 SKIP_NUM(p);
199 if(p == old) 200 if(p == old)
200 break; 201 break;
201 *args++ = atof(old); 202 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
202 203
203 SKIP_SPACE(p); 204 SKIP_SPACE(p);
204 old = p; 205 old = p;
205 SKIP_NUM(p); 206 SKIP_NUM(p);
206 if(p == old) 207 if(p == old)
207 return ERR; 208 return ERR;
208 *args++ = atof(old); 209 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
209 210
210 SKIP_SPACE(p); 211 SKIP_SPACE(p);
211 old = p; 212 old = p;
212 SKIP_NUM(p); 213 SKIP_NUM(p);
213 if(p == old) 214 if(p == old)
214 return ERR; 215 return ERR;
215 *args++ = atof(old); 216 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
216 217
217 SKIP_SPACE(p); 218 SKIP_SPACE(p);
218 old = p; 219 old = p;
219 SKIP_NUM(p); 220 SKIP_NUM(p);
220 if(p == old) 221 if(p == old)
221 return ERR; 222 return ERR;
222 *args++ = atof(old); 223 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
223 SKIP_SPACE(p); 224 SKIP_SPACE(p);
224 old = p; 225 old = p;
225 SKIP_NUM(p); 226 SKIP_NUM(p);
226 if(p == old) 227 if(p == old)
227 return ERR; 228 return ERR;
228 *args++ = atof(old); 229 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
229 230
230 SKIP_SPACE(p); 231 SKIP_SPACE(p);
231 old = p; 232 old = p;
232 SKIP_NUM(p); 233 SKIP_NUM(p);
233 if(p == old) 234 if(p == old)
234 return ERR; 235 return ERR;
235 *args++ = atof(old); 236 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
236 } 237 }
237 break; 238 break;
238 case 's': 239 case 's':
239 case 'S': 240 case 'S':
240 case 'q': 241 case 'q':
244 SKIP_SPACE(p); 245 SKIP_SPACE(p);
245 old = p; 246 old = p;
246 SKIP_NUM(p); 247 SKIP_NUM(p);
247 if(p == old) 248 if(p == old)
248 break; 249 break;
249 *args++ = atof(old); 250 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
250 251
251 SKIP_SPACE(p); 252 SKIP_SPACE(p);
252 old = p; 253 old = p;
253 SKIP_NUM(p); 254 SKIP_NUM(p);
254 if(p == old) 255 if(p == old)
255 return ERR; 256 return ERR;
256 *args++ = atof(old); 257 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
257 258
258 SKIP_SPACE(p); 259 SKIP_SPACE(p);
259 old = p; 260 old = p;
260 SKIP_NUM(p); 261 SKIP_NUM(p);
261 if(p == old) 262 if(p == old)
262 return ERR; 263 return ERR;
263 *args++ = atof(old); 264 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
264 265
265 SKIP_SPACE(p); 266 SKIP_SPACE(p);
266 old = p; 267 old = p;
267 SKIP_NUM(p); 268 SKIP_NUM(p);
268 if(p == old) 269 if(p == old)
269 return ERR; 270 return ERR;
270 *args++ = atof(old); 271 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
271 } 272 }
272 break; 273 break;
273 case 'm': 274 case 'm':
274 case 'M': 275 case 'M':
275 case 'l': 276 case 'l':
281 SKIP_SPACE(p); 282 SKIP_SPACE(p);
282 old = p; 283 old = p;
283 SKIP_NUM(p); 284 SKIP_NUM(p);
284 if(p == old) 285 if(p == old)
285 break; 286 break;
286 *args++ = atof(old); 287 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
287 288
288 SKIP_SPACE(p); 289 SKIP_SPACE(p);
289 old = p; 290 old = p;
290 SKIP_NUM(p); 291 SKIP_NUM(p);
291 if(p == old) 292 if(p == old)
292 return ERR; 293 return ERR;
293 *args++ = atof(old); 294 *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old);
294 } 295 }
295 break; 296 break;
296 case 'h': 297 case 'h':
297 case 'H': 298 case 'H':
298 case 'v': 299 case 'v':