1    /*******************************************************/
2    /*      "C" Language Integrated Production System      */
3    /*                                                     */
4    /*               CLIPS Version 6.30  08/22/14          */
5    /*                                                     */
6    /*                                                     */
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 /*            Corrected compilation errors for files         */
22 /*            generated by constructs-to-c. DR0861           */
23 /*                                                           */
24 /*      6.24: Loading a binary instance file from a run-time */
25 /*            program caused a bus error. DR0866             */
26 /*                                                           */
27 /*            Removed LOGICAL_DEPENDENCIES compilation flag. */
28 /*                                                           */
29 /*            Converted INSTANCE_PATTERN_MATCHING to         */
30 /*            DEFRULE_CONSTRUCT.                             */
31 /*                                                           */
32 /*            Renamed BOOLEAN macro type to intBool.         */
33 /*                                                           */
34 /*      6.30: Removed conditional code for unsupported       */
35 /*            compilers/operating systems (IBM_MCW,          */
36 /*            MAC_MCW, and IBM_TBC).                         */
37 /*                                                           */
38 /*            Changed integer type/precision.                */
39 /*                                                           */
40 /*            Changed garbage collection algorithm.          */
41 /*                                                           */
42 /*            Added const qualifiers to remove C++           */
43 /*            deprecation warnings.                          */
44 /*                                                           */
45 /*            Converted API macros to function calls.        */
46 /*                                                           */
47 /*************************************************************/
48 
49 #ifndef _H_inscom
50 #define _H_inscom
51 
52 #ifndef _H_object
53 #include "object.h"
54 #endif
55 
56 #ifndef _H_insfun
57 #include "insfun.h"
58 #endif
59 
60 #define INSTANCE_DATA 29
61 
62 struct instanceData
63   {
64    INSTANCE_TYPE DummyInstance;
65    INSTANCE_TYPE **InstanceTable;
66    int MaintainGarbageInstances;
67    int MkInsMsgPass;
68    int ChangesToInstances;
69    IGARBAGE *InstanceGarbageList;
70    struct patternEntityRecord InstanceInfo;
71    INSTANCE_TYPE *InstanceList;
72    unsigned long GlobalNumberOfInstances;
73    INSTANCE_TYPE *CurrentInstance;
74    INSTANCE_TYPE *InstanceListBottom;
75    intBool ObjectModDupMsgValid;
76   };
77 
78 #define InstanceData(theEnv) ((struct instanceData *) GetEnvironmentData(theEnv,INSTANCE_DATA))
79 
80 #ifdef LOCALE
81 #undef LOCALE
82 #endif
83 
84 #ifdef _INSCOM_SOURCE_
85 #define LOCALE
86 #else
87 #define LOCALE extern
88 #endif
89 
90    LOCALE void                           SetupInstances(void *);
91    LOCALE intBool                        EnvDeleteInstance(void *,void *);
92    LOCALE intBool                        EnvUnmakeInstance(void *,void *);
93 #if DEBUGGING_FUNCTIONS
94    LOCALE void                           InstancesCommand(void *);
95    LOCALE void                           PPInstanceCommand(void *);
96    LOCALE void                           EnvInstances(void *,const char *,void *,const char *,int);
97 #endif
98    LOCALE void                          *EnvMakeInstance(void *,const char *);
99    LOCALE void                          *EnvCreateRawInstance(void *,void *,const char *);
100    LOCALE void                          *EnvFindInstance(void *,void *,const char *,unsigned);
101    LOCALE int                            EnvValidInstanceAddress(void *,void *);
102    LOCALE void                           EnvDirectGetSlot(void *,void *,const char *,DATA_OBJECT *);
103    LOCALE int                            EnvDirectPutSlot(void *,void *,const char *,DATA_OBJECT *);
104    LOCALE const char                    *EnvGetInstanceName(void *,void *);
105    LOCALE void                          *EnvGetInstanceClass(void *,void *);
106    LOCALE unsigned long GetGlobalNumberOfInstances(void *);
107    LOCALE void                          *EnvGetNextInstance(void *,void *);
108    LOCALE void                          *GetNextInstanceInScope(void *,void *);
109    LOCALE void                          *EnvGetNextInstanceInClass(void *,void *,void *);
110    LOCALE void                          *EnvGetNextInstanceInClassAndSubclasses(void *,void **,void *,DATA_OBJECT *);
111    LOCALE void                           EnvGetInstancePPForm(void *,char *,size_t,void *);
112    LOCALE void                           ClassCommand(void *,DATA_OBJECT *);
113    LOCALE intBool                        DeleteInstanceCommand(void *);
114    LOCALE intBool                        UnmakeInstanceCommand(void *);
115    LOCALE void                           SymbolToInstanceName(void *,DATA_OBJECT *);
116    LOCALE void                          *InstanceNameToSymbol(void *);
117    LOCALE void                           InstanceAddressCommand(void *,DATA_OBJECT *);
118    LOCALE void                           InstanceNameCommand(void *,DATA_OBJECT *);
119    LOCALE intBool                        InstanceAddressPCommand(void *);
120    LOCALE intBool                        InstanceNamePCommand(void *);
121    LOCALE intBool                        InstancePCommand(void *);
122    LOCALE intBool                        InstanceExistPCommand(void *);
123    LOCALE intBool                        CreateInstanceHandler(void *);
124 
125 #if ALLOW_ENVIRONMENT_GLOBALS
126 
127    LOCALE const char                    *GetInstanceName(void *);
128    LOCALE void                          *CreateRawInstance(void *,const char *);
129    LOCALE intBool                        DeleteInstance(void *);
130    LOCALE void                           DirectGetSlot(void *,const char *,DATA_OBJECT *);
131    LOCALE int                            DirectPutSlot(void *,const char *,DATA_OBJECT *);
132    LOCALE void                          *FindInstance(void *,const char *,unsigned);
133    LOCALE void                          *GetInstanceClass(void *);
134    LOCALE void                           GetInstancePPForm(char *,unsigned,void *);
135    LOCALE void                          *GetNextInstance(void *);
136    LOCALE void                          *GetNextInstanceInClass(void *,void *);
137    LOCALE void                          *GetNextInstanceInClassAndSubclasses(void **,void *,DATA_OBJECT *);
138    LOCALE void                           Instances(const char *,void *,const char *,int);
139 #if DEBUGGING_FUNCTIONS
140    LOCALE void                          *MakeInstance(const char *);
141 #endif
142    LOCALE intBool                        UnmakeInstance(void *);
143    LOCALE int                            ValidInstanceAddress(void *);
144 
145 #endif /* ALLOW_ENVIRONMENT_GLOBALS */
146 
147 #endif /* _H_inscom */
148 
149 
150 
151 
152 
153