/[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 64 Revision 82
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/ 18*/
19 19
20#include "config.h" 20#include "config.h"
21#include "compat.h"
22
21#include <stdlib.h> 23#include <stdlib.h>
24
22#include "parse_routines.h" 25#include "parse_routines.h"
26#include "error.h"
23 27
24int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev, 28int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev,
25 psiconv_u32 off, int *length, 29 psiconv_u32 off, int *length,
26 psiconv_word_status_section *result) 30 psiconv_word_status_section *result)
27{ 31{
133 psiconv_debug(lev+2,off+len,"Cursor position: %08x", 137 psiconv_debug(lev+2,off+len,"Cursor position: %08x",
134 (*result)->cursor_position); 138 (*result)->cursor_position);
135 len += 0x04; 139 len += 0x04;
136 140
137 psiconv_progress(lev+2,off+len,"Going to read display size"); 141 psiconv_progress(lev+2,off+len,"Going to read display size");
138 (*result)->cursor_position = psiconv_read_u32(buf,lev+2,off + len,&res); 142 (*result)->display_size = psiconv_read_u32(buf,lev+2,off + len,&res);
139 if (res) 143 if (res)
140 goto ERROR2; 144 goto ERROR2;
141 psiconv_debug(lev+2,off+len,"Display size: %08x", 145 psiconv_debug(lev+2,off+len,"Display size: %08x",
142 (*result)->cursor_position); 146 (*result)->display_size);
143 len += 0x04; 147 len += 0x04;
144 148
145 if (length) 149 if (length)
146 *length = len; 150 *length = len;
147 151
304 if (res) 308 if (res)
305 goto ERROR6; 309 goto ERROR6;
306 psiconv_debug(lev+3,off+len,"Outline Level: %08x", style->outline_level); 310 psiconv_debug(lev+3,off+len,"Outline Level: %08x", style->outline_level);
307 len += 4; 311 len += 4;
308 psiconv_progress(lev+3,off+len,"Going to read the character codes"); 312 psiconv_progress(lev+3,off+len,"Going to read the character codes");
309 if (!(style->character = psiconv_basic_character_layout())) 313 if (!(style->character = psiconv_clone_character_layout((*result)->normal->character)))
310 goto ERROR6; 314 goto ERROR6;
311 if ((res = psiconv_parse_character_layout_list(buf,lev+3,off+len,&leng, 315 if ((res = psiconv_parse_character_layout_list(buf,lev+3,off+len,&leng,
312 style->character))) 316 style->character)))
313 goto ERROR7; 317 goto ERROR7;
314 len += leng; 318 len += leng;
315 psiconv_progress(lev+3,off+len,"Going to read the paragraph codes"); 319 psiconv_progress(lev+3,off+len,"Going to read the paragraph codes");
316 if (!(style->paragraph = psiconv_basic_paragraph_layout())) 320 if (!(style->paragraph = psiconv_clone_paragraph_layout((*result)->normal->paragraph)))
317 goto ERROR7; 321 goto ERROR7;
318 if ((res = psiconv_parse_paragraph_layout_list(buf,lev+3,off+len,&leng, 322 if ((res = psiconv_parse_paragraph_layout_list(buf,lev+3,off+len,&leng,
319 style->paragraph))) 323 style->paragraph)))
320 goto ERROR8; 324 goto ERROR8;
321 len += leng; 325 len += leng;
326 }
327
328 psiconv_progress(lev+2,off+len,"Reading trailing bytes");
329 for (i = 0; i < 3; i++) {
330 temp = psiconv_read_u8(buf,lev+3,off+len,&res);
331 if (res)
332 goto ERROR4;
333 if (temp != 0xff) {
334 psiconv_warn(lev+3,off+len,"Unknown trailing style byte");
335 psiconv_debug(lev+3,off+len,"Trailing byte: %02x expected, read %02x",
336 0xff,temp);
337 } else
338 psiconv_debug(lev+3,off+len,"Read trailing byte 0xff");
339 len++;
322 } 340 }
323 341
324 if (length) 342 if (length)
325 *length = len; 343 *length = len;
326 344

Legend:
Removed from v.64  
changed lines
  Added in v.82

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