--- psiconv/trunk/lib/psiconv/parse_driver.c 1999/10/11 15:17:17 11 +++ psiconv/trunk/lib/psiconv/parse_driver.c 1999/10/11 16:15:14 12 @@ -54,6 +54,9 @@ else if ((*result)->type == psiconv_texted_file) res = psiconv_parse_texted_file(buf,lev+2,off, (psiconv_texted_f *)(&((*result)->file))); + else if ((*result)->type == psiconv_mbm_file) + res = psiconv_parse_mbm_file(buf,lev+2,off, + (psiconv_mbm_f *)(&((*result)->file))); else { psiconv_warn(lev+1,off,"Can't parse this file yet!"); (*result)->file = NULL; @@ -63,6 +66,40 @@ return res; } +int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, + psiconv_mbm_f *result) +{ + int res=0; + int i; + psiconv_mbm_jumptable_section table; + psiconv_paint_data_section paint; + psiconv_header_section header; + psiconv_u32 *entry; + + psiconv_progress(lev+1,off,"Going to read a mbm file"); + *result = malloc(sizeof(**result)); + + psiconv_progress(lev+2,off, "Going to read the header section"); + res |= psiconv_parse_header_section(buf,lev+2,off,NULL,&header); + + psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); + res |= psiconv_parse_mbm_jumptable_section(buf,lev+2, + header->section_table_offset, + NULL,&table); + + (*result)->sections = psiconv_list_new(sizeof(*paint)); + for (i = 0; i < psiconv_list_length(table); i ++) { + entry = psiconv_list_get(table,i); + psiconv_parse_paint_data_section(buf,lev+2,*entry,NULL,&paint); + psiconv_list_add(table,paint); + } + + psiconv_free_header_section(header); + psiconv_free_mbm_jumptable_section(table); + psiconv_progress(lev+1,off,"End of mbm file"); + return res; +} + int psiconv_parse_texted_file(const psiconv_buffer buf,int lev, psiconv_u32 off, psiconv_texted_f *result) {