/[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 73 Revision 76
26#include "generate_routines.h" 26#include "generate_routines.h"
27 27
28 28
29int psiconv_write(psiconv_buffer *buf,const psiconv_file value) 29int psiconv_write(psiconv_buffer *buf,const psiconv_file value)
30{ 30{
31 int allocated = 0;
32 int res; 31 int res;
33 32
34 if (!value) { 33 if (!value) {
35 psiconv_warn(0,0,"Can't parse to an empty buffer!"); 34 psiconv_warn(0,0,"Can't parse to an empty buffer!");
36 return -PSICONV_E_OTHER; 35 return -PSICONV_E_OTHER;
37 } 36 }
38 if (!*buf) {
39 if (!(*buf = psiconv_new_buffer())) 37 if (!(*buf = psiconv_new_buffer()))
40 return -PSICONV_E_NOMEM; 38 return -PSICONV_E_NOMEM;
41 allocated = 1;
42 }
43 39
44#if 0 40#if 0
45 if (value->type == psiconv_word_file) { 41 if (value->type == psiconv_word_file) {
46 if ((res =psiconv_write_word_file(*buf,(psiconv_word_f) (value->file)))) 42 if ((res =psiconv_write_word_file(*buf,(psiconv_word_f) (value->file))))
47 goto ERROR; 43 goto ERROR;
71 goto ERROR; 67 goto ERROR;
72 } 68 }
73 return -PSICONV_E_OK; 69 return -PSICONV_E_OK;
74 70
75ERROR: 71ERROR:
76 if (allocated)
77 psiconv_free_buffer(*buf); 72 psiconv_free_buffer(*buf);
78 return res; 73 return res;
79} 74}
80 75
81int psiconv_write_texted_file(psiconv_buffer buf,psiconv_texted_f value) 76int psiconv_write_texted_file(psiconv_buffer buf,psiconv_texted_f value)
82{ 77{
122 goto ERROR6; 117 goto ERROR6;
123 118
124 119
125 entry->id = PSICONV_ID_APPL_ID_SECTION; 120 entry->id = PSICONV_ID_APPL_ID_SECTION;
126 entry->offset = psiconv_list_length(extra_buf) + 0x14; 121 entry->offset = psiconv_list_length(extra_buf) + 0x14;
127 if ((res = psiconv_list_add(section_table,&entry))) 122 if ((res = psiconv_list_add(section_table,entry)))
128 goto ERROR6; 123 goto ERROR6;
129 if ((res=psiconv_write_application_id_section(extra_buf, 124 if ((res=psiconv_write_application_id_section(extra_buf,
130 PSICONV_ID_TEXTED,"TextEd.app"))) 125 PSICONV_ID_TEXTED,"TextEd.app")))
131 goto ERROR6; 126 goto ERROR6;
132 127
133 entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION; 128 entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION;
134 entry->offset = psiconv_list_length(extra_buf) + 0x14; 129 entry->offset = psiconv_list_length(extra_buf) + 0x14;
135 if ((res = psiconv_list_add(section_table,&entry))) 130 if ((res = psiconv_list_add(section_table,entry)))
136 goto ERROR6; 131 goto ERROR6;
137 if ((res = psiconv_write_page_layout_section(extra_buf,value->page_sec))) 132 if ((res = psiconv_write_page_layout_section(extra_buf,value->page_sec)))
138 goto ERROR6; 133 goto ERROR6;
139 134
140 entry->id = PSICONV_ID_TEXTED; 135 entry->id = PSICONV_ID_TEXTED;
141 entry->offset = psiconv_list_length(extra_buf) + 0x14; 136 entry->offset = psiconv_list_length(extra_buf) + 0x14;
142 if ((res = psiconv_list_add(section_table,&entry))) 137 if ((res = psiconv_list_add(section_table,entry)))
143 goto ERROR6; 138 goto ERROR6;
144 if ((res = psiconv_write_texted_section(extra_buf,value->texted_sec, 139 if ((res = psiconv_write_texted_section(extra_buf,value->texted_sec,
145 base_char,base_para))) 140 base_char,base_para)))
146 goto ERROR6; 141 goto ERROR6;
147 142

Legend:
Removed from v.73  
changed lines
  Added in v.76

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