/[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 12 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"
34static void psiconv_free_paragraph_aux(void * paragraph); 35static void psiconv_free_paragraph_aux(void * paragraph);
35static void psiconv_free_paint_data_section_aux(void * section); 36static void psiconv_free_paint_data_section_aux(void * section);
36 37
37psiconv_character_layout psiconv_basic_character_layout(void) 38psiconv_character_layout psiconv_basic_character_layout(void)
38{ 39{
40 /* Make the structures static, to oblige IRIX */
39 struct psiconv_color black = 41 static struct psiconv_color black =
40 { 42 {
41 0x00, /* red */ 43 0x00, /* red */
42 0x00, /* green */ 44 0x00, /* green */
43 0x00, /* blue */ 45 0x00, /* blue */
44 }; 46 };
45 struct psiconv_color white = 47 static struct psiconv_color white =
46 { 48 {
47 0xff, /* red */ 49 0xff, /* red */
48 0xff, /* green */ 50 0xff, /* green */
49 0xff, /* blue */ 51 0xff, /* blue */
52 };
53 static struct psiconv_font font =
54 {
55 "Times New Roman", /* name */
56 3 /* screenfont */
50 }; 57 };
51 struct psiconv_character_layout cl = 58 struct psiconv_character_layout cl =
52 { 59 {
53 &black, /* color */ 60 &black, /* color */
54 &white, /* back_color */ 61 &white, /* back_color */
56 psiconv_bool_false, /* italic */ 63 psiconv_bool_false, /* italic */
57 psiconv_bool_false, /* bold */ 64 psiconv_bool_false, /* bold */
58 psiconv_normalscript, /* super_sub */ 65 psiconv_normalscript, /* super_sub */
59 psiconv_bool_false, /* underline */ 66 psiconv_bool_false, /* underline */
60 psiconv_bool_false, /* strike_out */ 67 psiconv_bool_false, /* strike_out */
61 NULL, /* font */ 68 &font, /* font */
62 }; 69 };
63 70
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); 71 return psiconv_clone_character_layout(&cl);
76} 72}
77 73
78psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) 74psiconv_paragraph_layout psiconv_basic_paragraph_layout(void)
79{ 75{
80 char base_font[] = "Times New Roman";
81
82 struct psiconv_font font = 76 static struct psiconv_font font =
83 { 77 {
84 base_font, /* name */ 78 "Times New Roman", /* name */
85 2 /* screenfont */ 79 2 /* screenfont */
86 }; 80 };
87 struct psiconv_color black = 81 static struct psiconv_color black =
88 { 82 {
89 0x00, /* red */ 83 0x00, /* red */
90 0x00, /* green */ 84 0x00, /* green */
91 0x00, /* blue */ 85 0x00, /* blue */
92 }; 86 };
93 struct psiconv_color white = 87 static struct psiconv_color white =
94 { 88 {
95 0xff, /* red */ 89 0xff, /* red */
96 0xff, /* green */ 90 0xff, /* green */
97 0xff, /* blue */ 91 0xff, /* blue */
98 }; 92 };
99 struct psiconv_border no_border = 93 static struct psiconv_border no_border =
100 { 94 {
101 psiconv_border_none, /* kind */ 95 psiconv_border_none, /* kind */
102 1, /* thickness */ 96 1, /* thickness */
103 &black /* color */ 97 &black /* color */
104 }; 98 };
105 struct psiconv_bullet bullet = 99 static struct psiconv_bullet bullet =
106 { 100 {
107 psiconv_bool_false, /* on */ 101 psiconv_bool_false, /* on */
108 10.0, /* font_size */ 102 10.0, /* font_size */
109 0x95, /* character */ 103 0x95, /* character */
110 psiconv_bool_true, /* indent */ 104 psiconv_bool_true, /* indent */
111 &black, /* color */ 105 &black, /* color */
112 &font, /* font */ 106 &font, /* font */
113 }; 107 };
114 struct psiconv_all_tabs tabs = 108 static struct psiconv_all_tabs tabs =
115 { 109 {
116 0.64, /* normal */ 110 0.64, /* normal */
117 NULL /* kind */ 111 NULL /* kind */
118 }; 112 };
119 struct psiconv_paragraph_layout pl = 113 struct psiconv_paragraph_layout pl =
487{ 481{
488 if (section) 482 if (section)
489 psiconv_list_free_el(section,&psiconv_free_paint_data_section_aux); 483 psiconv_list_free_el(section,&psiconv_free_paint_data_section_aux);
490} 484}
491 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) 492void psiconv_free_mbm_f(psiconv_mbm_f file)
493{ 493{
494 if (file) { 494 if (file) {
495 psiconv_free_pictures(file->sections); 495 psiconv_free_pictures(file->sections);
496 free(file); 496 free(file);
497 } 497 }
498} 498}
499 499
500void psiconv_free_mbm_jumptable_section (psiconv_mbm_jumptable_section section) 500void psiconv_free_sketch_section(psiconv_sketch_section sec)
501{ 501{
502 if (section) 502 if (sec) {
503 psiconv_list_free(section); 503 psiconv_free_paint_data_section(sec->picture);
504} 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}
505 515
506void psiconv_free_file(psiconv_file file) 516void psiconv_free_file(psiconv_file file)
507{ 517{
508 if (file) { 518 if (file) {
509 if (file->type == psiconv_word_file) 519 if (file->type == psiconv_word_file)
510 psiconv_free_word_f((psiconv_word_f) file->file); 520 psiconv_free_word_f((psiconv_word_f) file->file);
511 else if (file->type == psiconv_texted_file) 521 else if (file->type == psiconv_texted_file)
512 psiconv_free_texted_f((psiconv_texted_f) file->file); 522 psiconv_free_texted_f((psiconv_texted_f) file->file);
513 else if (file->type == psiconv_mbm_file) 523 else if (file->type == psiconv_mbm_file)
514 psiconv_free_mbm_f((psiconv_mbm_f) file->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);
515 free(file); 527 free(file);
516 } 528 }
517} 529}

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

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