00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _TCL_HASN
00020 #define _TCL_HASH
00021
00022 #ifndef BUFSIZ
00023 #include <stdio.h>
00024 #endif
00025
00026 #define TCL_VERSION "7.4"
00027 #define TCL_MAJOR_VERSION 7
00028 #define TCL_MINOR_VERSION 4
00029
00030
00031
00032
00033
00034
00035 #undef _ANSI_ARGS_
00036 #undef CONST
00037 #if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus)
00038 # define _USING_PROTOTYPES_ 1
00039 # define _ANSI_ARGS_(x) x
00040 # define CONST const
00041 # ifdef __cplusplus
00042 # define VARARGS(first) (first, ...)
00043 # else
00044 # define VARARGS(first) ()
00045 # endif
00046 #else
00047 # define _ANSI_ARGS_(x) ()
00048 # define CONST
00049 #endif
00050
00051 #ifdef __cplusplus
00052 # define EXTERN extern "C"
00053 #else
00054 # define EXTERN extern
00055 #endif
00056
00057
00058
00059
00060
00061
00062
00063 #ifndef VOID
00064 # ifdef __STDC__
00065 # define VOID void
00066 # else
00067 # define VOID char
00068 # endif
00069 #endif
00070
00071
00072
00073
00074
00075
00076 #ifndef NULL
00077 #define NULL 0
00078 #endif
00079
00080 #ifndef _CLIENTDATA
00081 # if defined(__STDC__) || defined(__cplusplus)
00082 typedef void *ClientData;
00083 # else
00084 typedef int *ClientData;
00085 # endif
00086 #define _CLIENTDATA
00087 #endif
00088
00089
00090
00091
00092
00093
00094
00095
00096 #ifdef __cplusplus
00097 struct Tcl_HashTable;
00098 #endif
00099
00100
00101
00102
00103
00104
00105
00106 typedef struct Tcl_HashEntry {
00107 struct Tcl_HashEntry *nextPtr;
00108
00109
00110 struct Tcl_HashTable *tablePtr;
00111 struct Tcl_HashEntry **bucketPtr;
00112
00113
00114 ClientData clientData;
00115
00116 union {
00117 char *oneWordValue;
00118 int words[1];
00119
00120
00121
00122 char string[4];
00123
00124
00125 } key;
00126 } Tcl_HashEntry;
00127
00128
00129
00130
00131
00132
00133
00134 #define TCL_SMALL_HASH_TABLE 4
00135 typedef struct Tcl_HashTable {
00136 Tcl_HashEntry **buckets;
00137
00138
00139 Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
00140
00141
00142 int numBuckets;
00143
00144 int numEntries;
00145
00146 int rebuildSize;
00147
00148 int downShift;
00149
00150
00151 int mask;
00152
00153 int keyType;
00154
00155
00156
00157
00158 Tcl_HashEntry *(*findProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr,
00159 char *key));
00160 Tcl_HashEntry *(*createProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr,
00161 char *key, int *newPtr));
00162 } Tcl_HashTable;
00163
00164
00165
00166
00167
00168
00169 typedef struct Tcl_HashSearch {
00170 Tcl_HashTable *tablePtr;
00171 int nextIndex;
00172
00173 Tcl_HashEntry *nextEntryPtr;
00174
00175 } Tcl_HashSearch;
00176
00177
00178
00179
00180
00181 #define TCL_STRING_KEYS 0
00182 #define TCL_ONE_WORD_KEYS 1
00183
00184
00185
00186
00187
00188 #define Tcl_GetHashValue(h) ((h)->clientData)
00189 #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
00190 #define Tcl_GetHashKey(tablePtr, h) \
00191 ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) ? (h)->key.oneWordValue \
00192 : (h)->key.string))
00193
00194
00195
00196
00197
00198 #define Tcl_FindHashEntry(tablePtr, key) \
00199 (*((tablePtr)->findProc))(tablePtr, key)
00200 #define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
00201 (*((tablePtr)->createProc))(tablePtr, key, newPtr)
00202
00203
00204 EXTERN void Tcl_DeleteHashEntry _ANSI_ARGS_((
00205 Tcl_HashEntry *entryPtr));
00206 EXTERN void Tcl_DeleteHashTable _ANSI_ARGS_((
00207 Tcl_HashTable *tablePtr));
00208 EXTERN Tcl_HashEntry * Tcl_FirstHashEntry _ANSI_ARGS_((
00209 Tcl_HashTable *tablePtr,
00210 Tcl_HashSearch *searchPtr));
00211 EXTERN char * Tcl_HashStats _ANSI_ARGS_((Tcl_HashTable *tablePtr));
00212 EXTERN void Tcl_InitHashTable _ANSI_ARGS_((Tcl_HashTable *tablePtr,
00213 int keyType));
00214 EXTERN Tcl_HashEntry * Tcl_NextHashEntry _ANSI_ARGS_((
00215 Tcl_HashSearch *searchPtr));
00216 #endif