14887Schin /*********************************************************************** 24887Schin * * 34887Schin * This software is part of the ast package * 4*12068SRoger.Faulkner@Oracle.COM * Copyright (c) 1985-2010 AT&T Intellectual Property * 54887Schin * and is licensed under the * 64887Schin * Common Public License, Version 1.0 * 78462SApril.Chin@Sun.COM * by AT&T Intellectual Property * 84887Schin * * 94887Schin * A copy of the License is available at * 104887Schin * http://www.opensource.org/licenses/cpl1.0.txt * 114887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 124887Schin * * 134887Schin * Information and Software Systems Research * 144887Schin * AT&T Research * 154887Schin * Florham Park NJ * 164887Schin * * 174887Schin * Glenn Fowler <gsf@research.att.com> * 184887Schin * David Korn <dgk@research.att.com> * 194887Schin * Phong Vo <kpv@research.att.com> * 204887Schin * * 214887Schin ***********************************************************************/ 224887Schin #ifndef _DTHDR_H 234887Schin #define _DTHDR_H 1 244887Schin #ifndef _BLD_cdt 254887Schin #define _BLD_cdt 1 264887Schin #endif 274887Schin 284887Schin /* Internal definitions for libcdt. 294887Schin ** Written by Kiem-Phong Vo (5/25/96) 304887Schin */ 314887Schin 324887Schin #if _PACKAGE_ast 334887Schin #include <ast.h> 344887Schin #endif 354887Schin 364887Schin #include <cdt.h> 374887Schin 384887Schin /* short-hand notations */ 394887Schin #define NIL(t) ((t)0) 404887Schin #define reg register 414887Schin #define uint unsigned int 424887Schin #define left hl._left 434887Schin #define hash hl._hash 444887Schin #define htab hh._htab 454887Schin #define head hh._head 464887Schin 474887Schin /* this must be disjoint from DT_METHODS */ 484887Schin #define DT_FLATTEN 010000 /* dictionary already flattened */ 494887Schin #define DT_WALK 020000 /* hash table being walked */ 504887Schin 514887Schin /* how the Dt_t handle was allocated */ 524887Schin #define DT_MALLOC 0 534887Schin #define DT_MEMORYF 1 544887Schin 554887Schin /* max search length before splaying */ 564887Schin #define DT_MINP (sizeof(size_t)*8 - 2) 574887Schin 584887Schin /* hash start size and load factor */ 594887Schin #define HSLOT (256) 604887Schin #define HRESIZE(n) ((n) << 1) 614887Schin #define HLOAD(s) ((s) << 1) 624887Schin #define HINDEX(n,h) ((h)&((n)-1)) 634887Schin 644887Schin #define UNFLATTEN(dt) \ 654887Schin ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0) 664887Schin 674887Schin /* tree rotation/linking functions */ 684887Schin #define rrotate(x,y) ((x)->left = (y)->right, (y)->right = (x)) 694887Schin #define lrotate(x,y) ((x)->right = (y)->left, (y)->left = (x)) 704887Schin #define rlink(r,x) ((r) = (r)->left = (x) ) 714887Schin #define llink(l,x) ((l) = (l)->right = (x) ) 724887Schin 734887Schin #define RROTATE(x,y) (rrotate(x,y), (x) = (y)) 744887Schin #define LROTATE(x,y) (lrotate(x,y), (x) = (y)) 754887Schin 764887Schin #if !_PACKAGE_ast 774887Schin _BEGIN_EXTERNS_ 784887Schin extern Void_t* malloc _ARG_((size_t)); 794887Schin extern Void_t* realloc _ARG_((Void_t*, size_t)); 804887Schin extern void free _ARG_((Void_t*)); 814887Schin _END_EXTERNS_ 824887Schin #endif 834887Schin 844887Schin #endif /* _DTHDR_H */ 85