cdt.h revision 34f9b3eef6fdadbda0a846aa4d68691ac40eace5
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#ifndef _CDT_H
#define _CDT_H 1
/* Public interface for the dictionary library
**
** Written by Kiem-Phong Vo
*/
#define CDT_VERSION 20050420L
#if _PACKAGE_ast
#include <ast_std.h>
#else
#include <ast_common.h>
#endif
typedef struct _dtmethod_s Dtmethod_t;
struct _dtlink_s
union
{ unsigned int _hash; /* hash value */
} hl;
};
/* private structure to hold an object */
struct _dthold_s
};
/* method to manipulate dictionary structure */
struct _dtmethod_s
int type; /* type of operation */
};
/* stuff that may be in shared memory */
struct _dtdata_s
{ int type; /* type of dictionary */
union
} hh;
int ntab; /* number of hash slots */
int size; /* number of objects */
int loop; /* number of nested loops */
int minp; /* min path before splay, always even */
/* for hash dt, > 0: fixed table size */
};
/* structure to hold methods that manipulate an object */
struct _dtdisc_s
{ int key; /* where the key begins in an object */
int size; /* key size and type */
int link; /* offset to Dtlink_t field */
};
#ifdef offsetof
#else
#endif
/* the dictionary structure itself */
struct _dt_s
int type; /* type information */
int nview; /* number of parent view dictionaries */
};
/* structure to get status of a dictionary */
struct _dtstat_s
{ int dt_meth; /* method type */
int dt_size; /* number of elements */
int dt_n; /* number of chains or levels */
int dt_max; /* max size of a chain or a level */
int* dt_count; /* counts of chains or levels by size */
};
/* flag set if the last search operation actually found the object */
#define DT_FOUND 0100000
/* supported storage methods */
/* asserts to dtdisc() */
/* types of search */
/* events */
_BEGIN_EXTERNS_ /* public data */
#if _BLD_cdt && defined(__EXPORT__)
#define extern __EXPORT__
#endif
#if !_BLD_cdt && defined(__IMPORT__)
#define extern __IMPORT__
#endif
extern Dtmethod_t* Dtset;
extern Dtmethod_t* Dtbag;
extern Dtmethod_t* Dtoset;
extern Dtmethod_t* Dtobag;
extern Dtmethod_t* Dtlist;
extern Dtmethod_t* Dtstack;
extern Dtmethod_t* Dtqueue;
/* compatibility stuff; will go away */
#ifndef KPVDEL
extern Dtmethod_t* Dtorder;
extern Dtmethod_t* Dttree;
extern Dtmethod_t* Dthash;
extern Dtmethod_t _Dttree;
extern Dtmethod_t _Dthash;
extern Dtmethod_t _Dtlist;
extern Dtmethod_t _Dtqueue;
extern Dtmethod_t _Dtstack;
#endif
#undef extern
_BEGIN_EXTERNS_ /* public functions */
#if _BLD_cdt && defined(__EXPORT__)
#define extern __EXPORT__
#endif
#if !_PACKAGE_ast
#endif
#undef extern
/* internal functions for translating among holder, object and key */
/* special search function for tree structure only */
break; \
} \
} while(0)
break; \
} \
} while(0)
#define dtcharhash(h,c) (((unsigned int)(h) + (unsigned int)(c)) * DT_PRIME )
#endif /* _CDT_H */