… | |
… | |
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" |
21 | #include <stdlib.h> |
22 | #include <stdlib.h> |
22 | #include <string.h> |
23 | #include <string.h> |
23 | #include "data.h" |
24 | #include "data.h" |
24 | #include "list.h" |
25 | #include "list.h" |
25 | #include "general.h" |
26 | #include "general.h" |
… | |
… | |
31 | static psiconv_all_tabs clone_all_tabs(psiconv_all_tabs all_tabs); |
32 | static psiconv_all_tabs clone_all_tabs(psiconv_all_tabs all_tabs); |
32 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
34 | static void psiconv_free_in_line_layout_aux(void * layout); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
35 | static void psiconv_free_paragraph_aux(void * paragraph); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
36 | static void psiconv_free_paint_data_section_aux(void * section); |
|
|
37 | static void psiconv_free_clipart_section_aux(void * section); |
36 | |
38 | |
37 | psiconv_character_layout psiconv_basic_character_layout(void) |
39 | psiconv_character_layout psiconv_basic_character_layout(void) |
38 | { |
40 | { |
|
|
41 | /* Make the structures static, to oblige IRIX */ |
39 | struct psiconv_color black = |
42 | static struct psiconv_color black = |
40 | { |
43 | { |
41 | 0x00, /* red */ |
44 | 0x00, /* red */ |
42 | 0x00, /* green */ |
45 | 0x00, /* green */ |
43 | 0x00, /* blue */ |
46 | 0x00, /* blue */ |
44 | }; |
47 | }; |
45 | struct psiconv_color white = |
48 | static struct psiconv_color white = |
46 | { |
49 | { |
47 | 0xff, /* red */ |
50 | 0xff, /* red */ |
48 | 0xff, /* green */ |
51 | 0xff, /* green */ |
49 | 0xff, /* blue */ |
52 | 0xff, /* blue */ |
|
|
53 | }; |
|
|
54 | static struct psiconv_font font = |
|
|
55 | { |
|
|
56 | "Times New Roman", /* name */ |
|
|
57 | 3 /* screenfont */ |
50 | }; |
58 | }; |
51 | struct psiconv_character_layout cl = |
59 | struct psiconv_character_layout cl = |
52 | { |
60 | { |
53 | &black, /* color */ |
61 | &black, /* color */ |
54 | &white, /* back_color */ |
62 | &white, /* back_color */ |
… | |
… | |
56 | psiconv_bool_false, /* italic */ |
64 | psiconv_bool_false, /* italic */ |
57 | psiconv_bool_false, /* bold */ |
65 | psiconv_bool_false, /* bold */ |
58 | psiconv_normalscript, /* super_sub */ |
66 | psiconv_normalscript, /* super_sub */ |
59 | psiconv_bool_false, /* underline */ |
67 | psiconv_bool_false, /* underline */ |
60 | psiconv_bool_false, /* strike_out */ |
68 | psiconv_bool_false, /* strike_out */ |
61 | NULL, /* font */ |
69 | &font, /* font */ |
62 | }; |
70 | }; |
63 | |
71 | |
64 | cl.color = malloc(sizeof(*cl.color)); |
|
|
65 | cl.color->red = 0x00; |
|
|
66 | cl.color->green = 0x00; |
|
|
67 | cl.color->blue = 0x00; |
|
|
68 | cl.back_color = malloc(sizeof(*cl.color)); |
|
|
69 | cl.back_color->red = 0xff; |
|
|
70 | cl.back_color->green = 0xff; |
|
|
71 | cl.back_color->blue = 0xff; |
|
|
72 | cl.font = malloc(sizeof(*cl.font)); |
|
|
73 | cl.font->name = strdup("Times New Roman"); |
|
|
74 | cl.font->screenfont = 3; |
|
|
75 | return psiconv_clone_character_layout(&cl); |
72 | return psiconv_clone_character_layout(&cl); |
76 | } |
73 | } |
77 | |
74 | |
78 | psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) |
75 | psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) |
79 | { |
76 | { |
80 | char base_font[] = "Times New Roman"; |
|
|
81 | |
|
|
82 | struct psiconv_font font = |
77 | static struct psiconv_font font = |
83 | { |
78 | { |
84 | base_font, /* name */ |
79 | "Times New Roman", /* name */ |
85 | 2 /* screenfont */ |
80 | 2 /* screenfont */ |
86 | }; |
81 | }; |
87 | struct psiconv_color black = |
82 | static struct psiconv_color black = |
88 | { |
83 | { |
89 | 0x00, /* red */ |
84 | 0x00, /* red */ |
90 | 0x00, /* green */ |
85 | 0x00, /* green */ |
91 | 0x00, /* blue */ |
86 | 0x00, /* blue */ |
92 | }; |
87 | }; |
93 | struct psiconv_color white = |
88 | static struct psiconv_color white = |
94 | { |
89 | { |
95 | 0xff, /* red */ |
90 | 0xff, /* red */ |
96 | 0xff, /* green */ |
91 | 0xff, /* green */ |
97 | 0xff, /* blue */ |
92 | 0xff, /* blue */ |
98 | }; |
93 | }; |
99 | struct psiconv_border no_border = |
94 | static struct psiconv_border no_border = |
100 | { |
95 | { |
101 | psiconv_border_none, /* kind */ |
96 | psiconv_border_none, /* kind */ |
102 | 1, /* thickness */ |
97 | 1, /* thickness */ |
103 | &black /* color */ |
98 | &black /* color */ |
104 | }; |
99 | }; |
105 | struct psiconv_bullet bullet = |
100 | static struct psiconv_bullet bullet = |
106 | { |
101 | { |
107 | psiconv_bool_false, /* on */ |
102 | psiconv_bool_false, /* on */ |
108 | 10.0, /* font_size */ |
103 | 10.0, /* font_size */ |
109 | 0x95, /* character */ |
104 | 0x95, /* character */ |
110 | psiconv_bool_true, /* indent */ |
105 | psiconv_bool_true, /* indent */ |
111 | &black, /* color */ |
106 | &black, /* color */ |
112 | &font, /* font */ |
107 | &font, /* font */ |
113 | }; |
108 | }; |
114 | struct psiconv_all_tabs tabs = |
109 | static struct psiconv_all_tabs tabs = |
115 | { |
110 | { |
116 | 0.64, /* normal */ |
111 | 0.64, /* normal */ |
117 | NULL /* kind */ |
112 | NULL /* kind */ |
118 | }; |
113 | }; |
119 | struct psiconv_paragraph_layout pl = |
114 | struct psiconv_paragraph_layout pl = |
… | |
… | |
487 | { |
482 | { |
488 | if (section) |
483 | if (section) |
489 | psiconv_list_free_el(section,&psiconv_free_paint_data_section_aux); |
484 | psiconv_list_free_el(section,&psiconv_free_paint_data_section_aux); |
490 | } |
485 | } |
491 | |
486 | |
|
|
487 | void psiconv_free_jumptable_section (psiconv_jumptable_section section) |
|
|
488 | { |
|
|
489 | if (section) |
|
|
490 | psiconv_list_free(section); |
|
|
491 | } |
|
|
492 | |
492 | void psiconv_free_mbm_f(psiconv_mbm_f file) |
493 | void psiconv_free_mbm_f(psiconv_mbm_f file) |
493 | { |
494 | { |
494 | if (file) { |
495 | if (file) { |
495 | psiconv_free_pictures(file->sections); |
496 | psiconv_free_pictures(file->sections); |
496 | free(file); |
497 | free(file); |
497 | } |
498 | } |
498 | } |
499 | } |
499 | |
500 | |
500 | void psiconv_free_mbm_jumptable_section (psiconv_mbm_jumptable_section section) |
501 | void psiconv_free_sketch_section(psiconv_sketch_section sec) |
|
|
502 | { |
|
|
503 | if (sec) { |
|
|
504 | psiconv_free_paint_data_section(sec->picture); |
|
|
505 | free(sec); |
|
|
506 | } |
|
|
507 | } |
|
|
508 | |
|
|
509 | void psiconv_free_sketch_f(psiconv_sketch_f file) |
|
|
510 | { |
|
|
511 | if (file) { |
|
|
512 | psiconv_free_sketch_section(file->sketch_sec); |
|
|
513 | free(file); |
|
|
514 | } |
|
|
515 | } |
|
|
516 | |
|
|
517 | void psiconv_free_clipart_section_aux(void *section) |
501 | { |
518 | { |
502 | if (section) |
519 | if (section) |
503 | psiconv_list_free(section); |
520 | free(((psiconv_clipart_section ) section)->picture); |
504 | } |
521 | } |
|
|
522 | |
|
|
523 | void psiconv_free_clipart_section(psiconv_clipart_section section) |
|
|
524 | { |
|
|
525 | if (section) { |
|
|
526 | psiconv_free_clipart_section_aux(section); |
|
|
527 | free(section); |
|
|
528 | } |
|
|
529 | } |
|
|
530 | |
|
|
531 | void psiconv_free_cliparts(psiconv_cliparts section) |
|
|
532 | { |
|
|
533 | if (section) |
|
|
534 | psiconv_list_free_el(section,&psiconv_free_clipart_section_aux); |
|
|
535 | } |
|
|
536 | |
|
|
537 | void psiconv_free_clipart_f(psiconv_clipart_f file) |
|
|
538 | { |
|
|
539 | if (file) { |
|
|
540 | psiconv_free_cliparts(file->sections); |
|
|
541 | free(file); |
|
|
542 | } |
|
|
543 | } |
505 | |
544 | |
506 | void psiconv_free_file(psiconv_file file) |
545 | void psiconv_free_file(psiconv_file file) |
507 | { |
546 | { |
508 | if (file) { |
547 | if (file) { |
509 | if (file->type == psiconv_word_file) |
548 | if (file->type == psiconv_word_file) |
510 | psiconv_free_word_f((psiconv_word_f) file->file); |
549 | psiconv_free_word_f((psiconv_word_f) file->file); |
511 | else if (file->type == psiconv_texted_file) |
550 | else if (file->type == psiconv_texted_file) |
512 | psiconv_free_texted_f((psiconv_texted_f) file->file); |
551 | psiconv_free_texted_f((psiconv_texted_f) file->file); |
513 | else if (file->type == psiconv_mbm_file) |
552 | else if (file->type == psiconv_mbm_file) |
514 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
553 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
|
|
554 | else if (file->type == psiconv_sketch_file) |
|
|
555 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
|
|
556 | else if (file->type == psiconv_clipart_file) |
|
|
557 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
515 | free(file); |
558 | free(file); |
516 | } |
559 | } |
517 | } |
560 | } |