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,88 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 07/30/16 */
|
5
|
+
/* */
|
6
|
+
/* CONSTRAINT PARSER HEADER FILE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Provides functions for parsing constraint */
|
11
|
+
/* declarations. */
|
12
|
+
/* */
|
13
|
+
/* Principal Programmer(s): */
|
14
|
+
/* Gary D. Riley */
|
15
|
+
/* */
|
16
|
+
/* Contributing Programmer(s): */
|
17
|
+
/* */
|
18
|
+
/* Revision History: */
|
19
|
+
/* */
|
20
|
+
/* 6.23: Changed name of variable exp to theExp */
|
21
|
+
/* because of Unix compiler warnings of shadowed */
|
22
|
+
/* definitions. */
|
23
|
+
/* */
|
24
|
+
/* 6.24: Added allowed-classes slot facet. */
|
25
|
+
/* */
|
26
|
+
/* Renamed BOOLEAN macro type to intBool. */
|
27
|
+
/* */
|
28
|
+
/* 6.30: Used gensprintf instead of sprintf. */
|
29
|
+
/* */
|
30
|
+
/* Added const qualifiers to remove C++ */
|
31
|
+
/* deprecation warnings. */
|
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_cstrnpsr
|
45
|
+
|
46
|
+
#pragma once
|
47
|
+
|
48
|
+
#define _H_cstrnpsr
|
49
|
+
|
50
|
+
#include "constrnt.h"
|
51
|
+
|
52
|
+
struct constraintParseRecord
|
53
|
+
{
|
54
|
+
unsigned int type : 1;
|
55
|
+
unsigned int range : 1;
|
56
|
+
unsigned int allowedSymbols : 1;
|
57
|
+
unsigned int allowedStrings : 1;
|
58
|
+
unsigned int allowedLexemes : 1;
|
59
|
+
unsigned int allowedFloats : 1;
|
60
|
+
unsigned int allowedIntegers : 1;
|
61
|
+
unsigned int allowedNumbers : 1;
|
62
|
+
unsigned int allowedValues : 1;
|
63
|
+
unsigned int allowedClasses : 1;
|
64
|
+
unsigned int allowedInstanceNames : 1;
|
65
|
+
unsigned int cardinality : 1;
|
66
|
+
};
|
67
|
+
|
68
|
+
typedef struct constraintParseRecord CONSTRAINT_PARSE_RECORD;
|
69
|
+
|
70
|
+
bool CheckConstraintParseConflicts(Environment *,CONSTRAINT_RECORD *);
|
71
|
+
void AttributeConflictErrorMessage(Environment *,const char *,const char *);
|
72
|
+
#if (! RUN_TIME) && (! BLOAD_ONLY)
|
73
|
+
void InitializeConstraintParseRecord(CONSTRAINT_PARSE_RECORD *);
|
74
|
+
bool StandardConstraint(const char *);
|
75
|
+
bool ParseStandardConstraint(Environment *,const char *,const char *,
|
76
|
+
CONSTRAINT_RECORD *,
|
77
|
+
CONSTRAINT_PARSE_RECORD *,
|
78
|
+
bool);
|
79
|
+
void OverlayConstraint(Environment *,CONSTRAINT_PARSE_RECORD *,
|
80
|
+
CONSTRAINT_RECORD *,CONSTRAINT_RECORD *);
|
81
|
+
void OverlayConstraintParseRecord(CONSTRAINT_PARSE_RECORD *,
|
82
|
+
CONSTRAINT_PARSE_RECORD *);
|
83
|
+
#endif /* (! RUN_TIME) && (! BLOAD_ONLY) */
|
84
|
+
|
85
|
+
#endif /* _H_cstrnpsr */
|
86
|
+
|
87
|
+
|
88
|
+
|
@@ -0,0 +1,564 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.41 01/26/22 */
|
5
|
+
/* */
|
6
|
+
/* CONSTRAINT UTILITY MODULE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Utility routines for manipulating, initializing, */
|
11
|
+
/* creating, copying, and comparing constraint records. */
|
12
|
+
/* */
|
13
|
+
/* Principal Programmer(s): */
|
14
|
+
/* Gary D. Riley */
|
15
|
+
/* */
|
16
|
+
/* Contributing Programmer(s): */
|
17
|
+
/* Brian Dantes */
|
18
|
+
/* */
|
19
|
+
/* Revision History: */
|
20
|
+
/* */
|
21
|
+
/* 6.24: Added allowed-classes slot facet. */
|
22
|
+
/* */
|
23
|
+
/* 6.30: Support for long long integers. */
|
24
|
+
/* */
|
25
|
+
/* 6.40: Pragma once and other inclusion changes. */
|
26
|
+
/* */
|
27
|
+
/* Added support for booleans with <stdbool.h>. */
|
28
|
+
/* */
|
29
|
+
/* Removed use of void pointers for specific */
|
30
|
+
/* data structures. */
|
31
|
+
/* */
|
32
|
+
/* UDF redesign. */
|
33
|
+
/* */
|
34
|
+
/* Eval support for run time and bload only. */
|
35
|
+
/* */
|
36
|
+
/* 6.41: Fixed FunctionCallBuilder bug with external */
|
37
|
+
/* and fact address arguments generating errors. */
|
38
|
+
/* */
|
39
|
+
/*************************************************************/
|
40
|
+
|
41
|
+
#include <stdio.h>
|
42
|
+
#include <stdlib.h>
|
43
|
+
|
44
|
+
#include "setup.h"
|
45
|
+
|
46
|
+
#include "argacces.h"
|
47
|
+
#include "constant.h"
|
48
|
+
#include "envrnmnt.h"
|
49
|
+
#include "extnfunc.h"
|
50
|
+
#include "memalloc.h"
|
51
|
+
#include "multifld.h"
|
52
|
+
#include "router.h"
|
53
|
+
#include "scanner.h"
|
54
|
+
|
55
|
+
#include "cstrnutl.h"
|
56
|
+
|
57
|
+
/************************************************/
|
58
|
+
/* GetConstraintRecord: Creates and initializes */
|
59
|
+
/* the values of a constraint record. */
|
60
|
+
/************************************************/
|
61
|
+
struct constraintRecord *GetConstraintRecord(
|
62
|
+
Environment *theEnv)
|
63
|
+
{
|
64
|
+
CONSTRAINT_RECORD *constraints;
|
65
|
+
unsigned i;
|
66
|
+
|
67
|
+
constraints = get_struct(theEnv,constraintRecord);
|
68
|
+
|
69
|
+
for (i = 0 ; i < sizeof(CONSTRAINT_RECORD) ; i++)
|
70
|
+
{ ((char *) constraints)[i] = '\0'; }
|
71
|
+
|
72
|
+
SetAnyAllowedFlags(constraints,true);
|
73
|
+
|
74
|
+
constraints->multifieldsAllowed = false;
|
75
|
+
constraints->singlefieldsAllowed = true;
|
76
|
+
|
77
|
+
constraints->anyRestriction = false;
|
78
|
+
constraints->symbolRestriction = false;
|
79
|
+
constraints->stringRestriction = false;
|
80
|
+
constraints->floatRestriction = false;
|
81
|
+
constraints->integerRestriction = false;
|
82
|
+
constraints->classRestriction = false;
|
83
|
+
constraints->instanceNameRestriction = false;
|
84
|
+
constraints->classList = NULL;
|
85
|
+
constraints->restrictionList = NULL;
|
86
|
+
constraints->minValue = GenConstant(theEnv,SYMBOL_TYPE,SymbolData(theEnv)->NegativeInfinity);
|
87
|
+
constraints->maxValue = GenConstant(theEnv,SYMBOL_TYPE,SymbolData(theEnv)->PositiveInfinity);
|
88
|
+
constraints->minFields = GenConstant(theEnv,INTEGER_TYPE,SymbolData(theEnv)->Zero);
|
89
|
+
constraints->maxFields = GenConstant(theEnv,SYMBOL_TYPE,SymbolData(theEnv)->PositiveInfinity);
|
90
|
+
constraints->installed = false;
|
91
|
+
constraints->bucket = 0;
|
92
|
+
constraints->count = 0;
|
93
|
+
constraints->multifield = NULL;
|
94
|
+
constraints->next = NULL;
|
95
|
+
|
96
|
+
return constraints;
|
97
|
+
}
|
98
|
+
|
99
|
+
/********************************************************/
|
100
|
+
/* SetAnyAllowedFlags: Sets the allowed type flags of a */
|
101
|
+
/* constraint record to allow all types. If passed an */
|
102
|
+
/* argument of true, just the "any allowed" flag is */
|
103
|
+
/* set to true. If passed an argument of false, then */
|
104
|
+
/* all of the individual type flags are set to true. */
|
105
|
+
/********************************************************/
|
106
|
+
void SetAnyAllowedFlags(
|
107
|
+
CONSTRAINT_RECORD *theConstraint,
|
108
|
+
bool justOne)
|
109
|
+
{
|
110
|
+
bool flag1, flag2;
|
111
|
+
|
112
|
+
if (justOne)
|
113
|
+
{
|
114
|
+
flag1 = true;
|
115
|
+
flag2 = false;
|
116
|
+
}
|
117
|
+
else
|
118
|
+
{
|
119
|
+
flag1 = false;
|
120
|
+
flag2 = true;
|
121
|
+
}
|
122
|
+
|
123
|
+
theConstraint->anyAllowed = flag1;
|
124
|
+
theConstraint->symbolsAllowed = flag2;
|
125
|
+
theConstraint->stringsAllowed = flag2;
|
126
|
+
theConstraint->floatsAllowed = flag2;
|
127
|
+
theConstraint->integersAllowed = flag2;
|
128
|
+
theConstraint->instanceNamesAllowed = flag2;
|
129
|
+
theConstraint->instanceAddressesAllowed = flag2;
|
130
|
+
theConstraint->externalAddressesAllowed = flag2;
|
131
|
+
theConstraint->voidAllowed = flag2;
|
132
|
+
theConstraint->factAddressesAllowed = flag2;
|
133
|
+
}
|
134
|
+
|
135
|
+
/*****************************************************/
|
136
|
+
/* CopyConstraintRecord: Copies a constraint record. */
|
137
|
+
/*****************************************************/
|
138
|
+
struct constraintRecord *CopyConstraintRecord(
|
139
|
+
Environment *theEnv,
|
140
|
+
CONSTRAINT_RECORD *sourceConstraint)
|
141
|
+
{
|
142
|
+
CONSTRAINT_RECORD *theConstraint;
|
143
|
+
|
144
|
+
if (sourceConstraint == NULL) return NULL;
|
145
|
+
|
146
|
+
theConstraint = get_struct(theEnv,constraintRecord);
|
147
|
+
|
148
|
+
theConstraint->anyAllowed = sourceConstraint->anyAllowed;
|
149
|
+
theConstraint->symbolsAllowed = sourceConstraint->symbolsAllowed;
|
150
|
+
theConstraint->stringsAllowed = sourceConstraint->stringsAllowed;
|
151
|
+
theConstraint->floatsAllowed = sourceConstraint->floatsAllowed;
|
152
|
+
theConstraint->integersAllowed = sourceConstraint->integersAllowed;
|
153
|
+
theConstraint->instanceNamesAllowed = sourceConstraint->instanceNamesAllowed;
|
154
|
+
theConstraint->instanceAddressesAllowed = sourceConstraint->instanceAddressesAllowed;
|
155
|
+
theConstraint->externalAddressesAllowed = sourceConstraint->externalAddressesAllowed;
|
156
|
+
theConstraint->voidAllowed = sourceConstraint->voidAllowed;
|
157
|
+
theConstraint->multifieldsAllowed = sourceConstraint->multifieldsAllowed;
|
158
|
+
theConstraint->singlefieldsAllowed = sourceConstraint->singlefieldsAllowed;
|
159
|
+
theConstraint->factAddressesAllowed = sourceConstraint->factAddressesAllowed;
|
160
|
+
theConstraint->anyRestriction = sourceConstraint->anyRestriction;
|
161
|
+
theConstraint->symbolRestriction = sourceConstraint->symbolRestriction;
|
162
|
+
theConstraint->stringRestriction = sourceConstraint->stringRestriction;
|
163
|
+
theConstraint->floatRestriction = sourceConstraint->floatRestriction;
|
164
|
+
theConstraint->integerRestriction = sourceConstraint->integerRestriction;
|
165
|
+
theConstraint->classRestriction = sourceConstraint->classRestriction;
|
166
|
+
theConstraint->instanceNameRestriction = sourceConstraint->instanceNameRestriction;
|
167
|
+
theConstraint->classList = CopyExpression(theEnv,sourceConstraint->classList);
|
168
|
+
theConstraint->restrictionList = CopyExpression(theEnv,sourceConstraint->restrictionList);
|
169
|
+
theConstraint->minValue = CopyExpression(theEnv,sourceConstraint->minValue);
|
170
|
+
theConstraint->maxValue = CopyExpression(theEnv,sourceConstraint->maxValue);
|
171
|
+
theConstraint->minFields = CopyExpression(theEnv,sourceConstraint->minFields);
|
172
|
+
theConstraint->maxFields = CopyExpression(theEnv,sourceConstraint->maxFields);
|
173
|
+
theConstraint->bucket = 0;
|
174
|
+
theConstraint->installed = false;
|
175
|
+
theConstraint->count = 0;
|
176
|
+
theConstraint->multifield = CopyConstraintRecord(theEnv,sourceConstraint->multifield);
|
177
|
+
theConstraint->next = NULL;
|
178
|
+
|
179
|
+
return(theConstraint);
|
180
|
+
}
|
181
|
+
|
182
|
+
/**************************************************************/
|
183
|
+
/* SetAnyRestrictionFlags: Sets the restriction type flags of */
|
184
|
+
/* a constraint record to indicate there are restriction on */
|
185
|
+
/* all types. If passed an argument of true, just the */
|
186
|
+
/* "any restriction" flag is set to true. If passed an */
|
187
|
+
/* argument of false, then all of the individual type */
|
188
|
+
/* restriction flags are set to true. */
|
189
|
+
/**************************************************************/
|
190
|
+
void SetAnyRestrictionFlags(
|
191
|
+
CONSTRAINT_RECORD *theConstraint,
|
192
|
+
bool justOne)
|
193
|
+
{
|
194
|
+
bool flag1, flag2;
|
195
|
+
|
196
|
+
if (justOne)
|
197
|
+
{
|
198
|
+
flag1 = true;
|
199
|
+
flag2 = false;
|
200
|
+
}
|
201
|
+
else
|
202
|
+
{
|
203
|
+
flag1 = false;
|
204
|
+
flag2 = true;
|
205
|
+
}
|
206
|
+
|
207
|
+
theConstraint->anyRestriction = flag1;
|
208
|
+
theConstraint->symbolRestriction = flag2;
|
209
|
+
theConstraint->stringRestriction = flag2;
|
210
|
+
theConstraint->floatRestriction = flag2;
|
211
|
+
theConstraint->integerRestriction = flag2;
|
212
|
+
theConstraint->instanceNameRestriction = flag2;
|
213
|
+
}
|
214
|
+
|
215
|
+
#if (! RUN_TIME) && (! BLOAD_ONLY)
|
216
|
+
|
217
|
+
/*****************************************************/
|
218
|
+
/* SetConstraintType: Given a constraint type and a */
|
219
|
+
/* constraint, sets the allowed type flags for the */
|
220
|
+
/* specified type in the constraint to true. */
|
221
|
+
/*****************************************************/
|
222
|
+
bool SetConstraintType(
|
223
|
+
int theType,
|
224
|
+
CONSTRAINT_RECORD *constraints)
|
225
|
+
{
|
226
|
+
bool rv = true;
|
227
|
+
|
228
|
+
switch(theType)
|
229
|
+
{
|
230
|
+
case UNKNOWN_VALUE:
|
231
|
+
rv = constraints->anyAllowed;
|
232
|
+
constraints->anyAllowed = true;
|
233
|
+
break;
|
234
|
+
|
235
|
+
case SYMBOL_TYPE:
|
236
|
+
rv = constraints->symbolsAllowed;
|
237
|
+
constraints->symbolsAllowed = true;
|
238
|
+
break;
|
239
|
+
|
240
|
+
case STRING_TYPE:
|
241
|
+
rv = constraints->stringsAllowed;
|
242
|
+
constraints->stringsAllowed = true;
|
243
|
+
break;
|
244
|
+
|
245
|
+
case SYMBOL_OR_STRING:
|
246
|
+
rv = (constraints->stringsAllowed || constraints->symbolsAllowed);
|
247
|
+
constraints->symbolsAllowed = true;
|
248
|
+
constraints->stringsAllowed = true;
|
249
|
+
break;
|
250
|
+
|
251
|
+
case INTEGER_TYPE:
|
252
|
+
rv = constraints->integersAllowed;
|
253
|
+
constraints->integersAllowed = true;
|
254
|
+
break;
|
255
|
+
|
256
|
+
case FLOAT_TYPE:
|
257
|
+
rv = constraints->floatsAllowed;
|
258
|
+
constraints->floatsAllowed = true;
|
259
|
+
break;
|
260
|
+
|
261
|
+
case INTEGER_OR_FLOAT:
|
262
|
+
rv = (constraints->integersAllowed || constraints->floatsAllowed);
|
263
|
+
constraints->integersAllowed = true;
|
264
|
+
constraints->floatsAllowed = true;
|
265
|
+
break;
|
266
|
+
|
267
|
+
case INSTANCE_ADDRESS_TYPE:
|
268
|
+
rv = constraints->instanceAddressesAllowed;
|
269
|
+
constraints->instanceAddressesAllowed = true;
|
270
|
+
break;
|
271
|
+
|
272
|
+
case INSTANCE_NAME_TYPE:
|
273
|
+
rv = constraints->instanceNamesAllowed;
|
274
|
+
constraints->instanceNamesAllowed = true;
|
275
|
+
break;
|
276
|
+
|
277
|
+
case INSTANCE_OR_INSTANCE_NAME:
|
278
|
+
rv = (constraints->instanceNamesAllowed || constraints->instanceAddressesAllowed);
|
279
|
+
constraints->instanceNamesAllowed = true;
|
280
|
+
constraints->instanceAddressesAllowed = true;
|
281
|
+
break;
|
282
|
+
|
283
|
+
case EXTERNAL_ADDRESS_TYPE:
|
284
|
+
rv = constraints->externalAddressesAllowed;
|
285
|
+
constraints->externalAddressesAllowed = true;
|
286
|
+
break;
|
287
|
+
|
288
|
+
case VOID_TYPE:
|
289
|
+
rv = constraints->voidAllowed;
|
290
|
+
constraints->voidAllowed = true;
|
291
|
+
break;
|
292
|
+
|
293
|
+
case FACT_ADDRESS_TYPE:
|
294
|
+
rv = constraints->factAddressesAllowed;
|
295
|
+
constraints->factAddressesAllowed = true;
|
296
|
+
break;
|
297
|
+
|
298
|
+
case MULTIFIELD_TYPE:
|
299
|
+
rv = constraints->multifieldsAllowed;
|
300
|
+
constraints->multifieldsAllowed = true;
|
301
|
+
break;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (theType != UNKNOWN_VALUE) constraints->anyAllowed = false;
|
305
|
+
return(rv);
|
306
|
+
}
|
307
|
+
|
308
|
+
#endif /* (! RUN_TIME) && (! BLOAD_ONLY) */
|
309
|
+
|
310
|
+
/*************************************************************/
|
311
|
+
/* CompareNumbers: Given two numbers (which can be integers, */
|
312
|
+
/* floats, or the symbols for positive/negative infinity) */
|
313
|
+
/* returns the relationship between the numbers (greater */
|
314
|
+
/* than, less than or equal). */
|
315
|
+
/*************************************************************/
|
316
|
+
int CompareNumbers(
|
317
|
+
Environment *theEnv,
|
318
|
+
int type1,
|
319
|
+
void *vptr1,
|
320
|
+
int type2,
|
321
|
+
void *vptr2)
|
322
|
+
{
|
323
|
+
/*============================================*/
|
324
|
+
/* Handle the situation in which the values */
|
325
|
+
/* are exactly equal (same type, same value). */
|
326
|
+
/*============================================*/
|
327
|
+
|
328
|
+
if (vptr1 == vptr2) return(EQUAL);
|
329
|
+
|
330
|
+
/*=======================================*/
|
331
|
+
/* Handle the special cases for positive */
|
332
|
+
/* and negative infinity. */
|
333
|
+
/*=======================================*/
|
334
|
+
|
335
|
+
if (vptr1 == SymbolData(theEnv)->PositiveInfinity) return(GREATER_THAN);
|
336
|
+
|
337
|
+
if (vptr1 == SymbolData(theEnv)->NegativeInfinity) return(LESS_THAN);
|
338
|
+
|
339
|
+
if (vptr2 == SymbolData(theEnv)->PositiveInfinity) return(LESS_THAN);
|
340
|
+
|
341
|
+
if (vptr2 == SymbolData(theEnv)->NegativeInfinity) return(GREATER_THAN);
|
342
|
+
|
343
|
+
/*=======================*/
|
344
|
+
/* Compare two integers. */
|
345
|
+
/*=======================*/
|
346
|
+
|
347
|
+
if ((type1 == INTEGER_TYPE) && (type2 == INTEGER_TYPE))
|
348
|
+
{
|
349
|
+
if (((CLIPSInteger *) vptr1)->contents < ((CLIPSInteger *) vptr2)->contents)
|
350
|
+
{ return(LESS_THAN); }
|
351
|
+
else if (((CLIPSInteger *) vptr1)->contents > ((CLIPSInteger *) vptr2)->contents)
|
352
|
+
{ return(GREATER_THAN); }
|
353
|
+
|
354
|
+
return(EQUAL);
|
355
|
+
}
|
356
|
+
|
357
|
+
/*=====================*/
|
358
|
+
/* Compare two floats. */
|
359
|
+
/*=====================*/
|
360
|
+
|
361
|
+
if ((type1 == FLOAT_TYPE) && (type2 == FLOAT_TYPE))
|
362
|
+
{
|
363
|
+
if (((CLIPSFloat *) vptr1)->contents < ((CLIPSFloat *) vptr2)->contents)
|
364
|
+
{ return(LESS_THAN); }
|
365
|
+
else if (((CLIPSFloat *) vptr1)->contents > ((CLIPSFloat *) vptr2)->contents)
|
366
|
+
{ return(GREATER_THAN); }
|
367
|
+
|
368
|
+
return(EQUAL);
|
369
|
+
}
|
370
|
+
|
371
|
+
/*================================*/
|
372
|
+
/* Compare an integer to a float. */
|
373
|
+
/*================================*/
|
374
|
+
|
375
|
+
if ((type1 == INTEGER_TYPE) && (type2 == FLOAT_TYPE))
|
376
|
+
{
|
377
|
+
if (((double) ((CLIPSInteger *) vptr1)->contents) < ((CLIPSFloat *) vptr2)->contents)
|
378
|
+
{ return(LESS_THAN); }
|
379
|
+
else if (((double) ((CLIPSInteger *) vptr1)->contents) > ((CLIPSFloat *) vptr2)->contents)
|
380
|
+
{ return(GREATER_THAN); }
|
381
|
+
|
382
|
+
return(EQUAL);
|
383
|
+
}
|
384
|
+
|
385
|
+
/*================================*/
|
386
|
+
/* Compare a float to an integer. */
|
387
|
+
/*================================*/
|
388
|
+
|
389
|
+
if ((type1 == FLOAT_TYPE) && (type2 == INTEGER_TYPE))
|
390
|
+
{
|
391
|
+
if (((CLIPSFloat *) vptr1)->contents < ((double) ((CLIPSInteger *) vptr2)->contents))
|
392
|
+
{ return(LESS_THAN); }
|
393
|
+
else if (((CLIPSFloat *) vptr1)->contents > ((double) ((CLIPSInteger *) vptr2)->contents))
|
394
|
+
{ return(GREATER_THAN); }
|
395
|
+
|
396
|
+
return(EQUAL);
|
397
|
+
}
|
398
|
+
|
399
|
+
/*===================================*/
|
400
|
+
/* One of the arguments was invalid. */
|
401
|
+
/* Return -1 to indicate an error. */
|
402
|
+
/*===================================*/
|
403
|
+
|
404
|
+
return(-1);
|
405
|
+
}
|
406
|
+
|
407
|
+
/****************************************************************/
|
408
|
+
/* ExpressionToConstraintRecord: Converts an expression into a */
|
409
|
+
/* constraint record. For example, an expression representing */
|
410
|
+
/* the symbol BLUE would be converted to a record with */
|
411
|
+
/* allowed types SYMBOL_TYPE and allow-values BLUE. */
|
412
|
+
/****************************************************************/
|
413
|
+
CONSTRAINT_RECORD *ExpressionToConstraintRecord(
|
414
|
+
Environment *theEnv,
|
415
|
+
struct expr *theExpression)
|
416
|
+
{
|
417
|
+
CONSTRAINT_RECORD *rv;
|
418
|
+
|
419
|
+
/*================================================*/
|
420
|
+
/* A NULL expression is converted to a constraint */
|
421
|
+
/* record with no values allowed. */
|
422
|
+
/*================================================*/
|
423
|
+
|
424
|
+
if (theExpression == NULL)
|
425
|
+
{
|
426
|
+
rv = GetConstraintRecord(theEnv);
|
427
|
+
rv->anyAllowed = false;
|
428
|
+
return(rv);
|
429
|
+
}
|
430
|
+
|
431
|
+
/*=============================================================*/
|
432
|
+
/* Convert variables and function calls to constraint records. */
|
433
|
+
/*=============================================================*/
|
434
|
+
|
435
|
+
if ((theExpression->type == SF_VARIABLE) ||
|
436
|
+
(theExpression->type == MF_VARIABLE) ||
|
437
|
+
#if DEFGENERIC_CONSTRUCT
|
438
|
+
(theExpression->type == GCALL) ||
|
439
|
+
#endif
|
440
|
+
#if DEFFUNCTION_CONSTRUCT
|
441
|
+
(theExpression->type == PCALL) ||
|
442
|
+
#endif
|
443
|
+
(theExpression->type == GBL_VARIABLE) ||
|
444
|
+
(theExpression->type == MF_GBL_VARIABLE))
|
445
|
+
{
|
446
|
+
rv = GetConstraintRecord(theEnv);
|
447
|
+
rv->multifieldsAllowed = true;
|
448
|
+
return(rv);
|
449
|
+
}
|
450
|
+
else if (theExpression->type == FCALL)
|
451
|
+
{ return(FunctionCallToConstraintRecord(theEnv,theExpression->value)); }
|
452
|
+
|
453
|
+
/*============================================*/
|
454
|
+
/* Convert a constant to a constraint record. */
|
455
|
+
/*============================================*/
|
456
|
+
|
457
|
+
rv = GetConstraintRecord(theEnv);
|
458
|
+
rv->anyAllowed = false;
|
459
|
+
|
460
|
+
switch (theExpression->type)
|
461
|
+
{
|
462
|
+
case FLOAT_TYPE:
|
463
|
+
rv->floatRestriction = true;
|
464
|
+
rv->floatsAllowed = true;
|
465
|
+
break;
|
466
|
+
|
467
|
+
case INTEGER_TYPE:
|
468
|
+
rv->integerRestriction = true;
|
469
|
+
rv->integersAllowed = true;
|
470
|
+
break;
|
471
|
+
|
472
|
+
case SYMBOL_TYPE:
|
473
|
+
rv->symbolRestriction = true;
|
474
|
+
rv->symbolsAllowed = true;
|
475
|
+
break;
|
476
|
+
|
477
|
+
case STRING_TYPE:
|
478
|
+
rv->stringRestriction = true;
|
479
|
+
rv->stringsAllowed = true;
|
480
|
+
break;
|
481
|
+
|
482
|
+
case EXTERNAL_ADDRESS_TYPE:
|
483
|
+
rv->externalAddressesAllowed = true;
|
484
|
+
break;
|
485
|
+
|
486
|
+
case FACT_ADDRESS_TYPE:
|
487
|
+
rv->factAddressesAllowed = true;
|
488
|
+
break;
|
489
|
+
|
490
|
+
case INSTANCE_NAME_TYPE:
|
491
|
+
rv->instanceNameRestriction = true;
|
492
|
+
rv->instanceNamesAllowed = true;
|
493
|
+
break;
|
494
|
+
|
495
|
+
case INSTANCE_ADDRESS_TYPE:
|
496
|
+
rv->instanceAddressesAllowed = true;
|
497
|
+
break;
|
498
|
+
|
499
|
+
default:
|
500
|
+
break;
|
501
|
+
}
|
502
|
+
|
503
|
+
if (rv->floatsAllowed || rv->integersAllowed || rv->symbolsAllowed ||
|
504
|
+
rv->stringsAllowed || rv->instanceNamesAllowed)
|
505
|
+
{ rv->restrictionList = GenConstant(theEnv,theExpression->type,theExpression->value); }
|
506
|
+
|
507
|
+
return rv;
|
508
|
+
}
|
509
|
+
|
510
|
+
/*******************************************************/
|
511
|
+
/* FunctionCallToConstraintRecord: Converts a function */
|
512
|
+
/* call to a constraint record. For example, the + */
|
513
|
+
/* function when converted would be a constraint */
|
514
|
+
/* record with allowed types INTEGER_TYPE and FLOAT_TYPE. */
|
515
|
+
/*******************************************************/
|
516
|
+
CONSTRAINT_RECORD *FunctionCallToConstraintRecord(
|
517
|
+
Environment *theEnv,
|
518
|
+
void *theFunction)
|
519
|
+
{
|
520
|
+
return ArgumentTypeToConstraintRecord(theEnv,UnknownFunctionType(theFunction));
|
521
|
+
}
|
522
|
+
|
523
|
+
/*********************************************/
|
524
|
+
/* ArgumentTypeToConstraintRecord2: Uses the */
|
525
|
+
/* new argument type codes for 6.4. */
|
526
|
+
/*********************************************/
|
527
|
+
CONSTRAINT_RECORD *ArgumentTypeToConstraintRecord(
|
528
|
+
Environment *theEnv,
|
529
|
+
unsigned bitTypes)
|
530
|
+
{
|
531
|
+
CONSTRAINT_RECORD *rv;
|
532
|
+
|
533
|
+
rv = GetConstraintRecord(theEnv);
|
534
|
+
rv->anyAllowed = false;
|
535
|
+
|
536
|
+
if (bitTypes & VOID_BIT)
|
537
|
+
{ rv->voidAllowed = true; }
|
538
|
+
if (bitTypes & FLOAT_BIT)
|
539
|
+
{ rv->floatsAllowed = true; }
|
540
|
+
if (bitTypes & INTEGER_BIT)
|
541
|
+
{ rv->integersAllowed = true; }
|
542
|
+
if (bitTypes & SYMBOL_BIT)
|
543
|
+
{ rv->symbolsAllowed = true; }
|
544
|
+
if (bitTypes & STRING_BIT)
|
545
|
+
{ rv->stringsAllowed = true; }
|
546
|
+
if (bitTypes & MULTIFIELD_BIT)
|
547
|
+
{ rv->multifieldsAllowed = true; }
|
548
|
+
if (bitTypes & EXTERNAL_ADDRESS_BIT)
|
549
|
+
{ rv->externalAddressesAllowed = true; }
|
550
|
+
if (bitTypes & FACT_ADDRESS_BIT)
|
551
|
+
{ rv->factAddressesAllowed = true; }
|
552
|
+
if (bitTypes & INSTANCE_ADDRESS_BIT)
|
553
|
+
{ rv->instanceAddressesAllowed = true; }
|
554
|
+
if (bitTypes & INSTANCE_NAME_BIT)
|
555
|
+
{ rv->instanceNamesAllowed = true; }
|
556
|
+
if (bitTypes & BOOLEAN_BIT)
|
557
|
+
{ rv->symbolsAllowed = true; }
|
558
|
+
|
559
|
+
if (bitTypes == ANY_TYPE_BITS)
|
560
|
+
{ rv->anyAllowed = true; }
|
561
|
+
|
562
|
+
return(rv);
|
563
|
+
}
|
564
|
+
|