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,677 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 04/08/20 */
|
5
|
+
/* */
|
6
|
+
/* DEVELOPER MODULE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Provides routines useful for browsing various */
|
11
|
+
/* data structures. The functions are provided for */
|
12
|
+
/* development use. */
|
13
|
+
/* */
|
14
|
+
/* Principal Programmer(s): */
|
15
|
+
/* Gary D. Riley */
|
16
|
+
/* */
|
17
|
+
/* Contributing Programmer(s): */
|
18
|
+
/* */
|
19
|
+
/* Revision History: */
|
20
|
+
/* */
|
21
|
+
/* 6.24: Converted INSTANCE_PATTERN_MATCHING to */
|
22
|
+
/* DEFRULE_CONSTRUCT. */
|
23
|
+
/* */
|
24
|
+
/* 6.30: Added support for hashed alpha memories. */
|
25
|
+
/* */
|
26
|
+
/* Changed garbage collection algorithm. */
|
27
|
+
/* Functions enable-gc-heuristics and */
|
28
|
+
/* disable-gc-heuristics are no longer supported. */
|
29
|
+
/* */
|
30
|
+
/* Changed integer type/precision. */
|
31
|
+
/* */
|
32
|
+
/* Added const qualifiers and type casts to */
|
33
|
+
/* remove C++ warnings. */
|
34
|
+
/* */
|
35
|
+
/* Replaced deprecated WCLIPS logical name with */
|
36
|
+
/* WPROMPT. */
|
37
|
+
/* */
|
38
|
+
/* 6.31: Crash fix for show-opn. */
|
39
|
+
/* */
|
40
|
+
/* 6.40: Pragma once and other inclusion changes. */
|
41
|
+
/* */
|
42
|
+
/* Added support for booleans with <stdbool.h>. */
|
43
|
+
/* */
|
44
|
+
/* Removed use of void pointers for specific */
|
45
|
+
/* data structures. */
|
46
|
+
/* */
|
47
|
+
/* UDF redesign. */
|
48
|
+
/* */
|
49
|
+
/*************************************************************/
|
50
|
+
|
51
|
+
#include <stdio.h>
|
52
|
+
|
53
|
+
#include "setup.h"
|
54
|
+
|
55
|
+
#include "argacces.h"
|
56
|
+
#include "envrnmnt.h"
|
57
|
+
#include "extnfunc.h"
|
58
|
+
#include "factmngr.h"
|
59
|
+
#include "inscom.h"
|
60
|
+
#include "modulutl.h"
|
61
|
+
#include "prntutil.h"
|
62
|
+
#include "router.h"
|
63
|
+
#include "utility.h"
|
64
|
+
|
65
|
+
#if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT
|
66
|
+
#include "tmpltdef.h"
|
67
|
+
#include "factbld.h"
|
68
|
+
#include "facthsh.h"
|
69
|
+
#endif
|
70
|
+
|
71
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
72
|
+
#include "classcom.h"
|
73
|
+
#include "classfun.h"
|
74
|
+
#include "objrtmch.h"
|
75
|
+
#endif
|
76
|
+
#if OBJECT_SYSTEM
|
77
|
+
#include "insfun.h"
|
78
|
+
#endif
|
79
|
+
|
80
|
+
#include "developr.h"
|
81
|
+
|
82
|
+
#if DEVELOPER
|
83
|
+
|
84
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
85
|
+
static void PrintOPNLevel(Environment *,OBJECT_PATTERN_NODE *,char *,int);
|
86
|
+
#endif
|
87
|
+
|
88
|
+
/**************************************************/
|
89
|
+
/* DeveloperCommands: Sets up developer commands. */
|
90
|
+
/**************************************************/
|
91
|
+
void DeveloperCommands(
|
92
|
+
Environment *theEnv)
|
93
|
+
{
|
94
|
+
#if ! RUN_TIME
|
95
|
+
AddUDF(theEnv,"primitives-info","v",0,0,NULL,PrimitiveTablesInfoCommand,"PrimitiveTablesInfoCommand",NULL);
|
96
|
+
AddUDF(theEnv,"primitives-usage","v",0,0,NULL,PrimitiveTablesUsageCommand,"PrimitiveTablesUsageCommand",NULL);
|
97
|
+
|
98
|
+
#if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT
|
99
|
+
AddUDF(theEnv,"validate-fact-integrity","b", 0,0,NULL,ValidateFactIntegrityCommand,"ValidateFactIntegrityCommand",NULL);
|
100
|
+
|
101
|
+
AddUDF(theEnv,"show-fpn","v",1,1,"y",ShowFactPatternNetworkCommand,"ShowFactPatternNetworkCommand",NULL);
|
102
|
+
AddUDF(theEnv,"show-fht","v",0,0,NULL,ShowFactHashTableCommand,"ShowFactHashTableCommand",NULL);
|
103
|
+
#endif
|
104
|
+
|
105
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
106
|
+
AddUDF(theEnv,"show-opn","v",0,0,NULL,PrintObjectPatternNetworkCommand,"PrintObjectPatternNetworkCommand",NULL);
|
107
|
+
#endif
|
108
|
+
|
109
|
+
#if OBJECT_SYSTEM
|
110
|
+
AddUDF(theEnv,"instance-table-usage","v",0,0,NULL,InstanceTableUsageCommand,"InstanceTableUsageCommand",NULL);
|
111
|
+
#endif
|
112
|
+
|
113
|
+
#endif
|
114
|
+
}
|
115
|
+
|
116
|
+
/******************************************************/
|
117
|
+
/* PrimitiveTablesInfo: Prints information about the */
|
118
|
+
/* symbol, float, integer, and bitmap tables. */
|
119
|
+
/******************************************************/
|
120
|
+
void PrimitiveTablesInfoCommand(
|
121
|
+
Environment *theEnv,
|
122
|
+
UDFContext *context,
|
123
|
+
UDFValue *returnValue)
|
124
|
+
{
|
125
|
+
unsigned long i;
|
126
|
+
CLIPSLexeme **symbolArray, *symbolPtr;
|
127
|
+
CLIPSFloat **floatArray, *floatPtr;
|
128
|
+
CLIPSInteger **integerArray, *integerPtr;
|
129
|
+
CLIPSBitMap **bitMapArray, *bitMapPtr;
|
130
|
+
unsigned long long symbolCount = 0, integerCount = 0;
|
131
|
+
unsigned long long floatCount = 0, bitMapCount = 0;
|
132
|
+
|
133
|
+
/*====================================*/
|
134
|
+
/* Count entries in the symbol table. */
|
135
|
+
/*====================================*/
|
136
|
+
|
137
|
+
symbolArray = GetSymbolTable(theEnv);
|
138
|
+
for (i = 0; i < SYMBOL_HASH_SIZE; i++)
|
139
|
+
{
|
140
|
+
for (symbolPtr = symbolArray[i]; symbolPtr != NULL; symbolPtr = symbolPtr->next)
|
141
|
+
{ symbolCount++; }
|
142
|
+
}
|
143
|
+
|
144
|
+
/*====================================*/
|
145
|
+
/* Count entries in the integer table. */
|
146
|
+
/*====================================*/
|
147
|
+
|
148
|
+
integerArray = GetIntegerTable(theEnv);
|
149
|
+
for (i = 0; i < INTEGER_HASH_SIZE; i++)
|
150
|
+
{
|
151
|
+
for (integerPtr = integerArray[i]; integerPtr != NULL; integerPtr = integerPtr->next)
|
152
|
+
{ integerCount++; }
|
153
|
+
}
|
154
|
+
|
155
|
+
/*====================================*/
|
156
|
+
/* Count entries in the float table. */
|
157
|
+
/*====================================*/
|
158
|
+
|
159
|
+
floatArray = GetFloatTable(theEnv);
|
160
|
+
for (i = 0; i < FLOAT_HASH_SIZE; i++)
|
161
|
+
{
|
162
|
+
for (floatPtr = floatArray[i]; floatPtr != NULL; floatPtr = floatPtr->next)
|
163
|
+
{ floatCount++; }
|
164
|
+
}
|
165
|
+
|
166
|
+
/*====================================*/
|
167
|
+
/* Count entries in the bitmap table. */
|
168
|
+
/*====================================*/
|
169
|
+
|
170
|
+
bitMapArray = GetBitMapTable(theEnv);
|
171
|
+
for (i = 0; i < BITMAP_HASH_SIZE; i++)
|
172
|
+
{
|
173
|
+
for (bitMapPtr = bitMapArray[i]; bitMapPtr != NULL; bitMapPtr = bitMapPtr->next)
|
174
|
+
{ bitMapCount++; }
|
175
|
+
}
|
176
|
+
|
177
|
+
/*========================*/
|
178
|
+
/* Print the information. */
|
179
|
+
/*========================*/
|
180
|
+
|
181
|
+
WriteString(theEnv,STDOUT,"Symbols: ");
|
182
|
+
PrintUnsignedInteger(theEnv,STDOUT,symbolCount);
|
183
|
+
WriteString(theEnv,STDOUT,"\n");
|
184
|
+
WriteString(theEnv,STDOUT,"Integers: ");
|
185
|
+
PrintUnsignedInteger(theEnv,STDOUT,integerCount);
|
186
|
+
WriteString(theEnv,STDOUT,"\n");
|
187
|
+
WriteString(theEnv,STDOUT,"Floats: ");
|
188
|
+
PrintUnsignedInteger(theEnv,STDOUT,floatCount);
|
189
|
+
WriteString(theEnv,STDOUT,"\n");
|
190
|
+
WriteString(theEnv,STDOUT,"BitMaps: ");
|
191
|
+
PrintUnsignedInteger(theEnv,STDOUT,bitMapCount);
|
192
|
+
WriteString(theEnv,STDOUT,"\n");
|
193
|
+
}
|
194
|
+
|
195
|
+
#define COUNT_SIZE 21
|
196
|
+
|
197
|
+
/*********************************************************/
|
198
|
+
/* PrimitiveTablesUsageCommand: Prints information about */
|
199
|
+
/* the symbol, float, integer, and bitmap tables. */
|
200
|
+
/*********************************************************/
|
201
|
+
void PrimitiveTablesUsageCommand(
|
202
|
+
Environment *theEnv,
|
203
|
+
UDFContext *context,
|
204
|
+
UDFValue *returnValue)
|
205
|
+
{
|
206
|
+
unsigned long i;
|
207
|
+
unsigned long long symbolCounts[COUNT_SIZE], floatCounts[COUNT_SIZE];
|
208
|
+
CLIPSLexeme **symbolArray, *symbolPtr;
|
209
|
+
CLIPSFloat **floatArray, *floatPtr;
|
210
|
+
unsigned long long symbolCount, totalSymbolCount = 0;
|
211
|
+
unsigned long long floatCount, totalFloatCount = 0;
|
212
|
+
|
213
|
+
for (i = 0; i < 21; i++)
|
214
|
+
{
|
215
|
+
symbolCounts[i] = 0;
|
216
|
+
floatCounts[i] = 0;
|
217
|
+
}
|
218
|
+
|
219
|
+
/*====================================*/
|
220
|
+
/* Count entries in the symbol table. */
|
221
|
+
/*====================================*/
|
222
|
+
|
223
|
+
symbolArray = GetSymbolTable(theEnv);
|
224
|
+
for (i = 0; i < SYMBOL_HASH_SIZE; i++)
|
225
|
+
{
|
226
|
+
symbolCount = 0;
|
227
|
+
for (symbolPtr = symbolArray[i]; symbolPtr != NULL; symbolPtr = symbolPtr->next)
|
228
|
+
{
|
229
|
+
symbolCount++;
|
230
|
+
totalSymbolCount++;
|
231
|
+
}
|
232
|
+
|
233
|
+
if (symbolCount < (COUNT_SIZE - 1))
|
234
|
+
{ symbolCounts[symbolCount]++; }
|
235
|
+
else
|
236
|
+
{ symbolCounts[COUNT_SIZE - 1]++; }
|
237
|
+
}
|
238
|
+
|
239
|
+
/*===================================*/
|
240
|
+
/* Count entries in the float table. */
|
241
|
+
/*===================================*/
|
242
|
+
|
243
|
+
floatArray = GetFloatTable(theEnv);
|
244
|
+
for (i = 0; i < FLOAT_HASH_SIZE; i++)
|
245
|
+
{
|
246
|
+
floatCount = 0;
|
247
|
+
for (floatPtr = floatArray[i]; floatPtr != NULL; floatPtr = floatPtr->next)
|
248
|
+
{
|
249
|
+
floatCount++;
|
250
|
+
totalFloatCount++;
|
251
|
+
}
|
252
|
+
|
253
|
+
if (floatCount < (COUNT_SIZE - 1))
|
254
|
+
{ floatCounts[floatCount]++; }
|
255
|
+
else
|
256
|
+
{ floatCounts[COUNT_SIZE - 1]++; }
|
257
|
+
}
|
258
|
+
|
259
|
+
/*========================*/
|
260
|
+
/* Print the information. */
|
261
|
+
/*========================*/
|
262
|
+
|
263
|
+
WriteString(theEnv,STDOUT,"Total Symbols: ");
|
264
|
+
PrintUnsignedInteger(theEnv,STDOUT,totalSymbolCount);
|
265
|
+
WriteString(theEnv,STDOUT,"\n");
|
266
|
+
for (i = 0; i < COUNT_SIZE; i++)
|
267
|
+
{
|
268
|
+
PrintUnsignedInteger(theEnv,STDOUT,i);
|
269
|
+
WriteString(theEnv,STDOUT," ");
|
270
|
+
PrintUnsignedInteger(theEnv,STDOUT,symbolCounts[i]);
|
271
|
+
WriteString(theEnv,STDOUT,"\n");
|
272
|
+
}
|
273
|
+
|
274
|
+
WriteString(theEnv,STDOUT,"\nTotal Floats: ");
|
275
|
+
PrintUnsignedInteger(theEnv,STDOUT,totalFloatCount);
|
276
|
+
WriteString(theEnv,STDOUT,"\n");
|
277
|
+
for (i = 0; i < COUNT_SIZE; i++)
|
278
|
+
{
|
279
|
+
PrintUnsignedInteger(theEnv,STDOUT,i);
|
280
|
+
WriteString(theEnv,STDOUT," ");
|
281
|
+
PrintUnsignedInteger(theEnv,STDOUT,floatCounts[i]);
|
282
|
+
WriteString(theEnv,STDOUT,"\n");
|
283
|
+
}
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
#if DEFRULE_CONSTRUCT && DEFTEMPLATE_CONSTRUCT
|
288
|
+
|
289
|
+
/******************************************************/
|
290
|
+
/* ValidateFactIntegrityCommand: Command for checking */
|
291
|
+
/* the facts for atom value integrity. */
|
292
|
+
/******************************************************/
|
293
|
+
void ValidateFactIntegrityCommand(
|
294
|
+
Environment *theEnv,
|
295
|
+
UDFContext *context,
|
296
|
+
UDFValue *returnValue)
|
297
|
+
{
|
298
|
+
Fact *theFact;
|
299
|
+
Multifield *theSegment;
|
300
|
+
size_t i;
|
301
|
+
CLIPSLexeme *theSymbol;
|
302
|
+
CLIPSFloat *theFloat;
|
303
|
+
CLIPSInteger *theInteger;
|
304
|
+
|
305
|
+
if (theEnv->initialized == false)
|
306
|
+
{
|
307
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
|
311
|
+
for (theFact = GetNextFact(theEnv,NULL);
|
312
|
+
theFact != NULL;
|
313
|
+
theFact = GetNextFact(theEnv,theFact))
|
314
|
+
{
|
315
|
+
if (theFact->patternHeader.busyCount <= 0)
|
316
|
+
{
|
317
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
318
|
+
return;
|
319
|
+
}
|
320
|
+
|
321
|
+
theSegment = &theFact->theProposition;
|
322
|
+
|
323
|
+
for (i = 0 ; i < theSegment->length ; i++)
|
324
|
+
{
|
325
|
+
if ((theSegment->contents[i].header->type == SYMBOL_TYPE) ||
|
326
|
+
(theSegment->contents[i].header->type == STRING_TYPE) ||
|
327
|
+
(theSegment->contents[i].header->type == INSTANCE_NAME_TYPE))
|
328
|
+
{
|
329
|
+
theSymbol = theSegment->contents[i].lexemeValue;
|
330
|
+
if (theSymbol->count <= 0)
|
331
|
+
{
|
332
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
333
|
+
return;
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
if (theSegment->contents[i].header->type == INTEGER_TYPE)
|
338
|
+
{
|
339
|
+
theInteger = theSegment->contents[i].integerValue;
|
340
|
+
if (theInteger->count <= 0)
|
341
|
+
{
|
342
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
if (theSegment->contents[i].header->type == FLOAT_TYPE)
|
348
|
+
{
|
349
|
+
theFloat = theSegment->contents[i].floatValue;
|
350
|
+
if (theFloat->count <= 0)
|
351
|
+
{
|
352
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
353
|
+
return;
|
354
|
+
}
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
|
359
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
360
|
+
}
|
361
|
+
|
362
|
+
/*************************************************************/
|
363
|
+
/* ShowFactPatternNetworkCommand: Command for displaying the */
|
364
|
+
/* fact pattern network for a specified deftemplate. */
|
365
|
+
/*************************************************************/
|
366
|
+
void ShowFactPatternNetworkCommand(
|
367
|
+
Environment *theEnv,
|
368
|
+
UDFContext *context,
|
369
|
+
UDFValue *returnValue)
|
370
|
+
{
|
371
|
+
struct factPatternNode *patternPtr;
|
372
|
+
Deftemplate *theDeftemplate;
|
373
|
+
const char *theName;
|
374
|
+
int depth = 0, i;
|
375
|
+
|
376
|
+
theName = GetConstructName(context,"show-fpn","template name");
|
377
|
+
if (theName == NULL) return;
|
378
|
+
|
379
|
+
theDeftemplate = FindDeftemplate(theEnv,theName);
|
380
|
+
if (theDeftemplate == NULL) return;
|
381
|
+
|
382
|
+
patternPtr = theDeftemplate->patternNetwork;
|
383
|
+
while (patternPtr != NULL)
|
384
|
+
{
|
385
|
+
for (i = 0; i < depth; i++) WriteString(theEnv,STDOUT," ");
|
386
|
+
if (patternPtr->header.singlefieldNode) WriteString(theEnv,STDOUT,"SF ");
|
387
|
+
else if (patternPtr->header.multifieldNode)
|
388
|
+
{
|
389
|
+
WriteString(theEnv,STDOUT,"MF");
|
390
|
+
if (patternPtr->header.endSlot) WriteString(theEnv,STDOUT,")");
|
391
|
+
else WriteString(theEnv,STDOUT,"*");
|
392
|
+
PrintUnsignedInteger(theEnv,STDOUT,patternPtr->leaveFields);
|
393
|
+
WriteString(theEnv,STDOUT," ");
|
394
|
+
}
|
395
|
+
|
396
|
+
WriteString(theEnv,STDOUT,"Slot: ");
|
397
|
+
|
398
|
+
PrintUnsignedInteger(theEnv,STDOUT,patternPtr->whichSlot);
|
399
|
+
WriteString(theEnv,STDOUT," Field: ");
|
400
|
+
PrintUnsignedInteger(theEnv,STDOUT,patternPtr->whichField);
|
401
|
+
WriteString(theEnv,STDOUT," Expression: ");
|
402
|
+
if (patternPtr->networkTest == NULL) WriteString(theEnv,STDOUT,"None");
|
403
|
+
else PrintExpression(theEnv,STDOUT,patternPtr->networkTest);
|
404
|
+
WriteString(theEnv,STDOUT," RightHash: ");
|
405
|
+
if (patternPtr->header.rightHash == NULL) WriteString(theEnv,STDOUT,"None");
|
406
|
+
else PrintExpression(theEnv,STDOUT,patternPtr->header.rightHash);
|
407
|
+
WriteString(theEnv,STDOUT,"\n");
|
408
|
+
|
409
|
+
if (patternPtr->nextLevel == NULL)
|
410
|
+
{
|
411
|
+
while (patternPtr->rightNode == NULL)
|
412
|
+
{
|
413
|
+
patternPtr = patternPtr->lastLevel;
|
414
|
+
depth--;
|
415
|
+
if (patternPtr == NULL) return;
|
416
|
+
}
|
417
|
+
patternPtr = patternPtr->rightNode;
|
418
|
+
}
|
419
|
+
else
|
420
|
+
{
|
421
|
+
patternPtr = patternPtr->nextLevel;
|
422
|
+
depth++;
|
423
|
+
}
|
424
|
+
}
|
425
|
+
}
|
426
|
+
|
427
|
+
#endif
|
428
|
+
|
429
|
+
#if DEFRULE_CONSTRUCT && OBJECT_SYSTEM
|
430
|
+
|
431
|
+
/***************************************************
|
432
|
+
NAME : PrintObjectPatternNetworkCommand
|
433
|
+
DESCRIPTION : Displays an indented printout of
|
434
|
+
the object pattern network
|
435
|
+
INPUTS : None
|
436
|
+
RETURNS : Nothing useful
|
437
|
+
SIDE EFFECTS : Object pattern network displayed
|
438
|
+
NOTES : None
|
439
|
+
***************************************************/
|
440
|
+
void PrintObjectPatternNetworkCommand(
|
441
|
+
Environment *theEnv,
|
442
|
+
UDFContext *context,
|
443
|
+
UDFValue *returnValue)
|
444
|
+
{
|
445
|
+
char indentbuf[80];
|
446
|
+
|
447
|
+
indentbuf[0] = '\0';
|
448
|
+
PrintOPNLevel(theEnv,ObjectNetworkPointer(theEnv),indentbuf,0);
|
449
|
+
}
|
450
|
+
|
451
|
+
/**********************************************************
|
452
|
+
NAME : PrintOPNLevel
|
453
|
+
DESCRIPTION : Recursivley prints object pattern network
|
454
|
+
INPUTS : 1) The current object pattern network node
|
455
|
+
2) A buffer holding preceding indentation
|
456
|
+
text showing the level in the tree
|
457
|
+
3) The length of the indentation text
|
458
|
+
RETURNS : Nothing useful
|
459
|
+
SIDE EFFECTS : Pattern nodes recursively printed
|
460
|
+
NOTES : None
|
461
|
+
**********************************************************/
|
462
|
+
static void PrintOPNLevel(
|
463
|
+
Environment *theEnv,
|
464
|
+
OBJECT_PATTERN_NODE *pptr,
|
465
|
+
char *indentbuf,
|
466
|
+
int ilen)
|
467
|
+
{
|
468
|
+
CLASS_BITMAP *cbmp;
|
469
|
+
SLOT_BITMAP *sbmp;
|
470
|
+
unsigned short i;
|
471
|
+
OBJECT_PATTERN_NODE *uptr;
|
472
|
+
OBJECT_ALPHA_NODE *alphaPtr;
|
473
|
+
|
474
|
+
while (pptr != NULL)
|
475
|
+
{
|
476
|
+
WriteString(theEnv,STDOUT,indentbuf);
|
477
|
+
if (pptr->alphaNode != NULL)
|
478
|
+
WriteString(theEnv,STDOUT,"+");
|
479
|
+
WriteString(theEnv,STDOUT,FindIDSlotName(theEnv,pptr->slotNameID)->contents);
|
480
|
+
WriteString(theEnv,STDOUT," (");
|
481
|
+
PrintUnsignedInteger(theEnv,STDOUT,pptr->slotNameID);
|
482
|
+
WriteString(theEnv,STDOUT,") ");
|
483
|
+
WriteString(theEnv,STDOUT,pptr->endSlot ? "EPF#" : "PF#");
|
484
|
+
PrintUnsignedInteger(theEnv,STDOUT,pptr->whichField);
|
485
|
+
WriteString(theEnv,STDOUT," ");
|
486
|
+
WriteString(theEnv,STDOUT,pptr->multifieldNode ? "$? " : "? ");
|
487
|
+
if (pptr->networkTest != NULL)
|
488
|
+
PrintExpression(theEnv,STDOUT,pptr->networkTest);
|
489
|
+
WriteString(theEnv,STDOUT,"\n");
|
490
|
+
alphaPtr = pptr->alphaNode;
|
491
|
+
while (alphaPtr != NULL)
|
492
|
+
{
|
493
|
+
WriteString(theEnv,STDOUT,indentbuf);
|
494
|
+
WriteString(theEnv,STDOUT," Classes:");
|
495
|
+
cbmp = (CLASS_BITMAP *) alphaPtr->classbmp->contents;
|
496
|
+
for (i = 0 ; i <= cbmp->maxid ; i++)
|
497
|
+
if (TestBitMap(cbmp->map,i))
|
498
|
+
{
|
499
|
+
WriteString(theEnv,STDOUT," ");
|
500
|
+
WriteString(theEnv,STDOUT,DefclassName(DefclassData(theEnv)->ClassIDMap[i]));
|
501
|
+
}
|
502
|
+
if (alphaPtr->slotbmp != NULL)
|
503
|
+
{
|
504
|
+
sbmp = (SLOT_BITMAP *) alphaPtr->slotbmp->contents;
|
505
|
+
WriteString(theEnv,STDOUT," *** Slots:");
|
506
|
+
for (i = NAME_ID ; i <= sbmp->maxid ; i++)
|
507
|
+
if (TestBitMap(sbmp->map,i))
|
508
|
+
{
|
509
|
+
for (uptr = pptr ; uptr != NULL ; uptr = uptr->lastLevel)
|
510
|
+
if (uptr->slotNameID == i)
|
511
|
+
break;
|
512
|
+
if (uptr == NULL)
|
513
|
+
{
|
514
|
+
WriteString(theEnv,STDOUT," ");
|
515
|
+
WriteString(theEnv,STDOUT,FindIDSlotName(theEnv,i)->contents);
|
516
|
+
}
|
517
|
+
}
|
518
|
+
}
|
519
|
+
if (alphaPtr->header.rightHash != NULL)
|
520
|
+
{
|
521
|
+
WriteString(theEnv,STDOUT," RH: ");
|
522
|
+
PrintExpression(theEnv,STDOUT,alphaPtr->header.rightHash);
|
523
|
+
}
|
524
|
+
|
525
|
+
WriteString(theEnv,STDOUT,"\n");
|
526
|
+
alphaPtr = alphaPtr->nxtInGroup;
|
527
|
+
}
|
528
|
+
indentbuf[ilen++] = (char) ((pptr->rightNode != NULL) ? '|' : ' ');
|
529
|
+
indentbuf[ilen++] = ' ';
|
530
|
+
indentbuf[ilen++] = ' ';
|
531
|
+
indentbuf[ilen] = '\0';
|
532
|
+
PrintOPNLevel(theEnv,pptr->nextLevel,indentbuf,ilen);
|
533
|
+
ilen -= 3;
|
534
|
+
indentbuf[ilen] = '\0';
|
535
|
+
pptr = pptr->rightNode;
|
536
|
+
}
|
537
|
+
}
|
538
|
+
|
539
|
+
#endif
|
540
|
+
|
541
|
+
#if OBJECT_SYSTEM
|
542
|
+
|
543
|
+
/*******************************************************/
|
544
|
+
/* InstanceTableUsageCommand: Prints information about */
|
545
|
+
/* the instances in the instance hash table. */
|
546
|
+
/*******************************************************/
|
547
|
+
void InstanceTableUsageCommand(
|
548
|
+
Environment *theEnv,
|
549
|
+
UDFContext *context,
|
550
|
+
UDFValue *returnValue)
|
551
|
+
{
|
552
|
+
unsigned long i;
|
553
|
+
unsigned long long instanceCounts[COUNT_SIZE];
|
554
|
+
Instance *ins;
|
555
|
+
unsigned long instanceCount, totalInstanceCount = 0;
|
556
|
+
|
557
|
+
for (i = 0; i < COUNT_SIZE; i++)
|
558
|
+
{ instanceCounts[i] = 0; }
|
559
|
+
|
560
|
+
/*======================================*/
|
561
|
+
/* Count entries in the instance table. */
|
562
|
+
/*======================================*/
|
563
|
+
|
564
|
+
for (i = 0; i < INSTANCE_TABLE_HASH_SIZE; i++)
|
565
|
+
{
|
566
|
+
instanceCount = 0;
|
567
|
+
for (ins = InstanceData(theEnv)->InstanceTable[i]; ins != NULL; ins = ins->nxtHash)
|
568
|
+
{
|
569
|
+
instanceCount++;
|
570
|
+
totalInstanceCount++;
|
571
|
+
}
|
572
|
+
|
573
|
+
if (instanceCount < (COUNT_SIZE - 1))
|
574
|
+
{ instanceCounts[instanceCount]++; }
|
575
|
+
else
|
576
|
+
{ instanceCounts[COUNT_SIZE - 1]++; }
|
577
|
+
}
|
578
|
+
|
579
|
+
/*========================*/
|
580
|
+
/* Print the information. */
|
581
|
+
/*========================*/
|
582
|
+
|
583
|
+
WriteString(theEnv,STDOUT,"Total Instances: ");
|
584
|
+
PrintUnsignedInteger(theEnv,STDOUT,totalInstanceCount);
|
585
|
+
WriteString(theEnv,STDOUT,"\n");
|
586
|
+
for (i = 0; i < COUNT_SIZE; i++)
|
587
|
+
{
|
588
|
+
PrintUnsignedInteger(theEnv,STDOUT,i);
|
589
|
+
WriteString(theEnv,STDOUT," ");
|
590
|
+
PrintUnsignedInteger(theEnv,STDOUT,instanceCounts[i]);
|
591
|
+
WriteString(theEnv,STDOUT,"\n");
|
592
|
+
}
|
593
|
+
}
|
594
|
+
|
595
|
+
#endif
|
596
|
+
|
597
|
+
#if DEFRULE_CONSTRUCT
|
598
|
+
|
599
|
+
/******************/
|
600
|
+
/* ExamineMemory: */
|
601
|
+
/******************/
|
602
|
+
static void ExamineMemory(
|
603
|
+
Environment *theEnv,
|
604
|
+
struct joinNode *theJoin,
|
605
|
+
struct betaMemory *theMemory)
|
606
|
+
{
|
607
|
+
#if MAC_XCD
|
608
|
+
#pragma unused(theJoin)
|
609
|
+
#endif
|
610
|
+
if (theMemory->size > 10000)
|
611
|
+
{
|
612
|
+
/* Set a break point here */
|
613
|
+
}
|
614
|
+
}
|
615
|
+
|
616
|
+
/*************************/
|
617
|
+
/* TraverseBetaMemories: */
|
618
|
+
/*************************/
|
619
|
+
static void TraverseBetaMemories(
|
620
|
+
Environment *theEnv,
|
621
|
+
struct joinNode *theJoin)
|
622
|
+
{
|
623
|
+
if (theJoin == NULL)
|
624
|
+
{ return; }
|
625
|
+
|
626
|
+
if (theJoin->lastLevel != NULL)
|
627
|
+
{ TraverseBetaMemories(theEnv,theJoin->lastLevel); }
|
628
|
+
|
629
|
+
if (theJoin->depth > 2)
|
630
|
+
{ ExamineMemory(theEnv,theJoin,theJoin->leftMemory); }
|
631
|
+
|
632
|
+
if (theJoin->joinFromTheRight)
|
633
|
+
{ TraverseBetaMemories(theEnv,(struct joinNode *) theJoin->rightSideEntryStructure); }
|
634
|
+
|
635
|
+
if ((theJoin->joinFromTheRight) &&
|
636
|
+
(((struct joinNode *) (theJoin->rightSideEntryStructure))->depth > 1))
|
637
|
+
{ ExamineMemory(theEnv,theJoin,theJoin->rightMemory); }
|
638
|
+
}
|
639
|
+
|
640
|
+
/***********************************/
|
641
|
+
/* ValidateRuleBetaMemoriesAction: */
|
642
|
+
/***********************************/
|
643
|
+
static void ValidateRuleBetaMemoriesAction(
|
644
|
+
Environment *theEnv,
|
645
|
+
ConstructHeader *theConstruct,
|
646
|
+
void *buffer)
|
647
|
+
{
|
648
|
+
#if MAC_XCD
|
649
|
+
#pragma unused(buffer)
|
650
|
+
#endif
|
651
|
+
Defrule *rulePtr;
|
652
|
+
|
653
|
+
for (rulePtr = (Defrule *) theConstruct;
|
654
|
+
rulePtr != NULL;
|
655
|
+
rulePtr = rulePtr->disjunct)
|
656
|
+
{
|
657
|
+
TraverseBetaMemories(theEnv,rulePtr->lastJoin);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
|
661
|
+
/*******************************/
|
662
|
+
/* ValidateBetaMemoriesCommand */
|
663
|
+
/*******************************/
|
664
|
+
void ValidateBetaMemoriesCommand(
|
665
|
+
Environment *theEnv,
|
666
|
+
UDFContext *context,
|
667
|
+
UDFValue *returnValue)
|
668
|
+
{
|
669
|
+
WriteString(theEnv,STDOUT,"ValidateBetaMemories");
|
670
|
+
DoForAllConstructs(theEnv,ValidateRuleBetaMemoriesAction,DefruleData(theEnv)->DefruleModuleIndex,false,NULL);
|
671
|
+
}
|
672
|
+
|
673
|
+
#endif
|
674
|
+
|
675
|
+
#endif
|
676
|
+
|
677
|
+
|