/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/cdt/dthdr.h

Go to the documentation of this file.
00001 /* $Id: dthdr.h,v 1.2 2006/12/07 22:49:35 erg Exp $ $Revision: 1.2 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 #ifndef _DTHDR_H
00022 #define _DTHDR_H        1
00023 #ifndef _BLD_cdt
00024 #define _BLD_cdt        1
00025 #endif
00026 
00027 /*      Internal definitions for libcdt.
00028 **      Written by Kiem-Phong Vo (5/25/96)
00029 */
00030 
00031 #if _PACKAGE_ast
00032 #include        <ast.h>
00033 #endif
00034 
00035 #include        <cdt.h>
00036 
00037 /* short-hand notations */
00038 #define reg     register
00039 #define uint    unsigned int
00040 #define left    hl._left
00041 #define hash    hl._hash
00042 #define htab    hh._htab
00043 #define head    hh._head
00044 
00045 /* this must be disjoint from DT_METHODS */
00046 #define DT_FLATTEN      010000  /* dictionary already flattened */
00047 #define DT_WALK         020000  /* hash table being walked      */
00048 
00049 /* hash start size and load factor */
00050 #define HSLOT           (32)
00051 #define HRESIZE(n)      ((n) << 1)
00052 #define HLOAD(s)        ((s) << 1)
00053 #define HINDEX(n,h)     ((h)&((n)-1))
00054 
00055 #define UNFLATTEN(dt) \
00056                 ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0)
00057 
00058 /* the pointer to the actual object */
00059 #define INITDISC(dt,d,ky,sz,lk,cmpf) \
00060                 (d = dt->disc, ky = d->key, sz = d->size, lk = d->link, cmpf = d->comparf)
00061 #define ELT(o,lk)       ((Dtlink_t*)((char*)(o) + lk) )
00062 #define OBJ(e,lk)       (lk < 0 ? ((Dthold_t*)(e))->obj : (Void_t*)((char*)(e) - lk) )
00063 #define KEY(o,ky,sz)    ((Void_t*)(sz < 0 ? *((char**)((char*)(o) + ky)) : \
00064                                             ((char*)(o) + ky) ) )
00065 
00066 /* compare and hash functions */
00067 #define CMP(dt,k1,k2,d,cmpf,sz) \
00068                 (cmpf ? (*cmpf)(dt,k1,k2,d) : \
00069                          sz <= 0 ? strcmp(k1,k2) : memcmp(k1,k2,sz) )
00070 #define HASH(dt,k,d,sz) (d->hashf ? (*d->hashf)(dt,k,d) : dtstrhash(0,k,sz) )
00071 
00072 /* tree rotation functions */
00073 #define RROTATE(x,y)    ((x)->left = (y)->right, (y)->right = (x), (x) = (y))
00074 #define LROTATE(x,y)    ((x)->right = (y)->left, (y)->left  = (x), (x) = (y))
00075 #define RLINK(r,x)      ((r) = (r)->left  = (x) )
00076 #define LLINK(l,x)      ((l) = (l)->right = (x) )
00077 
00078 #if !_PACKAGE_ast
00079     _BEGIN_EXTERNS_ extern Void_t *malloc _ARG_((size_t));
00080     extern Void_t *realloc _ARG_((Void_t *, size_t));
00081     extern void free _ARG_((Void_t *));
00082     extern int memcmp _ARG_((const Void_t *, const Void_t *, size_t));
00083     extern int strcmp _ARG_((const char *, const char *));
00084      _END_EXTERNS_
00085 #endif
00086 #endif                          /* _DTHDR_H */
00087 #ifdef __cplusplus
00088 }
00089 #endif

Generated on Mon Mar 31 19:03:23 2008 for Graphviz by  doxygen 1.5.1