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

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

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

Revision 64 Revision 71
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>
22#include <math.h> 24#include <math.h>
23 25
24#include "data.h"
25#include "parse_routines.h" 26#include "parse_routines.h"
27#include "error.h"
26 28
27int psiconv_parse_color(const psiconv_buffer buf, int lev, psiconv_u32 off, 29int psiconv_parse_color(const psiconv_buffer buf, int lev, psiconv_u32 off,
28 int *length, psiconv_color *result) 30 int *length, psiconv_color *result)
29{ 31{
30 int res = 0; 32 int res = 0;
145 else if (temp == 0x02) 147 else if (temp == 0x02)
146 (*result)->kind = psiconv_border_double; 148 (*result)->kind = psiconv_border_double;
147 else if (temp == 0x03) 149 else if (temp == 0x03)
148 (*result)->kind = psiconv_border_dotted; 150 (*result)->kind = psiconv_border_dotted;
149 else if (temp == 0x04) 151 else if (temp == 0x04)
150 (*result)->kind = psiconv_border_striped; 152 (*result)->kind = psiconv_border_dashed;
151 else if (temp == 0x05) 153 else if (temp == 0x05)
152 (*result)->kind = psiconv_border_dotstripe; 154 (*result)->kind = psiconv_border_dotdashed;
153 else if (temp == 0x06) 155 else if (temp == 0x06)
154 (*result)->kind = psiconv_border_dotdotstripe; 156 (*result)->kind = psiconv_border_dotdotdashed;
155 else { 157 else {
156 psiconv_warn(lev+2,off,"Unknown border kind (defaults to `none')"); 158 psiconv_warn(lev+2,off,"Unknown border kind (defaults to `none')");
157 (*result)->kind = psiconv_border_none; 159 (*result)->kind = psiconv_border_none;
158 } 160 }
159 psiconv_debug(lev+2,off+len,"Kind: %02x",temp); 161 psiconv_debug(lev+2,off+len,"Kind: %02x",temp);
270 psiconv_progress(lev+1,off + len - 1, 272 psiconv_progress(lev+1,off + len - 1,
271 "End of bullet data (total length: %08x)",len); 273 "End of bullet data (total length: %08x)",len);
272 274
273 if (length) 275 if (length)
274 *length = len; 276 *length = len;
275 return res; 277 return 0;
276 278
277ERROR3: 279ERROR3:
278 psiconv_free_color((*result)->color); 280 psiconv_free_color((*result)->color);
279ERROR2: 281ERROR2:
280 free (result); 282 free (result);
445 result->justify_ver = psiconv_justify_bottom; 447 result->justify_ver = psiconv_justify_bottom;
446 } 448 }
447 psiconv_debug(lev+3,off+len,"Justify: %02x",temp); 449 psiconv_debug(lev+3,off+len,"Justify: %02x",temp);
448 len ++; 450 len ++;
449 case 0x07: 451 case 0x07:
450 psiconv_progress(lev+3,off+len,"Going to read interline distance"); 452 psiconv_progress(lev+3,off+len,"Going to read linespacing distance");
451 result->interline = psiconv_read_size(buf,lev+3,off+len,&leng,&res); 453 result->linespacing = psiconv_read_size(buf,lev+3,off+len,&leng,&res);
452 if (res) 454 if (res)
453 goto ERROR1; 455 goto ERROR1;
454 len += leng; 456 len += leng;
455 break; 457 break;
456 case 0x08: 458 case 0x08:
457 psiconv_progress(lev+3,off+len,"Going to read interline exact"); 459 psiconv_progress(lev+3,off+len,"Going to read linespacing exact");
458 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, 460 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng,
459 &result->interline_exact))) 461 &result->linespacing_exact)))
460 goto ERROR1; 462 goto ERROR1;
461 len += leng; 463 len += leng;
462 break; 464 break;
463 case 0x09: 465 case 0x09:
464 psiconv_progress(lev+3,off+len,"Going to read top space"); 466 psiconv_progress(lev+3,off+len,"Going to read top space");
465 result->top_space = psiconv_read_size(buf,lev+3,off+len,&leng,&res); 467 result->space_above = psiconv_read_size(buf,lev+3,off+len,&leng,&res);
466 if (res) 468 if (res)
467 goto ERROR1; 469 goto ERROR1;
468 len += leng; 470 len += leng;
469 break; 471 break;
470 case 0x0a: 472 case 0x0a:
471 psiconv_progress(lev+3,off+len,"Going to read bottom space"); 473 psiconv_progress(lev+3,off+len,"Going to read bottom space");
472 result->bottom_space = psiconv_read_size(buf,lev+3,off+len,&leng,&res); 474 result->space_below = psiconv_read_size(buf,lev+3,off+len,&leng,&res);
473 if (res) 475 if (res)
474 goto ERROR1; 476 goto ERROR1;
475 len += leng; 477 len += leng;
476 break; 478 break;
477 case 0x0b: 479 case 0x0b:
478 psiconv_progress(lev+3,off+len,"Going to read on one page"); 480 psiconv_progress(lev+3,off+len,"Going to read on one page");
479 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, 481 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng,
480 &result->on_one_page))) 482 &result->keep_together)))
481 goto ERROR1; 483 goto ERROR1;
482 len += leng; 484 len += leng;
483 break; 485 break;
484 case 0x0c: 486 case 0x0c:
485 psiconv_progress(lev+3,off+len,"Going to read together with"); 487 psiconv_progress(lev+3,off+len,"Going to read together with");
486 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, 488 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng,
487 &result->together_with))) 489 &result->keep_with_next)))
488 goto ERROR1; 490 goto ERROR1;
489 len += leng; 491 len += leng;
490 break; 492 break;
491 case 0x0d: 493 case 0x0d:
492 psiconv_progress(lev+3,off+len,"Going to read on next page"); 494 psiconv_progress(lev+3,off+len,"Going to read on next page");
542 result->right_border = temp_border; 544 result->right_border = temp_border;
543 len += leng; 545 len += leng;
544 break; 546 break;
545 case 0x15: 547 case 0x15:
546 psiconv_progress(lev+3,off+len,"Going to read bullet"); 548 psiconv_progress(lev+3,off+len,"Going to read bullet");
547 if ((res = psiconv_parse_bullet(buf,lev+3,off+len,&leng,&temp_bullet))); 549 if ((res = psiconv_parse_bullet(buf,lev+3,off+len,&leng,&temp_bullet)))
548 goto ERROR1; 550 goto ERROR1;
549 psiconv_free_bullet(result->bullet); 551 psiconv_free_bullet(result->bullet);
550 result->bullet = temp_bullet; 552 result->bullet = temp_bullet;
551 len += leng; 553 len += leng;
552 break; 554 break;
697 &result->underline))) 699 &result->underline)))
698 goto ERROR1; 700 goto ERROR1;
699 len += leng; 701 len += leng;
700 break; 702 break;
701 case 0x21: 703 case 0x21:
702 psiconv_progress(lev+3,off+len,"Going to read strike_out"); 704 psiconv_progress(lev+3,off+len,"Going to read strikethrough");
703 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng, 705 if ((res = psiconv_parse_bool(buf,lev+3,off+len,&leng,
704 &result->strike_out))) 706 &result->strikethrough)))
705 goto ERROR1; 707 goto ERROR1;
706 len += leng; 708 len += leng;
707 break; 709 break;
708 case 0x22: 710 case 0x22:
709 psiconv_progress(lev+3,off+len,"Going to read font"); 711 psiconv_progress(lev+3,off+len,"Going to read font");

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

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