/[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 94 Revision 104
32static void psiconv_free_style_aux(void *style); 32static void psiconv_free_style_aux(void *style);
33static void psiconv_free_in_line_layout_aux(void * layout); 33static void psiconv_free_in_line_layout_aux(void * layout);
34static void psiconv_free_paragraph_aux(void * paragraph); 34static void psiconv_free_paragraph_aux(void * paragraph);
35static void psiconv_free_paint_data_section_aux(void * section); 35static void psiconv_free_paint_data_section_aux(void * section);
36static void psiconv_free_clipart_section_aux(void * section); 36static void psiconv_free_clipart_section_aux(void * section);
37static void psiconv_free_formula_aux(void *data);
37 38
38static psiconv_word_styles_section psiconv_empty_word_styles_section(void); 39static psiconv_word_styles_section psiconv_empty_word_styles_section(void);
39static psiconv_text_and_layout psiconv_empty_text_and_layout(void); 40static psiconv_text_and_layout psiconv_empty_text_and_layout(void);
40static psiconv_texted_section psiconv_empty_texted_section(void); 41static psiconv_texted_section psiconv_empty_texted_section(void);
41static psiconv_page_header psiconv_empty_page_header(void); 42static psiconv_page_header psiconv_empty_page_header(void);
42static psiconv_page_layout_section psiconv_empty_page_layout_section(void); 43static psiconv_page_layout_section psiconv_empty_page_layout_section(void);
43static psiconv_word_status_section psiconv_empty_word_status_section(void); 44static psiconv_word_status_section psiconv_empty_word_status_section(void);
44static psiconv_word_f psiconv_empty_word_f(void); 45static psiconv_word_f psiconv_empty_word_f(void);
45static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); 46static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void);
47static psiconv_formula_list psiconv_empty_formula_list(void);
48static psiconv_sheet_workbook_section
49 psiconv_empty_sheet_workbook_section(void);
46static psiconv_sheet_f psiconv_empty_sheet_f(void); 50static psiconv_sheet_f psiconv_empty_sheet_f(void);
47static psiconv_texted_f psiconv_empty_texted_f(void); 51static psiconv_texted_f psiconv_empty_texted_f(void);
48static psiconv_paint_data_section psiconv_empty_paint_data_section(void); 52static psiconv_paint_data_section psiconv_empty_paint_data_section(void);
49static psiconv_pictures psiconv_empty_pictures(void); 53static psiconv_pictures psiconv_empty_pictures(void);
50static psiconv_mbm_f psiconv_empty_mbm_f(void); 54static psiconv_mbm_f psiconv_empty_mbm_f(void);
147 0.0, /* space_below */ 151 0.0, /* space_below */
148 psiconv_bool_false, /* keep_together */ 152 psiconv_bool_false, /* keep_together */
149 psiconv_bool_false, /* keep_with_next */ 153 psiconv_bool_false, /* keep_with_next */
150 psiconv_bool_false, /* on_next_page */ 154 psiconv_bool_false, /* on_next_page */
151 psiconv_bool_false, /* no_widow_protection */ 155 psiconv_bool_false, /* no_widow_protection */
156 psiconv_bool_false, /* wrap_to_fit_cell */
152 0.0, /* left_margin */ 157 0.0, /* left_margin */
153 &bullet, /* bullet */ 158 &bullet, /* bullet */
154 &no_border, /* left_border */ 159 &no_border, /* left_border */
155 &no_border, /* right_border */ 160 &no_border, /* right_border */
156 &no_border, /* top_border */ 161 &no_border, /* top_border */
542{ 547{
543 if (section) 548 if (section)
544 free(section); 549 free(section);
545} 550}
546 551
552void psiconv_free_formula_aux(void *data)
553{
554 psiconv_formula formula;
555 formula = data;
556 if (formula->type == psiconv_formula_dat_string)
557 free(formula->data.dat_string);
558 else if ((formula->type != psiconv_formula_dat_int) &&
559 (formula->type != psiconv_formula_dat_var) &&
560 (formula->type != psiconv_formula_dat_float) &&
561 (formula->type != psiconv_formula_dat_cellref) &&
562 (formula->type != psiconv_formula_dat_cellblock) &&
563 (formula->type != psiconv_formula_dat_vcellblock) &&
564 (formula->type != psiconv_formula_mark_opsep) &&
565 (formula->type != psiconv_formula_mark_opend) &&
566 (formula->type != psiconv_formula_mark_eof) &&
567 (formula->type != psiconv_formula_unknown))
568 psiconv_free_formula_list(formula->data.fun_operands);
569}
570
571void psiconv_free_formula(psiconv_formula formula)
572{
573 if (formula) {
574 psiconv_free_formula_aux(formula);
575 free(formula);
576 }
577}
578
579void psiconv_free_formula_list(psiconv_formula_list list)
580{
581 if (list)
582 psiconv_list_free_el(list,psiconv_free_formula_aux);
583}
584
585void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
586{
587 if (section) {
588 psiconv_free_formula_list(section->formulas);
589 free(section);
590 }
591}
592
547void psiconv_free_sheet_f(psiconv_sheet_f file) 593void psiconv_free_sheet_f(psiconv_sheet_f file)
548{ 594{
549 if (file) { 595 if (file) {
550 psiconv_free_page_layout_section(file->page_sec); 596 psiconv_free_page_layout_section(file->page_sec);
551 psiconv_free_sheet_status_section(file->status_sec); 597 psiconv_free_sheet_status_section(file->status_sec);
598 psiconv_free_sheet_workbook_section(file->workbook_sec);
552 free(file); 599 free(file);
553 } 600 }
554} 601}
555 602
556void psiconv_free_texted_f(psiconv_texted_f file) 603void psiconv_free_texted_f(psiconv_texted_f file)
953 result->cursor_row = result->cursor_column = 0; 1000 result->cursor_row = result->cursor_column = 0;
954 result->sheet_display_size = result->graph_display_size = 1000; 1001 result->sheet_display_size = result->graph_display_size = 1000;
955 return result; 1002 return result;
956} 1003}
957 1004
1005psiconv_formula_list psiconv_empty_formula_list(void)
1006{
1007 return psiconv_list_new(sizeof(struct psiconv_formula_s));
1008}
1009
1010psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void)
1011{
1012 psiconv_sheet_workbook_section result;
1013 if (!(result = malloc(sizeof(*result))))
1014 goto ERROR1;
1015 if (!(result->formulas = psiconv_empty_formula_list()))
1016 goto ERROR2;
1017 return result;
1018ERROR2:
1019 free(result);
1020ERROR1:
1021 return NULL;
1022}
1023
1024
958psiconv_sheet_f psiconv_empty_sheet_f(void) 1025psiconv_sheet_f psiconv_empty_sheet_f(void)
959{ 1026{
960 psiconv_sheet_f result; 1027 psiconv_sheet_f result;
961 if (!(result = malloc(sizeof(*result)))) 1028 if (!(result = malloc(sizeof(*result))))
962 goto ERROR1; 1029 goto ERROR1;
963 if (!(result->page_sec = psiconv_empty_page_layout_section())) 1030 if (!(result->page_sec = psiconv_empty_page_layout_section()))
964 goto ERROR2; 1031 goto ERROR2;
965 if (!(result->status_sec = psiconv_empty_sheet_status_section())) 1032 if (!(result->status_sec = psiconv_empty_sheet_status_section()))
966 goto ERROR3; 1033 goto ERROR3;
1034 if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section()))
1035 goto ERROR4;
967 return result; 1036 return result;
1037ERROR4:
1038 psiconv_free_sheet_status_section(result->status_sec);
968ERROR3: 1039ERROR3:
969 psiconv_free_page_layout_section(result->page_sec); 1040 psiconv_free_page_layout_section(result->page_sec);
970ERROR2: 1041ERROR2:
971 free(result); 1042 free(result);
972ERROR1: 1043ERROR1:

Legend:
Removed from v.94  
changed lines
  Added in v.104

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