pdf_name_tree.h

Mon, 14 Dec 2009 16:18:21 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Mon, 14 Dec 2009 16:18:21 +0000
changeset 172
2fae6df568f6
parent 131
4b8c80d77f76
permissions
-rw-r--r--

remove erroneous 0.33-philpem1 tag

eric@80 1 /*
eric@125 2 * tumble: build a PDF file from image files
eric@80 3 *
eric@80 4 * PDF routines
eric@131 5 * $Id: pdf_name_tree.h,v 1.4 2003/03/14 00:24:37 eric Exp $
eric@80 6 * Copyright 2003 Eric Smith <eric@brouhaha.com>
eric@80 7 *
eric@80 8 * This program is free software; you can redistribute it and/or modify
eric@80 9 * it under the terms of the GNU General Public License version 2 as
eric@80 10 * published by the Free Software Foundation. Note that permission is
eric@80 11 * not granted to redistribute this program under the terms of any
eric@80 12 * other version of the General Public License.
eric@80 13 *
eric@80 14 * This program is distributed in the hope that it will be useful,
eric@80 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eric@80 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eric@80 17 * GNU General Public License for more details.
eric@80 18 *
eric@80 19 * You should have received a copy of the GNU General Public License
eric@80 20 * along with this program; if not, write to the Free Software
eric@80 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
eric@80 22 */
eric@80 23
eric@80 24
eric@80 25 struct pdf_name_tree
eric@80 26 {
eric@85 27 pdf_file_handle pdf_file;
eric@85 28 struct pdf_name_tree *next; /* chain all name trees in the PDF file */
eric@85 29 bool number_tree; /* false for name tree,
eric@85 30 true for number tree */
eric@80 31 struct pdf_name_tree_node *root;
eric@80 32 };
eric@80 33
eric@80 34
eric@131 35 #define MAX_NAME_TREE_NODE_ENTRIES 32
eric@131 36
eric@131 37
eric@131 38 struct pdf_name_tree_node
eric@131 39 {
eric@131 40 struct pdf_obj *dict; /* indirect reference */
eric@131 41
eric@131 42 struct pdf_name_tree_node *parent; /* NULL for root */
eric@131 43 bool leaf;
eric@131 44
eric@131 45 int count; /* how many kids or names/numbers are
eric@131 46 attached to this node */
eric@131 47
eric@131 48 struct pdf_name_tree_node *kids [MAX_NAME_TREE_NODE_ENTRIES]; /* non-leaf only */
eric@131 49
eric@131 50 struct pdf_obj *min_key;
eric@131 51 struct pdf_obj *max_key;
eric@131 52
eric@131 53 /* following fields valid in leaf nodes only: */
eric@131 54
eric@131 55 struct pdf_obj *keys [MAX_NAME_TREE_NODE_ENTRIES];
eric@131 56 struct pdf_obj *values [MAX_NAME_TREE_NODE_ENTRIES];
eric@131 57 };
eric@131 58
eric@131 59
eric@80 60 struct pdf_name_tree *pdf_new_name_tree (pdf_file_handle pdf_file,
eric@80 61 bool number_tree);
eric@80 62
eric@80 63
eric@80 64 void pdf_add_name_tree_element (struct pdf_name_tree *tree,
eric@80 65 char *key,
eric@80 66 struct pdf_obj *val);
eric@80 67
eric@80 68
eric@80 69 void pdf_add_number_tree_element (struct pdf_name_tree *tree,
eric@80 70 long key,
eric@80 71 struct pdf_obj *val);
eric@80 72
eric@80 73
eric@85 74 void pdf_finalize_name_trees (pdf_file_handle pdf_file);