1 /*******************************************************/ 2 /* "C" Language Integrated Production System */ 3 /* */ 4 /* CLIPS Version 6.30 08/16/14 */ 5 /* */ 6 /* INSTANCE FUNCTIONS MODULE */ 7 /*******************************************************/ 8 9 /*************************************************************/ 10 /* Purpose: */ 11 /* */ 12 /* Principal Programmer(s): */ 13 /* Brian L. Dantes */ 14 /* */ 15 /* Contributing Programmer(s): */ 16 /* */ 17 /* Revision History: */ 18 /* */ 19 /* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */ 20 /* */ 21 /* Changed name of variable log to logName */ 22 /* because of Unix compiler warnings of shadowed */ 23 /* definitions. */ 24 /* */ 25 /* Changed name of variable exp to theExp */ 26 /* because of Unix compiler warnings of shadowed */ 27 /* definitions. */ 28 /* */ 29 /* 6.24: Link error occurs for the SlotExistError */ 30 /* function when OBJECT_SYSTEM is set to 0 in */ 31 /* setup.h. DR0865 */ 32 /* */ 33 /* Converted INSTANCE_PATTERN_MATCHING to */ 34 /* DEFRULE_CONSTRUCT. */ 35 /* */ 36 /* Renamed BOOLEAN macro type to intBool. */ 37 /* */ 38 /* Moved EvaluateAndStoreInDataObject to */ 39 /* evaluatn.c */ 40 /* */ 41 /* 6.30: Removed conditional code for unsupported */ 42 /* compilers/operating systems (IBM_MCW, */ 43 /* MAC_MCW, and IBM_TBC). */ 44 /* */ 45 /* Changed integer type/precision. */ 46 /* */ 47 /* Changed garbage collection algorithm. */ 48 /* */ 49 /* Support for long long integers. */ 50 /* */ 51 /* Added const qualifiers to remove C++ */ 52 /* deprecation warnings. */ 53 /* */ 54 /* Converted API macros to function calls. */ 55 /* */ 56 /* Fixed slot override default ?NONE bug. */ 57 /* */ 58 //*************************************************************/ 59 60 #ifndef _H_insfun 61 #define _H_insfun 62 63 #ifndef _H_evaluatn 64 #include "evaluatn.h" 65 #endif 66 #ifndef _H_moduldef 67 #include "moduldef.h" 68 #endif 69 #ifndef _H_object 70 #include "object.h" 71 #endif 72 73 #ifndef _H_pattern 74 #include "pattern.h" 75 #endif 76 77 typedef struct igarbage 78 { 79 INSTANCE_TYPE *ins; 80 struct igarbage *nxt; 81 } IGARBAGE; 82 83 #define INSTANCE_TABLE_HASH_SIZE 8191 84 #define InstanceSizeHeuristic(ins) sizeof(INSTANCE_TYPE) 85 86 #ifdef LOCALE 87 #undef LOCALE 88 #endif 89 90 #ifdef _INSFUN_SOURCE_ 91 #define LOCALE 92 #else 93 #define LOCALE extern 94 #endif 95 96 LOCALE void EnvIncrementInstanceCount(void *,void *); 97 LOCALE void EnvDecrementInstanceCount(void *,void *); 98 LOCALE void InitializeInstanceTable(void *); 99 LOCALE void CleanupInstances(void *); 100 LOCALE unsigned HashInstance(SYMBOL_HN *); 101 LOCALE void DestroyAllInstances(void *); 102 LOCALE void RemoveInstanceData(void *,INSTANCE_TYPE *); 103 LOCALE INSTANCE_TYPE *FindInstanceBySymbol(void *,SYMBOL_HN *); 104 LOCALE INSTANCE_TYPE *FindInstanceInModule(void *,SYMBOL_HN *,struct defmodule *, 105 struct defmodule *,unsigned); 106 LOCALE INSTANCE_SLOT *FindInstanceSlot(void *,INSTANCE_TYPE *,SYMBOL_HN *); 107 LOCALE int FindInstanceTemplateSlot(void *,DEFCLASS *,SYMBOL_HN *); 108 LOCALE int PutSlotValue(void *,INSTANCE_TYPE *,INSTANCE_SLOT *,DATA_OBJECT *,DATA_OBJECT *,const char *); 109 LOCALE int DirectPutSlotValue(void *,INSTANCE_TYPE *,INSTANCE_SLOT *,DATA_OBJECT *,DATA_OBJECT *); 110 LOCALE intBool ValidSlotValue(void *,DATA_OBJECT *,SLOT_DESC *,INSTANCE_TYPE *,const char *); 111 LOCALE INSTANCE_TYPE *CheckInstance(void *,const char *); 112 LOCALE void NoInstanceError(void *,const char *,const char *); 113 LOCALE void StaleInstanceAddress(void *,const char *,int); 114 LOCALE int EnvGetInstancesChanged(void *); 115 LOCALE void EnvSetInstancesChanged(void *,int); 116 LOCALE void PrintSlot(void *,const char *,SLOT_DESC *,INSTANCE_TYPE *,const char *); 117 LOCALE void PrintInstanceNameAndClass(void *,const char *,INSTANCE_TYPE *,intBool); 118 LOCALE void PrintInstanceName(void *,const char *,void *); 119 LOCALE void PrintInstanceLongForm(void *,const char *,void *); 120 #if DEFRULE_CONSTRUCT && OBJECT_SYSTEM 121 LOCALE void DecrementObjectBasisCount(void *,void *); 122 LOCALE void IncrementObjectBasisCount(void *,void *); 123 LOCALE void MatchObjectFunction(void *,void *); 124 LOCALE intBool NetworkSynchronized(void *,void *); 125 LOCALE intBool InstanceIsDeleted(void *,void *); 126 #endif 127 128 #if ALLOW_ENVIRONMENT_GLOBALS 129 130 LOCALE void DecrementInstanceCount(void *); 131 LOCALE int GetInstancesChanged(void); 132 LOCALE void IncrementInstanceCount(void *); 133 LOCALE void SetInstancesChanged(int); 134 135 #endif /* ALLOW_ENVIRONMENT_GLOBALS */ 136 137 #endif /* _H_insfun */ 138 139 140 141 142 143 144 145