Graphviz 2.29.20120208.0545
lib/cdt/dthdr.h
Go to the documentation of this file.
00001 #ifndef _DTHDR_H
00002 #define _DTHDR_H        1
00003 #ifndef _BLD_cdt
00004 #define _BLD_cdt        1
00005 #endif
00006 
00007 /*      Internal definitions for libcdt.
00008 **      Written by Kiem-Phong Vo (5/25/96)
00009 */
00010 
00011 #if _PACKAGE_ast
00012 #include        <ast.h>
00013 #endif
00014 
00015 #include        <cdt.h>
00016 
00017 /* short-hand notations */
00018 #define NIL(t)  ((t)0)
00019 #define reg     register
00020 #define uint    unsigned int
00021 #define left    hl._left
00022 #define hash    hl._hash
00023 #define htab    hh._htab
00024 #define head    hh._head
00025 
00026 /* this must be disjoint from DT_METHODS */
00027 #define DT_FLATTEN      010000  /* dictionary already flattened */
00028 #define DT_WALK         020000  /* hash table being walked      */
00029 
00030 /* how the Dt_t handle was allocated */
00031 #define DT_MALLOC       0
00032 #define DT_MEMORYF      1
00033 
00034 /* max search length before splaying */
00035 #define DT_MINP         (sizeof(size_t)*8 - 2)
00036 
00037 /* hash start size and load factor */
00038 #define HSLOT           (256)
00039 #define HRESIZE(n)      ((n) << 1)
00040 #define HLOAD(s)        ((s) << 1)
00041 #define HINDEX(n,h)     ((h)&((n)-1))
00042 
00043 #define UNFLATTEN(dt) \
00044                 ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0)
00045 
00046 /* tree rotation/linking functions */
00047 #define rrotate(x,y)    ((x)->left  = (y)->right, (y)->right = (x))
00048 #define lrotate(x,y)    ((x)->right = (y)->left,  (y)->left  = (x))
00049 #define rlink(r,x)      ((r) = (r)->left   = (x) )
00050 #define llink(l,x)      ((l) = (l)->right  = (x) )
00051 
00052 #define RROTATE(x,y)    (rrotate(x,y), (x) = (y))
00053 #define LROTATE(x,y)    (lrotate(x,y), (x) = (y))
00054 
00055 #if !_PACKAGE_ast
00056 _BEGIN_EXTERNS_
00057 extern Void_t*  malloc _ARG_((size_t));
00058 extern Void_t*  realloc _ARG_((Void_t*, size_t));
00059 extern void     free _ARG_((Void_t*));
00060 _END_EXTERNS_
00061 #endif
00062 
00063 #endif /* _DTHDR_H */