1*4887Schin /*********************************************************************** 2*4887Schin * * 3*4887Schin * This software is part of the ast package * 4*4887Schin * Copyright (c) 1985-2007 AT&T Knowledge Ventures * 5*4887Schin * and is licensed under the * 6*4887Schin * Common Public License, Version 1.0 * 7*4887Schin * by AT&T Knowledge Ventures * 8*4887Schin * * 9*4887Schin * A copy of the License is available at * 10*4887Schin * http://www.opensource.org/licenses/cpl1.0.txt * 11*4887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 12*4887Schin * * 13*4887Schin * Information and Software Systems Research * 14*4887Schin * AT&T Research * 15*4887Schin * Florham Park NJ * 16*4887Schin * * 17*4887Schin * Glenn Fowler <gsf@research.att.com> * 18*4887Schin * David Korn <dgk@research.att.com> * 19*4887Schin * Phong Vo <kpv@research.att.com> * 20*4887Schin * * 21*4887Schin ***********************************************************************/ 22*4887Schin #ifndef _DTHDR_H 23*4887Schin #define _DTHDR_H 1 24*4887Schin #ifndef _BLD_cdt 25*4887Schin #define _BLD_cdt 1 26*4887Schin #endif 27*4887Schin 28*4887Schin /* Internal definitions for libcdt. 29*4887Schin ** Written by Kiem-Phong Vo (5/25/96) 30*4887Schin */ 31*4887Schin 32*4887Schin #if _PACKAGE_ast 33*4887Schin #include <ast.h> 34*4887Schin #endif 35*4887Schin 36*4887Schin #include <cdt.h> 37*4887Schin 38*4887Schin /* short-hand notations */ 39*4887Schin #define NIL(t) ((t)0) 40*4887Schin #define reg register 41*4887Schin #define uint unsigned int 42*4887Schin #define left hl._left 43*4887Schin #define hash hl._hash 44*4887Schin #define htab hh._htab 45*4887Schin #define head hh._head 46*4887Schin 47*4887Schin /* this must be disjoint from DT_METHODS */ 48*4887Schin #define DT_FLATTEN 010000 /* dictionary already flattened */ 49*4887Schin #define DT_WALK 020000 /* hash table being walked */ 50*4887Schin 51*4887Schin /* how the Dt_t handle was allocated */ 52*4887Schin #define DT_MALLOC 0 53*4887Schin #define DT_MEMORYF 1 54*4887Schin 55*4887Schin /* max search length before splaying */ 56*4887Schin #define DT_MINP (sizeof(size_t)*8 - 2) 57*4887Schin 58*4887Schin /* hash start size and load factor */ 59*4887Schin #define HSLOT (256) 60*4887Schin #define HRESIZE(n) ((n) << 1) 61*4887Schin #define HLOAD(s) ((s) << 1) 62*4887Schin #define HINDEX(n,h) ((h)&((n)-1)) 63*4887Schin 64*4887Schin #define UNFLATTEN(dt) \ 65*4887Schin ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0) 66*4887Schin 67*4887Schin /* tree rotation/linking functions */ 68*4887Schin #define rrotate(x,y) ((x)->left = (y)->right, (y)->right = (x)) 69*4887Schin #define lrotate(x,y) ((x)->right = (y)->left, (y)->left = (x)) 70*4887Schin #define rlink(r,x) ((r) = (r)->left = (x) ) 71*4887Schin #define llink(l,x) ((l) = (l)->right = (x) ) 72*4887Schin 73*4887Schin #define RROTATE(x,y) (rrotate(x,y), (x) = (y)) 74*4887Schin #define LROTATE(x,y) (lrotate(x,y), (x) = (y)) 75*4887Schin 76*4887Schin #if !_PACKAGE_ast 77*4887Schin _BEGIN_EXTERNS_ 78*4887Schin extern Void_t* malloc _ARG_((size_t)); 79*4887Schin extern Void_t* realloc _ARG_((Void_t*, size_t)); 80*4887Schin extern void free _ARG_((Void_t*)); 81*4887Schin _END_EXTERNS_ 82*4887Schin #endif 83*4887Schin 84*4887Schin #endif /* _DTHDR_H */ 85