/[public]/psiconv/trunk/lib/psiconv/parse_driver.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_driver.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 41 Revision 60
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
27int psiconv_verbosity = PSICONV_VERB_WARN;
26 28
27psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length, 29psiconv_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;
81} 83}
82 84
83int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, 85int 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{
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");
86 (*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");
87 return 0; 111 return res;
88} 112}
89 113
90int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, 114int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off,
91 psiconv_mbm_f *result) 115 psiconv_mbm_f *result)
92{ 116{
93 int res=0; 117 int res=0;
94 int i; 118 int i;
95 psiconv_mbm_jumptable_section table; 119 psiconv_jumptable_section table;
96 psiconv_paint_data_section paint; 120 psiconv_paint_data_section paint;
97 psiconv_u32 *entry; 121 psiconv_u32 *entry;
98 psiconv_u32 sto; 122 psiconv_u32 sto;
99 123
100 psiconv_progress(lev+1,off,"Going to read a mbm file"); 124 psiconv_progress(lev+1,off,"Going to read a mbm file");
103 psiconv_progress(lev+2,off,"Going to read the offset of the MBM jumptable"); 127 psiconv_progress(lev+2,off,"Going to read the offset of the MBM jumptable");
104 sto = psiconv_read_u32(buf,lev+2,off); 128 sto = psiconv_read_u32(buf,lev+2,off);
105 psiconv_debug(lev+2,off,"Offset: %08x",sto); 129 psiconv_debug(lev+2,off,"Offset: %08x",sto);
106 130
107 psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); 131 psiconv_progress(lev+2,off,"Going to read the MBM jumptable");
108 res |= psiconv_parse_mbm_jumptable_section(buf,lev+2,sto, NULL,&table); 132 res |= psiconv_parse_jumptable_section(buf,lev+2,sto, NULL,&table);
109 133
110 psiconv_progress(lev+2,off,"Going to read the picture sections"); 134 psiconv_progress(lev+2,off,"Going to read the picture sections");
111 (*result)->sections = psiconv_list_new(sizeof(*paint)); 135 (*result)->sections = psiconv_list_new(sizeof(*paint));
112 for (i = 0; i < psiconv_list_length(table); i ++) { 136 for (i = 0; i < psiconv_list_length(table); i ++) {
113 entry = psiconv_list_get(table,i); 137 entry = psiconv_list_get(table,i);
114 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);
115 psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,&paint); 139 psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,0,&paint);
116 psiconv_list_add((*result)->sections,paint); 140 psiconv_list_add((*result)->sections,paint);
117 } 141 }
118 142
119 psiconv_free_mbm_jumptable_section(table); 143 psiconv_free_jumptable_section(table);
120 psiconv_progress(lev+1,off,"End of mbm file"); 144 psiconv_progress(lev+1,off,"End of mbm file");
121 return res; 145 return res;
122} 146}
123 147
124int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev, 148int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev,

Legend:
Removed from v.41  
changed lines
  Added in v.60

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26