… | |
… | |
52 | res = psiconv_parse_word_file(buf,lev+2,off, |
52 | res = psiconv_parse_word_file(buf,lev+2,off, |
53 | (psiconv_word_f *)(&((*result)->file))); |
53 | (psiconv_word_f *)(&((*result)->file))); |
54 | else if ((*result)->type == psiconv_texted_file) |
54 | else if ((*result)->type == psiconv_texted_file) |
55 | res = psiconv_parse_texted_file(buf,lev+2,off, |
55 | res = psiconv_parse_texted_file(buf,lev+2,off, |
56 | (psiconv_texted_f *)(&((*result)->file))); |
56 | (psiconv_texted_f *)(&((*result)->file))); |
|
|
57 | else if ((*result)->type == psiconv_mbm_file) |
|
|
58 | res = psiconv_parse_mbm_file(buf,lev+2,off, |
|
|
59 | (psiconv_mbm_f *)(&((*result)->file))); |
57 | else { |
60 | else { |
58 | psiconv_warn(lev+1,off,"Can't parse this file yet!"); |
61 | psiconv_warn(lev+1,off,"Can't parse this file yet!"); |
59 | (*result)->file = NULL; |
62 | (*result)->file = NULL; |
60 | } |
63 | } |
61 | res = -1; |
64 | res = -1; |
62 | |
65 | |
|
|
66 | return res; |
|
|
67 | } |
|
|
68 | |
|
|
69 | int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
|
|
70 | psiconv_mbm_f *result) |
|
|
71 | { |
|
|
72 | int res=0; |
|
|
73 | int i; |
|
|
74 | psiconv_mbm_jumptable_section table; |
|
|
75 | psiconv_paint_data_section paint; |
|
|
76 | psiconv_header_section header; |
|
|
77 | psiconv_u32 *entry; |
|
|
78 | |
|
|
79 | psiconv_progress(lev+1,off,"Going to read a mbm file"); |
|
|
80 | *result = malloc(sizeof(**result)); |
|
|
81 | |
|
|
82 | psiconv_progress(lev+2,off, "Going to read the header section"); |
|
|
83 | res |= psiconv_parse_header_section(buf,lev+2,off,NULL,&header); |
|
|
84 | |
|
|
85 | psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); |
|
|
86 | res |= psiconv_parse_mbm_jumptable_section(buf,lev+2, |
|
|
87 | header->section_table_offset, |
|
|
88 | NULL,&table); |
|
|
89 | |
|
|
90 | (*result)->sections = psiconv_list_new(sizeof(*paint)); |
|
|
91 | for (i = 0; i < psiconv_list_length(table); i ++) { |
|
|
92 | entry = psiconv_list_get(table,i); |
|
|
93 | psiconv_parse_paint_data_section(buf,lev+2,*entry,NULL,&paint); |
|
|
94 | psiconv_list_add(table,paint); |
|
|
95 | } |
|
|
96 | |
|
|
97 | psiconv_free_header_section(header); |
|
|
98 | psiconv_free_mbm_jumptable_section(table); |
|
|
99 | psiconv_progress(lev+1,off,"End of mbm file"); |
63 | return res; |
100 | return res; |
64 | } |
101 | } |
65 | |
102 | |
66 | int psiconv_parse_texted_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
103 | int psiconv_parse_texted_file(const psiconv_buffer buf,int lev, psiconv_u32 off, |
67 | psiconv_texted_f *result) |
104 | psiconv_texted_f *result) |