clipsruby 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/clipsruby/agenda.c +1373 -0
- data/ext/clipsruby/agenda.h +169 -0
- data/ext/clipsruby/analysis.c +1142 -0
- data/ext/clipsruby/analysis.h +61 -0
- data/ext/clipsruby/argacces.c +526 -0
- data/ext/clipsruby/argacces.h +77 -0
- data/ext/clipsruby/bload.c +884 -0
- data/ext/clipsruby/bload.h +94 -0
- data/ext/clipsruby/bmathfun.c +557 -0
- data/ext/clipsruby/bmathfun.h +66 -0
- data/ext/clipsruby/bsave.c +634 -0
- data/ext/clipsruby/bsave.h +130 -0
- data/ext/clipsruby/classcom.c +976 -0
- data/ext/clipsruby/classcom.h +115 -0
- data/ext/clipsruby/classexm.c +1376 -0
- data/ext/clipsruby/classexm.h +97 -0
- data/ext/clipsruby/classfun.c +1392 -0
- data/ext/clipsruby/classfun.h +164 -0
- data/ext/clipsruby/classinf.c +1245 -0
- data/ext/clipsruby/classinf.h +94 -0
- data/ext/clipsruby/classini.c +843 -0
- data/ext/clipsruby/classini.h +75 -0
- data/ext/clipsruby/classpsr.c +957 -0
- data/ext/clipsruby/classpsr.h +73 -0
- data/ext/clipsruby/clips.h +133 -0
- data/ext/clipsruby/clipsruby.c +619 -0
- data/ext/clipsruby/clsltpsr.c +931 -0
- data/ext/clipsruby/clsltpsr.h +72 -0
- data/ext/clipsruby/commline.c +1217 -0
- data/ext/clipsruby/commline.h +131 -0
- data/ext/clipsruby/conscomp.c +1593 -0
- data/ext/clipsruby/conscomp.h +150 -0
- data/ext/clipsruby/constant.h +264 -0
- data/ext/clipsruby/constrct.c +1090 -0
- data/ext/clipsruby/constrct.h +216 -0
- data/ext/clipsruby/constrnt.c +554 -0
- data/ext/clipsruby/constrnt.h +132 -0
- data/ext/clipsruby/crstrtgy.c +1088 -0
- data/ext/clipsruby/crstrtgy.h +85 -0
- data/ext/clipsruby/cstrcbin.c +185 -0
- data/ext/clipsruby/cstrcbin.h +61 -0
- data/ext/clipsruby/cstrccmp.h +43 -0
- data/ext/clipsruby/cstrccom.c +1791 -0
- data/ext/clipsruby/cstrccom.h +115 -0
- data/ext/clipsruby/cstrcpsr.c +835 -0
- data/ext/clipsruby/cstrcpsr.h +97 -0
- data/ext/clipsruby/cstrnbin.c +282 -0
- data/ext/clipsruby/cstrnbin.h +55 -0
- data/ext/clipsruby/cstrnchk.c +826 -0
- data/ext/clipsruby/cstrnchk.h +91 -0
- data/ext/clipsruby/cstrncmp.c +238 -0
- data/ext/clipsruby/cstrncmp.h +57 -0
- data/ext/clipsruby/cstrnops.c +1176 -0
- data/ext/clipsruby/cstrnops.h +47 -0
- data/ext/clipsruby/cstrnpsr.c +1394 -0
- data/ext/clipsruby/cstrnpsr.h +88 -0
- data/ext/clipsruby/cstrnutl.c +564 -0
- data/ext/clipsruby/cstrnutl.h +54 -0
- data/ext/clipsruby/default.c +454 -0
- data/ext/clipsruby/default.h +57 -0
- data/ext/clipsruby/defins.c +971 -0
- data/ext/clipsruby/defins.h +127 -0
- data/ext/clipsruby/developr.c +677 -0
- data/ext/clipsruby/developr.h +69 -0
- data/ext/clipsruby/dffctbin.c +477 -0
- data/ext/clipsruby/dffctbin.h +76 -0
- data/ext/clipsruby/dffctbsc.c +308 -0
- data/ext/clipsruby/dffctbsc.h +72 -0
- data/ext/clipsruby/dffctcmp.c +297 -0
- data/ext/clipsruby/dffctcmp.h +44 -0
- data/ext/clipsruby/dffctdef.c +364 -0
- data/ext/clipsruby/dffctdef.h +104 -0
- data/ext/clipsruby/dffctpsr.c +179 -0
- data/ext/clipsruby/dffctpsr.h +49 -0
- data/ext/clipsruby/dffnxbin.c +520 -0
- data/ext/clipsruby/dffnxbin.h +67 -0
- data/ext/clipsruby/dffnxcmp.c +378 -0
- data/ext/clipsruby/dffnxcmp.h +54 -0
- data/ext/clipsruby/dffnxexe.c +241 -0
- data/ext/clipsruby/dffnxexe.h +58 -0
- data/ext/clipsruby/dffnxfun.c +1192 -0
- data/ext/clipsruby/dffnxfun.h +155 -0
- data/ext/clipsruby/dffnxpsr.c +514 -0
- data/ext/clipsruby/dffnxpsr.h +57 -0
- data/ext/clipsruby/dfinsbin.c +509 -0
- data/ext/clipsruby/dfinsbin.h +66 -0
- data/ext/clipsruby/dfinscmp.c +345 -0
- data/ext/clipsruby/dfinscmp.h +48 -0
- data/ext/clipsruby/drive.c +1191 -0
- data/ext/clipsruby/drive.h +65 -0
- data/ext/clipsruby/emathfun.c +1213 -0
- data/ext/clipsruby/emathfun.h +99 -0
- data/ext/clipsruby/engine.c +1568 -0
- data/ext/clipsruby/engine.h +203 -0
- data/ext/clipsruby/entities.h +276 -0
- data/ext/clipsruby/envrnbld.c +514 -0
- data/ext/clipsruby/envrnbld.h +40 -0
- data/ext/clipsruby/envrnmnt.c +257 -0
- data/ext/clipsruby/envrnmnt.h +112 -0
- data/ext/clipsruby/evaluatn.c +1736 -0
- data/ext/clipsruby/evaluatn.h +211 -0
- data/ext/clipsruby/expressn.c +494 -0
- data/ext/clipsruby/expressn.h +154 -0
- data/ext/clipsruby/exprnbin.c +538 -0
- data/ext/clipsruby/exprnbin.h +60 -0
- data/ext/clipsruby/exprnops.c +564 -0
- data/ext/clipsruby/exprnops.h +67 -0
- data/ext/clipsruby/exprnpsr.c +1112 -0
- data/ext/clipsruby/exprnpsr.h +98 -0
- data/ext/clipsruby/extconf.rb +2 -0
- data/ext/clipsruby/extnfunc.c +1015 -0
- data/ext/clipsruby/extnfunc.h +157 -0
- data/ext/clipsruby/factbin.c +447 -0
- data/ext/clipsruby/factbin.h +56 -0
- data/ext/clipsruby/factbld.c +1035 -0
- data/ext/clipsruby/factbld.h +63 -0
- data/ext/clipsruby/factcmp.c +386 -0
- data/ext/clipsruby/factcmp.h +46 -0
- data/ext/clipsruby/factcom.c +759 -0
- data/ext/clipsruby/factcom.h +80 -0
- data/ext/clipsruby/factfile.c +1761 -0
- data/ext/clipsruby/factfile.h +54 -0
- data/ext/clipsruby/factfun.c +682 -0
- data/ext/clipsruby/factfun.h +77 -0
- data/ext/clipsruby/factgen.c +1305 -0
- data/ext/clipsruby/factgen.h +229 -0
- data/ext/clipsruby/facthsh.c +438 -0
- data/ext/clipsruby/facthsh.h +81 -0
- data/ext/clipsruby/factlhs.c +250 -0
- data/ext/clipsruby/factlhs.h +54 -0
- data/ext/clipsruby/factmch.c +905 -0
- data/ext/clipsruby/factmch.h +68 -0
- data/ext/clipsruby/factmngr.c +3373 -0
- data/ext/clipsruby/factmngr.h +325 -0
- data/ext/clipsruby/factprt.c +498 -0
- data/ext/clipsruby/factprt.h +60 -0
- data/ext/clipsruby/factqpsr.c +796 -0
- data/ext/clipsruby/factqpsr.h +61 -0
- data/ext/clipsruby/factqury.c +1267 -0
- data/ext/clipsruby/factqury.h +112 -0
- data/ext/clipsruby/factrete.c +978 -0
- data/ext/clipsruby/factrete.h +70 -0
- data/ext/clipsruby/factrhs.c +667 -0
- data/ext/clipsruby/factrhs.h +55 -0
- data/ext/clipsruby/filecom.c +353 -0
- data/ext/clipsruby/filecom.h +137 -0
- data/ext/clipsruby/filertr.c +481 -0
- data/ext/clipsruby/filertr.h +94 -0
- data/ext/clipsruby/fileutil.c +1020 -0
- data/ext/clipsruby/fileutil.h +50 -0
- data/ext/clipsruby/generate.c +1079 -0
- data/ext/clipsruby/generate.h +57 -0
- data/ext/clipsruby/genrcbin.c +902 -0
- data/ext/clipsruby/genrcbin.h +69 -0
- data/ext/clipsruby/genrccmp.c +640 -0
- data/ext/clipsruby/genrccmp.h +59 -0
- data/ext/clipsruby/genrccom.c +2017 -0
- data/ext/clipsruby/genrccom.h +119 -0
- data/ext/clipsruby/genrcexe.c +737 -0
- data/ext/clipsruby/genrcexe.h +73 -0
- data/ext/clipsruby/genrcfun.c +890 -0
- data/ext/clipsruby/genrcfun.h +185 -0
- data/ext/clipsruby/genrcpsr.c +1618 -0
- data/ext/clipsruby/genrcpsr.h +80 -0
- data/ext/clipsruby/globlbin.c +458 -0
- data/ext/clipsruby/globlbin.h +71 -0
- data/ext/clipsruby/globlbsc.c +361 -0
- data/ext/clipsruby/globlbsc.h +83 -0
- data/ext/clipsruby/globlcmp.c +330 -0
- data/ext/clipsruby/globlcmp.h +52 -0
- data/ext/clipsruby/globlcom.c +289 -0
- data/ext/clipsruby/globlcom.h +63 -0
- data/ext/clipsruby/globldef.c +1087 -0
- data/ext/clipsruby/globldef.h +151 -0
- data/ext/clipsruby/globlpsr.c +530 -0
- data/ext/clipsruby/globlpsr.h +59 -0
- data/ext/clipsruby/immthpsr.c +431 -0
- data/ext/clipsruby/immthpsr.h +55 -0
- data/ext/clipsruby/incrrset.c +530 -0
- data/ext/clipsruby/incrrset.h +73 -0
- data/ext/clipsruby/inherpsr.c +850 -0
- data/ext/clipsruby/inherpsr.h +52 -0
- data/ext/clipsruby/inscom.c +2076 -0
- data/ext/clipsruby/inscom.h +182 -0
- data/ext/clipsruby/insfile.c +1764 -0
- data/ext/clipsruby/insfile.h +96 -0
- data/ext/clipsruby/insfun.c +1451 -0
- data/ext/clipsruby/insfun.h +134 -0
- data/ext/clipsruby/insmngr.c +2550 -0
- data/ext/clipsruby/insmngr.h +125 -0
- data/ext/clipsruby/insmoddp.c +1041 -0
- data/ext/clipsruby/insmoddp.h +91 -0
- data/ext/clipsruby/insmult.c +804 -0
- data/ext/clipsruby/insmult.h +62 -0
- data/ext/clipsruby/inspsr.c +602 -0
- data/ext/clipsruby/inspsr.h +60 -0
- data/ext/clipsruby/insquery.c +1278 -0
- data/ext/clipsruby/insquery.h +115 -0
- data/ext/clipsruby/insqypsr.c +729 -0
- data/ext/clipsruby/insqypsr.h +63 -0
- data/ext/clipsruby/iofun.c +2045 -0
- data/ext/clipsruby/iofun.h +116 -0
- data/ext/clipsruby/lgcldpnd.c +644 -0
- data/ext/clipsruby/lgcldpnd.h +75 -0
- data/ext/clipsruby/main.c +112 -0
- data/ext/clipsruby/match.h +142 -0
- data/ext/clipsruby/memalloc.c +481 -0
- data/ext/clipsruby/memalloc.h +197 -0
- data/ext/clipsruby/miscfun.c +1801 -0
- data/ext/clipsruby/miscfun.h +132 -0
- data/ext/clipsruby/modulbin.c +607 -0
- data/ext/clipsruby/modulbin.h +84 -0
- data/ext/clipsruby/modulbsc.c +347 -0
- data/ext/clipsruby/modulbsc.h +67 -0
- data/ext/clipsruby/modulcmp.c +499 -0
- data/ext/clipsruby/modulcmp.h +54 -0
- data/ext/clipsruby/moduldef.c +817 -0
- data/ext/clipsruby/moduldef.h +271 -0
- data/ext/clipsruby/modulpsr.c +1150 -0
- data/ext/clipsruby/modulpsr.h +69 -0
- data/ext/clipsruby/modulutl.c +1036 -0
- data/ext/clipsruby/modulutl.h +84 -0
- data/ext/clipsruby/msgcom.c +1221 -0
- data/ext/clipsruby/msgcom.h +125 -0
- data/ext/clipsruby/msgfun.c +1076 -0
- data/ext/clipsruby/msgfun.h +118 -0
- data/ext/clipsruby/msgpass.c +1441 -0
- data/ext/clipsruby/msgpass.h +103 -0
- data/ext/clipsruby/msgpsr.c +698 -0
- data/ext/clipsruby/msgpsr.h +73 -0
- data/ext/clipsruby/multifld.c +1404 -0
- data/ext/clipsruby/multifld.h +130 -0
- data/ext/clipsruby/multifun.c +2182 -0
- data/ext/clipsruby/multifun.h +102 -0
- data/ext/clipsruby/network.h +142 -0
- data/ext/clipsruby/objbin.c +1522 -0
- data/ext/clipsruby/objbin.h +79 -0
- data/ext/clipsruby/objcmp.c +1507 -0
- data/ext/clipsruby/objcmp.h +71 -0
- data/ext/clipsruby/object.h +260 -0
- data/ext/clipsruby/objrtbin.c +701 -0
- data/ext/clipsruby/objrtbin.h +79 -0
- data/ext/clipsruby/objrtbld.c +2393 -0
- data/ext/clipsruby/objrtbld.h +66 -0
- data/ext/clipsruby/objrtcmp.c +734 -0
- data/ext/clipsruby/objrtcmp.h +66 -0
- data/ext/clipsruby/objrtfnx.c +1330 -0
- data/ext/clipsruby/objrtfnx.h +222 -0
- data/ext/clipsruby/objrtgen.c +736 -0
- data/ext/clipsruby/objrtgen.h +63 -0
- data/ext/clipsruby/objrtmch.c +1524 -0
- data/ext/clipsruby/objrtmch.h +160 -0
- data/ext/clipsruby/parsefun.c +415 -0
- data/ext/clipsruby/parsefun.h +67 -0
- data/ext/clipsruby/pattern.c +1265 -0
- data/ext/clipsruby/pattern.h +163 -0
- data/ext/clipsruby/pprint.c +328 -0
- data/ext/clipsruby/pprint.h +79 -0
- data/ext/clipsruby/prccode.c +1478 -0
- data/ext/clipsruby/prccode.h +145 -0
- data/ext/clipsruby/prcdrfun.c +640 -0
- data/ext/clipsruby/prcdrfun.h +95 -0
- data/ext/clipsruby/prcdrpsr.c +1068 -0
- data/ext/clipsruby/prcdrpsr.h +79 -0
- data/ext/clipsruby/prdctfun.c +869 -0
- data/ext/clipsruby/prdctfun.h +77 -0
- data/ext/clipsruby/prntutil.c +878 -0
- data/ext/clipsruby/prntutil.h +125 -0
- data/ext/clipsruby/proflfun.c +827 -0
- data/ext/clipsruby/proflfun.h +118 -0
- data/ext/clipsruby/reorder.c +2082 -0
- data/ext/clipsruby/reorder.h +172 -0
- data/ext/clipsruby/reteutil.c +1732 -0
- data/ext/clipsruby/reteutil.h +111 -0
- data/ext/clipsruby/retract.c +710 -0
- data/ext/clipsruby/retract.h +74 -0
- data/ext/clipsruby/router.c +737 -0
- data/ext/clipsruby/router.h +147 -0
- data/ext/clipsruby/rulebin.c +1136 -0
- data/ext/clipsruby/rulebin.h +153 -0
- data/ext/clipsruby/rulebld.c +1328 -0
- data/ext/clipsruby/rulebld.h +62 -0
- data/ext/clipsruby/rulebsc.c +517 -0
- data/ext/clipsruby/rulebsc.h +91 -0
- data/ext/clipsruby/rulecmp.c +733 -0
- data/ext/clipsruby/rulecmp.h +63 -0
- data/ext/clipsruby/rulecom.c +1583 -0
- data/ext/clipsruby/rulecom.h +116 -0
- data/ext/clipsruby/rulecstr.c +892 -0
- data/ext/clipsruby/rulecstr.h +53 -0
- data/ext/clipsruby/ruledef.c +559 -0
- data/ext/clipsruby/ruledef.h +179 -0
- data/ext/clipsruby/ruledlt.c +599 -0
- data/ext/clipsruby/ruledlt.h +58 -0
- data/ext/clipsruby/rulelhs.c +1216 -0
- data/ext/clipsruby/rulelhs.h +52 -0
- data/ext/clipsruby/rulepsr.c +1073 -0
- data/ext/clipsruby/rulepsr.h +61 -0
- data/ext/clipsruby/scanner.c +856 -0
- data/ext/clipsruby/scanner.h +112 -0
- data/ext/clipsruby/setup.h +488 -0
- data/ext/clipsruby/sortfun.c +433 -0
- data/ext/clipsruby/sortfun.h +55 -0
- data/ext/clipsruby/strngfun.c +1173 -0
- data/ext/clipsruby/strngfun.h +96 -0
- data/ext/clipsruby/strngrtr.c +523 -0
- data/ext/clipsruby/strngrtr.h +97 -0
- data/ext/clipsruby/symblbin.c +648 -0
- data/ext/clipsruby/symblbin.h +64 -0
- data/ext/clipsruby/symblcmp.c +893 -0
- data/ext/clipsruby/symblcmp.h +61 -0
- data/ext/clipsruby/symbol.c +1961 -0
- data/ext/clipsruby/symbol.h +243 -0
- data/ext/clipsruby/sysdep.c +894 -0
- data/ext/clipsruby/sysdep.h +164 -0
- data/ext/clipsruby/textpro.c +1388 -0
- data/ext/clipsruby/textpro.h +77 -0
- data/ext/clipsruby/tmpltbin.c +609 -0
- data/ext/clipsruby/tmpltbin.h +108 -0
- data/ext/clipsruby/tmpltbsc.c +327 -0
- data/ext/clipsruby/tmpltbsc.h +87 -0
- data/ext/clipsruby/tmpltcmp.c +450 -0
- data/ext/clipsruby/tmpltcmp.h +57 -0
- data/ext/clipsruby/tmpltdef.c +584 -0
- data/ext/clipsruby/tmpltdef.h +155 -0
- data/ext/clipsruby/tmpltfun.c +2477 -0
- data/ext/clipsruby/tmpltfun.h +122 -0
- data/ext/clipsruby/tmpltlhs.c +379 -0
- data/ext/clipsruby/tmpltlhs.h +50 -0
- data/ext/clipsruby/tmpltpsr.c +819 -0
- data/ext/clipsruby/tmpltpsr.h +59 -0
- data/ext/clipsruby/tmpltrhs.c +595 -0
- data/ext/clipsruby/tmpltrhs.h +55 -0
- data/ext/clipsruby/tmpltutl.c +637 -0
- data/ext/clipsruby/tmpltutl.h +82 -0
- data/ext/clipsruby/userdata.c +156 -0
- data/ext/clipsruby/userdata.h +72 -0
- data/ext/clipsruby/userfunctions.c +70 -0
- data/ext/clipsruby/usrsetup.h +7 -0
- data/ext/clipsruby/utility.c +1594 -0
- data/ext/clipsruby/utility.h +250 -0
- data/ext/clipsruby/watch.c +865 -0
- data/ext/clipsruby/watch.h +124 -0
- data/lib/clipsruby.rb +1 -0
- metadata +388 -0
@@ -0,0 +1,2076 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.41 07/12/21 */
|
5
|
+
/* */
|
6
|
+
/* INSTANCE COMMAND MODULE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Kernel Interface Commands for Instances */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Brian L. Dantes */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* Gary D. Riley */
|
17
|
+
/* */
|
18
|
+
/* Revision History: */
|
19
|
+
/* */
|
20
|
+
/* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */
|
21
|
+
/* */
|
22
|
+
/* Corrected compilation errors for files */
|
23
|
+
/* generated by constructs-to-c. DR0861 */
|
24
|
+
/* */
|
25
|
+
/* 6.24: Loading a binary instance file from a run-time */
|
26
|
+
/* program caused a bus error. DR0866 */
|
27
|
+
/* */
|
28
|
+
/* Removed LOGICAL_DEPENDENCIES compilation flag. */
|
29
|
+
/* */
|
30
|
+
/* Converted INSTANCE_PATTERN_MATCHING to */
|
31
|
+
/* DEFRULE_CONSTRUCT. */
|
32
|
+
/* */
|
33
|
+
/* Renamed BOOLEAN macro type to intBool. */
|
34
|
+
/* */
|
35
|
+
/* 6.30: Removed conditional code for unsupported */
|
36
|
+
/* compilers/operating systems (IBM_MCW, */
|
37
|
+
/* MAC_MCW, and IBM_TBC). */
|
38
|
+
/* */
|
39
|
+
/* Changed integer type/precision. */
|
40
|
+
/* */
|
41
|
+
/* Changed garbage collection algorithm. */
|
42
|
+
/* */
|
43
|
+
/* Added const qualifiers to remove C++ */
|
44
|
+
/* deprecation warnings. */
|
45
|
+
/* */
|
46
|
+
/* Converted API macros to function calls. */
|
47
|
+
/* */
|
48
|
+
/* 6.31: Fast router used for MakeInstance. */
|
49
|
+
/* */
|
50
|
+
/* Added code to keep track of pointers to */
|
51
|
+
/* constructs that are contained externally to */
|
52
|
+
/* to constructs, DanglingConstructs. */
|
53
|
+
/* */
|
54
|
+
/* 6.32: Fixed embedded reset of error flags. */
|
55
|
+
/* */
|
56
|
+
/* Fixed instance redefinition crash with rules */
|
57
|
+
/* in JNSimpleCompareFunction1 when deleted */
|
58
|
+
/* instance slots are referenced. */
|
59
|
+
/* */
|
60
|
+
/* 6.40: Added Env prefix to GetEvaluationError and */
|
61
|
+
/* SetEvaluationError functions. */
|
62
|
+
/* */
|
63
|
+
/* Added Env prefix to GetHaltExecution and */
|
64
|
+
/* SetHaltExecution functions. */
|
65
|
+
/* */
|
66
|
+
/* Pragma once and other inclusion changes. */
|
67
|
+
/* */
|
68
|
+
/* Added support for booleans with <stdbool.h>. */
|
69
|
+
/* */
|
70
|
+
/* Removed use of void pointers for specific */
|
71
|
+
/* data structures. */
|
72
|
+
/* */
|
73
|
+
/* ALLOW_ENVIRONMENT_GLOBALS no longer supported. */
|
74
|
+
/* */
|
75
|
+
/* UDF redesign. */
|
76
|
+
/* */
|
77
|
+
/* Eval support for run time and bload only. */
|
78
|
+
/* */
|
79
|
+
/*************************************************************/
|
80
|
+
|
81
|
+
/* =========================================
|
82
|
+
*****************************************
|
83
|
+
EXTERNAL DEFINITIONS
|
84
|
+
=========================================
|
85
|
+
***************************************** */
|
86
|
+
#include "setup.h"
|
87
|
+
|
88
|
+
#if OBJECT_SYSTEM
|
89
|
+
|
90
|
+
#include "argacces.h"
|
91
|
+
#include "classcom.h"
|
92
|
+
#include "classfun.h"
|
93
|
+
#include "classinf.h"
|
94
|
+
#include "commline.h"
|
95
|
+
#include "envrnmnt.h"
|
96
|
+
#include "exprnpsr.h"
|
97
|
+
#include "evaluatn.h"
|
98
|
+
#include "insfile.h"
|
99
|
+
#include "insfun.h"
|
100
|
+
#include "insmngr.h"
|
101
|
+
#include "insmoddp.h"
|
102
|
+
#include "insmult.h"
|
103
|
+
#include "inspsr.h"
|
104
|
+
#include "lgcldpnd.h"
|
105
|
+
#include "memalloc.h"
|
106
|
+
#include "msgcom.h"
|
107
|
+
#include "msgfun.h"
|
108
|
+
#include "prntutil.h"
|
109
|
+
#include "router.h"
|
110
|
+
#include "strngrtr.h"
|
111
|
+
#include "sysdep.h"
|
112
|
+
#include "utility.h"
|
113
|
+
|
114
|
+
#include "inscom.h"
|
115
|
+
|
116
|
+
/* =========================================
|
117
|
+
*****************************************
|
118
|
+
CONSTANTS
|
119
|
+
=========================================
|
120
|
+
***************************************** */
|
121
|
+
#define ALL_QUALIFIER "inherit"
|
122
|
+
|
123
|
+
/***************************************/
|
124
|
+
/* LOCAL INTERNAL FUNCTION DEFINITIONS */
|
125
|
+
/***************************************/
|
126
|
+
|
127
|
+
#if DEBUGGING_FUNCTIONS
|
128
|
+
static unsigned long ListInstancesInModule(Environment *,int,const char *,const char *,bool,bool);
|
129
|
+
static unsigned long TabulateInstances(Environment *,int,const char *,Defclass *,bool,bool);
|
130
|
+
#endif
|
131
|
+
|
132
|
+
static void PrintInstance(Environment *,const char *,Instance *,const char *);
|
133
|
+
static InstanceSlot *FindISlotByName(Environment *,Instance *,const char *);
|
134
|
+
static void DeallocateInstanceData(Environment *);
|
135
|
+
|
136
|
+
/* =========================================
|
137
|
+
*****************************************
|
138
|
+
EXTERNALLY VISIBLE FUNCTIONS
|
139
|
+
=========================================
|
140
|
+
***************************************** */
|
141
|
+
|
142
|
+
/*********************************************************
|
143
|
+
NAME : SetupInstances
|
144
|
+
DESCRIPTION : Initializes instance Hash Table,
|
145
|
+
Function Parsers, and Data Structures
|
146
|
+
INPUTS : None
|
147
|
+
RETURNS : Nothing useful
|
148
|
+
SIDE EFFECTS : None
|
149
|
+
NOTES : None
|
150
|
+
*********************************************************/
|
151
|
+
void SetupInstances(
|
152
|
+
Environment *theEnv)
|
153
|
+
{
|
154
|
+
struct patternEntityRecord instanceInfo = { { "INSTANCE_ADDRESS_TYPE",
|
155
|
+
INSTANCE_ADDRESS_TYPE,0,0,0,
|
156
|
+
(EntityPrintFunction *) PrintInstanceName,
|
157
|
+
(EntityPrintFunction *) PrintInstanceLongForm,
|
158
|
+
(bool (*)(void *,Environment *)) UnmakeInstanceCallback,
|
159
|
+
NULL,
|
160
|
+
(void *(*)(void *,void *)) GetNextInstance,
|
161
|
+
(EntityBusyCountFunction *) DecrementInstanceCallback,
|
162
|
+
(EntityBusyCountFunction *) IncrementInstanceCallback,
|
163
|
+
NULL,NULL,NULL,NULL,NULL
|
164
|
+
},
|
165
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
166
|
+
(void (*)(Environment *,void *)) DecrementObjectBasisCount,
|
167
|
+
(void (*)(Environment *,void *)) IncrementObjectBasisCount,
|
168
|
+
(void (*)(Environment *,void *)) MatchObjectFunction,
|
169
|
+
(bool (*)(Environment *,void *)) NetworkSynchronized,
|
170
|
+
(bool (*)(Environment *,void *)) InstanceIsDeleted
|
171
|
+
#else
|
172
|
+
NULL,NULL,NULL,NULL,NULL
|
173
|
+
#endif
|
174
|
+
};
|
175
|
+
|
176
|
+
Instance dummyInstance = { { { { INSTANCE_ADDRESS_TYPE } , NULL, NULL, 0, 0L } },
|
177
|
+
NULL, NULL, 0, 1, 0, 0, 0, 0,
|
178
|
+
NULL, 0, 0, NULL, NULL, NULL, NULL,
|
179
|
+
NULL, NULL, NULL, NULL, NULL };
|
180
|
+
|
181
|
+
AllocateEnvironmentData(theEnv,INSTANCE_DATA,sizeof(struct instanceData),DeallocateInstanceData);
|
182
|
+
|
183
|
+
InstanceData(theEnv)->MkInsMsgPass = true;
|
184
|
+
memcpy(&InstanceData(theEnv)->InstanceInfo,&instanceInfo,sizeof(struct patternEntityRecord));
|
185
|
+
dummyInstance.patternHeader.theInfo = &InstanceData(theEnv)->InstanceInfo;
|
186
|
+
memcpy(&InstanceData(theEnv)->DummyInstance,&dummyInstance,sizeof(Instance));
|
187
|
+
|
188
|
+
InitializeInstanceTable(theEnv);
|
189
|
+
InstallPrimitive(theEnv,(struct entityRecord *) &InstanceData(theEnv)->InstanceInfo,INSTANCE_ADDRESS_TYPE);
|
190
|
+
|
191
|
+
#if ! RUN_TIME
|
192
|
+
|
193
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
194
|
+
AddUDF(theEnv,"initialize-instance","bn",0,UNBOUNDED,NULL,InactiveInitializeInstance,"InactiveInitializeInstance",NULL);
|
195
|
+
AddUDF(theEnv,"active-initialize-instance","bn",0,UNBOUNDED,NULL,InitializeInstanceCommand,"InitializeInstanceCommand",NULL);
|
196
|
+
|
197
|
+
AddUDF(theEnv,"make-instance","bn",0,UNBOUNDED,NULL,InactiveMakeInstance,"InactiveMakeInstance",NULL);
|
198
|
+
AddUDF(theEnv,"active-make-instance","bn",0,UNBOUNDED,NULL,MakeInstanceCommand,"MakeInstanceCommand",NULL);
|
199
|
+
|
200
|
+
#else
|
201
|
+
AddUDF(theEnv,"initialize-instance","bn",0,UNBOUNDED,NULL,InitializeInstanceCommand,"InitializeInstanceCommand",NULL);
|
202
|
+
AddUDF(theEnv,"make-instance","bn",0,UNBOUNDED,NULL,MakeInstanceCommand,"MakeInstanceCommand",NULL);
|
203
|
+
#endif
|
204
|
+
|
205
|
+
AddUDF(theEnv,"init-slots","*",0,0,NULL,InitSlotsCommand,"InitSlotsCommand",NULL);
|
206
|
+
|
207
|
+
AddUDF(theEnv,"delete-instance","b",0,0,NULL,DeleteInstanceCommand,"DeleteInstanceCommand",NULL);
|
208
|
+
AddUDF(theEnv,"(create-instance)","b",0,0,NULL,CreateInstanceHandler,"CreateInstanceHandler",NULL);
|
209
|
+
AddUDF(theEnv,"unmake-instance","b",1,UNBOUNDED,"iny",UnmakeInstanceCommand,"UnmakeInstanceCommand",NULL);
|
210
|
+
|
211
|
+
#if DEBUGGING_FUNCTIONS
|
212
|
+
AddUDF(theEnv,"instances","v",0,3,"y",InstancesCommand,"InstancesCommand",NULL);
|
213
|
+
AddUDF(theEnv,"ppinstance","v",0,0,NULL,PPInstanceCommand,"PPInstanceCommand",NULL);
|
214
|
+
#endif
|
215
|
+
|
216
|
+
AddUDF(theEnv,"symbol-to-instance-name","*",1,1,"y",SymbolToInstanceNameFunction,"SymbolToInstanceNameFunction",NULL);
|
217
|
+
AddUDF(theEnv,"instance-name-to-symbol","y",1,1,"ny",InstanceNameToSymbolFunction,"InstanceNameToSymbolFunction",NULL);
|
218
|
+
AddUDF(theEnv,"instance-address","bi",1,2,";iyn;yn",InstanceAddressCommand,"InstanceAddressCommand",NULL);
|
219
|
+
AddUDF(theEnv,"instance-addressp","b",1,1,NULL,InstanceAddressPCommand,"InstanceAddressPCommand",NULL);
|
220
|
+
AddUDF(theEnv,"instance-namep","b",1,1,NULL,InstanceNamePCommand,"InstanceNamePCommand",NULL);
|
221
|
+
AddUDF(theEnv,"instance-name","bn",1,1,"yin",InstanceNameCommand,"InstanceNameCommand",NULL);
|
222
|
+
AddUDF(theEnv,"instancep","b",1,1,NULL,InstancePCommand,"InstancePCommand",NULL);
|
223
|
+
AddUDF(theEnv,"instance-existp","b",1,1,"niy",InstanceExistPCommand,"InstanceExistPCommand",NULL);
|
224
|
+
AddUDF(theEnv,"class","*",1,1,NULL,ClassCommand,"ClassCommand",NULL);
|
225
|
+
|
226
|
+
#endif
|
227
|
+
|
228
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
229
|
+
AddFunctionParser(theEnv,"active-initialize-instance",ParseInitializeInstance);
|
230
|
+
AddFunctionParser(theEnv,"active-make-instance",ParseInitializeInstance);
|
231
|
+
#endif
|
232
|
+
AddFunctionParser(theEnv,"initialize-instance",ParseInitializeInstance);
|
233
|
+
AddFunctionParser(theEnv,"make-instance",ParseInitializeInstance);
|
234
|
+
|
235
|
+
SetupInstanceModDupCommands(theEnv);
|
236
|
+
/* SetupInstanceFileCommands(theEnv); DR0866 */
|
237
|
+
SetupInstanceMultifieldCommands(theEnv);
|
238
|
+
|
239
|
+
SetupInstanceFileCommands(theEnv); /* DR0866 */
|
240
|
+
|
241
|
+
AddCleanupFunction(theEnv,"instances",CleanupInstances,0,NULL);
|
242
|
+
AddResetFunction(theEnv,"instances",DestroyAllInstances,60,NULL);
|
243
|
+
}
|
244
|
+
|
245
|
+
/***************************************/
|
246
|
+
/* DeallocateInstanceData: Deallocates */
|
247
|
+
/* environment data for instances. */
|
248
|
+
/***************************************/
|
249
|
+
static void DeallocateInstanceData(
|
250
|
+
Environment *theEnv)
|
251
|
+
{
|
252
|
+
Instance *tmpIPtr, *nextIPtr;
|
253
|
+
long i;
|
254
|
+
InstanceSlot *sp;
|
255
|
+
IGARBAGE *tmpGPtr, *nextGPtr;
|
256
|
+
struct patternMatch *theMatch, *tmpMatch;
|
257
|
+
|
258
|
+
/*=================================*/
|
259
|
+
/* Remove the instance hash table. */
|
260
|
+
/*=================================*/
|
261
|
+
|
262
|
+
rm(theEnv,InstanceData(theEnv)->InstanceTable,
|
263
|
+
(sizeof(Instance *) * INSTANCE_TABLE_HASH_SIZE));
|
264
|
+
|
265
|
+
/*=======================*/
|
266
|
+
/* Return all instances. */
|
267
|
+
/*=======================*/
|
268
|
+
|
269
|
+
tmpIPtr = InstanceData(theEnv)->InstanceList;
|
270
|
+
while (tmpIPtr != NULL)
|
271
|
+
{
|
272
|
+
nextIPtr = tmpIPtr->nxtList;
|
273
|
+
|
274
|
+
theMatch = (struct patternMatch *) tmpIPtr->partialMatchList;
|
275
|
+
while (theMatch != NULL)
|
276
|
+
{
|
277
|
+
tmpMatch = theMatch->next;
|
278
|
+
rtn_struct(theEnv,patternMatch,theMatch);
|
279
|
+
theMatch = tmpMatch;
|
280
|
+
}
|
281
|
+
|
282
|
+
#if DEFRULE_CONSTRUCT
|
283
|
+
ReturnEntityDependencies(theEnv,(struct patternEntity *) tmpIPtr);
|
284
|
+
#endif
|
285
|
+
|
286
|
+
for (i = 0 ; i < tmpIPtr->cls->instanceSlotCount ; i++)
|
287
|
+
{
|
288
|
+
sp = tmpIPtr->slotAddresses[i];
|
289
|
+
if ((sp == &sp->desc->sharedValue) ?
|
290
|
+
(--sp->desc->sharedCount == 0) : true)
|
291
|
+
{
|
292
|
+
if (sp->desc->multiple)
|
293
|
+
{ ReturnMultifield(theEnv,sp->multifieldValue); }
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
if (tmpIPtr->cls->instanceSlotCount != 0)
|
298
|
+
{
|
299
|
+
rm(theEnv,tmpIPtr->slotAddresses,
|
300
|
+
(tmpIPtr->cls->instanceSlotCount * sizeof(InstanceSlot *)));
|
301
|
+
if (tmpIPtr->cls->localInstanceSlotCount != 0)
|
302
|
+
{
|
303
|
+
rm(theEnv,tmpIPtr->slots,
|
304
|
+
(tmpIPtr->cls->localInstanceSlotCount * sizeof(InstanceSlot)));
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
rtn_struct(theEnv,instance,tmpIPtr);
|
309
|
+
|
310
|
+
tmpIPtr = nextIPtr;
|
311
|
+
}
|
312
|
+
|
313
|
+
/*===============================*/
|
314
|
+
/* Get rid of garbage instances. */
|
315
|
+
/*===============================*/
|
316
|
+
|
317
|
+
tmpGPtr = InstanceData(theEnv)->InstanceGarbageList;
|
318
|
+
while (tmpGPtr != NULL)
|
319
|
+
{
|
320
|
+
nextGPtr = tmpGPtr->nxt;
|
321
|
+
rtn_struct(theEnv,instance,tmpGPtr->ins);
|
322
|
+
rtn_struct(theEnv,igarbage,tmpGPtr);
|
323
|
+
tmpGPtr = nextGPtr;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
/*******************************************************************
|
328
|
+
NAME : DeleteInstance
|
329
|
+
DESCRIPTION : DIRECTLY removes a named instance from the
|
330
|
+
hash table and its class's
|
331
|
+
instance list
|
332
|
+
INPUTS : The instance address
|
333
|
+
RETURNS : True if successful, false otherwise
|
334
|
+
SIDE EFFECTS : Instance is deallocated
|
335
|
+
NOTES : C interface for deleting instances
|
336
|
+
*******************************************************************/
|
337
|
+
UnmakeInstanceError DeleteInstance(
|
338
|
+
Instance *theInstance)
|
339
|
+
{
|
340
|
+
GCBlock gcb;
|
341
|
+
UnmakeInstanceError success;
|
342
|
+
|
343
|
+
if (theInstance != NULL)
|
344
|
+
{
|
345
|
+
Environment *theEnv = theInstance->cls->header.env;
|
346
|
+
|
347
|
+
/*=====================================*/
|
348
|
+
/* If embedded, clear the error flags. */
|
349
|
+
/*=====================================*/
|
350
|
+
|
351
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
352
|
+
{ ResetErrorFlags(theEnv); }
|
353
|
+
|
354
|
+
GCBlockStart(theEnv,&gcb);
|
355
|
+
success = QuashInstance(theEnv,theInstance);
|
356
|
+
GCBlockEnd(theEnv,&gcb);
|
357
|
+
|
358
|
+
return success;
|
359
|
+
}
|
360
|
+
|
361
|
+
return UIE_NULL_POINTER_ERROR;
|
362
|
+
}
|
363
|
+
|
364
|
+
/*******************************************************************
|
365
|
+
NAME : DeleteAllInstances
|
366
|
+
DESCRIPTION : DIRECTLY removes all instances from the
|
367
|
+
hash table and its class's instance list
|
368
|
+
INPUTS : The environment
|
369
|
+
RETURNS : True if successful, false otherwise
|
370
|
+
SIDE EFFECTS : Instance is deallocated
|
371
|
+
NOTES : C interface for deleting instances
|
372
|
+
*******************************************************************/
|
373
|
+
UnmakeInstanceError DeleteAllInstances(
|
374
|
+
Environment *theEnv)
|
375
|
+
{
|
376
|
+
Instance *ins, *itmp;
|
377
|
+
GCBlock gcb;
|
378
|
+
UnmakeInstanceError success = UIE_NO_ERROR, rv;
|
379
|
+
|
380
|
+
/*=====================================*/
|
381
|
+
/* If embedded, clear the error flags. */
|
382
|
+
/*=====================================*/
|
383
|
+
|
384
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
385
|
+
{ ResetErrorFlags(theEnv); }
|
386
|
+
|
387
|
+
GCBlockStart(theEnv,&gcb);
|
388
|
+
|
389
|
+
ins = InstanceData(theEnv)->InstanceList;
|
390
|
+
while (ins != NULL)
|
391
|
+
{
|
392
|
+
itmp = ins;
|
393
|
+
ins = ins->nxtList;
|
394
|
+
if ((rv = QuashInstance(theEnv,itmp)) != UIE_NO_ERROR)
|
395
|
+
{ success = rv; }
|
396
|
+
}
|
397
|
+
|
398
|
+
GCBlockEnd(theEnv,&gcb);
|
399
|
+
|
400
|
+
InstanceData(theEnv)->unmakeInstanceError = success;
|
401
|
+
return success;
|
402
|
+
}
|
403
|
+
|
404
|
+
/**************************/
|
405
|
+
/* UnmakeInstanceCallback */
|
406
|
+
/**************************/
|
407
|
+
bool UnmakeInstanceCallback(
|
408
|
+
Instance *theInstance,
|
409
|
+
Environment *theEnv)
|
410
|
+
{
|
411
|
+
return (UnmakeInstance(theInstance) == UIE_NO_ERROR);
|
412
|
+
}
|
413
|
+
|
414
|
+
/*******************************************************************
|
415
|
+
NAME : UnmakeAllInstances
|
416
|
+
DESCRIPTION : Removes all instances from the environment
|
417
|
+
INPUTS : The environment
|
418
|
+
RETURNS : 1 if successful, 0 otherwise
|
419
|
+
SIDE EFFECTS : Instance is deallocated
|
420
|
+
NOTES : C interface for deleting instances
|
421
|
+
*******************************************************************/
|
422
|
+
UnmakeInstanceError UnmakeAllInstances(
|
423
|
+
Environment *theEnv)
|
424
|
+
{
|
425
|
+
UnmakeInstanceError success = UIE_NO_ERROR;
|
426
|
+
bool svmaintain;
|
427
|
+
GCBlock gcb;
|
428
|
+
Instance *theInstance;
|
429
|
+
|
430
|
+
/*=====================================*/
|
431
|
+
/* If embedded, clear the error flags. */
|
432
|
+
/*=====================================*/
|
433
|
+
|
434
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
435
|
+
{ ResetErrorFlags(theEnv); }
|
436
|
+
|
437
|
+
GCBlockStart(theEnv,&gcb);
|
438
|
+
|
439
|
+
svmaintain = InstanceData(theEnv)->MaintainGarbageInstances;
|
440
|
+
InstanceData(theEnv)->MaintainGarbageInstances = true;
|
441
|
+
|
442
|
+
theInstance = InstanceData(theEnv)->InstanceList;
|
443
|
+
while (theInstance != NULL)
|
444
|
+
{
|
445
|
+
DirectMessage(theEnv,MessageHandlerData(theEnv)->DELETE_SYMBOL,theInstance,NULL,NULL);
|
446
|
+
|
447
|
+
if (theInstance->garbage == 0)
|
448
|
+
{ success = UIE_DELETED_ERROR; }
|
449
|
+
|
450
|
+
theInstance = theInstance->nxtList;
|
451
|
+
while ((theInstance != NULL) ? theInstance->garbage : false)
|
452
|
+
theInstance = theInstance->nxtList;
|
453
|
+
}
|
454
|
+
|
455
|
+
InstanceData(theEnv)->MaintainGarbageInstances = svmaintain;
|
456
|
+
CleanupInstances(theEnv,NULL);
|
457
|
+
|
458
|
+
GCBlockEnd(theEnv,&gcb);
|
459
|
+
|
460
|
+
InstanceData(theEnv)->unmakeInstanceError = success;
|
461
|
+
return success;
|
462
|
+
}
|
463
|
+
|
464
|
+
/*******************************************************************
|
465
|
+
NAME : UnmakeInstance
|
466
|
+
DESCRIPTION : Removes a named instance via message-passing
|
467
|
+
INPUTS : The instance address
|
468
|
+
RETURNS : Error code (UIE_NO_ERROR if successful)
|
469
|
+
SIDE EFFECTS : Instance is deallocated
|
470
|
+
NOTES : C interface for deleting instances
|
471
|
+
*******************************************************************/
|
472
|
+
UnmakeInstanceError UnmakeInstance(
|
473
|
+
Instance *theInstance)
|
474
|
+
{
|
475
|
+
UnmakeInstanceError success = UIE_NO_ERROR;
|
476
|
+
bool svmaintain;
|
477
|
+
GCBlock gcb;
|
478
|
+
Environment *theEnv = theInstance->cls->header.env;
|
479
|
+
|
480
|
+
if (theInstance == NULL)
|
481
|
+
{
|
482
|
+
InstanceData(theEnv)->unmakeInstanceError = UIE_NULL_POINTER_ERROR;
|
483
|
+
return UIE_NULL_POINTER_ERROR;
|
484
|
+
}
|
485
|
+
|
486
|
+
/*=====================================*/
|
487
|
+
/* If embedded, clear the error flags. */
|
488
|
+
/*=====================================*/
|
489
|
+
|
490
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
491
|
+
{ ResetErrorFlags(theEnv); }
|
492
|
+
|
493
|
+
GCBlockStart(theEnv,&gcb);
|
494
|
+
|
495
|
+
svmaintain = InstanceData(theEnv)->MaintainGarbageInstances;
|
496
|
+
InstanceData(theEnv)->MaintainGarbageInstances = true;
|
497
|
+
|
498
|
+
if (theInstance->garbage)
|
499
|
+
{ success = UIE_DELETED_ERROR; }
|
500
|
+
else
|
501
|
+
{
|
502
|
+
DirectMessage(theEnv,MessageHandlerData(theEnv)->DELETE_SYMBOL,theInstance,NULL,NULL);
|
503
|
+
if (theInstance->garbage == 0)
|
504
|
+
{ success = UIE_COULD_NOT_DELETE_ERROR; }
|
505
|
+
}
|
506
|
+
|
507
|
+
InstanceData(theEnv)->MaintainGarbageInstances = svmaintain;
|
508
|
+
CleanupInstances(theEnv,NULL);
|
509
|
+
|
510
|
+
GCBlockEnd(theEnv,&gcb);
|
511
|
+
|
512
|
+
if (EvaluationData(theEnv)->EvaluationError)
|
513
|
+
{ success = UIE_RULE_NETWORK_ERROR; }
|
514
|
+
|
515
|
+
InstanceData(theEnv)->unmakeInstanceError = success;
|
516
|
+
return success;
|
517
|
+
}
|
518
|
+
|
519
|
+
#if DEBUGGING_FUNCTIONS
|
520
|
+
|
521
|
+
/*******************************************************************
|
522
|
+
NAME : InstancesCommand
|
523
|
+
DESCRIPTION : Lists all instances associated
|
524
|
+
with a particular class
|
525
|
+
INPUTS : None
|
526
|
+
RETURNS : Nothing useful
|
527
|
+
SIDE EFFECTS : None
|
528
|
+
NOTES : H/L Syntax : (instances [<class-name> [inherit]])
|
529
|
+
*******************************************************************/
|
530
|
+
void InstancesCommand(
|
531
|
+
Environment *theEnv,
|
532
|
+
UDFContext *context,
|
533
|
+
UDFValue *returnValue)
|
534
|
+
{
|
535
|
+
bool inheritFlag = false;
|
536
|
+
Defmodule *theDefmodule;
|
537
|
+
const char *className = NULL;
|
538
|
+
UDFValue theArg;
|
539
|
+
|
540
|
+
theDefmodule = GetCurrentModule(theEnv);
|
541
|
+
|
542
|
+
if (UDFHasNextArgument(context))
|
543
|
+
{
|
544
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg)) return;
|
545
|
+
|
546
|
+
theDefmodule = FindDefmodule(theEnv,theArg.lexemeValue->contents);
|
547
|
+
if ((theDefmodule != NULL) ? false :
|
548
|
+
(strcmp(theArg.lexemeValue->contents,"*") != 0))
|
549
|
+
{
|
550
|
+
SetEvaluationError(theEnv,true);
|
551
|
+
ExpectedTypeError1(theEnv,"instances",1,"'defmodule name'");
|
552
|
+
return;
|
553
|
+
}
|
554
|
+
if (UDFHasNextArgument(context))
|
555
|
+
{
|
556
|
+
if (! UDFNextArgument(context,SYMBOL_BIT,&theArg)) return;
|
557
|
+
className = theArg.lexemeValue->contents;
|
558
|
+
if (LookupDefclassAnywhere(theEnv,theDefmodule,className) == NULL)
|
559
|
+
{
|
560
|
+
if (strcmp(className,"*") == 0)
|
561
|
+
className = NULL;
|
562
|
+
else
|
563
|
+
{
|
564
|
+
ClassExistError(theEnv,"instances",className);
|
565
|
+
return;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
if (UDFHasNextArgument(context))
|
569
|
+
{
|
570
|
+
if (! UDFNextArgument(context,SYMBOL_BIT,&theArg)) return;
|
571
|
+
|
572
|
+
if (strcmp(theArg.lexemeValue->contents,ALL_QUALIFIER) != 0)
|
573
|
+
{
|
574
|
+
SetEvaluationError(theEnv,true);
|
575
|
+
ExpectedTypeError1(theEnv,"instances",3,"keyword \"inherit\"");
|
576
|
+
return;
|
577
|
+
}
|
578
|
+
inheritFlag = true;
|
579
|
+
}
|
580
|
+
}
|
581
|
+
}
|
582
|
+
Instances(theEnv,STDOUT,theDefmodule,className,inheritFlag);
|
583
|
+
}
|
584
|
+
|
585
|
+
/********************************************************
|
586
|
+
NAME : PPInstanceCommand
|
587
|
+
DESCRIPTION : Displays the current slot-values
|
588
|
+
of an instance
|
589
|
+
INPUTS : None
|
590
|
+
RETURNS : Nothing useful
|
591
|
+
SIDE EFFECTS : None
|
592
|
+
NOTES : H/L Syntax : (ppinstance <instance>)
|
593
|
+
********************************************************/
|
594
|
+
void PPInstanceCommand(
|
595
|
+
Environment *theEnv,
|
596
|
+
UDFContext *context,
|
597
|
+
UDFValue *returnValue)
|
598
|
+
{
|
599
|
+
Instance *ins;
|
600
|
+
|
601
|
+
if (CheckCurrentMessage(theEnv,"ppinstance",true) == false)
|
602
|
+
return;
|
603
|
+
ins = GetActiveInstance(theEnv);
|
604
|
+
if (ins->garbage == 1)
|
605
|
+
return;
|
606
|
+
PrintInstance(theEnv,STDOUT,ins,"\n");
|
607
|
+
WriteString(theEnv,STDOUT,"\n");
|
608
|
+
}
|
609
|
+
|
610
|
+
/***************************************************************
|
611
|
+
NAME : Instances
|
612
|
+
DESCRIPTION : Lists instances of classes
|
613
|
+
INPUTS : 1) The logical name for the output
|
614
|
+
2) Address of the module (NULL for all classes)
|
615
|
+
3) Name of the class
|
616
|
+
(NULL for all classes in specified module)
|
617
|
+
4) A flag indicating whether to print instances
|
618
|
+
of subclasses or not
|
619
|
+
RETURNS : Nothing useful
|
620
|
+
SIDE EFFECTS : None
|
621
|
+
NOTES : None
|
622
|
+
**************************************************************/
|
623
|
+
void Instances(
|
624
|
+
Environment *theEnv,
|
625
|
+
const char *logicalName,
|
626
|
+
Defmodule *theModule,
|
627
|
+
const char *className,
|
628
|
+
bool inheritFlag)
|
629
|
+
{
|
630
|
+
int id;
|
631
|
+
unsigned long count = 0L;
|
632
|
+
|
633
|
+
/*=====================================*/
|
634
|
+
/* If embedded, clear the error flags. */
|
635
|
+
/*=====================================*/
|
636
|
+
|
637
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
638
|
+
{ ResetErrorFlags(theEnv); }
|
639
|
+
|
640
|
+
/*==============================================*/
|
641
|
+
/* Grab a traversal id to avoid printing out */
|
642
|
+
/* instances twice due to multiple inheritance. */
|
643
|
+
/*==============================================*/
|
644
|
+
|
645
|
+
if ((id = GetTraversalID(theEnv)) == -1)
|
646
|
+
{ return; }
|
647
|
+
SaveCurrentModule(theEnv);
|
648
|
+
|
649
|
+
/*======================================*/
|
650
|
+
/* For all modules, print out instances */
|
651
|
+
/* of specified class(es). */
|
652
|
+
/*======================================*/
|
653
|
+
|
654
|
+
if (theModule == NULL)
|
655
|
+
{
|
656
|
+
theModule = GetNextDefmodule(theEnv,NULL);
|
657
|
+
while (theModule != NULL)
|
658
|
+
{
|
659
|
+
if (GetHaltExecution(theEnv) == true)
|
660
|
+
{
|
661
|
+
RestoreCurrentModule(theEnv);
|
662
|
+
ReleaseTraversalID(theEnv);
|
663
|
+
return;
|
664
|
+
}
|
665
|
+
|
666
|
+
WriteString(theEnv,logicalName,DefmoduleName(theModule));
|
667
|
+
WriteString(theEnv,logicalName,":\n");
|
668
|
+
SetCurrentModule(theEnv,theModule);
|
669
|
+
count += ListInstancesInModule(theEnv,id,logicalName,className,inheritFlag,true);
|
670
|
+
theModule = GetNextDefmodule(theEnv,theModule);
|
671
|
+
}
|
672
|
+
}
|
673
|
+
|
674
|
+
/*=======================================*/
|
675
|
+
/* For the specified module, print out */
|
676
|
+
/* instances of the specified class(es). */
|
677
|
+
/*=======================================*/
|
678
|
+
|
679
|
+
else
|
680
|
+
{
|
681
|
+
SetCurrentModule(theEnv,theModule);
|
682
|
+
count = ListInstancesInModule(theEnv,id,logicalName,className,inheritFlag,false);
|
683
|
+
}
|
684
|
+
|
685
|
+
RestoreCurrentModule(theEnv);
|
686
|
+
ReleaseTraversalID(theEnv);
|
687
|
+
if (EvaluationData(theEnv)->HaltExecution == false)
|
688
|
+
{ PrintTally(theEnv,logicalName,count,"instance","instances"); }
|
689
|
+
}
|
690
|
+
|
691
|
+
#endif /* DEBUGGING_FUNCTIONS */
|
692
|
+
|
693
|
+
/*********************************************************
|
694
|
+
NAME : MakeInstance
|
695
|
+
DESCRIPTION : C Interface for creating and
|
696
|
+
initializing a class instance
|
697
|
+
INPUTS : The make-instance call string,
|
698
|
+
e.g. "([bill] of man (age 34))"
|
699
|
+
RETURNS : The instance address if instance created,
|
700
|
+
NULL otherwise
|
701
|
+
SIDE EFFECTS : Creates the instance and returns
|
702
|
+
the result in caller's buffer
|
703
|
+
NOTES : None
|
704
|
+
*********************************************************/
|
705
|
+
Instance *MakeInstance(
|
706
|
+
Environment *theEnv,
|
707
|
+
const char *mkstr)
|
708
|
+
{
|
709
|
+
const char *router = "***MKINS***";
|
710
|
+
GCBlock gcb;
|
711
|
+
struct token tkn;
|
712
|
+
Expression *top;
|
713
|
+
UDFValue returnValue;
|
714
|
+
Instance *rv;
|
715
|
+
const char *oldRouter;
|
716
|
+
const char *oldString;
|
717
|
+
long oldIndex;
|
718
|
+
int danglingConstructs;
|
719
|
+
|
720
|
+
InstanceData(theEnv)->makeInstanceError = MIE_NO_ERROR;
|
721
|
+
|
722
|
+
if (mkstr == NULL)
|
723
|
+
{
|
724
|
+
InstanceData(theEnv)->makeInstanceError = MIE_NULL_POINTER_ERROR;
|
725
|
+
return NULL;
|
726
|
+
}
|
727
|
+
|
728
|
+
/*=====================================*/
|
729
|
+
/* If embedded, clear the error flags. */
|
730
|
+
/*=====================================*/
|
731
|
+
|
732
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
733
|
+
{ ResetErrorFlags(theEnv); }
|
734
|
+
|
735
|
+
returnValue.value = FalseSymbol(theEnv);
|
736
|
+
|
737
|
+
/*=============================*/
|
738
|
+
/* Use the fast router bypass. */
|
739
|
+
/*=============================*/
|
740
|
+
|
741
|
+
oldRouter = RouterData(theEnv)->FastCharGetRouter;
|
742
|
+
oldString = RouterData(theEnv)->FastCharGetString;
|
743
|
+
oldIndex = RouterData(theEnv)->FastCharGetIndex;
|
744
|
+
|
745
|
+
RouterData(theEnv)->FastCharGetRouter = router;
|
746
|
+
RouterData(theEnv)->FastCharGetString = mkstr;
|
747
|
+
RouterData(theEnv)->FastCharGetIndex = 0;
|
748
|
+
|
749
|
+
GCBlockStart(theEnv,&gcb);
|
750
|
+
|
751
|
+
GetToken(theEnv,router,&tkn);
|
752
|
+
if (tkn.tknType == LEFT_PARENTHESIS_TOKEN)
|
753
|
+
{
|
754
|
+
danglingConstructs = ConstructData(theEnv)->DanglingConstructs;
|
755
|
+
|
756
|
+
top = GenConstant(theEnv,FCALL,FindFunction(theEnv,"make-instance"));
|
757
|
+
if (ParseSimpleInstance(theEnv,top,router) != NULL)
|
758
|
+
{
|
759
|
+
GetToken(theEnv,router,&tkn);
|
760
|
+
if (tkn.tknType == STOP_TOKEN)
|
761
|
+
{
|
762
|
+
ExpressionInstall(theEnv,top);
|
763
|
+
EvaluateExpression(theEnv,top,&returnValue);
|
764
|
+
ExpressionDeinstall(theEnv,top);
|
765
|
+
}
|
766
|
+
else
|
767
|
+
{
|
768
|
+
InstanceData(theEnv)->makeInstanceError = MIE_PARSING_ERROR;
|
769
|
+
SyntaxErrorMessage(theEnv,"instance definition");
|
770
|
+
}
|
771
|
+
ReturnExpression(theEnv,top);
|
772
|
+
}
|
773
|
+
else
|
774
|
+
{ InstanceData(theEnv)->makeInstanceError = MIE_PARSING_ERROR; }
|
775
|
+
|
776
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
777
|
+
{ ConstructData(theEnv)->DanglingConstructs = danglingConstructs; }
|
778
|
+
}
|
779
|
+
else
|
780
|
+
{
|
781
|
+
InstanceData(theEnv)->makeInstanceError = MIE_PARSING_ERROR;
|
782
|
+
SyntaxErrorMessage(theEnv,"instance definition");
|
783
|
+
}
|
784
|
+
|
785
|
+
/*===========================================*/
|
786
|
+
/* Restore the old state of the fast router. */
|
787
|
+
/*===========================================*/
|
788
|
+
|
789
|
+
RouterData(theEnv)->FastCharGetRouter = oldRouter;
|
790
|
+
RouterData(theEnv)->FastCharGetString = oldString;
|
791
|
+
RouterData(theEnv)->FastCharGetIndex = oldIndex;
|
792
|
+
|
793
|
+
if (returnValue.value == FalseSymbol(theEnv))
|
794
|
+
{ rv = NULL; }
|
795
|
+
else
|
796
|
+
{ rv = FindInstanceBySymbol(theEnv,returnValue.lexemeValue); }
|
797
|
+
|
798
|
+
GCBlockEnd(theEnv,&gcb);
|
799
|
+
|
800
|
+
return rv;
|
801
|
+
}
|
802
|
+
|
803
|
+
/************************/
|
804
|
+
/* GetMakeInstanceError */
|
805
|
+
/************************/
|
806
|
+
MakeInstanceError GetMakeInstanceError(
|
807
|
+
Environment *theEnv)
|
808
|
+
{
|
809
|
+
return InstanceData(theEnv)->makeInstanceError;
|
810
|
+
}
|
811
|
+
|
812
|
+
/***************************************************************
|
813
|
+
NAME : CreateRawInstance
|
814
|
+
DESCRIPTION : Creates an empty of instance of the specified
|
815
|
+
class. No slot-overrides or class defaults
|
816
|
+
are applied.
|
817
|
+
INPUTS : 1) Address of class
|
818
|
+
2) Name of the new instance
|
819
|
+
RETURNS : The instance address if instance created,
|
820
|
+
NULL otherwise
|
821
|
+
SIDE EFFECTS : Old instance of same name deleted (if possible)
|
822
|
+
NOTES : None
|
823
|
+
***************************************************************/
|
824
|
+
Instance *CreateRawInstance(
|
825
|
+
Environment *theEnv,
|
826
|
+
Defclass *theDefclass,
|
827
|
+
const char *instanceName)
|
828
|
+
{
|
829
|
+
return BuildInstance(theEnv,CreateInstanceName(theEnv,instanceName),theDefclass,false);
|
830
|
+
}
|
831
|
+
|
832
|
+
/***************************************************************************
|
833
|
+
NAME : FindInstance
|
834
|
+
DESCRIPTION : Looks up a specified instance in the instance hash table
|
835
|
+
INPUTS : Name-string of the instance
|
836
|
+
RETURNS : The address of the found instance, NULL otherwise
|
837
|
+
SIDE EFFECTS : None
|
838
|
+
NOTES : None
|
839
|
+
***************************************************************************/
|
840
|
+
Instance *FindInstance(
|
841
|
+
Environment *theEnv,
|
842
|
+
Defmodule *theModule,
|
843
|
+
const char *iname,
|
844
|
+
bool searchImports)
|
845
|
+
{
|
846
|
+
CLIPSLexeme *isym;
|
847
|
+
|
848
|
+
isym = FindSymbolHN(theEnv,iname,LEXEME_BITS | INSTANCE_NAME_BIT);
|
849
|
+
|
850
|
+
if (isym == NULL)
|
851
|
+
{ return NULL; }
|
852
|
+
|
853
|
+
if (theModule == NULL)
|
854
|
+
{ theModule = GetCurrentModule(theEnv); }
|
855
|
+
|
856
|
+
return FindInstanceInModule(theEnv,isym,theModule,GetCurrentModule(theEnv),searchImports);
|
857
|
+
}
|
858
|
+
|
859
|
+
/***************************************************************************
|
860
|
+
NAME : ValidInstanceAddress
|
861
|
+
DESCRIPTION : Determines if an instance address is still valid
|
862
|
+
INPUTS : Instance address
|
863
|
+
RETURNS : 1 if the address is still valid, 0 otherwise
|
864
|
+
SIDE EFFECTS : None
|
865
|
+
NOTES : None
|
866
|
+
***************************************************************************/
|
867
|
+
bool ValidInstanceAddress(
|
868
|
+
Instance *theInstance)
|
869
|
+
{
|
870
|
+
return (theInstance->garbage == 0) ? true : false;
|
871
|
+
}
|
872
|
+
|
873
|
+
/***************************************************
|
874
|
+
NAME : DirectGetSlot
|
875
|
+
DESCRIPTION : Gets a slot value
|
876
|
+
INPUTS : 1) Instance address
|
877
|
+
2) Slot name
|
878
|
+
3) Caller's result buffer
|
879
|
+
RETURNS : Nothing useful
|
880
|
+
SIDE EFFECTS : None
|
881
|
+
NOTES : None
|
882
|
+
***************************************************/
|
883
|
+
GetSlotError DirectGetSlot(
|
884
|
+
Instance *theInstance,
|
885
|
+
const char *sname,
|
886
|
+
CLIPSValue *returnValue)
|
887
|
+
{
|
888
|
+
InstanceSlot *sp;
|
889
|
+
Environment *theEnv = theInstance->cls->header.env;
|
890
|
+
|
891
|
+
if ((theInstance == NULL) || (sname == NULL) || (returnValue == NULL))
|
892
|
+
{ return GSE_NULL_POINTER_ERROR; }
|
893
|
+
|
894
|
+
/*=====================================*/
|
895
|
+
/* If embedded, clear the error flags. */
|
896
|
+
/*=====================================*/
|
897
|
+
|
898
|
+
if (EvaluationData(theEnv)->CurrentExpression == NULL)
|
899
|
+
{ ResetErrorFlags(theEnv); }
|
900
|
+
|
901
|
+
if (theInstance->garbage == 1)
|
902
|
+
{
|
903
|
+
SetEvaluationError(theEnv,true);
|
904
|
+
returnValue->value = FalseSymbol(theEnv);
|
905
|
+
return GSE_INVALID_TARGET_ERROR;
|
906
|
+
}
|
907
|
+
|
908
|
+
sp = FindISlotByName(theEnv,theInstance,sname);
|
909
|
+
if (sp == NULL)
|
910
|
+
{
|
911
|
+
SetEvaluationError(theEnv,true);
|
912
|
+
returnValue->value = FalseSymbol(theEnv);
|
913
|
+
return GSE_SLOT_NOT_FOUND_ERROR;
|
914
|
+
}
|
915
|
+
|
916
|
+
returnValue->value = sp->value;
|
917
|
+
|
918
|
+
return GSE_NO_ERROR;
|
919
|
+
}
|
920
|
+
|
921
|
+
/*********************************************************
|
922
|
+
NAME : DirectPutSlot
|
923
|
+
DESCRIPTION : Gets a slot value
|
924
|
+
INPUTS : 1) Instance address
|
925
|
+
2) Slot name
|
926
|
+
3) Caller's new value buffer
|
927
|
+
RETURNS : True if put successful, false otherwise
|
928
|
+
SIDE EFFECTS : None
|
929
|
+
NOTES : None
|
930
|
+
*********************************************************/
|
931
|
+
PutSlotError DirectPutSlot(
|
932
|
+
Instance *theInstance,
|
933
|
+
const char *sname,
|
934
|
+
CLIPSValue *val)
|
935
|
+
{
|
936
|
+
InstanceSlot *sp;
|
937
|
+
UDFValue junk, temp;
|
938
|
+
GCBlock gcb;
|
939
|
+
PutSlotError rv;
|
940
|
+
Environment *theEnv;
|
941
|
+
|
942
|
+
if (theInstance == NULL)
|
943
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
944
|
+
|
945
|
+
theEnv = theInstance->cls->header.env;
|
946
|
+
|
947
|
+
if ((sname == NULL) || (val == NULL))
|
948
|
+
{
|
949
|
+
SetEvaluationError(theEnv,true);
|
950
|
+
return PSE_NULL_POINTER_ERROR;
|
951
|
+
}
|
952
|
+
|
953
|
+
if (theInstance->garbage == 1)
|
954
|
+
{
|
955
|
+
SetEvaluationError(theEnv,true);
|
956
|
+
return PSE_INVALID_TARGET_ERROR;
|
957
|
+
}
|
958
|
+
|
959
|
+
sp = FindISlotByName(theEnv,theInstance,sname);
|
960
|
+
if (sp == NULL)
|
961
|
+
{
|
962
|
+
SetEvaluationError(theEnv,true);
|
963
|
+
return PSE_SLOT_NOT_FOUND_ERROR;
|
964
|
+
}
|
965
|
+
|
966
|
+
GCBlockStart(theEnv,&gcb);
|
967
|
+
CLIPSToUDFValue(val,&temp);
|
968
|
+
rv = PutSlotValue(theEnv,theInstance,sp,&temp,&junk,"external put");
|
969
|
+
GCBlockEnd(theEnv,&gcb);
|
970
|
+
|
971
|
+
return rv;
|
972
|
+
}
|
973
|
+
|
974
|
+
/*************************/
|
975
|
+
/* DirectPutSlotInteger: */
|
976
|
+
/*************************/
|
977
|
+
PutSlotError DirectPutSlotInteger(
|
978
|
+
Instance *theInstance,
|
979
|
+
const char *sname,
|
980
|
+
long long val)
|
981
|
+
{
|
982
|
+
CLIPSValue cv;
|
983
|
+
|
984
|
+
if (theInstance == NULL)
|
985
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
986
|
+
|
987
|
+
cv.integerValue = CreateInteger(theInstance->cls->header.env,val);
|
988
|
+
|
989
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
990
|
+
}
|
991
|
+
|
992
|
+
/***********************/
|
993
|
+
/* DirectPutSlotFloat: */
|
994
|
+
/***********************/
|
995
|
+
PutSlotError DirectPutSlotFloat(
|
996
|
+
Instance *theInstance,
|
997
|
+
const char *sname,
|
998
|
+
double val)
|
999
|
+
{
|
1000
|
+
CLIPSValue cv;
|
1001
|
+
|
1002
|
+
if (theInstance == NULL)
|
1003
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1004
|
+
|
1005
|
+
cv.floatValue = CreateFloat(theInstance->cls->header.env,val);
|
1006
|
+
|
1007
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
/************************/
|
1011
|
+
/* DirectPutSlotSymbol: */
|
1012
|
+
/************************/
|
1013
|
+
PutSlotError DirectPutSlotSymbol(
|
1014
|
+
Instance *theInstance,
|
1015
|
+
const char *sname,
|
1016
|
+
const char *val)
|
1017
|
+
{
|
1018
|
+
CLIPSValue cv;
|
1019
|
+
|
1020
|
+
if (theInstance == NULL)
|
1021
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1022
|
+
|
1023
|
+
cv.lexemeValue = CreateSymbol(theInstance->cls->header.env,val);
|
1024
|
+
|
1025
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
/************************/
|
1029
|
+
/* DirectPutSlotString: */
|
1030
|
+
/************************/
|
1031
|
+
PutSlotError DirectPutSlotString(
|
1032
|
+
Instance *theInstance,
|
1033
|
+
const char *sname,
|
1034
|
+
const char *val)
|
1035
|
+
{
|
1036
|
+
CLIPSValue cv;
|
1037
|
+
|
1038
|
+
if (theInstance == NULL)
|
1039
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1040
|
+
|
1041
|
+
cv.lexemeValue = CreateString(theInstance->cls->header.env,val);
|
1042
|
+
|
1043
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
/******************************/
|
1047
|
+
/* DirectPutSlotInstanceName: */
|
1048
|
+
/******************************/
|
1049
|
+
PutSlotError DirectPutSlotInstanceName(
|
1050
|
+
Instance *theInstance,
|
1051
|
+
const char *sname,
|
1052
|
+
const char *val)
|
1053
|
+
{
|
1054
|
+
CLIPSValue cv;
|
1055
|
+
|
1056
|
+
if (theInstance == NULL)
|
1057
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1058
|
+
|
1059
|
+
cv.lexemeValue = CreateInstanceName(theInstance->cls->header.env,val);
|
1060
|
+
|
1061
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
/******************************/
|
1065
|
+
/* DirectPutSlotCLIPSInteger: */
|
1066
|
+
/******************************/
|
1067
|
+
PutSlotError DirectPutSlotCLIPSInteger(
|
1068
|
+
Instance *theInstance,
|
1069
|
+
const char *sname,
|
1070
|
+
CLIPSInteger *val)
|
1071
|
+
{
|
1072
|
+
CLIPSValue cv;
|
1073
|
+
|
1074
|
+
if (theInstance == NULL)
|
1075
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1076
|
+
|
1077
|
+
cv.integerValue = val;
|
1078
|
+
|
1079
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
/****************************/
|
1083
|
+
/* DirectPutSlotCLIPSFloat: */
|
1084
|
+
/****************************/
|
1085
|
+
PutSlotError DirectPutSlotCLIPSFloat(
|
1086
|
+
Instance *theInstance,
|
1087
|
+
const char *sname,
|
1088
|
+
CLIPSFloat *val)
|
1089
|
+
{
|
1090
|
+
CLIPSValue cv;
|
1091
|
+
|
1092
|
+
if (theInstance == NULL)
|
1093
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1094
|
+
|
1095
|
+
cv.floatValue = val;
|
1096
|
+
|
1097
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
/*****************************/
|
1101
|
+
/* DirectPutSlotCLIPSLexeme: */
|
1102
|
+
/*****************************/
|
1103
|
+
PutSlotError DirectPutSlotCLIPSLexeme(
|
1104
|
+
Instance *theInstance,
|
1105
|
+
const char *sname,
|
1106
|
+
CLIPSLexeme *val)
|
1107
|
+
{
|
1108
|
+
CLIPSValue cv;
|
1109
|
+
|
1110
|
+
if (theInstance == NULL)
|
1111
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1112
|
+
|
1113
|
+
cv.lexemeValue = val;
|
1114
|
+
|
1115
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
/**********************/
|
1119
|
+
/* DirectPutSlotFact: */
|
1120
|
+
/**********************/
|
1121
|
+
PutSlotError DirectPutSlotFact(
|
1122
|
+
Instance *theInstance,
|
1123
|
+
const char *sname,
|
1124
|
+
Fact *val)
|
1125
|
+
{
|
1126
|
+
CLIPSValue cv;
|
1127
|
+
|
1128
|
+
if (theInstance == NULL)
|
1129
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1130
|
+
|
1131
|
+
cv.factValue = val;
|
1132
|
+
|
1133
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
/**************************/
|
1137
|
+
/* DirectPutSlotInstance: */
|
1138
|
+
/**************************/
|
1139
|
+
PutSlotError DirectPutSlotInstance(
|
1140
|
+
Instance *theInstance,
|
1141
|
+
const char *sname,
|
1142
|
+
Instance *val)
|
1143
|
+
{
|
1144
|
+
CLIPSValue cv;
|
1145
|
+
|
1146
|
+
if (theInstance == NULL)
|
1147
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1148
|
+
|
1149
|
+
cv.instanceValue = val;
|
1150
|
+
|
1151
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
/****************************/
|
1155
|
+
/* DirectPutSlotMultifield: */
|
1156
|
+
/****************************/
|
1157
|
+
PutSlotError DirectPutSlotMultifield(
|
1158
|
+
Instance *theInstance,
|
1159
|
+
const char *sname,
|
1160
|
+
Multifield *val)
|
1161
|
+
{
|
1162
|
+
CLIPSValue cv;
|
1163
|
+
|
1164
|
+
if (theInstance == NULL)
|
1165
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1166
|
+
|
1167
|
+
cv.multifieldValue = val;
|
1168
|
+
|
1169
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
/**************************************/
|
1173
|
+
/* DirectPutSlotCLIPSExternalAddress: */
|
1174
|
+
/**************************************/
|
1175
|
+
PutSlotError DirectPutSlotCLIPSExternalAddress(
|
1176
|
+
Instance *theInstance,
|
1177
|
+
const char *sname,
|
1178
|
+
CLIPSExternalAddress *val)
|
1179
|
+
{
|
1180
|
+
CLIPSValue cv;
|
1181
|
+
|
1182
|
+
if (theInstance == NULL)
|
1183
|
+
{ return PSE_NULL_POINTER_ERROR; }
|
1184
|
+
|
1185
|
+
cv.externalAddressValue = val;
|
1186
|
+
|
1187
|
+
return DirectPutSlot(theInstance,sname,&cv);
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
/***************************************************
|
1191
|
+
NAME : InstanceName
|
1192
|
+
DESCRIPTION : Returns name of instance
|
1193
|
+
INPUTS : Pointer to instance
|
1194
|
+
RETURNS : Name of instance
|
1195
|
+
SIDE EFFECTS : None
|
1196
|
+
NOTES : None
|
1197
|
+
***************************************************/
|
1198
|
+
const char *InstanceName(
|
1199
|
+
Instance *theInstance)
|
1200
|
+
{
|
1201
|
+
if (theInstance->garbage == 1)
|
1202
|
+
{ return NULL; }
|
1203
|
+
|
1204
|
+
return theInstance->name->contents;
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
/***************************************************
|
1208
|
+
NAME : InstanceClass
|
1209
|
+
DESCRIPTION : Returns class of instance
|
1210
|
+
INPUTS : Pointer to instance
|
1211
|
+
RETURNS : Pointer to class of instance
|
1212
|
+
SIDE EFFECTS : None
|
1213
|
+
NOTES : None
|
1214
|
+
***************************************************/
|
1215
|
+
Defclass *InstanceClass(
|
1216
|
+
Instance *theInstance)
|
1217
|
+
{
|
1218
|
+
if (theInstance->garbage == 1)
|
1219
|
+
{ return NULL; }
|
1220
|
+
|
1221
|
+
return theInstance->cls;
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
/***************************************************
|
1225
|
+
NAME : GetGlobalNumberOfInstances
|
1226
|
+
DESCRIPTION : Returns the total number of
|
1227
|
+
instances in all modules
|
1228
|
+
INPUTS : None
|
1229
|
+
RETURNS : The instance count
|
1230
|
+
SIDE EFFECTS : None
|
1231
|
+
NOTES : None
|
1232
|
+
***************************************************/
|
1233
|
+
unsigned long GetGlobalNumberOfInstances(
|
1234
|
+
Environment *theEnv)
|
1235
|
+
{
|
1236
|
+
return(InstanceData(theEnv)->GlobalNumberOfInstances);
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
/***************************************************
|
1240
|
+
NAME : GetNextInstance
|
1241
|
+
DESCRIPTION : Returns next instance in list
|
1242
|
+
(or first instance in list)
|
1243
|
+
INPUTS : Pointer to previous instance
|
1244
|
+
(or NULL to get first instance)
|
1245
|
+
RETURNS : The next instance or first instance
|
1246
|
+
SIDE EFFECTS : None
|
1247
|
+
NOTES : None
|
1248
|
+
***************************************************/
|
1249
|
+
Instance *GetNextInstance(
|
1250
|
+
Environment *theEnv,
|
1251
|
+
Instance *theInstance)
|
1252
|
+
{
|
1253
|
+
if (theInstance == NULL)
|
1254
|
+
{ return InstanceData(theEnv)->InstanceList; }
|
1255
|
+
|
1256
|
+
if (theInstance->garbage == 1)
|
1257
|
+
{ return NULL; }
|
1258
|
+
|
1259
|
+
return theInstance->nxtList;
|
1260
|
+
}
|
1261
|
+
|
1262
|
+
/***************************************************
|
1263
|
+
NAME : GetNextInstanceInScope
|
1264
|
+
DESCRIPTION : Returns next instance in list
|
1265
|
+
(or first instance in list)
|
1266
|
+
which class is in scope
|
1267
|
+
INPUTS : Pointer to previous instance
|
1268
|
+
(or NULL to get first instance)
|
1269
|
+
RETURNS : The next instance or first instance
|
1270
|
+
which class is in scope of the
|
1271
|
+
current module
|
1272
|
+
SIDE EFFECTS : None
|
1273
|
+
NOTES : None
|
1274
|
+
***************************************************/
|
1275
|
+
Instance *GetNextInstanceInScope(
|
1276
|
+
Environment *theEnv,
|
1277
|
+
Instance *theInstance)
|
1278
|
+
{
|
1279
|
+
if (theInstance == NULL)
|
1280
|
+
{ theInstance = InstanceData(theEnv)->InstanceList; }
|
1281
|
+
else if (theInstance->garbage)
|
1282
|
+
{ return NULL; }
|
1283
|
+
else
|
1284
|
+
{ theInstance = theInstance->nxtList; }
|
1285
|
+
|
1286
|
+
while (theInstance != NULL)
|
1287
|
+
{
|
1288
|
+
if (DefclassInScope(theEnv,theInstance->cls,NULL))
|
1289
|
+
{ return theInstance; }
|
1290
|
+
|
1291
|
+
theInstance = theInstance->nxtList;
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
return NULL;
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
/***************************************************
|
1298
|
+
NAME : GetNextInstanceInClass
|
1299
|
+
DESCRIPTION : Finds next instance of class
|
1300
|
+
(or first instance of class)
|
1301
|
+
INPUTS : 1) Class address
|
1302
|
+
2) Instance address
|
1303
|
+
(NULL to get first instance)
|
1304
|
+
RETURNS : The next or first class instance
|
1305
|
+
SIDE EFFECTS : None
|
1306
|
+
NOTES : None
|
1307
|
+
***************************************************/
|
1308
|
+
Instance *GetNextInstanceInClass(
|
1309
|
+
Defclass *theDefclass,
|
1310
|
+
Instance *theInstance)
|
1311
|
+
{
|
1312
|
+
if (theInstance == NULL)
|
1313
|
+
{ return theDefclass->instanceList; }
|
1314
|
+
|
1315
|
+
if (theInstance->garbage == 1)
|
1316
|
+
{ return NULL; }
|
1317
|
+
|
1318
|
+
return theInstance->nxtClass;
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
/***************************************************
|
1322
|
+
NAME : GetNextInstanceInClassAndSubclasses
|
1323
|
+
DESCRIPTION : Finds next instance of class
|
1324
|
+
(or first instance of class) and
|
1325
|
+
all of its subclasses
|
1326
|
+
INPUTS : 1) Class address
|
1327
|
+
2) Instance address
|
1328
|
+
(NULL to get first instance)
|
1329
|
+
RETURNS : The next or first class instance
|
1330
|
+
SIDE EFFECTS : None
|
1331
|
+
NOTES : None
|
1332
|
+
***************************************************/
|
1333
|
+
Instance *GetNextInstanceInClassAndSubclasses(
|
1334
|
+
Defclass **cptr,
|
1335
|
+
Instance *theInstance,
|
1336
|
+
UDFValue *iterationInfo)
|
1337
|
+
{
|
1338
|
+
Instance *nextInstance;
|
1339
|
+
Defclass *theClass;
|
1340
|
+
Environment *theEnv;
|
1341
|
+
|
1342
|
+
theClass = *cptr;
|
1343
|
+
theEnv = theClass->header.env;
|
1344
|
+
|
1345
|
+
if (theInstance == NULL)
|
1346
|
+
{
|
1347
|
+
ClassSubclassAddresses(theEnv,theClass,iterationInfo,true);
|
1348
|
+
nextInstance = theClass->instanceList;
|
1349
|
+
}
|
1350
|
+
else if (theInstance->garbage == 1)
|
1351
|
+
{ nextInstance = NULL; }
|
1352
|
+
else
|
1353
|
+
{ nextInstance = theInstance->nxtClass; }
|
1354
|
+
|
1355
|
+
while ((nextInstance == NULL) &&
|
1356
|
+
(iterationInfo->begin < iterationInfo->range))
|
1357
|
+
{
|
1358
|
+
theClass = (Defclass *) iterationInfo->multifieldValue->contents[iterationInfo->begin].value;
|
1359
|
+
*cptr = theClass;
|
1360
|
+
iterationInfo->begin = iterationInfo->begin + 1;
|
1361
|
+
nextInstance = theClass->instanceList;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
return nextInstance;
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
/***************************************************
|
1368
|
+
NAME : InstancePPForm
|
1369
|
+
DESCRIPTION : Writes slot names and values to
|
1370
|
+
caller's buffer
|
1371
|
+
INPUTS : 1) Caller's buffer
|
1372
|
+
2) Size of buffer (not including
|
1373
|
+
space for terminating '\0')
|
1374
|
+
3) Instance address
|
1375
|
+
RETURNS : Nothing useful
|
1376
|
+
SIDE EFFECTS : Caller's buffer written
|
1377
|
+
NOTES : None
|
1378
|
+
***************************************************/
|
1379
|
+
void InstancePPForm(
|
1380
|
+
Instance *theInstance,
|
1381
|
+
StringBuilder *theSB)
|
1382
|
+
{
|
1383
|
+
const char *pbuf = "***InstancePPForm***";
|
1384
|
+
Environment *theEnv;
|
1385
|
+
|
1386
|
+
if (theInstance->garbage == 1)
|
1387
|
+
{ return; }
|
1388
|
+
|
1389
|
+
theEnv = theInstance->cls->header.env;
|
1390
|
+
|
1391
|
+
if (OpenStringBuilderDestination(theEnv,pbuf,theSB) == 0)
|
1392
|
+
{ return; }
|
1393
|
+
|
1394
|
+
PrintInstance(theEnv,pbuf,theInstance," ");
|
1395
|
+
|
1396
|
+
CloseStringBuilderDestination(theEnv,pbuf);
|
1397
|
+
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
/*********************************************************
|
1401
|
+
NAME : ClassCommand
|
1402
|
+
DESCRIPTION : Returns the class of an instance
|
1403
|
+
INPUTS : Caller's result buffer
|
1404
|
+
RETURNS : Nothing useful
|
1405
|
+
SIDE EFFECTS : None
|
1406
|
+
NOTES : H/L Syntax : (class <object>)
|
1407
|
+
Can also be called by (type <object>)
|
1408
|
+
if you have generic functions installed
|
1409
|
+
*********************************************************/
|
1410
|
+
void ClassCommand(
|
1411
|
+
Environment *theEnv,
|
1412
|
+
UDFContext *context,
|
1413
|
+
UDFValue *returnValue)
|
1414
|
+
{
|
1415
|
+
Instance *ins;
|
1416
|
+
const char *func;
|
1417
|
+
UDFValue temp;
|
1418
|
+
|
1419
|
+
func = EvaluationData(theEnv)->CurrentExpression->functionValue->callFunctionName->contents;
|
1420
|
+
|
1421
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1422
|
+
|
1423
|
+
EvaluateExpression(theEnv,GetFirstArgument(),&temp);
|
1424
|
+
if (temp.header->type == INSTANCE_ADDRESS_TYPE)
|
1425
|
+
{
|
1426
|
+
ins = temp.instanceValue;
|
1427
|
+
if (ins->garbage == 1)
|
1428
|
+
{
|
1429
|
+
StaleInstanceAddress(theEnv,func,0);
|
1430
|
+
SetEvaluationError(theEnv,true);
|
1431
|
+
return;
|
1432
|
+
}
|
1433
|
+
returnValue->value = GetDefclassNamePointer(ins->cls);
|
1434
|
+
}
|
1435
|
+
else if (temp.header->type == INSTANCE_NAME_TYPE)
|
1436
|
+
{
|
1437
|
+
ins = FindInstanceBySymbol(theEnv,temp.lexemeValue);
|
1438
|
+
if (ins == NULL)
|
1439
|
+
{
|
1440
|
+
NoInstanceError(theEnv,temp.lexemeValue->contents,func);
|
1441
|
+
return;
|
1442
|
+
}
|
1443
|
+
returnValue->value = GetDefclassNamePointer(ins->cls);
|
1444
|
+
}
|
1445
|
+
else
|
1446
|
+
{
|
1447
|
+
switch (temp.header->type)
|
1448
|
+
{
|
1449
|
+
case INTEGER_TYPE :
|
1450
|
+
case FLOAT_TYPE :
|
1451
|
+
case SYMBOL_TYPE :
|
1452
|
+
case STRING_TYPE :
|
1453
|
+
case MULTIFIELD_TYPE :
|
1454
|
+
case EXTERNAL_ADDRESS_TYPE :
|
1455
|
+
case FACT_ADDRESS_TYPE :
|
1456
|
+
returnValue->value = GetDefclassNamePointer(
|
1457
|
+
DefclassData(theEnv)->PrimitiveClassMap[temp.header->type]);
|
1458
|
+
return;
|
1459
|
+
|
1460
|
+
default : PrintErrorID(theEnv,"INSCOM",1,false);
|
1461
|
+
WriteString(theEnv,STDERR,"Undefined type in function '");
|
1462
|
+
WriteString(theEnv,STDERR,func);
|
1463
|
+
WriteString(theEnv,STDERR,"'.\n");
|
1464
|
+
SetEvaluationError(theEnv,true);
|
1465
|
+
}
|
1466
|
+
}
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
/******************************************************
|
1470
|
+
NAME : CreateInstanceHandler
|
1471
|
+
DESCRIPTION : Message handler called after instance creation
|
1472
|
+
INPUTS : None
|
1473
|
+
RETURNS : True if successful,
|
1474
|
+
false otherwise
|
1475
|
+
SIDE EFFECTS : None
|
1476
|
+
NOTES : Does nothing. Provided so it can be overridden.
|
1477
|
+
******************************************************/
|
1478
|
+
void CreateInstanceHandler(
|
1479
|
+
Environment *theEnv,
|
1480
|
+
UDFContext *context,
|
1481
|
+
UDFValue *returnValue)
|
1482
|
+
{
|
1483
|
+
#if MAC_XCD
|
1484
|
+
#pragma unused(theEnv,context)
|
1485
|
+
#endif
|
1486
|
+
|
1487
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
1488
|
+
}
|
1489
|
+
|
1490
|
+
/******************************************************
|
1491
|
+
NAME : DeleteInstanceCommand
|
1492
|
+
DESCRIPTION : Removes a named instance from the
|
1493
|
+
hash table and its class's
|
1494
|
+
instance list
|
1495
|
+
INPUTS : None
|
1496
|
+
RETURNS : True if successful,
|
1497
|
+
false otherwise
|
1498
|
+
SIDE EFFECTS : Instance is deallocated
|
1499
|
+
NOTES : This is an internal function that
|
1500
|
+
only be called by a handler
|
1501
|
+
******************************************************/
|
1502
|
+
void DeleteInstanceCommand(
|
1503
|
+
Environment *theEnv,
|
1504
|
+
UDFContext *context,
|
1505
|
+
UDFValue *returnValue)
|
1506
|
+
{
|
1507
|
+
if (CheckCurrentMessage(theEnv,"delete-instance",true))
|
1508
|
+
{
|
1509
|
+
UnmakeInstanceError rv = QuashInstance(theEnv,GetActiveInstance(theEnv));
|
1510
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,(rv == UIE_NO_ERROR));
|
1511
|
+
}
|
1512
|
+
else
|
1513
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
/********************************************************************
|
1517
|
+
NAME : UnmakeInstanceCommand
|
1518
|
+
DESCRIPTION : Uses message-passing to delete the
|
1519
|
+
specified instance
|
1520
|
+
INPUTS : None
|
1521
|
+
RETURNS : True if successful, false otherwise
|
1522
|
+
SIDE EFFECTS : Instance is deallocated
|
1523
|
+
NOTES : Syntax: (unmake-instance <instance-expression>+ | *)
|
1524
|
+
********************************************************************/
|
1525
|
+
void UnmakeInstanceCommand(
|
1526
|
+
Environment *theEnv,
|
1527
|
+
UDFContext *context,
|
1528
|
+
UDFValue *returnValue)
|
1529
|
+
{
|
1530
|
+
UDFValue theArg;
|
1531
|
+
Instance *ins;
|
1532
|
+
unsigned int argNumber = 1;
|
1533
|
+
bool rtn = true;
|
1534
|
+
|
1535
|
+
while (UDFHasNextArgument(context))
|
1536
|
+
{
|
1537
|
+
if (! UDFNextArgument(context,INSTANCE_BITS | SYMBOL_BIT,&theArg))
|
1538
|
+
{ return; }
|
1539
|
+
|
1540
|
+
if (CVIsType(&theArg,INSTANCE_NAME_BIT | SYMBOL_BIT))
|
1541
|
+
{
|
1542
|
+
ins = FindInstanceBySymbol(theEnv,theArg.lexemeValue);
|
1543
|
+
if ((ins == NULL) ? (strcmp(theArg.lexemeValue->contents,"*") != 0) : false)
|
1544
|
+
{
|
1545
|
+
NoInstanceError(theEnv,theArg.lexemeValue->contents,"unmake-instance");
|
1546
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1547
|
+
return;
|
1548
|
+
}
|
1549
|
+
}
|
1550
|
+
else if (CVIsType(&theArg,INSTANCE_ADDRESS_BIT))
|
1551
|
+
{
|
1552
|
+
ins = theArg.instanceValue;
|
1553
|
+
if (ins->garbage)
|
1554
|
+
{
|
1555
|
+
StaleInstanceAddress(theEnv,"unmake-instance",0);
|
1556
|
+
SetEvaluationError(theEnv,true);
|
1557
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1558
|
+
return;
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
else
|
1562
|
+
{
|
1563
|
+
ExpectedTypeError1(theEnv,"unmake-instance",argNumber,"instance-address, instance-name, or the symbol *");
|
1564
|
+
SetEvaluationError(theEnv,true);
|
1565
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1566
|
+
return;
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
if (ins != NULL)
|
1570
|
+
{
|
1571
|
+
if (UnmakeInstance(ins) != UIE_NO_ERROR)
|
1572
|
+
rtn = false;
|
1573
|
+
}
|
1574
|
+
else
|
1575
|
+
{
|
1576
|
+
if (UnmakeAllInstances(theEnv) != UIE_NO_ERROR)
|
1577
|
+
rtn = false;
|
1578
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,rtn);
|
1579
|
+
return;
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
argNumber++;
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,rtn);
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
/*****************************************************************
|
1589
|
+
NAME : SymbolToInstanceNameFunction
|
1590
|
+
DESCRIPTION : Converts a symbol from type SYMBOL_TYPE
|
1591
|
+
to type INSTANCE_NAME_TYPE
|
1592
|
+
INPUTS : The address of the value buffer
|
1593
|
+
RETURNS : The new INSTANCE_NAME_TYPE symbol
|
1594
|
+
SIDE EFFECTS : None
|
1595
|
+
NOTES : H/L Syntax : (symbol-to-instance-name <symbol>)
|
1596
|
+
*****************************************************************/
|
1597
|
+
void SymbolToInstanceNameFunction(
|
1598
|
+
Environment *theEnv,
|
1599
|
+
UDFContext *context,
|
1600
|
+
UDFValue *returnValue)
|
1601
|
+
{
|
1602
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,returnValue))
|
1603
|
+
{ return; }
|
1604
|
+
|
1605
|
+
returnValue->value = CreateInstanceName(theEnv,returnValue->lexemeValue->contents);
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
/*****************************************************************
|
1609
|
+
NAME : InstanceNameToSymbolFunction
|
1610
|
+
DESCRIPTION : Converts a symbol from type INSTANCE_NAME_TYPE
|
1611
|
+
to type SYMBOL_TYPE
|
1612
|
+
INPUTS : None
|
1613
|
+
RETURNS : Symbol FALSE on errors - or converted instance name
|
1614
|
+
SIDE EFFECTS : None
|
1615
|
+
NOTES : H/L Syntax : (instance-name-to-symbol <iname>)
|
1616
|
+
*****************************************************************/
|
1617
|
+
void InstanceNameToSymbolFunction(
|
1618
|
+
Environment *theEnv,
|
1619
|
+
UDFContext *context,
|
1620
|
+
UDFValue *returnValue)
|
1621
|
+
{
|
1622
|
+
if (! UDFFirstArgument(context,INSTANCE_NAME_BIT | SYMBOL_BIT,returnValue))
|
1623
|
+
{ return; }
|
1624
|
+
|
1625
|
+
returnValue->value = CreateSymbol(theEnv,returnValue->lexemeValue->contents);
|
1626
|
+
}
|
1627
|
+
|
1628
|
+
/*********************************************************************************
|
1629
|
+
NAME : InstanceAddressCommand
|
1630
|
+
DESCRIPTION : Returns the address of an instance
|
1631
|
+
INPUTS : The address of the value buffer
|
1632
|
+
RETURNS : Nothing useful
|
1633
|
+
SIDE EFFECTS : Stores instance address in caller's buffer
|
1634
|
+
NOTES : H/L Syntax : (instance-address [<module-name>] <instance-name>)
|
1635
|
+
*********************************************************************************/
|
1636
|
+
void InstanceAddressCommand(
|
1637
|
+
Environment *theEnv,
|
1638
|
+
UDFContext *context,
|
1639
|
+
UDFValue *returnValue)
|
1640
|
+
{
|
1641
|
+
Instance *ins;
|
1642
|
+
UDFValue temp;
|
1643
|
+
Defmodule *theModule;
|
1644
|
+
bool searchImports;
|
1645
|
+
|
1646
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1647
|
+
if (UDFArgumentCount(context) > 1)
|
1648
|
+
{
|
1649
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&temp))
|
1650
|
+
{
|
1651
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1652
|
+
return;
|
1653
|
+
}
|
1654
|
+
theModule = FindDefmodule(theEnv,temp.lexemeValue->contents);
|
1655
|
+
if ((theModule == NULL) ? (strcmp(temp.lexemeValue->contents,"*") != 0) : false)
|
1656
|
+
{
|
1657
|
+
ExpectedTypeError1(theEnv,"instance-address",1,"'module name'");
|
1658
|
+
SetEvaluationError(theEnv,true);
|
1659
|
+
return;
|
1660
|
+
}
|
1661
|
+
if (theModule == NULL)
|
1662
|
+
{
|
1663
|
+
searchImports = true;
|
1664
|
+
theModule = GetCurrentModule(theEnv);
|
1665
|
+
}
|
1666
|
+
else
|
1667
|
+
searchImports = false;
|
1668
|
+
|
1669
|
+
if (! UDFNextArgument(context,INSTANCE_NAME_BIT | SYMBOL_BIT,&temp))
|
1670
|
+
{
|
1671
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1672
|
+
return;
|
1673
|
+
}
|
1674
|
+
ins = FindInstanceInModule(theEnv,temp.lexemeValue,theModule,
|
1675
|
+
GetCurrentModule(theEnv),searchImports);
|
1676
|
+
if (ins != NULL)
|
1677
|
+
{ returnValue->instanceValue = ins; }
|
1678
|
+
else
|
1679
|
+
NoInstanceError(theEnv,temp.lexemeValue->contents,"instance-address");
|
1680
|
+
}
|
1681
|
+
else if (UDFFirstArgument(context,INSTANCE_BITS | SYMBOL_BIT,&temp))
|
1682
|
+
{
|
1683
|
+
if (temp.header->type == INSTANCE_ADDRESS_TYPE)
|
1684
|
+
{
|
1685
|
+
ins = temp.instanceValue;
|
1686
|
+
if (ins->garbage == 0)
|
1687
|
+
{ returnValue->instanceValue = temp.instanceValue; }
|
1688
|
+
else
|
1689
|
+
{
|
1690
|
+
StaleInstanceAddress(theEnv,"instance-address",0);
|
1691
|
+
SetEvaluationError(theEnv,true);
|
1692
|
+
}
|
1693
|
+
}
|
1694
|
+
else
|
1695
|
+
{
|
1696
|
+
ins = FindInstanceBySymbol(theEnv,temp.lexemeValue);
|
1697
|
+
if (ins != NULL)
|
1698
|
+
{ returnValue->instanceValue = ins; }
|
1699
|
+
else
|
1700
|
+
NoInstanceError(theEnv,temp.lexemeValue->contents,"instance-address");
|
1701
|
+
}
|
1702
|
+
}
|
1703
|
+
else
|
1704
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
1705
|
+
}
|
1706
|
+
|
1707
|
+
/***************************************************************
|
1708
|
+
NAME : InstanceNameCommand
|
1709
|
+
DESCRIPTION : Gets the name of an INSTANCE
|
1710
|
+
INPUTS : The address of the value buffer
|
1711
|
+
RETURNS : The INSTANCE_NAME_TYPE symbol
|
1712
|
+
SIDE EFFECTS : None
|
1713
|
+
NOTES : H/L Syntax : (instance-name <instance>)
|
1714
|
+
***************************************************************/
|
1715
|
+
void InstanceNameCommand(
|
1716
|
+
Environment *theEnv,
|
1717
|
+
UDFContext *context,
|
1718
|
+
UDFValue *returnValue)
|
1719
|
+
{
|
1720
|
+
Instance *ins;
|
1721
|
+
UDFValue theArg;
|
1722
|
+
|
1723
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1724
|
+
if (! UDFFirstArgument(context,INSTANCE_BITS | SYMBOL_BIT,&theArg))
|
1725
|
+
{ return; }
|
1726
|
+
|
1727
|
+
if (CVIsType(&theArg,INSTANCE_ADDRESS_BIT))
|
1728
|
+
{
|
1729
|
+
ins = theArg.instanceValue;
|
1730
|
+
if (ins->garbage == 1)
|
1731
|
+
{
|
1732
|
+
StaleInstanceAddress(theEnv,"instance-name",0);
|
1733
|
+
SetEvaluationError(theEnv,true);
|
1734
|
+
return;
|
1735
|
+
}
|
1736
|
+
}
|
1737
|
+
else
|
1738
|
+
{
|
1739
|
+
ins = FindInstanceBySymbol(theEnv,theArg.lexemeValue);
|
1740
|
+
if (ins == NULL)
|
1741
|
+
{
|
1742
|
+
NoInstanceError(theEnv,theArg.lexemeValue->contents,"instance-name");
|
1743
|
+
return;
|
1744
|
+
}
|
1745
|
+
}
|
1746
|
+
|
1747
|
+
returnValue->value = ins->name;
|
1748
|
+
}
|
1749
|
+
|
1750
|
+
/**************************************************************
|
1751
|
+
NAME : InstanceAddressPCommand
|
1752
|
+
DESCRIPTION : Determines if a value is of type INSTANCE
|
1753
|
+
INPUTS : None
|
1754
|
+
RETURNS : True if type INSTANCE_ADDRESS_TYPE, false otherwise
|
1755
|
+
SIDE EFFECTS : None
|
1756
|
+
NOTES : H/L Syntax : (instance-addressp <arg>)
|
1757
|
+
**************************************************************/
|
1758
|
+
void InstanceAddressPCommand(
|
1759
|
+
Environment *theEnv,
|
1760
|
+
UDFContext *context,
|
1761
|
+
UDFValue *returnValue)
|
1762
|
+
{
|
1763
|
+
UDFValue theArg;
|
1764
|
+
|
1765
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&theArg))
|
1766
|
+
{ return; }
|
1767
|
+
|
1768
|
+
if (theArg.header->type == INSTANCE_ADDRESS_TYPE)
|
1769
|
+
{ returnValue->value = TrueSymbol(theEnv); }
|
1770
|
+
else
|
1771
|
+
{ returnValue->value = FalseSymbol(theEnv); }
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
/**************************************************************
|
1775
|
+
NAME : InstanceNamePCommand
|
1776
|
+
DESCRIPTION : Determines if a value is of type INSTANCE_NAME_TYPE
|
1777
|
+
INPUTS : None
|
1778
|
+
RETURNS : True if type INSTANCE_NAME_TYPE, false otherwise
|
1779
|
+
SIDE EFFECTS : None
|
1780
|
+
NOTES : H/L Syntax : (instance-namep <arg>)
|
1781
|
+
**************************************************************/
|
1782
|
+
void InstanceNamePCommand(
|
1783
|
+
Environment *theEnv,
|
1784
|
+
UDFContext *context,
|
1785
|
+
UDFValue *returnValue)
|
1786
|
+
{
|
1787
|
+
UDFValue theArg;
|
1788
|
+
|
1789
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&theArg))
|
1790
|
+
{ return; }
|
1791
|
+
|
1792
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,CVIsType(&theArg,INSTANCE_NAME_BIT));
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
/*****************************************************************
|
1796
|
+
NAME : InstancePCommand
|
1797
|
+
DESCRIPTION : Determines if a value is of type INSTANCE_ADDRESS_TYPE
|
1798
|
+
or INSTANCE_NAME_TYPE
|
1799
|
+
INPUTS : None
|
1800
|
+
RETURNS : True if type INSTANCE_NAME_TYPE or INSTANCE_ADDRESS_TYPE,
|
1801
|
+
false otherwise
|
1802
|
+
SIDE EFFECTS : None
|
1803
|
+
NOTES : H/L Syntax : (instancep <arg>)
|
1804
|
+
*****************************************************************/
|
1805
|
+
void InstancePCommand(
|
1806
|
+
Environment *theEnv,
|
1807
|
+
UDFContext *context,
|
1808
|
+
UDFValue *returnValue)
|
1809
|
+
{
|
1810
|
+
UDFValue theArg;
|
1811
|
+
|
1812
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&theArg))
|
1813
|
+
{ return; }
|
1814
|
+
|
1815
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,CVIsType(&theArg,INSTANCE_ADDRESS_BIT | INSTANCE_NAME_BIT));
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
/********************************************************
|
1819
|
+
NAME : InstanceExistPCommand
|
1820
|
+
DESCRIPTION : Determines if an instance exists
|
1821
|
+
INPUTS : None
|
1822
|
+
RETURNS : True if instance exists, false otherwise
|
1823
|
+
SIDE EFFECTS : None
|
1824
|
+
NOTES : H/L Syntax : (instance-existp <arg>)
|
1825
|
+
********************************************************/
|
1826
|
+
void InstanceExistPCommand(
|
1827
|
+
Environment *theEnv,
|
1828
|
+
UDFContext *context,
|
1829
|
+
UDFValue *returnValue)
|
1830
|
+
{
|
1831
|
+
UDFValue theArg;
|
1832
|
+
|
1833
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&theArg))
|
1834
|
+
{ return; }
|
1835
|
+
|
1836
|
+
if (CVIsType(&theArg,INSTANCE_ADDRESS_BIT))
|
1837
|
+
{
|
1838
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,(theArg.instanceValue->garbage == 0) ? true : false);
|
1839
|
+
return;
|
1840
|
+
}
|
1841
|
+
|
1842
|
+
if (CVIsType(&theArg,INSTANCE_NAME_BIT | SYMBOL_BIT))
|
1843
|
+
{
|
1844
|
+
returnValue->lexemeValue = CreateBoolean(theEnv,((FindInstanceBySymbol(theEnv,theArg.lexemeValue) != NULL) ?
|
1845
|
+
true : false));
|
1846
|
+
return;
|
1847
|
+
}
|
1848
|
+
ExpectedTypeError1(theEnv,"instance-existp",1,"instance name, instance address or symbol");
|
1849
|
+
SetEvaluationError(theEnv,true);
|
1850
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
1851
|
+
}
|
1852
|
+
|
1853
|
+
/* =========================================
|
1854
|
+
*****************************************
|
1855
|
+
INTERNALLY VISIBLE FUNCTIONS
|
1856
|
+
=========================================
|
1857
|
+
***************************************** */
|
1858
|
+
|
1859
|
+
#if DEBUGGING_FUNCTIONS
|
1860
|
+
|
1861
|
+
/***************************************************
|
1862
|
+
NAME : ListInstancesInModule
|
1863
|
+
DESCRIPTION : List instances of specified
|
1864
|
+
class(es) in a module
|
1865
|
+
INPUTS : 1) Traversal id to avoid multiple
|
1866
|
+
passes over same class
|
1867
|
+
2) Logical name of output
|
1868
|
+
3) The name of the class
|
1869
|
+
(NULL for all classes)
|
1870
|
+
4) Flag indicating whether to
|
1871
|
+
include instances of subclasses
|
1872
|
+
5) A flag indicating whether to
|
1873
|
+
indent because of module name
|
1874
|
+
RETURNS : The number of instances listed
|
1875
|
+
SIDE EFFECTS : Instances listed to logical output
|
1876
|
+
NOTES : Assumes defclass scope flags
|
1877
|
+
are up to date
|
1878
|
+
***************************************************/
|
1879
|
+
static unsigned long ListInstancesInModule(
|
1880
|
+
Environment *theEnv,
|
1881
|
+
int id,
|
1882
|
+
const char *logicalName,
|
1883
|
+
const char *className,
|
1884
|
+
bool inheritFlag,
|
1885
|
+
bool allModulesFlag)
|
1886
|
+
{
|
1887
|
+
Defclass *theDefclass;
|
1888
|
+
Instance *theInstance;
|
1889
|
+
unsigned long count = 0L;
|
1890
|
+
|
1891
|
+
/* ===================================
|
1892
|
+
For the specified module, print out
|
1893
|
+
instances of all the classes
|
1894
|
+
=================================== */
|
1895
|
+
if (className == NULL)
|
1896
|
+
{
|
1897
|
+
/* ==============================================
|
1898
|
+
If instances are being listed for all modules,
|
1899
|
+
only list the instances of classes in this
|
1900
|
+
module (to avoid listing instances twice)
|
1901
|
+
============================================== */
|
1902
|
+
if (allModulesFlag)
|
1903
|
+
{
|
1904
|
+
for (theDefclass = GetNextDefclass(theEnv,NULL) ;
|
1905
|
+
theDefclass != NULL ;
|
1906
|
+
theDefclass = GetNextDefclass(theEnv,theDefclass))
|
1907
|
+
count += TabulateInstances(theEnv,id,logicalName,
|
1908
|
+
theDefclass,false,allModulesFlag);
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
/* ===================================================
|
1912
|
+
If instances are only be listed for one module,
|
1913
|
+
list all instances visible to the module (including
|
1914
|
+
ones belonging to classes in other modules)
|
1915
|
+
=================================================== */
|
1916
|
+
else
|
1917
|
+
{
|
1918
|
+
theInstance = GetNextInstanceInScope(theEnv,NULL);
|
1919
|
+
while (theInstance != NULL)
|
1920
|
+
{
|
1921
|
+
if (GetHaltExecution(theEnv) == true)
|
1922
|
+
{ return(count); }
|
1923
|
+
|
1924
|
+
count++;
|
1925
|
+
PrintInstanceNameAndClass(theEnv,logicalName,theInstance,true);
|
1926
|
+
theInstance = GetNextInstanceInScope(theEnv,theInstance);
|
1927
|
+
}
|
1928
|
+
}
|
1929
|
+
}
|
1930
|
+
|
1931
|
+
/* ===================================
|
1932
|
+
For the specified module, print out
|
1933
|
+
instances of the specified class
|
1934
|
+
=================================== */
|
1935
|
+
else
|
1936
|
+
{
|
1937
|
+
theDefclass = LookupDefclassAnywhere(theEnv,GetCurrentModule(theEnv),className);
|
1938
|
+
if (theDefclass != NULL)
|
1939
|
+
{
|
1940
|
+
count += TabulateInstances(theEnv,id,logicalName,
|
1941
|
+
theDefclass,inheritFlag,allModulesFlag);
|
1942
|
+
}
|
1943
|
+
else if (! allModulesFlag)
|
1944
|
+
ClassExistError(theEnv,"instances",className);
|
1945
|
+
}
|
1946
|
+
return(count);
|
1947
|
+
}
|
1948
|
+
|
1949
|
+
/******************************************************
|
1950
|
+
NAME : TabulateInstances
|
1951
|
+
DESCRIPTION : Displays all instances for a class
|
1952
|
+
INPUTS : 1) The traversal id for the classes
|
1953
|
+
2) The logical name of the output
|
1954
|
+
3) The class address
|
1955
|
+
4) A flag indicating whether to
|
1956
|
+
print out instances of subclasses
|
1957
|
+
or not.
|
1958
|
+
5) A flag indicating whether to
|
1959
|
+
indent because of module name
|
1960
|
+
RETURNS : The number of instances (including
|
1961
|
+
subclasses' instances)
|
1962
|
+
SIDE EFFECTS : None
|
1963
|
+
NOTES : None
|
1964
|
+
******************************************************/
|
1965
|
+
static unsigned long TabulateInstances(
|
1966
|
+
Environment *theEnv,
|
1967
|
+
int id,
|
1968
|
+
const char *logicalName,
|
1969
|
+
Defclass *cls,
|
1970
|
+
bool inheritFlag,
|
1971
|
+
bool allModulesFlag)
|
1972
|
+
{
|
1973
|
+
Instance *ins;
|
1974
|
+
unsigned long i;
|
1975
|
+
unsigned long count = 0;
|
1976
|
+
|
1977
|
+
if (TestTraversalID(cls->traversalRecord,id))
|
1978
|
+
return 0L;
|
1979
|
+
|
1980
|
+
SetTraversalID(cls->traversalRecord,id);
|
1981
|
+
for (ins = cls->instanceList ; ins != NULL ; ins = ins->nxtClass)
|
1982
|
+
{
|
1983
|
+
if (EvaluationData(theEnv)->HaltExecution)
|
1984
|
+
return count;
|
1985
|
+
if (allModulesFlag)
|
1986
|
+
WriteString(theEnv,logicalName," ");
|
1987
|
+
PrintInstanceNameAndClass(theEnv,logicalName,ins,true);
|
1988
|
+
count++;
|
1989
|
+
}
|
1990
|
+
|
1991
|
+
if (inheritFlag)
|
1992
|
+
{
|
1993
|
+
for (i = 0 ; i < cls->directSubclasses.classCount ; i++)
|
1994
|
+
{
|
1995
|
+
if (EvaluationData(theEnv)->HaltExecution)
|
1996
|
+
return count;
|
1997
|
+
count += TabulateInstances(theEnv,id,logicalName,
|
1998
|
+
cls->directSubclasses.classArray[i],inheritFlag,allModulesFlag);
|
1999
|
+
}
|
2000
|
+
}
|
2001
|
+
|
2002
|
+
return count;
|
2003
|
+
}
|
2004
|
+
|
2005
|
+
#endif
|
2006
|
+
|
2007
|
+
/***************************************************
|
2008
|
+
NAME : PrintInstance
|
2009
|
+
DESCRIPTION : Displays an instance's slots
|
2010
|
+
INPUTS : 1) Logical name for output
|
2011
|
+
2) Instance address
|
2012
|
+
3) String used to separate
|
2013
|
+
slot printouts
|
2014
|
+
RETURNS : Nothing useful
|
2015
|
+
SIDE EFFECTS : None
|
2016
|
+
NOTES : Assumes instance is valid
|
2017
|
+
***************************************************/
|
2018
|
+
static void PrintInstance(
|
2019
|
+
Environment *theEnv,
|
2020
|
+
const char *logicalName,
|
2021
|
+
Instance *ins,
|
2022
|
+
const char *separator)
|
2023
|
+
{
|
2024
|
+
long i;
|
2025
|
+
InstanceSlot *sp;
|
2026
|
+
|
2027
|
+
PrintInstanceNameAndClass(theEnv,logicalName,ins,false);
|
2028
|
+
for (i = 0 ; i < ins->cls->instanceSlotCount ; i++)
|
2029
|
+
{
|
2030
|
+
WriteString(theEnv,logicalName,separator);
|
2031
|
+
sp = ins->slotAddresses[i];
|
2032
|
+
WriteString(theEnv,logicalName,"(");
|
2033
|
+
WriteString(theEnv,logicalName,sp->desc->slotName->name->contents);
|
2034
|
+
if (sp->type != MULTIFIELD_TYPE)
|
2035
|
+
{
|
2036
|
+
WriteString(theEnv,logicalName," ");
|
2037
|
+
PrintAtom(theEnv,logicalName,sp->type,sp->value);
|
2038
|
+
}
|
2039
|
+
else if (sp->multifieldValue->length != 0)
|
2040
|
+
{
|
2041
|
+
WriteString(theEnv,logicalName," ");
|
2042
|
+
PrintMultifieldDriver(theEnv,logicalName,sp->multifieldValue,0,
|
2043
|
+
sp->multifieldValue->length,false);
|
2044
|
+
}
|
2045
|
+
WriteString(theEnv,logicalName,")");
|
2046
|
+
}
|
2047
|
+
}
|
2048
|
+
|
2049
|
+
/***************************************************
|
2050
|
+
NAME : FindISlotByName
|
2051
|
+
DESCRIPTION : Looks up an instance slot by
|
2052
|
+
instance name and slot name
|
2053
|
+
INPUTS : 1) Instance address
|
2054
|
+
2) Instance name-string
|
2055
|
+
RETURNS : The instance slot address, NULL if
|
2056
|
+
does not exist
|
2057
|
+
SIDE EFFECTS : None
|
2058
|
+
NOTES : None
|
2059
|
+
***************************************************/
|
2060
|
+
static InstanceSlot *FindISlotByName(
|
2061
|
+
Environment *theEnv,
|
2062
|
+
Instance *theInstance,
|
2063
|
+
const char *sname)
|
2064
|
+
{
|
2065
|
+
CLIPSLexeme *ssym;
|
2066
|
+
|
2067
|
+
ssym = FindSymbolHN(theEnv,sname,SYMBOL_BIT);
|
2068
|
+
|
2069
|
+
if (ssym == NULL)
|
2070
|
+
{ return NULL; }
|
2071
|
+
|
2072
|
+
return FindInstanceSlot(theEnv,theInstance,ssym);
|
2073
|
+
}
|
2074
|
+
|
2075
|
+
#endif /* OBJECT_SYSTEM */
|
2076
|
+
|