… | |
… | |
21 | #include <stdlib.h> |
21 | #include <stdlib.h> |
22 | |
22 | |
23 | #include "parse.h" |
23 | #include "parse.h" |
24 | #include "parse_routines.h" |
24 | #include "parse_routines.h" |
25 | #include "data.h" |
25 | #include "data.h" |
|
|
26 | |
|
|
27 | int psiconv_verbosity = PSICONV_VERB_WARN; |
26 | |
28 | |
27 | psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length, |
29 | psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length, |
28 | psiconv_header_section *result) |
30 | psiconv_header_section *result) |
29 | { |
31 | { |
30 | psiconv_header_section header; |
32 | psiconv_header_section header; |
… | |
… | |
82 | |
84 | |
83 | int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, |
85 | int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, |
84 | psiconv_u32 off, psiconv_clipart_f *result) |
86 | psiconv_u32 off, psiconv_clipart_f *result) |
85 | { |
87 | { |
86 | int res=0; |
88 | int res=0; |
|
|
89 | int i; |
|
|
90 | psiconv_jumptable_section table; |
|
|
91 | psiconv_clipart_section clipart; |
|
|
92 | psiconv_u32 *entry; |
|
|
93 | |
|
|
94 | psiconv_progress(lev+1,off,"Going to read a clipart file"); |
87 | (*result) = malloc(sizeof(**result)); |
95 | (*result) = malloc(sizeof(**result)); |
|
|
96 | |
|
|
97 | psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); |
|
|
98 | res |= psiconv_parse_jumptable_section(buf,lev+2,off, NULL,&table); |
|
|
99 | |
|
|
100 | psiconv_progress(lev+2,off,"Going to read the clipart sections"); |
|
|
101 | (*result)->sections = psiconv_list_new(sizeof(*clipart)); |
|
|
102 | for (i = 0; i < psiconv_list_length(table); i ++) { |
|
|
103 | entry = psiconv_list_get(table,i); |
|
|
104 | psiconv_progress(lev+3,off,"Going to read clipart section %i",i); |
|
|
105 | psiconv_parse_clipart_section(buf,lev+3,*entry,NULL,&clipart); |
|
|
106 | psiconv_list_add((*result)->sections,clipart); |
|
|
107 | } |
|
|
108 | |
|
|
109 | psiconv_free_jumptable_section(table); |
|
|
110 | psiconv_progress(lev+1,off,"End of clipart file"); |
88 | return 0; |
111 | return res; |
89 | } |
112 | } |
90 | |
113 | |
91 | int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
114 | int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
92 | psiconv_mbm_f *result) |
115 | psiconv_mbm_f *result) |
93 | { |
116 | { |
… | |
… | |
111 | psiconv_progress(lev+2,off,"Going to read the picture sections"); |
134 | psiconv_progress(lev+2,off,"Going to read the picture sections"); |
112 | (*result)->sections = psiconv_list_new(sizeof(*paint)); |
135 | (*result)->sections = psiconv_list_new(sizeof(*paint)); |
113 | for (i = 0; i < psiconv_list_length(table); i ++) { |
136 | for (i = 0; i < psiconv_list_length(table); i ++) { |
114 | entry = psiconv_list_get(table,i); |
137 | entry = psiconv_list_get(table,i); |
115 | psiconv_progress(lev+3,off,"Going to read picture section %i",i); |
138 | psiconv_progress(lev+3,off,"Going to read picture section %i",i); |
116 | psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,&paint); |
139 | psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,0,&paint); |
117 | psiconv_list_add((*result)->sections,paint); |
140 | psiconv_list_add((*result)->sections,paint); |
118 | } |
141 | } |
119 | |
142 | |
120 | psiconv_free_jumptable_section(table); |
143 | psiconv_free_jumptable_section(table); |
121 | psiconv_progress(lev+1,off,"End of mbm file"); |
144 | psiconv_progress(lev+1,off,"End of mbm file"); |