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,59 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 07/30/16 */
|
5
|
+
/* */
|
6
|
+
/* DEFGLOBAL PARSER HEADER FILE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Gary D. Riley */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* */
|
17
|
+
/* Revision History: */
|
18
|
+
/* */
|
19
|
+
/* 6.24: Renamed BOOLEAN macro type to intBool. */
|
20
|
+
/* */
|
21
|
+
/* Made the construct redefinition message more */
|
22
|
+
/* prominent. */
|
23
|
+
/* */
|
24
|
+
/* 6.30: Removed conditional code for unsupported */
|
25
|
+
/* compilers/operating systems (IBM_MCW and */
|
26
|
+
/* MAC_MCW). */
|
27
|
+
/* */
|
28
|
+
/* Added const qualifiers to remove C++ */
|
29
|
+
/* deprecation warnings. */
|
30
|
+
/* */
|
31
|
+
/* Moved WatchGlobals global to defglobalData. */
|
32
|
+
/* */
|
33
|
+
/* 6.40: Removed LOCALE definition. */
|
34
|
+
/* */
|
35
|
+
/* Pragma once and other inclusion changes. */
|
36
|
+
/* */
|
37
|
+
/* Added support for booleans with <stdbool.h>. */
|
38
|
+
/* */
|
39
|
+
/* Removed use of void pointers for specific */
|
40
|
+
/* data structures. */
|
41
|
+
/* */
|
42
|
+
/*************************************************************/
|
43
|
+
|
44
|
+
#ifndef _H_globlpsr
|
45
|
+
|
46
|
+
#pragma once
|
47
|
+
|
48
|
+
#define _H_globlpsr
|
49
|
+
|
50
|
+
#include "expressn.h"
|
51
|
+
|
52
|
+
bool ParseDefglobal(Environment *,const char *);
|
53
|
+
bool ReplaceGlobalVariable(Environment *,struct expr *);
|
54
|
+
void GlobalReferenceErrorMessage(Environment *,const char *);
|
55
|
+
|
56
|
+
#endif /* _H_globlpsr */
|
57
|
+
|
58
|
+
|
59
|
+
|
@@ -0,0 +1,431 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 11/01/16 */
|
5
|
+
/* */
|
6
|
+
/* IMPLICIT SYSTEM METHODS PARSING MODULE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Parsing routines for Implicit System Methods */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Brian L. Dantes */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* */
|
17
|
+
/* Revision History: */
|
18
|
+
/* */
|
19
|
+
/* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */
|
20
|
+
/* */
|
21
|
+
/* 6.24: Added pragmas to remove unused parameter */
|
22
|
+
/* warnings. */
|
23
|
+
/* */
|
24
|
+
/* 6.30: Removed conditional code for unsupported */
|
25
|
+
/* compilers/operating systems (IBM_MCW, */
|
26
|
+
/* MAC_MCW, and IBM_TBC). */
|
27
|
+
/* */
|
28
|
+
/* Support for long long integers. */
|
29
|
+
/* */
|
30
|
+
/* Added const qualifiers to remove C++ */
|
31
|
+
/* deprecation warnings. */
|
32
|
+
/* */
|
33
|
+
/* 6.40: Changed restrictions from char * to */
|
34
|
+
/* CLIPSLexeme * to support strings */
|
35
|
+
/* originating from sources that are not */
|
36
|
+
/* statically allocated. */
|
37
|
+
/* */
|
38
|
+
/* Pragma once and other inclusion changes. */
|
39
|
+
/* */
|
40
|
+
/* Added support for booleans with <stdbool.h>. */
|
41
|
+
/* */
|
42
|
+
/* Removed use of void pointers for specific */
|
43
|
+
/* data structures. */
|
44
|
+
/* */
|
45
|
+
/* UDF redesign. */
|
46
|
+
/* */
|
47
|
+
/*************************************************************/
|
48
|
+
|
49
|
+
/* =========================================
|
50
|
+
*****************************************
|
51
|
+
EXTERNAL DEFINITIONS
|
52
|
+
=========================================
|
53
|
+
***************************************** */
|
54
|
+
#include "setup.h"
|
55
|
+
|
56
|
+
#if DEFGENERIC_CONSTRUCT && (! BLOAD_ONLY) && (! RUN_TIME)
|
57
|
+
|
58
|
+
#include <stdlib.h>
|
59
|
+
|
60
|
+
#if OBJECT_SYSTEM
|
61
|
+
#include "classcom.h"
|
62
|
+
#include "classfun.h"
|
63
|
+
#endif
|
64
|
+
#include "cstrnutl.h"
|
65
|
+
#include "envrnmnt.h"
|
66
|
+
#include "exprnpsr.h"
|
67
|
+
#include "extnfunc.h"
|
68
|
+
#include "genrcpsr.h"
|
69
|
+
#include "memalloc.h"
|
70
|
+
#include "prccode.h"
|
71
|
+
|
72
|
+
#include "immthpsr.h"
|
73
|
+
|
74
|
+
/* =========================================
|
75
|
+
*****************************************
|
76
|
+
INTERNALLY VISIBLE FUNCTION HEADERS
|
77
|
+
=========================================
|
78
|
+
***************************************** */
|
79
|
+
|
80
|
+
static void FormMethodsFromRestrictions(Environment *,Defgeneric *,struct functionDefinition *,Expression *);
|
81
|
+
static RESTRICTION *ParseRestrictionType(Environment *,unsigned);
|
82
|
+
static Expression *GenTypeExpression(Environment *,Expression *,int,int,const char *);
|
83
|
+
static Expression *ParseRestrictionCreateTypes(Environment *,CONSTRAINT_RECORD *);
|
84
|
+
|
85
|
+
/* =========================================
|
86
|
+
*****************************************
|
87
|
+
EXTERNALLY VISIBLE FUNCTIONS
|
88
|
+
=========================================
|
89
|
+
***************************************** */
|
90
|
+
|
91
|
+
/********************************************************
|
92
|
+
NAME : AddImplicitMethods
|
93
|
+
DESCRIPTION : Adds a method(s) for a generic function
|
94
|
+
for an overloaded system function
|
95
|
+
INPUTS : A pointer to a gneeric function
|
96
|
+
RETURNS : Nothing useful
|
97
|
+
SIDE EFFECTS : Method added
|
98
|
+
NOTES : Method marked as system
|
99
|
+
Assumes no other methods already present
|
100
|
+
********************************************************/
|
101
|
+
void AddImplicitMethods(
|
102
|
+
Environment *theEnv,
|
103
|
+
Defgeneric *gfunc)
|
104
|
+
{
|
105
|
+
struct functionDefinition *sysfunc;
|
106
|
+
Expression action;
|
107
|
+
|
108
|
+
sysfunc = FindFunction(theEnv,gfunc->header.name->contents);
|
109
|
+
if (sysfunc == NULL)
|
110
|
+
return;
|
111
|
+
action.type = FCALL;
|
112
|
+
action.value = sysfunc;
|
113
|
+
action.nextArg = NULL;
|
114
|
+
action.argList = NULL;
|
115
|
+
FormMethodsFromRestrictions(theEnv,gfunc,sysfunc,&action);
|
116
|
+
}
|
117
|
+
|
118
|
+
/* =========================================
|
119
|
+
*****************************************
|
120
|
+
INTERNALLY VISIBLE FUNCTIONS
|
121
|
+
=========================================
|
122
|
+
***************************************** */
|
123
|
+
|
124
|
+
/**********************************************************************
|
125
|
+
NAME : FormMethodsFromRestrictions
|
126
|
+
DESCRIPTION : Uses restriction string given in DefineFunction2()
|
127
|
+
for system function to create an equivalent method
|
128
|
+
INPUTS : 1) The generic function for the new methods
|
129
|
+
2) System function restriction string
|
130
|
+
(see DefineFunction2() last argument)
|
131
|
+
3) The actions to attach to a new method(s)
|
132
|
+
RETURNS : Nothing useful
|
133
|
+
SIDE EFFECTS : Implicit method(s) created
|
134
|
+
NOTES : None
|
135
|
+
**********************************************************************/
|
136
|
+
static void FormMethodsFromRestrictions(
|
137
|
+
Environment *theEnv,
|
138
|
+
Defgeneric *gfunc,
|
139
|
+
struct functionDefinition *sysfunc,
|
140
|
+
Expression *actions)
|
141
|
+
{
|
142
|
+
Defmethod *meth;
|
143
|
+
Expression *plist,*tmp,*bot,*svBot;
|
144
|
+
RESTRICTION *rptr;
|
145
|
+
unsigned defaultc2, argRestriction2;
|
146
|
+
int mposn;
|
147
|
+
unsigned short min, max;
|
148
|
+
bool needMinimumMethod;
|
149
|
+
unsigned short i;
|
150
|
+
const char *rstring;
|
151
|
+
|
152
|
+
if (sysfunc->restrictions == NULL)
|
153
|
+
{ rstring = NULL; }
|
154
|
+
else
|
155
|
+
{ rstring = sysfunc->restrictions->contents; }
|
156
|
+
|
157
|
+
/*================================*/
|
158
|
+
/* Extract the range of arguments */
|
159
|
+
/* from the restriction string. */
|
160
|
+
/*================================*/
|
161
|
+
|
162
|
+
min = sysfunc->minArgs;
|
163
|
+
max = sysfunc->maxArgs;
|
164
|
+
PopulateRestriction(theEnv,&defaultc2,ANY_TYPE_BITS,rstring,0);
|
165
|
+
|
166
|
+
/*==================================================*/
|
167
|
+
/* Form a list of method restrictions corresponding */
|
168
|
+
/* to the minimum number of arguments. */
|
169
|
+
/*==================================================*/
|
170
|
+
|
171
|
+
plist = bot = NULL;
|
172
|
+
for (i = 0 ; i < min ; i++)
|
173
|
+
{
|
174
|
+
PopulateRestriction(theEnv,&argRestriction2,defaultc2,rstring,i+1);
|
175
|
+
rptr = ParseRestrictionType(theEnv,argRestriction2);
|
176
|
+
tmp = get_struct(theEnv,expr);
|
177
|
+
tmp->argList = (Expression *) rptr;
|
178
|
+
tmp->nextArg = NULL;
|
179
|
+
if (plist == NULL)
|
180
|
+
plist = tmp;
|
181
|
+
else
|
182
|
+
bot->nextArg = tmp;
|
183
|
+
bot = tmp;
|
184
|
+
}
|
185
|
+
|
186
|
+
/*==================================*/
|
187
|
+
/* Remember where restrictions end */
|
188
|
+
/* for minimum number of arguments. */
|
189
|
+
/*==================================*/
|
190
|
+
|
191
|
+
svBot = bot;
|
192
|
+
needMinimumMethod = true;
|
193
|
+
|
194
|
+
/*=====================================================*/
|
195
|
+
/* Attach one or more new methods to correspond to the */
|
196
|
+
/* possible variations of the extra arguments. Add a */
|
197
|
+
/* separate method for each specified extra argument. */
|
198
|
+
/*=====================================================*/
|
199
|
+
|
200
|
+
i = 0;
|
201
|
+
while (RestrictionExists(rstring,min+i+1))
|
202
|
+
{
|
203
|
+
if ((min + i + 1) == max)
|
204
|
+
{
|
205
|
+
if (! RestrictionExists(rstring,min+i+2))
|
206
|
+
{
|
207
|
+
PopulateRestriction(theEnv,&defaultc2,ANY_TYPE_BITS,rstring,min+i+1);
|
208
|
+
break;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
PopulateRestriction(theEnv,&argRestriction2,defaultc2,rstring,min+i+1);
|
213
|
+
rptr = ParseRestrictionType(theEnv,argRestriction2);
|
214
|
+
|
215
|
+
tmp = get_struct(theEnv,expr);
|
216
|
+
tmp->argList = (Expression *) rptr;
|
217
|
+
tmp->nextArg = NULL;
|
218
|
+
if (plist == NULL)
|
219
|
+
plist = tmp;
|
220
|
+
else
|
221
|
+
bot->nextArg = tmp;
|
222
|
+
bot = tmp;
|
223
|
+
i++;
|
224
|
+
if (RestrictionExists(rstring,min+i+1) ||
|
225
|
+
((min + i) == max))
|
226
|
+
{
|
227
|
+
FindMethodByRestrictions(gfunc,plist,min + i,NULL,&mposn);
|
228
|
+
meth = AddMethod(theEnv,gfunc,NULL,mposn,0,plist,min + i,0,NULL,
|
229
|
+
PackExpression(theEnv,actions),NULL,true);
|
230
|
+
meth->system = 1;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
/*================================================*/
|
235
|
+
/* Add a method to account for wildcard arguments */
|
236
|
+
/* and attach a query in case there is a limit. */
|
237
|
+
/*================================================*/
|
238
|
+
|
239
|
+
if ((min + i) != max)
|
240
|
+
{
|
241
|
+
/*==================================================*/
|
242
|
+
/* If a wildcard is present immediately after the */
|
243
|
+
/* minimum number of args - then the minimum case */
|
244
|
+
/* will already be handled by this method. We don't */
|
245
|
+
/* need to add an extra method for that case. */
|
246
|
+
/*==================================================*/
|
247
|
+
|
248
|
+
if (i == 0)
|
249
|
+
{ needMinimumMethod = false; }
|
250
|
+
|
251
|
+
rptr = ParseRestrictionType(theEnv,defaultc2);
|
252
|
+
|
253
|
+
if (max != UNBOUNDED)
|
254
|
+
{
|
255
|
+
rptr->query = GenConstant(theEnv,FCALL,FindFunction(theEnv,"<="));
|
256
|
+
rptr->query->argList = GenConstant(theEnv,FCALL,FindFunction(theEnv,"length$"));
|
257
|
+
rptr->query->argList->argList = GenProcWildcardReference(theEnv,min + i + 1);
|
258
|
+
rptr->query->argList->nextArg =
|
259
|
+
GenConstant(theEnv,INTEGER_TYPE,CreateInteger(theEnv,(long long) (max - min - i)));
|
260
|
+
}
|
261
|
+
tmp = get_struct(theEnv,expr);
|
262
|
+
tmp->argList = (Expression *) rptr;
|
263
|
+
tmp->nextArg = NULL;
|
264
|
+
if (plist == NULL)
|
265
|
+
plist = tmp;
|
266
|
+
else
|
267
|
+
bot->nextArg = tmp;
|
268
|
+
FindMethodByRestrictions(gfunc,plist,min + i + 1,TrueSymbol(theEnv),&mposn);
|
269
|
+
meth = AddMethod(theEnv,gfunc,NULL,mposn,0,plist,min + i + 1,0,TrueSymbol(theEnv),
|
270
|
+
PackExpression(theEnv,actions),NULL,false);
|
271
|
+
meth->system = 1;
|
272
|
+
}
|
273
|
+
|
274
|
+
/*=====================================================*/
|
275
|
+
/* When extra methods had to be added because of */
|
276
|
+
/* different restrictions on the optional arguments OR */
|
277
|
+
/* the system function accepts a fixed number of args, */
|
278
|
+
/* we must add a specific method for the minimum case. */
|
279
|
+
/* Otherwise, the method with the wildcard covers it. */
|
280
|
+
/*=====================================================*/
|
281
|
+
|
282
|
+
if (needMinimumMethod)
|
283
|
+
{
|
284
|
+
if (svBot != NULL)
|
285
|
+
{
|
286
|
+
bot = svBot->nextArg;
|
287
|
+
svBot->nextArg = NULL;
|
288
|
+
DeleteTempRestricts(theEnv,bot);
|
289
|
+
}
|
290
|
+
FindMethodByRestrictions(gfunc,plist,min,NULL,&mposn);
|
291
|
+
meth = AddMethod(theEnv,gfunc,NULL,mposn,0,plist,min,0,NULL,
|
292
|
+
PackExpression(theEnv,actions),NULL,true);
|
293
|
+
meth->system = 1;
|
294
|
+
}
|
295
|
+
DeleteTempRestricts(theEnv,plist);
|
296
|
+
}
|
297
|
+
|
298
|
+
/*******************************/
|
299
|
+
/* ParseRestrictionCreateTypes */
|
300
|
+
/*******************************/
|
301
|
+
static Expression *ParseRestrictionCreateTypes(
|
302
|
+
Environment *theEnv,
|
303
|
+
CONSTRAINT_RECORD *rv)
|
304
|
+
{
|
305
|
+
Expression *types = NULL;
|
306
|
+
|
307
|
+
if (rv->anyAllowed == false)
|
308
|
+
{
|
309
|
+
if (rv->symbolsAllowed && rv->stringsAllowed)
|
310
|
+
types = GenTypeExpression(theEnv,types,LEXEME_TYPE_CODE,-1,LEXEME_TYPE_NAME);
|
311
|
+
else if (rv->symbolsAllowed)
|
312
|
+
types = GenTypeExpression(theEnv,types,SYMBOL_TYPE,SYMBOL_TYPE,NULL);
|
313
|
+
else if (rv->stringsAllowed)
|
314
|
+
types = GenTypeExpression(theEnv,types,STRING_TYPE,STRING_TYPE,NULL);
|
315
|
+
|
316
|
+
if (rv->floatsAllowed && rv->integersAllowed)
|
317
|
+
types = GenTypeExpression(theEnv,types,NUMBER_TYPE_CODE,-1,NUMBER_TYPE_NAME);
|
318
|
+
else if (rv->integersAllowed)
|
319
|
+
types = GenTypeExpression(theEnv,types,INTEGER_TYPE,INTEGER_TYPE,NULL);
|
320
|
+
else if (rv->floatsAllowed)
|
321
|
+
types = GenTypeExpression(theEnv,types,FLOAT_TYPE,FLOAT_TYPE,NULL);
|
322
|
+
|
323
|
+
if (rv->instanceNamesAllowed && rv->instanceAddressesAllowed)
|
324
|
+
types = GenTypeExpression(theEnv,types,INSTANCE_TYPE_CODE,-1,INSTANCE_TYPE_NAME);
|
325
|
+
else if (rv->instanceNamesAllowed)
|
326
|
+
types = GenTypeExpression(theEnv,types,INSTANCE_NAME_TYPE,INSTANCE_NAME_TYPE,NULL);
|
327
|
+
else if (rv->instanceAddressesAllowed)
|
328
|
+
types = GenTypeExpression(theEnv,types,INSTANCE_ADDRESS_TYPE,INSTANCE_ADDRESS_TYPE,NULL);
|
329
|
+
|
330
|
+
if (rv->externalAddressesAllowed && rv->instanceAddressesAllowed &&
|
331
|
+
rv->factAddressesAllowed)
|
332
|
+
types = GenTypeExpression(theEnv,types,ADDRESS_TYPE_CODE,-1,ADDRESS_TYPE_NAME);
|
333
|
+
else
|
334
|
+
{
|
335
|
+
if (rv->externalAddressesAllowed)
|
336
|
+
types = GenTypeExpression(theEnv,types,EXTERNAL_ADDRESS_TYPE,EXTERNAL_ADDRESS_TYPE,NULL);
|
337
|
+
if (rv->instanceAddressesAllowed && (rv->instanceNamesAllowed == 0))
|
338
|
+
types = GenTypeExpression(theEnv,types,INSTANCE_ADDRESS_TYPE,INSTANCE_ADDRESS_TYPE,NULL);
|
339
|
+
if (rv->factAddressesAllowed)
|
340
|
+
types = GenTypeExpression(theEnv,types,FACT_ADDRESS_TYPE,FACT_ADDRESS_TYPE,NULL);
|
341
|
+
}
|
342
|
+
|
343
|
+
if (rv->multifieldsAllowed)
|
344
|
+
types = GenTypeExpression(theEnv,types,MULTIFIELD_TYPE,MULTIFIELD_TYPE,NULL);
|
345
|
+
}
|
346
|
+
|
347
|
+
return(types);
|
348
|
+
}
|
349
|
+
|
350
|
+
/*******************************************************************
|
351
|
+
NAME : ParseRestrictionType
|
352
|
+
DESCRIPTION : Takes a string of type character codes (as given in
|
353
|
+
DefineFunction2()) and converts it into a method
|
354
|
+
restriction structure
|
355
|
+
INPUTS : The type character code
|
356
|
+
RETURNS : The restriction
|
357
|
+
SIDE EFFECTS : Restriction allocated
|
358
|
+
NOTES : None
|
359
|
+
*******************************************************************/
|
360
|
+
static RESTRICTION *ParseRestrictionType(
|
361
|
+
Environment *theEnv,
|
362
|
+
unsigned code)
|
363
|
+
{
|
364
|
+
RESTRICTION *rptr;
|
365
|
+
CONSTRAINT_RECORD *rv;
|
366
|
+
Expression *types = NULL;
|
367
|
+
|
368
|
+
rptr = get_struct(theEnv,restriction);
|
369
|
+
rptr->query = NULL;
|
370
|
+
rv = ArgumentTypeToConstraintRecord(theEnv,code);
|
371
|
+
|
372
|
+
types = ParseRestrictionCreateTypes(theEnv,rv);
|
373
|
+
RemoveConstraint(theEnv,rv);
|
374
|
+
PackRestrictionTypes(theEnv,rptr,types);
|
375
|
+
return(rptr);
|
376
|
+
}
|
377
|
+
|
378
|
+
/***************************************************
|
379
|
+
NAME : GenTypeExpression
|
380
|
+
DESCRIPTION : Creates an expression corresponding
|
381
|
+
to the type specified and adds it
|
382
|
+
to the front of a temporary type
|
383
|
+
list for a method restriction
|
384
|
+
INPUTS : 1) The top of the current type list
|
385
|
+
2) The type code when COOL is
|
386
|
+
not installed
|
387
|
+
3) The primitive type (-1 if not
|
388
|
+
a primitive type)
|
389
|
+
4) The name of the COOL class if
|
390
|
+
it is not a primitive type
|
391
|
+
RETURNS : The new top of the types list
|
392
|
+
SIDE EFFECTS : Type node allocated and attached
|
393
|
+
NOTES : Restriction types in a non-COOL
|
394
|
+
environment are the type codes
|
395
|
+
given in CONSTANT.H. In a COOL
|
396
|
+
environment, they are pointers
|
397
|
+
to classes
|
398
|
+
***************************************************/
|
399
|
+
static Expression *GenTypeExpression(
|
400
|
+
Environment *theEnv,
|
401
|
+
Expression *top,
|
402
|
+
int nonCOOLCode,
|
403
|
+
int primitiveCode,
|
404
|
+
const char *COOLName)
|
405
|
+
{
|
406
|
+
#if OBJECT_SYSTEM
|
407
|
+
#if MAC_XCD
|
408
|
+
#pragma unused(nonCOOLCode)
|
409
|
+
#endif
|
410
|
+
#else
|
411
|
+
#if MAC_XCD
|
412
|
+
#pragma unused(primitiveCode)
|
413
|
+
#pragma unused(COOLName)
|
414
|
+
#endif
|
415
|
+
#endif
|
416
|
+
Expression *tmp;
|
417
|
+
|
418
|
+
#if OBJECT_SYSTEM
|
419
|
+
if (primitiveCode != -1)
|
420
|
+
tmp = GenConstant(theEnv,0,DefclassData(theEnv)->PrimitiveClassMap[primitiveCode]);
|
421
|
+
else
|
422
|
+
tmp = GenConstant(theEnv,0,LookupDefclassByMdlOrScope(theEnv,COOLName));
|
423
|
+
#else
|
424
|
+
tmp = GenConstant(theEnv,0,CreateInteger(theEnv,nonCOOLCode));
|
425
|
+
#endif
|
426
|
+
tmp->nextArg = top;
|
427
|
+
return(tmp);
|
428
|
+
}
|
429
|
+
|
430
|
+
#endif /* DEFGENERIC_CONSTRUCT && (! BLOAD_ONLY) && (! RUN_TIME) */
|
431
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 07/30/16 */
|
5
|
+
/* */
|
6
|
+
/* */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Brian L. Dantes */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* */
|
17
|
+
/* Revision History: */
|
18
|
+
/* */
|
19
|
+
/* 6.30: Removed conditional code for unsupported */
|
20
|
+
/* compilers/operating systems (IBM_MCW, */
|
21
|
+
/* MAC_MCW, and IBM_TBC). */
|
22
|
+
/* */
|
23
|
+
/* Support for long long integers. */
|
24
|
+
/* */
|
25
|
+
/* Added const qualifiers to remove C++ */
|
26
|
+
/* deprecation warnings. */
|
27
|
+
/* */
|
28
|
+
/* 6.40: Removed LOCALE definition. */
|
29
|
+
/* */
|
30
|
+
/* Pragma once and other inclusion changes. */
|
31
|
+
/* */
|
32
|
+
/* Removed use of void pointers for specific */
|
33
|
+
/* data structures. */
|
34
|
+
/* */
|
35
|
+
/*************************************************************/
|
36
|
+
|
37
|
+
#ifndef _H_immthpsr
|
38
|
+
|
39
|
+
#pragma once
|
40
|
+
|
41
|
+
#define _H_immthpsr
|
42
|
+
|
43
|
+
#if DEFGENERIC_CONSTRUCT && (! BLOAD_ONLY) && (! RUN_TIME)
|
44
|
+
|
45
|
+
#include "genrcfun.h"
|
46
|
+
|
47
|
+
void AddImplicitMethods(Environment *,Defgeneric *);
|
48
|
+
|
49
|
+
#endif /* DEFGENERIC_CONSTRUCT && (! BLOAD_ONLY) && (! RUN_TIME) */
|
50
|
+
|
51
|
+
#endif /* _H_immthpsr */
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|