/usr/include/clips/symbol.h is in libclips-dev 6.24-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | /*******************************************************/
/* "C" Language Integrated Production System */
/* */
/* CLIPS Version 6.24 06/05/06 */
/* */
/* SYMBOL HEADER FILE */
/*******************************************************/
/*************************************************************/
/* Purpose: Manages the atomic data value hash tables for */
/* storing symbols, integers, floats, and bit maps. */
/* Contains routines for adding entries, examining the */
/* hash tables, and performing garbage collection to */
/* remove entries no longer in use. */
/* */
/* Principal Programmer(s): */
/* Gary D. Riley */
/* */
/* Contributing Programmer(s): */
/* */
/* Revision History: */
/* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */
/* */
/* 6.24: Support for run-time programs directly passing */
/* the hash tables for initialization. */
/* */
/*************************************************************/
#ifndef _H_symbol
#define _H_symbol
#ifdef LOCALE
#undef LOCALE
#endif
#ifdef _SYMBOL_SOURCE_
#define LOCALE
#else
#define LOCALE extern
#endif
#ifndef SYMBOL_HASH_SIZE
#define SYMBOL_HASH_SIZE 63559L
#endif
#ifndef FLOAT_HASH_SIZE
#define FLOAT_HASH_SIZE 8191
#endif
#ifndef INTEGER_HASH_SIZE
#define INTEGER_HASH_SIZE 8191
#endif
#ifndef BITMAP_HASH_SIZE
#define BITMAP_HASH_SIZE 8191
#endif
/************************************************************/
/* symbolHashNode STRUCTURE: */
/************************************************************/
struct symbolHashNode
{
struct symbolHashNode *next;
long count;
int depth;
unsigned int permanent : 1;
unsigned int markedEphemeral : 1;
unsigned int neededSymbol : 1;
unsigned int bucket : 29;
char *contents;
};
/************************************************************/
/* floatHashNode STRUCTURE: */
/************************************************************/
struct floatHashNode
{
struct floatHashNode *next;
long count;
int depth;
unsigned int permanent : 1;
unsigned int markedEphemeral : 1;
unsigned int neededFloat : 1;
unsigned int bucket : 29;
double contents;
};
/************************************************************/
/* integerHashNode STRUCTURE: */
/************************************************************/
struct integerHashNode
{
struct integerHashNode *next;
long count;
int depth;
unsigned int permanent : 1;
unsigned int markedEphemeral : 1;
unsigned int neededInteger : 1;
unsigned int bucket : 29;
long int contents;
};
/************************************************************/
/* bitMapHashNode STRUCTURE: */
/************************************************************/
struct bitMapHashNode
{
struct bitMapHashNode *next;
long count;
int depth;
unsigned int permanent : 1;
unsigned int markedEphemeral : 1;
unsigned int neededBitMap : 1;
unsigned int bucket : 29;
char *contents;
unsigned short size;
};
/************************************************************/
/* genericHashNode STRUCTURE: */
/************************************************************/
struct genericHashNode
{
struct genericHashNode *next;
long count;
int depth;
unsigned int permanent : 1;
unsigned int markedEphemeral : 1;
unsigned int needed : 1;
unsigned int bucket : 29;
};
typedef struct symbolHashNode SYMBOL_HN;
typedef struct floatHashNode FLOAT_HN;
typedef struct integerHashNode INTEGER_HN;
typedef struct bitMapHashNode BITMAP_HN;
typedef struct genericHashNode GENERIC_HN;
/**********************************************************/
/* EPHEMERON STRUCTURE: Data structure used to keep track */
/* of ephemeral symbols, floats, and integers. */
/* */
/* associatedValue: Contains a pointer to the storage */
/* structure for the symbol, float, or integer which is */
/* ephemeral. */
/* */
/* next: Contains a pointer to the next ephemeral item */
/* in a list of ephemeral items. */
/**********************************************************/
struct ephemeron
{
GENERIC_HN *associatedValue;
struct ephemeron *next;
};
/************************************************************/
/* symbolMatch STRUCTURE: */
/************************************************************/
struct symbolMatch
{
struct symbolHashNode *match;
struct symbolMatch *next;
};
#define ValueToString(target) (((struct symbolHashNode *) (target))->contents)
#define ValueToDouble(target) (((struct floatHashNode *) (target))->contents)
#define ValueToLong(target) (((struct integerHashNode *) (target))->contents)
#define ValueToInteger(target) ((int) (((struct integerHashNode *) (target))->contents))
#define ValueToBitMap(target) ((void *) ((struct bitMapHashNode *) (target))->contents)
#define EnvValueToString(theEnv,target) (((struct symbolHashNode *) (target))->contents)
#define EnvValueToDouble(theEnv,target) (((struct floatHashNode *) (target))->contents)
#define EnvValueToLong(theEnv,target) (((struct integerHashNode *) (target))->contents)
#define EnvValueToInteger(theEnv,target) ((int) (((struct integerHashNode *) (target))->contents))
#define EnvValueToBitMap(theEnv,target) ((void *) ((struct bitMapHashNode *) (target))->contents)
#define IncrementSymbolCount(theValue) (((SYMBOL_HN *) theValue)->count++)
#define IncrementFloatCount(theValue) (((FLOAT_HN *) theValue)->count++)
#define IncrementIntegerCount(theValue) (((INTEGER_HN *) theValue)->count++)
#define IncrementBitMapCount(theValue) (((BITMAP_HN *) theValue)->count++)
/*==================*/
/* ENVIRONMENT DATA */
/*==================*/
#define SYMBOL_DATA 49
struct symbolData
{
void *TrueSymbolHN;
void *FalseSymbolHN;
void *PositiveInfinity;
void *NegativeInfinity;
void *Zero;
SYMBOL_HN **SymbolTable;
FLOAT_HN **FloatTable;
INTEGER_HN **IntegerTable;
BITMAP_HN **BitMapTable;
struct ephemeron *EphemeralSymbolList;
struct ephemeron *EphemeralFloatList;
struct ephemeron *EphemeralIntegerList;
struct ephemeron *EphemeralBitMapList;
#if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE || BLOAD_INSTANCES || BSAVE_INSTANCES
long NumberOfSymbols;
long NumberOfFloats;
long NumberOfIntegers;
long NumberOfBitMaps;
SYMBOL_HN **SymbolArray;
struct floatHashNode **FloatArray;
INTEGER_HN **IntegerArray;
BITMAP_HN **BitMapArray;
#endif
};
#define SymbolData(theEnv) ((struct symbolData *) GetEnvironmentData(theEnv,SYMBOL_DATA))
#define EnvFalseSymbol(theEnv) SymbolData(theEnv)->FalseSymbolHN
#define EnvTrueSymbol(theEnv) SymbolData(theEnv)->TrueSymbolHN
#if ENVIRONMENT_API_ONLY
#define FalseSymbol(theEnv) SymbolData(theEnv)->FalseSymbolHN
#define TrueSymbol(theEnv) SymbolData(theEnv)->TrueSymbolHN
#define AddSymbol(theEnv,a) EnvAddSymbol(theEnv,a)
#define AddLong(theEnv,a) EnvAddLong(theEnv,a)
#define AddDouble(theEnv,a) EnvAddDouble(theEnv,a)
#else
#define FalseSymbol() SymbolData(GetCurrentEnvironment())->FalseSymbolHN
#define TrueSymbol() SymbolData(GetCurrentEnvironment())->TrueSymbolHN
#define AddSymbol(a) EnvAddSymbol(GetCurrentEnvironment(),a)
#define AddLong(a) EnvAddLong(GetCurrentEnvironment(),a)
#define AddDouble(a) EnvAddDouble(GetCurrentEnvironment(),a)
#endif
LOCALE void InitializeAtomTables(void *,struct symbolHashNode **,struct floatHashNode **,
struct integerHashNode **,struct bitMapHashNode **);
LOCALE void *EnvAddSymbol(void *,char *);
LOCALE SYMBOL_HN *FindSymbolHN(void *,char *);
LOCALE void *EnvAddDouble(void *,double);
LOCALE void *EnvAddLong(void *,long int);
LOCALE void *AddBitMap(void *,void *,unsigned);
LOCALE INTEGER_HN *FindLongHN(void *,long int);
LOCALE unsigned long HashSymbol(char *,unsigned long);
LOCALE unsigned HashFloat(double,unsigned);
LOCALE unsigned HashInteger(long int,unsigned);
LOCALE unsigned HashBitMap(char *,unsigned,unsigned);
LOCALE void DecrementSymbolCount(void *,struct symbolHashNode *);
LOCALE void DecrementFloatCount(void *,struct floatHashNode *);
LOCALE void DecrementIntegerCount(void *,struct integerHashNode *);
LOCALE void DecrementBitMapCount(void *,struct bitMapHashNode *);
LOCALE void RemoveEphemeralAtoms(void *);
LOCALE struct symbolHashNode **GetSymbolTable(void *);
LOCALE void SetSymbolTable(void *,struct symbolHashNode **);
LOCALE struct floatHashNode **GetFloatTable(void *);
LOCALE void SetFloatTable(void *,struct floatHashNode **);
LOCALE struct integerHashNode **GetIntegerTable(void *);
LOCALE void SetIntegerTable(void *,struct integerHashNode **);
LOCALE struct bitMapHashNode **GetBitMapTable(void *);
LOCALE void SetBitMapTable(void *,struct bitMapHashNode **);
LOCALE void RefreshSpecialSymbols(void *);
LOCALE struct symbolMatch *FindSymbolMatches(void *,char *,unsigned *,unsigned *);
LOCALE void ReturnSymbolMatches(void *,struct symbolMatch *);
LOCALE SYMBOL_HN *GetNextSymbolMatch(void *,char *,unsigned,SYMBOL_HN *,int,unsigned *);
LOCALE void ClearBitString(void *,unsigned);
LOCALE void SetAtomicValueIndices(void *,int);
LOCALE void RestoreAtomicValueBuckets(void *);
#endif
|