/[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 98
41static psiconv_page_header psiconv_empty_page_header(void); 41static psiconv_page_header psiconv_empty_page_header(void);
42static psiconv_page_layout_section psiconv_empty_page_layout_section(void); 42static psiconv_page_layout_section psiconv_empty_page_layout_section(void);
43static psiconv_word_status_section psiconv_empty_word_status_section(void); 43static psiconv_word_status_section psiconv_empty_word_status_section(void);
44static psiconv_word_f psiconv_empty_word_f(void); 44static psiconv_word_f psiconv_empty_word_f(void);
45static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); 45static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void);
46static psiconv_formula_list psiconv_empty_formula_list(void);
47static psiconv_sheet_workbook_section
48 psiconv_empty_sheet_workbook_section(void);
46static psiconv_sheet_f psiconv_empty_sheet_f(void); 49static psiconv_sheet_f psiconv_empty_sheet_f(void);
47static psiconv_texted_f psiconv_empty_texted_f(void); 50static psiconv_texted_f psiconv_empty_texted_f(void);
48static psiconv_paint_data_section psiconv_empty_paint_data_section(void); 51static psiconv_paint_data_section psiconv_empty_paint_data_section(void);
49static psiconv_pictures psiconv_empty_pictures(void); 52static psiconv_pictures psiconv_empty_pictures(void);
50static psiconv_mbm_f psiconv_empty_mbm_f(void); 53static psiconv_mbm_f psiconv_empty_mbm_f(void);
542{ 545{
543 if (section) 546 if (section)
544 free(section); 547 free(section);
545} 548}
546 549
550/* TODO: Free sublists, strings etc. depending on formula->type */
551void psiconv_free_formula(psiconv_formula formula)
552{
553 if (formula)
554 free(formula);
555}
556
557void psiconv_free_formula_list(psiconv_formula_list list)
558{
559 if (list)
560 psiconv_list_free(list);
561}
562
563void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
564{
565 if (section) {
566 psiconv_free_formula_list(section->formulas);
567 free(section);
568 }
569}
570
547void psiconv_free_sheet_f(psiconv_sheet_f file) 571void psiconv_free_sheet_f(psiconv_sheet_f file)
548{ 572{
549 if (file) { 573 if (file) {
550 psiconv_free_page_layout_section(file->page_sec); 574 psiconv_free_page_layout_section(file->page_sec);
551 psiconv_free_sheet_status_section(file->status_sec); 575 psiconv_free_sheet_status_section(file->status_sec);
576 psiconv_free_sheet_workbook_section(file->workbook_sec);
552 free(file); 577 free(file);
553 } 578 }
554} 579}
555 580
556void psiconv_free_texted_f(psiconv_texted_f file) 581void psiconv_free_texted_f(psiconv_texted_f file)
953 result->cursor_row = result->cursor_column = 0; 978 result->cursor_row = result->cursor_column = 0;
954 result->sheet_display_size = result->graph_display_size = 1000; 979 result->sheet_display_size = result->graph_display_size = 1000;
955 return result; 980 return result;
956} 981}
957 982
983psiconv_formula_list psiconv_empty_formula_list(void)
984{
985 return psiconv_list_new(sizeof(struct psiconv_formula_s));
986}
987
988psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void)
989{
990 psiconv_sheet_workbook_section result;
991 if (!(result = malloc(sizeof(*result))))
992 goto ERROR1;
993 if (!(result->formulas = psiconv_empty_formula_list()))
994 goto ERROR2;
995 return result;
996ERROR2:
997 free(result);
998ERROR1:
999 return NULL;
1000}
1001
1002
958psiconv_sheet_f psiconv_empty_sheet_f(void) 1003psiconv_sheet_f psiconv_empty_sheet_f(void)
959{ 1004{
960 psiconv_sheet_f result; 1005 psiconv_sheet_f result;
961 if (!(result = malloc(sizeof(*result)))) 1006 if (!(result = malloc(sizeof(*result))))
962 goto ERROR1; 1007 goto ERROR1;
963 if (!(result->page_sec = psiconv_empty_page_layout_section())) 1008 if (!(result->page_sec = psiconv_empty_page_layout_section()))
964 goto ERROR2; 1009 goto ERROR2;
965 if (!(result->status_sec = psiconv_empty_sheet_status_section())) 1010 if (!(result->status_sec = psiconv_empty_sheet_status_section()))
966 goto ERROR3; 1011 goto ERROR3;
1012 if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section()))
1013 goto ERROR4;
967 return result; 1014 return result;
1015ERROR4:
1016 psiconv_free_sheet_status_section(result->status_sec);
968ERROR3: 1017ERROR3:
969 psiconv_free_page_layout_section(result->page_sec); 1018 psiconv_free_page_layout_section(result->page_sec);
970ERROR2: 1019ERROR2:
971 free(result); 1020 free(result);
972ERROR1: 1021ERROR1:

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

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