pdf_name_tree.h

Fri, 14 Mar 2003 08:24:37 +0000

author
eric
date
Fri, 14 Mar 2003 08:24:37 +0000
changeset 131
4b8c80d77f76
parent 125
e2ef1c2f9eca
permissions
-rw-r--r--

finished implementing page labels.

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