Sat, 08 Mar 2003 06:52:09 +0000
add linked list of name trees to struct pdf_file, and finalize all name trees when PDF file is closed.
pdf.c | file | annotate | diff | revisions | |
pdf_name_tree.c | file | annotate | diff | revisions | |
pdf_name_tree.h | file | annotate | diff | revisions | |
pdf_private.h | file | annotate | diff | revisions |
1.1 --- a/pdf.c Fri Mar 07 11:35:36 2003 +0000 1.2 +++ b/pdf.c Sat Mar 08 06:52:09 2003 +0000 1.3 @@ -4,7 +4,7 @@ 1.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 1.5 * 1.6 * PDF routines 1.7 - * $Id: pdf.c,v 1.5 2003/03/04 18:09:49 eric Exp $ 1.8 + * $Id: pdf.c,v 1.6 2003/03/07 22:52:09 eric Exp $ 1.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 1.10 * 1.11 * This program is free software; you can redistribute it and/or modify 1.12 @@ -35,6 +35,7 @@ 1.13 #include "pdf_util.h" 1.14 #include "pdf_prim.h" 1.15 #include "pdf_private.h" 1.16 +#include "pdf_name_tree.h" 1.17 1.18 1.19 static void pdf_set_info (pdf_file_handle pdf_file, char *key, char *val) 1.20 @@ -113,6 +114,9 @@ 1.21 1.22 void pdf_close (pdf_file_handle pdf_file) 1.23 { 1.24 + /* finalize all data structures */ 1.25 + pdf_finalize_name_trees (pdf_file); 1.26 + 1.27 /* write body */ 1.28 pdf_write_all_ind_obj (pdf_file); 1.29
2.1 --- a/pdf_name_tree.c Fri Mar 07 11:35:36 2003 +0000 2.2 +++ b/pdf_name_tree.c Sat Mar 08 06:52:09 2003 +0000 2.3 @@ -4,7 +4,7 @@ 2.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 2.5 * 2.6 * PDF routines 2.7 - * $Id: pdf_name_tree.c,v 1.3 2003/03/07 03:35:36 eric Exp $ 2.8 + * $Id: pdf_name_tree.c,v 1.4 2003/03/07 22:52:09 eric Exp $ 2.9 * Copyright 2003 Eric Smith <eric@brouhaha.com> 2.10 * 2.11 * This program is free software; you can redistribute it and/or modify 2.12 @@ -80,6 +80,9 @@ 2.13 root->parent = NULL; 2.14 root->leaf = 1; 2.15 2.16 + tree->next = pdf_file->name_tree_list; 2.17 + pdf_file->name_tree_list = tree; 2.18 + 2.19 return (tree); 2.20 } 2.21 2.22 @@ -248,7 +251,10 @@ 2.23 } 2.24 2.25 2.26 -void pdf_finalize_name_tree (struct pdf_name_tree *tree) 2.27 +void pdf_finalize_name_trees (pdf_file_handle pdf_file) 2.28 { 2.29 - pdf_finalize_name_tree_node (tree, tree->root); 2.30 + struct pdf_name_tree *tree; 2.31 + 2.32 + for (tree = pdf_file->name_tree_list; tree; tree = tree->next) 2.33 + pdf_finalize_name_tree_node (tree, tree->root); 2.34 }
3.1 --- a/pdf_name_tree.h Fri Mar 07 11:35:36 2003 +0000 3.2 +++ b/pdf_name_tree.h Sat Mar 08 06:52:09 2003 +0000 3.3 @@ -4,7 +4,7 @@ 3.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 3.5 * 3.6 * PDF routines 3.7 - * $Id: pdf_name_tree.h,v 1.1 2003/03/07 02:16:08 eric Exp $ 3.8 + * $Id: pdf_name_tree.h,v 1.2 2003/03/07 22:52:09 eric Exp $ 3.9 * Copyright 2003 Eric Smith <eric@brouhaha.com> 3.10 * 3.11 * This program is free software; you can redistribute it and/or modify 3.12 @@ -26,9 +26,10 @@ 3.13 3.14 struct pdf_name_tree 3.15 { 3.16 - pdf_file_handle pdf_file; 3.17 - bool number_tree; /* false for name tree, 3.18 - true for number tree */ 3.19 + pdf_file_handle pdf_file; 3.20 + struct pdf_name_tree *next; /* chain all name trees in the PDF file */ 3.21 + bool number_tree; /* false for name tree, 3.22 + true for number tree */ 3.23 struct pdf_name_tree_node *root; 3.24 }; 3.25 3.26 @@ -47,4 +48,4 @@ 3.27 struct pdf_obj *val); 3.28 3.29 3.30 -void pdf_finalize_name_tree (struct pdf_name_tree *tree); 3.31 +void pdf_finalize_name_trees (pdf_file_handle pdf_file);
4.1 --- a/pdf_private.h Fri Mar 07 11:35:36 2003 +0000 4.2 +++ b/pdf_private.h Sat Mar 08 06:52:09 2003 +0000 4.3 @@ -4,7 +4,7 @@ 4.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 4.5 * 4.6 * PDF routines 4.7 - * $Id: pdf_private.h,v 1.5 2003/03/05 12:56:25 eric Exp $ 4.8 + * $Id: pdf_private.h,v 1.6 2003/03/07 22:52:09 eric Exp $ 4.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 4.10 * 4.11 * This program is free software; you can redistribute it and/or modify 4.12 @@ -47,13 +47,14 @@ 4.13 4.14 struct pdf_file 4.15 { 4.16 - FILE *f; 4.17 - struct pdf_obj *first_ind_obj; 4.18 - struct pdf_obj *last_ind_obj; 4.19 - long int xref_offset; 4.20 - struct pdf_obj *catalog; 4.21 - struct pdf_obj *info; 4.22 - struct pdf_pages *root; 4.23 - struct pdf_bookmark *outline_root; 4.24 - struct pdf_obj *trailer_dict; 4.25 + FILE *f; 4.26 + struct pdf_obj *first_ind_obj; 4.27 + struct pdf_obj *last_ind_obj; 4.28 + long int xref_offset; 4.29 + struct pdf_obj *catalog; 4.30 + struct pdf_obj *info; 4.31 + struct pdf_pages *root; 4.32 + struct pdf_bookmark *outline_root; 4.33 + struct pdf_obj *trailer_dict; 4.34 + struct pdf_name_tree *name_tree_list; 4.35 };