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

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

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

Revision 2 Revision 24
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"
30static psiconv_bullet clone_bullet(psiconv_bullet bullet); 31static psiconv_bullet clone_bullet(psiconv_bullet bullet);
31static psiconv_all_tabs clone_all_tabs(psiconv_all_tabs all_tabs); 32static psiconv_all_tabs clone_all_tabs(psiconv_all_tabs all_tabs);
32static void psiconv_free_style_aux(void *style); 33static void psiconv_free_style_aux(void *style);
33static void psiconv_free_in_line_layout_aux(void * layout); 34static void psiconv_free_in_line_layout_aux(void * layout);
34static void psiconv_free_paragraph_aux(void * paragraph); 35static void psiconv_free_paragraph_aux(void * paragraph);
36static void psiconv_free_paint_data_section_aux(void * section);
35 37
36psiconv_character_layout psiconv_basic_character_layout(void) 38psiconv_character_layout psiconv_basic_character_layout(void)
37{ 39{
40 /* Make the structures static, to oblige IRIX */
38 struct psiconv_color black = 41 static struct psiconv_color black =
39 { 42 {
40 0x00, /* red */ 43 0x00, /* red */
41 0x00, /* green */ 44 0x00, /* green */
42 0x00, /* blue */ 45 0x00, /* blue */
43 }; 46 };
44 struct psiconv_color white = 47 static struct psiconv_color white =
45 { 48 {
46 0xff, /* red */ 49 0xff, /* red */
47 0xff, /* green */ 50 0xff, /* green */
48 0xff, /* blue */ 51 0xff, /* blue */
52 };
53 static struct psiconv_font font =
54 {
55 "Times New Roman", /* name */
56 3 /* screenfont */
49 }; 57 };
50 struct psiconv_character_layout cl = 58 struct psiconv_character_layout cl =
51 { 59 {
52 &black, /* color */ 60 &black, /* color */
53 &white, /* back_color */ 61 &white, /* back_color */
55 psiconv_bool_false, /* italic */ 63 psiconv_bool_false, /* italic */
56 psiconv_bool_false, /* bold */ 64 psiconv_bool_false, /* bold */
57 psiconv_normalscript, /* super_sub */ 65 psiconv_normalscript, /* super_sub */
58 psiconv_bool_false, /* underline */ 66 psiconv_bool_false, /* underline */
59 psiconv_bool_false, /* strike_out */ 67 psiconv_bool_false, /* strike_out */
60 NULL, /* font */ 68 &font, /* font */
61 }; 69 };
62 70
63 cl.color = malloc(sizeof(*cl.color));
64 cl.color->red = 0x00;
65 cl.color->green = 0x00;
66 cl.color->blue = 0x00;
67 cl.back_color = malloc(sizeof(*cl.color));
68 cl.back_color->red = 0xff;
69 cl.back_color->green = 0xff;
70 cl.back_color->blue = 0xff;
71 cl.font = malloc(sizeof(*cl.font));
72 cl.font->name = strdup("Times New Roman");
73 cl.font->screenfont = 3;
74 return psiconv_clone_character_layout(&cl); 71 return psiconv_clone_character_layout(&cl);
75} 72}
76 73
77psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) 74psiconv_paragraph_layout psiconv_basic_paragraph_layout(void)
78{ 75{
79 char base_font[] = "Times New Roman";
80
81 struct psiconv_font font = 76 static struct psiconv_font font =
82 { 77 {
83 base_font, /* name */ 78 "Times New Roman", /* name */
84 2 /* screenfont */ 79 2 /* screenfont */
85 }; 80 };
86 struct psiconv_color black = 81 static struct psiconv_color black =
87 { 82 {
88 0x00, /* red */ 83 0x00, /* red */
89 0x00, /* green */ 84 0x00, /* green */
90 0x00, /* blue */ 85 0x00, /* blue */
91 }; 86 };
92 struct psiconv_color white = 87 static struct psiconv_color white =
93 { 88 {
94 0xff, /* red */ 89 0xff, /* red */
95 0xff, /* green */ 90 0xff, /* green */
96 0xff, /* blue */ 91 0xff, /* blue */
97 }; 92 };
98 struct psiconv_border no_border = 93 static struct psiconv_border no_border =
99 { 94 {
100 psiconv_border_none, /* kind */ 95 psiconv_border_none, /* kind */
101 1, /* thickness */ 96 1, /* thickness */
102 &black /* color */ 97 &black /* color */
103 }; 98 };
104 struct psiconv_bullet bullet = 99 static struct psiconv_bullet bullet =
105 { 100 {
106 psiconv_bool_false, /* on */ 101 psiconv_bool_false, /* on */
107 10.0, /* font_size */ 102 10.0, /* font_size */
108 0x95, /* character */ 103 0x95, /* character */
109 psiconv_bool_true, /* indent */ 104 psiconv_bool_true, /* indent */
110 &black, /* color */ 105 &black, /* color */
111 &font, /* font */ 106 &font, /* font */
112 }; 107 };
113 struct psiconv_all_tabs tabs = 108 static struct psiconv_all_tabs tabs =
114 { 109 {
115 0.64, /* normal */ 110 0.64, /* normal */
116 NULL /* kind */ 111 NULL /* kind */
117 }; 112 };
118 struct psiconv_paragraph_layout pl = 113 struct psiconv_paragraph_layout pl =
453 psiconv_free_word_styles_section(file->styles_sec); 448 psiconv_free_word_styles_section(file->styles_sec);
454 free(file); 449 free(file);
455 } 450 }
456} 451}
457 452
453void psiconv_free_texted_f(psiconv_texted_f file)
454{
455 if (file) {
456 psiconv_free_page_layout_section(file->page_sec);
457 psiconv_free_texted_section(file->texted_sec);
458 free(file);
459 }
460}
461
462void psiconv_free_paint_data_section_aux(void * section)
463{
464 if (((psiconv_paint_data_section) section)->red)
465 free(((psiconv_paint_data_section)section) -> red);
466 if (((psiconv_paint_data_section) section)->green)
467 free(((psiconv_paint_data_section)section) -> green);
468 if (((psiconv_paint_data_section) section)->blue)
469 free(((psiconv_paint_data_section)section) -> blue);
470}
471
472void psiconv_free_paint_data_section(psiconv_paint_data_section section)
473{
474 if (section) {
475 psiconv_free_paint_data_section_aux(section);
476 free(section);
477 }
478}
479
480void psiconv_free_pictures(psiconv_pictures section)
481{
482 if (section)
483 psiconv_list_free_el(section,&psiconv_free_paint_data_section_aux);
484}
485
486void psiconv_free_mbm_jumptable_section (psiconv_mbm_jumptable_section section)
487{
488 if (section)
489 psiconv_list_free(section);
490}
491
492void psiconv_free_mbm_f(psiconv_mbm_f file)
493{
494 if (file) {
495 psiconv_free_pictures(file->sections);
496 free(file);
497 }
498}
499
500void psiconv_free_sketch_section(psiconv_sketch_section sec)
501{
502 if (sec) {
503 psiconv_free_paint_data_section(sec->picture);
504 free(sec);
505 }
506}
507
508void psiconv_free_sketch_f(psiconv_sketch_f file)
509{
510 if (file) {
511 psiconv_free_sketch_section(file->sketch_sec);
512 free(file);
513 }
514}
515
458void psiconv_free_file(psiconv_file file) 516void psiconv_free_file(psiconv_file file)
459{ 517{
460 if (file) { 518 if (file) {
461 if (file->type == psiconv_word_file) 519 if (file->type == psiconv_word_file)
462 psiconv_free_word_f((psiconv_word_f) file->file); 520 psiconv_free_word_f((psiconv_word_f) file->file);
521 else if (file->type == psiconv_texted_file)
522 psiconv_free_texted_f((psiconv_texted_f) file->file);
523 else if (file->type == psiconv_mbm_file)
524 psiconv_free_mbm_f((psiconv_mbm_f) file->file);
525 else if (file->type == psiconv_sketch_file)
526 psiconv_free_sketch_f((psiconv_sketch_f) file->file);
463 free(file); 527 free(file);
464 } 528 }
465} 529}

Legend:
Removed from v.2  
changed lines
  Added in v.24

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