… | |
… | |
23 | #include <stdlib.h> |
23 | #include <stdlib.h> |
24 | #include <math.h> |
24 | #include <math.h> |
25 | |
25 | |
26 | #include "parse_routines.h" |
26 | #include "parse_routines.h" |
27 | #include "error.h" |
27 | #include "error.h" |
|
|
28 | |
|
|
29 | #ifdef DMALLOC |
|
|
30 | #include <dmalloc.h> |
|
|
31 | #endif |
|
|
32 | |
28 | |
33 | |
29 | int psiconv_parse_color(const psiconv_buffer buf, int lev, psiconv_u32 off, |
34 | int psiconv_parse_color(const psiconv_buffer buf, int lev, psiconv_u32 off, |
30 | int *length, psiconv_color *result) |
35 | int *length, psiconv_color *result) |
31 | { |
36 | { |
32 | int res = 0; |
37 | int res = 0; |
… | |
… | |
449 | "in paragraph layout codes list"); |
454 | "in paragraph layout codes list"); |
450 | result->justify_ver = psiconv_justify_bottom; |
455 | result->justify_ver = psiconv_justify_bottom; |
451 | } |
456 | } |
452 | psiconv_debug(lev+3,off+len,"Justify: %02x",temp); |
457 | psiconv_debug(lev+3,off+len,"Justify: %02x",temp); |
453 | len ++; |
458 | len ++; |
|
|
459 | break; |
454 | case 0x07: |
460 | case 0x07: |
455 | psiconv_progress(lev+3,off+len,"Going to read linespacing distance"); |
461 | psiconv_progress(lev+3,off+len,"Going to read linespacing distance"); |
456 | result->linespacing = psiconv_read_size(buf,lev+3,off+len,&leng,&res); |
462 | result->linespacing = psiconv_read_size(buf,lev+3,off+len,&leng,&res); |
457 | if (res) |
463 | if (res) |
458 | goto ERROR1; |
464 | goto ERROR1; |
… | |
… | |
502 | break; |
508 | break; |
503 | case 0x0e: |
509 | case 0x0e: |
504 | psiconv_progress(lev+3,off+len,"Going to read no widow protection"); |
510 | psiconv_progress(lev+3,off+len,"Going to read no widow protection"); |
505 | if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, |
511 | if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, |
506 | &result->no_widow_protection))) |
512 | &result->no_widow_protection))) |
|
|
513 | goto ERROR1; |
|
|
514 | len += leng; |
|
|
515 | break; |
|
|
516 | case 0x0f: |
|
|
517 | psiconv_progress(lev+3,off+len,"Going to read wrap to fit cell limits"); |
|
|
518 | if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, |
|
|
519 | &result->wrap_to_fit_cell))) |
507 | goto ERROR1; |
520 | goto ERROR1; |
508 | len += leng; |
521 | len += leng; |
509 | break; |
522 | break; |
510 | case 0x10: |
523 | case 0x10: |
511 | psiconv_progress(lev+3,off+len,"Going to read border distance to text"); |
524 | psiconv_progress(lev+3,off+len,"Going to read border distance to text"); |
… | |
… | |
641 | if (res) |
654 | if (res) |
642 | goto ERROR1; |
655 | goto ERROR1; |
643 | psiconv_debug(lev+3,off+len,"Id: %02x",id); |
656 | psiconv_debug(lev+3,off+len,"Id: %02x",id); |
644 | len ++; |
657 | len ++; |
645 | switch(id) { |
658 | switch(id) { |
|
|
659 | case 0x18: |
|
|
660 | psiconv_progress(lev+3,off+len,"Going to skip an unknown setting"); |
|
|
661 | len ++; |
|
|
662 | break; |
646 | case 0x19: |
663 | case 0x19: |
647 | psiconv_progress(lev+3,off+len,"Going to read text color"); |
664 | psiconv_progress(lev+3,off+len,"Going to read text color"); |
648 | if ((res = psiconv_parse_color(buf,lev+3,off+len, &leng,&temp_color))) |
665 | if ((res = psiconv_parse_color(buf,lev+3,off+len, &leng,&temp_color))) |
649 | goto ERROR1; |
666 | goto ERROR1; |
650 | psiconv_free_color(result->color); |
667 | psiconv_free_color(result->color); |
… | |
… | |
656 | if ((res = psiconv_parse_color(buf,lev+2,off+len, &leng,&temp_color))) |
673 | if ((res = psiconv_parse_color(buf,lev+2,off+len, &leng,&temp_color))) |
657 | goto ERROR1; |
674 | goto ERROR1; |
658 | psiconv_free_color(result->back_color); |
675 | psiconv_free_color(result->back_color); |
659 | result->back_color = temp_color; |
676 | result->back_color = temp_color; |
660 | len += leng; |
677 | len += leng; |
|
|
678 | break; |
|
|
679 | case 0x1b: |
|
|
680 | psiconv_progress(lev+3,off+len,"Going to skip an unknown setting"); |
|
|
681 | len ++; |
661 | break; |
682 | break; |
662 | case 0x1c: |
683 | case 0x1c: |
663 | psiconv_progress(lev+3,off+len,"Going to read font size"); |
684 | psiconv_progress(lev+3,off+len,"Going to read font size"); |
664 | result->font_size = psiconv_read_size(buf,lev+3,off+len,&leng,&res); |
685 | result->font_size = psiconv_read_size(buf,lev+3,off+len,&leng,&res); |
665 | if (res) |
686 | if (res) |
… | |
… | |
716 | goto ERROR1; |
737 | goto ERROR1; |
717 | psiconv_free_font(result->font); |
738 | psiconv_free_font(result->font); |
718 | result->font = temp_font; |
739 | result->font = temp_font; |
719 | len += leng; |
740 | len += leng; |
720 | break; |
741 | break; |
|
|
742 | case 0x23: |
|
|
743 | psiconv_progress(lev+3,off+len,"Going to skip an unknown setting"); |
|
|
744 | len ++; |
|
|
745 | break; |
721 | case 0x24: |
746 | case 0x24: |
722 | psiconv_progress(lev+3,off+len, |
747 | psiconv_progress(lev+3,off+len, |
723 | "Going to read unknown code 0x24 (%02x expected)", 0); |
748 | "Going to read unknown code 0x24 (%02x expected)", 0); |
724 | temp = psiconv_read_u8(buf,lev+3,off+len,&res); |
749 | temp = psiconv_read_u8(buf,lev+3,off+len,&res); |
725 | if (res) |
750 | if (res) |