… | |
… | |
66 | res = psiconv_parse_mbm_file(buf,lev+2,leng, |
66 | res = psiconv_parse_mbm_file(buf,lev+2,leng, |
67 | (psiconv_mbm_f *)(&((*result)->file))); |
67 | (psiconv_mbm_f *)(&((*result)->file))); |
68 | else if ((*result)->type == psiconv_sketch_file) |
68 | else if ((*result)->type == psiconv_sketch_file) |
69 | res = psiconv_parse_sketch_file(buf,lev+2,leng, |
69 | res = psiconv_parse_sketch_file(buf,lev+2,leng, |
70 | (psiconv_sketch_f *)(&((*result)->file))); |
70 | (psiconv_sketch_f *)(&((*result)->file))); |
|
|
71 | else if ((*result)->type == psiconv_clipart_file) |
|
|
72 | res = psiconv_parse_clipart_file(buf,lev+2,leng, |
|
|
73 | (psiconv_clipart_f *)(&((*result)->file))); |
71 | else { |
74 | else { |
72 | psiconv_warn(lev+1,off,"Can't parse this file yet!"); |
75 | psiconv_warn(lev+1,off,"Can't parse this file yet!"); |
73 | (*result)->file = NULL; |
76 | (*result)->file = NULL; |
74 | } |
77 | } |
75 | res = -1; |
78 | res = -1; |
76 | |
79 | |
77 | return res; |
80 | return res; |
78 | } |
81 | } |
79 | |
82 | |
|
|
83 | int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, |
|
|
84 | psiconv_u32 off, psiconv_clipart_f *result) |
|
|
85 | { |
|
|
86 | int res=0; |
|
|
87 | (*result) = malloc(sizeof(**result)); |
|
|
88 | return 0; |
|
|
89 | } |
|
|
90 | |
80 | int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
91 | int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
81 | psiconv_mbm_f *result) |
92 | psiconv_mbm_f *result) |
82 | { |
93 | { |
83 | int res=0; |
94 | int res=0; |
84 | int i; |
95 | int i; |
85 | psiconv_mbm_jumptable_section table; |
96 | psiconv_jumptable_section table; |
86 | psiconv_paint_data_section paint; |
97 | psiconv_paint_data_section paint; |
87 | psiconv_u32 *entry; |
98 | psiconv_u32 *entry; |
88 | psiconv_u32 sto; |
99 | psiconv_u32 sto; |
89 | |
100 | |
90 | psiconv_progress(lev+1,off,"Going to read a mbm file"); |
101 | psiconv_progress(lev+1,off,"Going to read a mbm file"); |
… | |
… | |
93 | psiconv_progress(lev+2,off,"Going to read the offset of the MBM jumptable"); |
104 | psiconv_progress(lev+2,off,"Going to read the offset of the MBM jumptable"); |
94 | sto = psiconv_read_u32(buf,lev+2,off); |
105 | sto = psiconv_read_u32(buf,lev+2,off); |
95 | psiconv_debug(lev+2,off,"Offset: %08x",sto); |
106 | psiconv_debug(lev+2,off,"Offset: %08x",sto); |
96 | |
107 | |
97 | psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); |
108 | psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); |
98 | res |= psiconv_parse_mbm_jumptable_section(buf,lev+2,sto, NULL,&table); |
109 | res |= psiconv_parse_jumptable_section(buf,lev+2,sto, NULL,&table); |
99 | |
110 | |
100 | psiconv_progress(lev+2,off,"Going to read the picture sections"); |
111 | psiconv_progress(lev+2,off,"Going to read the picture sections"); |
101 | (*result)->sections = psiconv_list_new(sizeof(*paint)); |
112 | (*result)->sections = psiconv_list_new(sizeof(*paint)); |
102 | for (i = 0; i < psiconv_list_length(table); i ++) { |
113 | for (i = 0; i < psiconv_list_length(table); i ++) { |
103 | entry = psiconv_list_get(table,i); |
114 | entry = psiconv_list_get(table,i); |
104 | psiconv_progress(lev+3,off,"Going to read picture section %i",i); |
115 | psiconv_progress(lev+3,off,"Going to read picture section %i",i); |
105 | psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,&paint); |
116 | psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,&paint); |
106 | psiconv_list_add((*result)->sections,paint); |
117 | psiconv_list_add((*result)->sections,paint); |
107 | } |
118 | } |
108 | |
119 | |
109 | psiconv_free_mbm_jumptable_section(table); |
120 | psiconv_free_jumptable_section(table); |
110 | psiconv_progress(lev+1,off,"End of mbm file"); |
121 | psiconv_progress(lev+1,off,"End of mbm file"); |
111 | return res; |
122 | return res; |
112 | } |
123 | } |
113 | |
124 | |
114 | int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev, |
125 | int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev, |