00001 /*******************************************************/ 00002 /* "C" Language Integrated Production System */ 00003 /* */ 00004 /* CLIPS Version 6.24 07/01/05 */ 00005 /* */ 00006 /* CONSTRAINT HEADER FILE */ 00007 /*******************************************************/ 00008 00009 /*************************************************************/ 00010 /* Purpose: Provides functions for creating and removing */ 00011 /* constraint records, adding them to the contraint hash */ 00012 /* table, and enabling and disabling static and dynamic */ 00013 /* constraint checking. */ 00014 /* */ 00015 /* Principal Programmer(s): */ 00016 /* Gary D. Riley */ 00017 /* */ 00018 /* Contributing Programmer(s): */ 00019 /* */ 00020 /* Revision History: */ 00021 /* 6.24: Added allowed-classes slot facet. */ 00022 /* */ 00023 /* Renamed BOOLEAN macro type to intBool. */ 00024 /* */ 00025 /*************************************************************/ 00026 00027 #ifndef _H_constrnt 00028 #define _H_constrnt 00029 00030 struct constraintRecord; 00031 00032 #ifndef _H_evaluatn 00033 #include "evaluatn.h" 00034 #endif 00035 00036 #ifdef LOCALE 00037 #undef LOCALE 00038 #endif 00039 00040 #ifdef _CONSTRNT_SOURCE_ 00041 #define LOCALE 00042 #else 00043 #define LOCALE extern 00044 #endif 00045 00046 struct constraintRecord 00047 { 00048 unsigned int anyAllowed : 1; 00049 unsigned int symbolsAllowed : 1; 00050 unsigned int stringsAllowed : 1; 00051 unsigned int floatsAllowed : 1; 00052 unsigned int integersAllowed : 1; 00053 unsigned int instanceNamesAllowed : 1; 00054 unsigned int instanceAddressesAllowed : 1; 00055 unsigned int externalAddressesAllowed : 1; 00056 unsigned int factAddressesAllowed : 1; 00057 unsigned int voidAllowed : 1; 00058 unsigned int anyRestriction : 1; 00059 unsigned int symbolRestriction : 1; 00060 unsigned int stringRestriction : 1; 00061 unsigned int floatRestriction : 1; 00062 unsigned int integerRestriction : 1; 00063 unsigned int classRestriction : 1; 00064 unsigned int instanceNameRestriction : 1; 00065 unsigned int multifieldsAllowed : 1; 00066 unsigned int singlefieldsAllowed : 1; 00067 unsigned short bsaveIndex; 00068 struct expr *classList; 00069 struct expr *restrictionList; 00070 struct expr *minValue; 00071 struct expr *maxValue; 00072 struct expr *minFields; 00073 struct expr *maxFields; 00074 struct constraintRecord *multifield; 00075 struct constraintRecord *next; 00076 int bucket; 00077 int count; 00078 }; 00079 00080 typedef struct constraintRecord CONSTRAINT_RECORD; 00081 00082 #define SIZE_CONSTRAINT_HASH 167 00083 00084 #define CONSTRAINT_DATA 43 00085 00086 struct constraintData 00087 { 00088 struct constraintRecord **ConstraintHashtable; 00089 intBool StaticConstraintChecking; 00090 intBool DynamicConstraintChecking; 00091 #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME) 00092 struct constraintRecord *ConstraintArray; 00093 long int NumberOfConstraints; 00094 #endif 00095 }; 00096 00097 #define ConstraintData(theEnv) ((struct constraintData *) GetEnvironmentData(theEnv,CONSTRAINT_DATA)) 00098 00099 #define GetDynamicConstraintChecking() EnvGetDynamicConstraintChecking(GetCurrentEnvironment()) 00100 #define GetStaticConstraintChecking() EnvGetStaticConstraintChecking(GetCurrentEnvironment()) 00101 #define SetDynamicConstraintChecking(a) EnvSetDynamicConstraintChecking(GetCurrentEnvironment(),a) 00102 #define SetStaticConstraintChecking(a) EnvSetStaticConstraintChecking(GetCurrentEnvironment(),a) 00103 00104 LOCALE void InitializeConstraints(void *); 00105 LOCALE int GDCCommand(void *); 00106 LOCALE int SDCCommand(void *d); 00107 LOCALE int GSCCommand(void *); 00108 LOCALE int SSCCommand(void *); 00109 LOCALE intBool EnvSetDynamicConstraintChecking(void *,int); 00110 LOCALE intBool EnvGetDynamicConstraintChecking(void *); 00111 LOCALE intBool EnvSetStaticConstraintChecking(void *,int); 00112 LOCALE intBool EnvGetStaticConstraintChecking(void *); 00113 #if (! BLOAD_ONLY) && (! RUN_TIME) 00114 LOCALE unsigned long HashConstraint(struct constraintRecord *); 00115 LOCALE struct constraintRecord *AddConstraint(void *,struct constraintRecord *); 00116 #endif 00117 #if (! RUN_TIME) 00118 LOCALE void RemoveConstraint(void *,struct constraintRecord *); 00119 #endif 00120 00121 #endif 00122 00123 00124 00125
1.5.6