1 /*******************************************************/ 2 /* "C" Language Integrated Production System */ 3 /* */ 4 /* CLIPS Version 6.30 08/16/14 */ 5 /* */ 6 /* CONSTRAINT HEADER FILE */ 7 /*******************************************************/ 8 9 /*************************************************************/ 10 /* Purpose: Provides functions for creating and removing */ 11 /* constraint records, adding them to the contraint hash */ 12 /* table, and enabling and disabling static and dynamic */ 13 /* constraint checking. */ 14 /* */ 15 /* Principal Programmer(s): */ 16 /* Gary D. Riley */ 17 /* */ 18 /* Contributing Programmer(s): */ 19 /* */ 20 /* Revision History: */ 21 /* */ 22 /* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */ 23 /* */ 24 /* 6.24: Added allowed-classes slot facet. */ 25 /* */ 26 /* Renamed BOOLEAN macro type to intBool. */ 27 /* */ 28 /* 6.30: Removed conditional code for unsupported */ 29 /* compilers/operating systems (IBM_MCW and */ 30 /* MAC_MCW). */ 31 /* */ 32 /* Changed integer type/precision. */ 33 /* */ 34 /* Converted API macros to function calls. */ 35 /* */ 36 /*************************************************************/ 37 38 #ifndef _H_constrnt 39 #define _H_constrnt 40 41 struct constraintRecord; 42 43 #ifndef _H_evaluatn 44 #include "evaluatn.h" 45 #endif 46 47 #ifdef LOCALE 48 #undef LOCALE 49 #endif 50 51 #ifdef _CONSTRNT_SOURCE_ 52 #define LOCALE 53 #else 54 #define LOCALE extern 55 #endif 56 57 struct constraintRecord 58 { 59 unsigned int anyAllowed : 1; 60 unsigned int symbolsAllowed : 1; 61 unsigned int stringsAllowed : 1; 62 unsigned int floatsAllowed : 1; 63 unsigned int integersAllowed : 1; 64 unsigned int instanceNamesAllowed : 1; 65 unsigned int instanceAddressesAllowed : 1; 66 unsigned int externalAddressesAllowed : 1; 67 unsigned int factAddressesAllowed : 1; 68 unsigned int voidAllowed : 1; 69 unsigned int anyRestriction : 1; 70 unsigned int symbolRestriction : 1; 71 unsigned int stringRestriction : 1; 72 unsigned int floatRestriction : 1; 73 unsigned int integerRestriction : 1; 74 unsigned int classRestriction : 1; 75 unsigned int instanceNameRestriction : 1; 76 unsigned int multifieldsAllowed : 1; 77 unsigned int singlefieldsAllowed : 1; 78 unsigned short bsaveIndex; 79 struct expr *classList; 80 struct expr *restrictionList; 81 struct expr *minValue; 82 struct expr *maxValue; 83 struct expr *minFields; 84 struct expr *maxFields; 85 struct constraintRecord *multifield; 86 struct constraintRecord *next; 87 int bucket; 88 int count; 89 }; 90 91 typedef struct constraintRecord CONSTRAINT_RECORD; 92 93 #define SIZE_CONSTRAINT_HASH 167 94 95 #define CONSTRAINT_DATA 43 96 97 struct constraintData 98 { 99 struct constraintRecord **ConstraintHashtable; 100 intBool StaticConstraintChecking; 101 intBool DynamicConstraintChecking; 102 #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME) 103 struct constraintRecord *ConstraintArray; 104 long int NumberOfConstraints; 105 #endif 106 }; 107 108 #define ConstraintData(theEnv) ((struct constraintData *) GetEnvironmentData(theEnv,CONSTRAINT_DATA)) 109 110 LOCALE void InitializeConstraints(void *); 111 LOCALE int GDCCommand(void *); 112 LOCALE int SDCCommand(void *d); 113 LOCALE int GSCCommand(void *); 114 LOCALE int SSCCommand(void *); 115 LOCALE intBool EnvSetDynamicConstraintChecking(void *,int); 116 LOCALE intBool EnvGetDynamicConstraintChecking(void *); 117 LOCALE intBool EnvSetStaticConstraintChecking(void *,int); 118 LOCALE intBool EnvGetStaticConstraintChecking(void *); 119 #if (! BLOAD_ONLY) && (! RUN_TIME) 120 LOCALE unsigned long HashConstraint(struct constraintRecord *); 121 LOCALE struct constraintRecord *AddConstraint(void *,struct constraintRecord *); 122 #endif 123 #if (! RUN_TIME) 124 LOCALE void RemoveConstraint(void *,struct constraintRecord *); 125 #endif 126 127 #if ALLOW_ENVIRONMENT_GLOBALS 128 129 LOCALE intBool SetDynamicConstraintChecking(int); 130 LOCALE intBool GetDynamicConstraintChecking(void); 131 LOCALE intBool SetStaticConstraintChecking(int); 132 LOCALE intBool GetStaticConstraintChecking(void); 133 134 #endif 135 136 #endif 137 138 139 140 141