--- psiconv/trunk/lib/psiconv/parse_driver.c 1999/10/29 21:14:58 24 +++ psiconv/trunk/lib/psiconv/parse_driver.c 2000/12/13 16:30:21 63 @@ -1,6 +1,6 @@ /* parse_driver.c - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 1999 Frodo Looijaard + Copyright (c) 1999, 2000 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,6 +68,9 @@ else if ((*result)->type == psiconv_sketch_file) res = psiconv_parse_sketch_file(buf,lev+2,leng, (psiconv_sketch_f *)(&((*result)->file))); + else if ((*result)->type == psiconv_clipart_file) + res = psiconv_parse_clipart_file(buf,lev+2,leng, + (psiconv_clipart_f *)(&((*result)->file))); else { psiconv_warn(lev+1,off,"Can't parse this file yet!"); (*result)->file = NULL; @@ -77,12 +80,41 @@ return res; } +int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, + psiconv_u32 off, psiconv_clipart_f *result) +{ + int res=0; + int i; + psiconv_jumptable_section table; + psiconv_clipart_section clipart; + psiconv_u32 *entry; + + psiconv_progress(lev+1,off,"Going to read a clipart file"); + (*result) = malloc(sizeof(**result)); + + psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); + res |= psiconv_parse_jumptable_section(buf,lev+2,off, NULL,&table); + + psiconv_progress(lev+2,off,"Going to read the clipart sections"); + (*result)->sections = psiconv_list_new(sizeof(*clipart)); + for (i = 0; i < psiconv_list_length(table); i ++) { + entry = psiconv_list_get(table,i); + psiconv_progress(lev+3,off,"Going to read clipart section %i",i); + psiconv_parse_clipart_section(buf,lev+3,*entry,NULL,&clipart); + psiconv_list_add((*result)->sections,clipart); + } + + psiconv_free_jumptable_section(table); + psiconv_progress(lev+1,off,"End of clipart file"); + 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_jumptable_section table; psiconv_paint_data_section paint; psiconv_u32 *entry; psiconv_u32 sto; @@ -95,18 +127,18 @@ psiconv_debug(lev+2,off,"Offset: %08x",sto); psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); - res |= psiconv_parse_mbm_jumptable_section(buf,lev+2,sto, NULL,&table); + res |= psiconv_parse_jumptable_section(buf,lev+2,sto, NULL,&table); psiconv_progress(lev+2,off,"Going to read the picture sections"); (*result)->sections = psiconv_list_new(sizeof(*paint)); for (i = 0; i < psiconv_list_length(table); i ++) { entry = psiconv_list_get(table,i); psiconv_progress(lev+3,off,"Going to read picture section %i",i); - psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,&paint); + psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,0,&paint); psiconv_list_add((*result)->sections,paint); } - psiconv_free_mbm_jumptable_section(table); + psiconv_free_jumptable_section(table); psiconv_progress(lev+1,off,"End of mbm file"); return res; }