/[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 13 Revision 41
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"
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);
35static void psiconv_free_paint_data_section_aux(void * section); 36static void psiconv_free_paint_data_section_aux(void * section);
37static void psiconv_free_clipart_section_aux(psiconv_clipart_section section);
36 38
37psiconv_character_layout psiconv_basic_character_layout(void) 39psiconv_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
78psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) 75psiconv_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 =
501 psiconv_free_pictures(file->sections); 496 psiconv_free_pictures(file->sections);
502 free(file); 497 free(file);
503 } 498 }
504} 499}
505 500
501void 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
509void 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
517void psiconv_free_clipart_section_aux(psiconv_clipart_section section)
518{
519 if (section)
520 free(section->picture);
521}
522
523void 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
531void psiconv_free_cliparts(psiconv_cliparts section)
532{
533 if (section)
534 psiconv_list_free_el(section,&psiconv_free_clipart_section_aux);
535}
536
537void psiconv_free_clipart_f(psiconv_clipart_f file)
538{
539 if (file) {
540 psiconv_free_cliparts(file->sections);
541 free(file);
542 }
543}
544
506void psiconv_free_file(psiconv_file file) 545void 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_sketch_f((psiconv_clipart_f) file->file);
515 free(file); 558 free(file);
516 } 559 }
517} 560}

Legend:
Removed from v.13  
changed lines
  Added in v.41

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