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

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

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

Revision 184 Revision 217
1/* 1/*
2 parse_word.c - Part of psiconv, a PSION 5 file formats converter 2 parse_word.c - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl> 3 Copyright (c) 1999-2004 Frodo Looijaard <frodol@dds.nl>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
201 goto ERROR2_2; 201 goto ERROR2_2;
202 if ((res = psiconv_parse_character_layout_list(config,buf,lev+3,off+len,&leng, 202 if ((res = psiconv_parse_character_layout_list(config,buf,lev+3,off+len,&leng,
203 style->character))) 203 style->character)))
204 goto ERROR2_3; 204 goto ERROR2_3;
205 len += leng; 205 len += leng;
206 /* Ugly: I really don't know whether this is right for UTF8 */
206 psiconv_progress(config,lev+3,off+len,"Going to read the hotkey"); 207 psiconv_progress(config,lev+3,off+len,"Going to read the hotkey");
207 temp = psiconv_read_u32(config,buf,lev+3,off+len,&res); 208 style->hotkey = psiconv_unicode_read_char(config,buf,lev+3,off+len,NULL,&res);
209 psiconv_debug(config,lev+3,off+len,"Normal Hotkey value %08x",style->hotkey);
208 if (res) 210 if (res)
209 goto ERROR2_3; 211 goto ERROR2_3;
210 if (temp & 0xffffff00) { 212 len += 0x04;
211 psiconv_warn(config,lev+3,off+len,
212 "Normal style hotkey has unknown value (ignored)");
213 psiconv_debug(config,lev+3,off+len,"Hotkey value %08x",temp);
214 temp = 0;
215 }
216 style->hotkey = temp & 0x000000ff;
217 if ((style->hotkey >= 32) && (style->hotkey < 127))
218 psiconv_debug(config,lev+3,off+len,"Hotkey: %c",style->hotkey);
219 else if (style->hotkey == 0x00)
220 psiconv_debug(config,lev+3,off+len,"Hotkey: <none>");
221 else
222 psiconv_debug(config,lev+3,off+len,"Hotkey: %02x",style->hotkey);
223 (*result)->normal = style; 213 (*result)->normal = style;
224 len += 0x04;
225 214
226 psiconv_progress(config,lev+2,off+len,"Going to read hotkeys list"); 215 psiconv_progress(config,lev+2,off+len,"Going to read hotkeys list");
227 if (!((*result)->styles = psiconv_list_new(sizeof(*style)))) 216 if (!((*result)->styles = psiconv_list_new(sizeof(*style))))
228 goto ERROR3; 217 goto ERROR3;
229 if (!(style = malloc(sizeof(*style)))) { 218 if (!(style = malloc(sizeof(*style)))) {
235 if (res) 224 if (res)
236 goto ERROR3_2; 225 goto ERROR3_2;
237 len ++; 226 len ++;
238 psiconv_debug(config,lev+3,off+len,"Nummer of hotkeys: %02x",nr); 227 psiconv_debug(config,lev+3,off+len,"Nummer of hotkeys: %02x",nr);
239 for (i = 0; i < nr; i ++) { 228 for (i = 0; i < nr; i ++) {
240 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res); 229 /* Ugly: I really don't know whether this is right for UTF8 */
241 if (res) 230 style->hotkey = psiconv_unicode_read_char(config,buf,lev+3,off+len,
242 goto ERROR3_2; 231 NULL,&res);
243 if (temp & 0xffffff00) {
244 psiconv_warn(config,lev+3,off+len,"Style hotkey has unknown value (ignored)");
245 psiconv_debug(config,lev+3,off+len,"Hotkey %d value %08x",i,temp);
246 temp = 0;
247 }
248 style->hotkey = temp & 0x000000ff;
249 if ((style->hotkey >= 32) && (style->hotkey < 127))
250 psiconv_debug(config,lev+3,off+len,"Hotkey %d: %c",i,style->hotkey);
251 else if (style->hotkey == 0x00)
252 psiconv_debug(config,lev+3,off+len,"Hotkey %d: <none>",i);
253 else
254 psiconv_debug(config,lev+3,off+len,"Hotkey %d: %02x",i,style->hotkey); 232 psiconv_debug(config,lev+3,off+len,"Hotkey %d value %08x",i,style->hotkey);
233 len += 0x04;
255 if ((res = psiconv_list_add((*result)->styles,style))) 234 if ((res = psiconv_list_add((*result)->styles,style)))
256 goto ERROR3_2; 235 goto ERROR3_2;
257 len += 0x04;
258 } 236 }
259 free(style); 237 free(style);
260 238
261 psiconv_progress(config,lev+2,off+len,"Going to read all other styles"); 239 psiconv_progress(config,lev+2,off+len,"Going to read all other styles");
262 psiconv_progress(config,lev+2,off+len,"Going to read the number of styles"); 240 psiconv_progress(config,lev+2,off+len,"Going to read the number of styles");

Legend:
Removed from v.184  
changed lines
  Added in v.217

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