/[public]/psiconv/trunk/lib/psiconv/generate_driver.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/generate_driver.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 169 Revision 170
55 PSICONV_ID_TEXTED))) 55 PSICONV_ID_TEXTED)))
56 goto ERROR; 56 goto ERROR;
57 if ((res =psiconv_write_texted_file(config,*buf, 57 if ((res =psiconv_write_texted_file(config,*buf,
58 (psiconv_texted_f) (value->file)))) 58 (psiconv_texted_f) (value->file))))
59 goto ERROR; 59 goto ERROR;
60#if 0
61 } else if (value->type == psiconv_sketch_file) { 60 } else if (value->type == psiconv_sketch_file) {
61 if ((res = psiconv_write_header_section(config,*buf,PSICONV_ID_PSION5,
62 PSICONV_ID_DATA_FILE,
63 PSICONV_ID_SKETCH)))
64 goto ERROR;
62 if ((res =psiconv_write_sketch_file(config,*buf, 65 if ((res =psiconv_write_sketch_file(config,*buf,
63 (psiconv_sketch_f) (value->file)))) 66 (psiconv_sketch_f) (value->file))))
64 goto ERROR; 67 goto ERROR;
68#if 0
65 } else if (value->type == psiconv_mbm_file) { 69 } else if (value->type == psiconv_mbm_file) {
66 if ((res =psiconv_write_mbm_file(config,*buf, 70 if ((res =psiconv_write_mbm_file(config,*buf,
67 (psiconv_mbm_f) (value->file)))) 71 (psiconv_mbm_f) (value->file))))
68 goto ERROR; 72 goto ERROR;
69 } else if (value->type == psiconv_clipart_file) { 73 } else if (value->type == psiconv_clipart_file) {
269ERROR2: 273ERROR2:
270 psiconv_list_free(section_table); 274 psiconv_list_free(section_table);
271ERROR1: 275ERROR1:
272 return res; 276 return res;
273} 277}
278
279int psiconv_write_sketch_file(const psiconv_config config,
280 psiconv_buffer buf,psiconv_sketch_f value)
281{
282 int res;
283 psiconv_section_table_section section_table;
284 psiconv_section_table_entry entry;
285 psiconv_u32 section_table_id;
286
287 if (!value) {
288 psiconv_warn(config,0,0,"Null Sketch file");
289 return -PSICONV_E_GENERATE;
290 }
291
292 if (!(section_table = psiconv_list_new(sizeof(*entry)))) {
293 res = -PSICONV_E_NOMEM;
294 goto ERROR1;
295 }
296
297 if (!(entry = malloc(sizeof(*entry)))) {
298 res = -PSICONV_E_NOMEM;
299 goto ERROR2;
300 }
301
302 section_table_id = psiconv_buffer_unique_id();
303 if ((res = psiconv_write_offset(config,buf,section_table_id)))
304 goto ERROR3;
305
306 entry->id = PSICONV_ID_APPL_ID_SECTION;
307 entry->offset = psiconv_buffer_unique_id();
308 if ((res = psiconv_list_add(section_table,entry)))
309 goto ERROR3;
310 if ((res = psiconv_buffer_add_target(buf,entry->offset)))
311 goto ERROR3;
312 if ((res=psiconv_write_application_id_section(config,buf,
313 PSICONV_ID_SKETCH,"Paint.app")))
314 goto ERROR3;
315
316 entry->id = PSICONV_ID_SKETCH_SECTION;
317 entry->offset = psiconv_buffer_unique_id();
318 if ((res = psiconv_list_add(section_table,entry)))
319 goto ERROR3;
320 if ((res = psiconv_buffer_add_target(buf,entry->offset)))
321 goto ERROR3;
322 if ((res = psiconv_write_sketch_section(config,buf,value->sketch_sec)))
323 goto ERROR3;
324
325 if ((res = psiconv_buffer_add_target(buf,section_table_id)))
326 goto ERROR3;
327 res = psiconv_write_section_table_section(config,buf,section_table);
328
329ERROR3:
330 free(entry);
331ERROR2:
332 psiconv_list_free(section_table);
333ERROR1:
334 return res;
335}

Legend:
Removed from v.169  
changed lines
  Added in v.170

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26