~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to cdt/dthdr.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This software may only be used by you under license from AT&T Corp.
 
3
    ("AT&T").  A copy of AT&T's Source Code Agreement is available at
 
4
    AT&T's Internet website having the URL:
 
5
    <http://www.research.att.com/sw/tools/graphviz/license/source.html>
 
6
    If you received this software without first entering into a license
 
7
    with AT&T, you have an infringing copy of this software and cannot use
 
8
    it without violating AT&T's intellectual property rights.
 
9
*/
 
10
#ifndef _DTHDR_H
 
11
#define _DTHDR_H        1
 
12
#ifndef _BLD_cdt
 
13
#define _BLD_cdt        1
 
14
#endif
 
15
 
 
16
/*      Internal definitions for libcdt.
 
17
**      Written by Kiem-Phong Vo (5/25/96)
 
18
*/
 
19
 
 
20
#if _PACKAGE_ast
 
21
#include        <ast.h>
 
22
#endif
 
23
 
 
24
#include        <cdt.h>
 
25
 
 
26
/* short-hand notations */
 
27
#define NIL(t)  ((t)0)
 
28
#define reg     register
 
29
#define uint    unsigned int
 
30
#define left    hl._left
 
31
#define hash    hl._hash
 
32
#define htab    hh._htab
 
33
#define head    hh._head
 
34
 
 
35
/* this must be disjoint from DT_METHODS */
 
36
#define DT_FLATTEN      010000  /* dictionary already flattened */
 
37
#define DT_WALK         020000  /* hash table being walked      */
 
38
 
 
39
/* hash start size and load factor */
 
40
#define HSLOT           (32)
 
41
#define HRESIZE(n)      ((n) << 1)
 
42
#define HLOAD(s)        ((s) << 1)
 
43
#define HINDEX(n,h)     ((h)&((n)-1))
 
44
 
 
45
#define UNFLATTEN(dt) \
 
46
                ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0)
 
47
 
 
48
/* the pointer to the actual object */
 
49
#define INITDISC(dt,d,ky,sz,lk,cmpf) \
 
50
                (d = dt->disc, ky = d->key, sz = d->size, lk = d->link, cmpf = d->comparf)
 
51
#define ELT(o,lk)       ((Dtlink_t*)((char*)(o) + lk) )
 
52
#define OBJ(e,lk)       (lk < 0 ? ((Dthold_t*)(e))->obj : (Void_t*)((char*)(e) - lk) )
 
53
#define KEY(o,ky,sz)    ((Void_t*)(sz < 0 ? *((char**)((char*)(o) + ky)) : \
 
54
                                            ((char*)(o) + ky) ) )
 
55
 
 
56
/* compare and hash functions */
 
57
#define CMP(dt,k1,k2,d,cmpf,sz) \
 
58
                (cmpf ? (*cmpf)(dt,k1,k2,d) : \
 
59
                         sz <= 0 ? strcmp(k1,k2) : memcmp(k1,k2,sz) )
 
60
#define HASH(dt,k,d,sz) (d->hashf ? (*d->hashf)(dt,k,d) : dtstrhash(0,k,sz) )
 
61
 
 
62
/* tree rotation functions */
 
63
#define RROTATE(x,y)    ((x)->left = (y)->right, (y)->right = (x), (x) = (y))
 
64
#define LROTATE(x,y)    ((x)->right = (y)->left, (y)->left  = (x), (x) = (y))
 
65
#define RLINK(r,x)      ((r) = (r)->left  = (x) )
 
66
#define LLINK(l,x)      ((l) = (l)->right = (x) )
 
67
 
 
68
#if !_PACKAGE_ast
 
69
_BEGIN_EXTERNS_
 
70
extern Void_t*  malloc _ARG_((size_t));
 
71
extern Void_t*  realloc _ARG_((Void_t*, size_t));
 
72
extern void     free _ARG_((Void_t*));
 
73
extern int      memcmp _ARG_((const Void_t*, const Void_t*, size_t));
 
74
extern int      strcmp _ARG_((const char*, const char*));
 
75
_END_EXTERNS_
 
76
#endif
 
77
 
 
78
#endif /* _DTHDR_H */