#ifndef HAVE_URTREE_PRIVATE_H #define HAVE_URTREE_PRIVATE_H /* --------------------------------------------------------------------- */ /* BEGIN COPYRIGHT AND LICENSE NOTICE */ /* --------------------------------------------------------------------- */ /* ** Copyright (c) 2007, 2009 by Richard Harter. ** ** Permission is hereby granted, free of charge, to any person ** obtaining a copy of this software and associated documentation ** files , to deal in the Software without ** restriction, including without limitation the rights to use, ** copy, modify, merge, publish, distribute, sublicense, and/or ** sell copies of the Software, and to permit persons to whom the ** Software is furnished to do so, subject to the following ** conditions: ** ** The above copyright notice and this permission notice shall be ** included in copies of this software and in copies of substantial ** portions, whether or not the software has been modified. ** ** Derivative works shall include a notice that the software is a ** modified version of the copyrighted software. ** ** There is no guarantee that this software is useful for anything ** or that it is any way correct or of value. The author disclaims ** any responsibility for the consequences of using this software. ** */ /* --------------------------------------------------------------------- */ /* END COPYRIGHT AND LICENSE NOTICE */ /* --------------------------------------------------------------------- */ /* ----------------------------------------------------------------- */ /* Revision History */ /* */ /* April 22, 2007 - Base release 1.0.0 */ /* */ /* ----------------------------------------------------------------- */ #include #include "urtree.h" #include "stgpool.h" #define URT_MAX_SMALL_STRING_SIZE 255 #define URT_NODE struct urt_node #define URT_VALUE struct urt_data #define URT_BAGS struct urt_bags #define URT_STACKREC struct stackrec #define URT_STACKHDR struct stackhdr #define URT_INTNODE struct intnode #define ADDKEY_RET struct addkey_ret #define TREE_STATS struct tree_stats #define UN_NODE union un_node #define N_SIB_FREELISTS 6 #define BAG_SIZE 680 UN_NODE { URT_NODE * kids; /* Children node */ URT_NODE * link; /* Link field for free list */ URT_VALUE * data; /* Data field if a leaf */ URT_INTNODE * pair; /* (node, integer) pair */ }; URT_VALUE { int len; /* Length of the data item in bytes */ unsigned char * data; /* The data item in char array form */ VAL_ALT id; /* A handle to be used elsewhere */ size_t seqno; /* Sequence number for signature */ URT_VALUE * link; /* Link field for free list */ }; URT_NODE { int index; /* Char position for this node */ UN_NODE un[16]; /* Array of pointers */ int mode; /* Un bit flags: 1 = kids, 0=data */ }; URT_STACKREC { URT_NODE * node; int nibble; }; URT_INTNODE { URT_NODE * node; int ival; }; ADDKEY_RET { int success; VAL_ALT value; }; TREE_STATS { long cum_depth; /* Sum of depth(key) for all keys */ long max_depth; /* Maximum depth in tree */ long num_nodes; /* Number of nodes in tree */ long num_keys; /* Number of keys in tree */ }; URT_HANDLE { URT_NODE * roots[URT_MAX_SMALL_STRING_SIZE + 1]; URT_NODE * node_freelist; URT_VALUE * data_freelist; FILE * errfile; URT_NODE * big_data; stgpool_s * pool; size_t seqno; int id_type; /* int = 0, ptr = 1 */ int copy; /* make a copy of the key? */ }; #endif