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,869 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 08/19/18 */
|
5
|
+
/* */
|
6
|
+
/* PREDICATE FUNCTIONS MODULE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Contains the code for several predicate */
|
11
|
+
/* functions including not, and, or, eq, neq, <=, >=, <, */
|
12
|
+
/* >, =, <>, symbolp, stringp, lexemep, numberp, integerp, */
|
13
|
+
/* floatp, oddp, evenp, multifieldp, sequencep, and */
|
14
|
+
/* pointerp. */
|
15
|
+
/* */
|
16
|
+
/* Principal Programmer(s): */
|
17
|
+
/* Gary D. Riley */
|
18
|
+
/* */
|
19
|
+
/* Contributing Programmer(s): */
|
20
|
+
/* */
|
21
|
+
/* Revision History: */
|
22
|
+
/* */
|
23
|
+
/* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */
|
24
|
+
/* */
|
25
|
+
/* 6.24: Renamed BOOLEAN macro type to intBool. */
|
26
|
+
/* */
|
27
|
+
/* 6.30: Support for long long integers. */
|
28
|
+
/* */
|
29
|
+
/* Removed conditional code for unsupported */
|
30
|
+
/* compilers/operating systems (IBM_MCW and */
|
31
|
+
/* MAC_MCW). */
|
32
|
+
/* */
|
33
|
+
/* 6.40: Pragma once and other inclusion changes. */
|
34
|
+
/* */
|
35
|
+
/* Added support for booleans with <stdbool.h>. */
|
36
|
+
/* */
|
37
|
+
/* Removed use of void pointers for specific */
|
38
|
+
/* data structures. */
|
39
|
+
/* */
|
40
|
+
/* UDF redesign. */
|
41
|
+
/* */
|
42
|
+
/* Removed the wordp and sequencep functions. */
|
43
|
+
/* */
|
44
|
+
/* Deprecated the pointerp function and added */
|
45
|
+
/* the external-addressp function. */
|
46
|
+
/* */
|
47
|
+
/*************************************************************/
|
48
|
+
|
49
|
+
#include <stdio.h>
|
50
|
+
|
51
|
+
#include "setup.h"
|
52
|
+
|
53
|
+
#include "argacces.h"
|
54
|
+
#include "envrnmnt.h"
|
55
|
+
#include "exprnpsr.h"
|
56
|
+
#include "multifld.h"
|
57
|
+
#include "router.h"
|
58
|
+
|
59
|
+
#include "prdctfun.h"
|
60
|
+
|
61
|
+
/**************************************************/
|
62
|
+
/* PredicateFunctionDefinitions: Defines standard */
|
63
|
+
/* math and predicate functions. */
|
64
|
+
/**************************************************/
|
65
|
+
void PredicateFunctionDefinitions(
|
66
|
+
Environment *theEnv)
|
67
|
+
{
|
68
|
+
#if ! RUN_TIME
|
69
|
+
AddUDF(theEnv,"not","b",1,1,NULL,NotFunction,"NotFunction",NULL);
|
70
|
+
AddUDF(theEnv,"and","b",2,UNBOUNDED ,NULL,AndFunction,"AndFunction",NULL);
|
71
|
+
AddUDF(theEnv,"or","b",2,UNBOUNDED ,NULL,OrFunction,"OrFunction",NULL);
|
72
|
+
|
73
|
+
AddUDF(theEnv,"eq","b",2,UNBOUNDED,NULL,EqFunction,"EqFunction",NULL);
|
74
|
+
AddUDF(theEnv,"neq","b",2,UNBOUNDED,NULL,NeqFunction,"NeqFunction",NULL);
|
75
|
+
|
76
|
+
AddUDF(theEnv,"<=","b",2,UNBOUNDED ,"ld",LessThanOrEqualFunction,"LessThanOrEqualFunction",NULL);
|
77
|
+
AddUDF(theEnv,">=","b",2,UNBOUNDED ,"ld",GreaterThanOrEqualFunction,"GreaterThanOrEqualFunction",NULL);
|
78
|
+
AddUDF(theEnv,"<","b",2,UNBOUNDED ,"ld",LessThanFunction,"LessThanFunction",NULL);
|
79
|
+
AddUDF(theEnv,">","b",2,UNBOUNDED ,"ld",GreaterThanFunction,"GreaterThanFunction",NULL);
|
80
|
+
AddUDF(theEnv,"=","b",2,UNBOUNDED ,"ld",NumericEqualFunction,"NumericEqualFunction",NULL);
|
81
|
+
AddUDF(theEnv,"<>","b",2,UNBOUNDED ,"ld",NumericNotEqualFunction,"NumericNotEqualFunction",NULL);
|
82
|
+
AddUDF(theEnv,"!=","b",2,UNBOUNDED ,"ld",NumericNotEqualFunction,"NumericNotEqualFunction",NULL);
|
83
|
+
|
84
|
+
AddUDF(theEnv,"symbolp","b",1,1,NULL,SymbolpFunction,"SymbolpFunction",NULL);
|
85
|
+
AddUDF(theEnv,"stringp","b",1,1,NULL,StringpFunction,"StringpFunction",NULL);
|
86
|
+
AddUDF(theEnv,"lexemep","b",1,1,NULL,LexemepFunction,"LexemepFunction",NULL);
|
87
|
+
AddUDF(theEnv,"numberp","b",1,1,NULL,NumberpFunction,"NumberpFunction",NULL);
|
88
|
+
AddUDF(theEnv,"integerp","b",1,1,NULL,IntegerpFunction,"IntegerpFunction",NULL);
|
89
|
+
AddUDF(theEnv,"floatp","b",1,1,NULL,FloatpFunction,"FloatpFunction",NULL);
|
90
|
+
AddUDF(theEnv,"oddp","b",1,1,"l",OddpFunction,"OddpFunction",NULL);
|
91
|
+
AddUDF(theEnv,"evenp","b",1,1,"l",EvenpFunction,"EvenpFunction",NULL);
|
92
|
+
AddUDF(theEnv,"multifieldp","b",1,1,NULL,MultifieldpFunction,"MultifieldpFunction",NULL);
|
93
|
+
AddUDF(theEnv,"pointerp","b",1,1,NULL,ExternalAddresspFunction,"ExternalAddresspFunction",NULL);
|
94
|
+
AddUDF(theEnv,"external-addressp","b",1,1,NULL,ExternalAddresspFunction,"ExternalAddresspFunction",NULL);
|
95
|
+
#else
|
96
|
+
#if MAC_XCD
|
97
|
+
#pragma unused(theEnv)
|
98
|
+
#endif
|
99
|
+
#endif
|
100
|
+
}
|
101
|
+
|
102
|
+
/************************************/
|
103
|
+
/* EqFunction: H/L access routine */
|
104
|
+
/* for the eq function. */
|
105
|
+
/************************************/
|
106
|
+
void EqFunction(
|
107
|
+
Environment *theEnv,
|
108
|
+
UDFContext *context,
|
109
|
+
UDFValue *returnValue)
|
110
|
+
{
|
111
|
+
UDFValue item, nextItem;
|
112
|
+
unsigned int numArgs, i;
|
113
|
+
struct expr *theExpression;
|
114
|
+
|
115
|
+
/*====================================*/
|
116
|
+
/* Determine the number of arguments. */
|
117
|
+
/*====================================*/
|
118
|
+
|
119
|
+
numArgs = UDFArgumentCount(context);
|
120
|
+
if (numArgs == 0)
|
121
|
+
{
|
122
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
|
126
|
+
/*==============================================*/
|
127
|
+
/* Get the value of the first argument against */
|
128
|
+
/* which subsequent arguments will be compared. */
|
129
|
+
/*==============================================*/
|
130
|
+
|
131
|
+
theExpression = GetFirstArgument();
|
132
|
+
EvaluateExpression(theEnv,theExpression,&item);
|
133
|
+
|
134
|
+
/*=====================================*/
|
135
|
+
/* Compare all arguments to the first. */
|
136
|
+
/* If any are the same, return FALSE. */
|
137
|
+
/*=====================================*/
|
138
|
+
|
139
|
+
theExpression = GetNextArgument(theExpression);
|
140
|
+
for (i = 2 ; i <= numArgs ; i++)
|
141
|
+
{
|
142
|
+
EvaluateExpression(theEnv,theExpression,&nextItem);
|
143
|
+
|
144
|
+
if (nextItem.header->type != item.header->type)
|
145
|
+
{
|
146
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
|
150
|
+
if (nextItem.header->type == MULTIFIELD_TYPE)
|
151
|
+
{
|
152
|
+
if (MultifieldDOsEqual(&nextItem,&item) == false)
|
153
|
+
{
|
154
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
else if (nextItem.value != item.value)
|
159
|
+
{
|
160
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
|
164
|
+
theExpression = GetNextArgument(theExpression);
|
165
|
+
}
|
166
|
+
|
167
|
+
/*=====================================*/
|
168
|
+
/* All of the arguments were different */
|
169
|
+
/* from the first. Return TRUE. */
|
170
|
+
/*=====================================*/
|
171
|
+
|
172
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
173
|
+
}
|
174
|
+
|
175
|
+
/*************************************/
|
176
|
+
/* NeqFunction: H/L access routine */
|
177
|
+
/* for the neq function. */
|
178
|
+
/*************************************/
|
179
|
+
void NeqFunction(
|
180
|
+
Environment *theEnv,
|
181
|
+
UDFContext *context,
|
182
|
+
UDFValue *returnValue)
|
183
|
+
{
|
184
|
+
UDFValue item, nextItem;
|
185
|
+
unsigned int numArgs, i;
|
186
|
+
struct expr *theExpression;
|
187
|
+
|
188
|
+
/*====================================*/
|
189
|
+
/* Determine the number of arguments. */
|
190
|
+
/*====================================*/
|
191
|
+
|
192
|
+
numArgs = UDFArgumentCount(context);
|
193
|
+
if (numArgs == 0)
|
194
|
+
{
|
195
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
196
|
+
return;
|
197
|
+
}
|
198
|
+
|
199
|
+
/*==============================================*/
|
200
|
+
/* Get the value of the first argument against */
|
201
|
+
/* which subsequent arguments will be compared. */
|
202
|
+
/*==============================================*/
|
203
|
+
|
204
|
+
theExpression = GetFirstArgument();
|
205
|
+
EvaluateExpression(theEnv,theExpression,&item);
|
206
|
+
|
207
|
+
/*=====================================*/
|
208
|
+
/* Compare all arguments to the first. */
|
209
|
+
/* If any are different, return FALSE. */
|
210
|
+
/*=====================================*/
|
211
|
+
|
212
|
+
for (i = 2, theExpression = GetNextArgument(theExpression);
|
213
|
+
i <= numArgs;
|
214
|
+
i++, theExpression = GetNextArgument(theExpression))
|
215
|
+
{
|
216
|
+
EvaluateExpression(theEnv,theExpression,&nextItem);
|
217
|
+
if (nextItem.header->type != item.header->type)
|
218
|
+
{ continue; }
|
219
|
+
else if (nextItem.header->type == MULTIFIELD_TYPE)
|
220
|
+
{
|
221
|
+
if (MultifieldDOsEqual(&nextItem,&item) == true)
|
222
|
+
{
|
223
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
else if (nextItem.value == item.value)
|
228
|
+
{
|
229
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
/*=====================================*/
|
235
|
+
/* All of the arguments were identical */
|
236
|
+
/* to the first. Return TRUE. */
|
237
|
+
/*=====================================*/
|
238
|
+
|
239
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
240
|
+
}
|
241
|
+
|
242
|
+
/*****************************************/
|
243
|
+
/* StringpFunction: H/L access routine */
|
244
|
+
/* for the stringp function. */
|
245
|
+
/*****************************************/
|
246
|
+
void StringpFunction(
|
247
|
+
Environment *theEnv,
|
248
|
+
UDFContext *context,
|
249
|
+
UDFValue *returnValue)
|
250
|
+
{
|
251
|
+
UDFValue item;
|
252
|
+
|
253
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
254
|
+
{ return; }
|
255
|
+
|
256
|
+
if (CVIsType(&item,STRING_BIT))
|
257
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
258
|
+
else
|
259
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
260
|
+
}
|
261
|
+
|
262
|
+
/*****************************************/
|
263
|
+
/* SymbolpFunction: H/L access routine */
|
264
|
+
/* for the symbolp function. */
|
265
|
+
/*****************************************/
|
266
|
+
void SymbolpFunction(
|
267
|
+
Environment *theEnv,
|
268
|
+
UDFContext *context,
|
269
|
+
UDFValue *returnValue)
|
270
|
+
{
|
271
|
+
UDFValue item;
|
272
|
+
|
273
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
274
|
+
{ return; }
|
275
|
+
|
276
|
+
if (CVIsType(&item,SYMBOL_BIT))
|
277
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
278
|
+
else
|
279
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
280
|
+
}
|
281
|
+
|
282
|
+
/*****************************************/
|
283
|
+
/* LexemepFunction: H/L access routine */
|
284
|
+
/* for the lexemep function. */
|
285
|
+
/*****************************************/
|
286
|
+
void LexemepFunction(
|
287
|
+
Environment *theEnv,
|
288
|
+
UDFContext *context,
|
289
|
+
UDFValue *returnValue)
|
290
|
+
{
|
291
|
+
UDFValue item;
|
292
|
+
|
293
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
294
|
+
{ return; }
|
295
|
+
|
296
|
+
if (CVIsType(&item,LEXEME_BITS))
|
297
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
298
|
+
else
|
299
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
300
|
+
}
|
301
|
+
|
302
|
+
/*****************************************/
|
303
|
+
/* NumberpFunction: H/L access routine */
|
304
|
+
/* for the numberp function. */
|
305
|
+
/*****************************************/
|
306
|
+
void NumberpFunction(
|
307
|
+
Environment *theEnv,
|
308
|
+
UDFContext *context,
|
309
|
+
UDFValue *returnValue)
|
310
|
+
{
|
311
|
+
UDFValue item;
|
312
|
+
|
313
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
314
|
+
{ return; }
|
315
|
+
|
316
|
+
if (CVIsType(&item,NUMBER_BITS))
|
317
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
318
|
+
else
|
319
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
320
|
+
}
|
321
|
+
|
322
|
+
/****************************************/
|
323
|
+
/* FloatpFunction: H/L access routine */
|
324
|
+
/* for the floatp function. */
|
325
|
+
/****************************************/
|
326
|
+
void FloatpFunction(
|
327
|
+
Environment *theEnv,
|
328
|
+
UDFContext *context,
|
329
|
+
UDFValue *returnValue)
|
330
|
+
{
|
331
|
+
UDFValue item;
|
332
|
+
|
333
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
334
|
+
{ return; }
|
335
|
+
|
336
|
+
if (CVIsType(&item,FLOAT_BIT))
|
337
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
338
|
+
else
|
339
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
340
|
+
}
|
341
|
+
|
342
|
+
/******************************************/
|
343
|
+
/* IntegerpFunction: H/L access routine */
|
344
|
+
/* for the integerp function. */
|
345
|
+
/******************************************/
|
346
|
+
void IntegerpFunction(
|
347
|
+
Environment *theEnv,
|
348
|
+
UDFContext *context,
|
349
|
+
UDFValue *returnValue)
|
350
|
+
{
|
351
|
+
UDFValue item;
|
352
|
+
|
353
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
354
|
+
{ return; }
|
355
|
+
|
356
|
+
if (CVIsType(&item,INTEGER_BIT))
|
357
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
358
|
+
else
|
359
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
360
|
+
}
|
361
|
+
|
362
|
+
/*********************************************/
|
363
|
+
/* MultifieldpFunction: H/L access routine */
|
364
|
+
/* for the multifieldp function. */
|
365
|
+
/*********************************************/
|
366
|
+
void MultifieldpFunction(
|
367
|
+
Environment *theEnv,
|
368
|
+
UDFContext *context,
|
369
|
+
UDFValue *returnValue)
|
370
|
+
{
|
371
|
+
UDFValue item;
|
372
|
+
|
373
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
374
|
+
{ return; }
|
375
|
+
|
376
|
+
if (CVIsType(&item,MULTIFIELD_BIT))
|
377
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
378
|
+
else
|
379
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
380
|
+
}
|
381
|
+
|
382
|
+
/************************************************/
|
383
|
+
/* ExternalAddresspFunction: H/L access routine */
|
384
|
+
/* for the external-addressp function. */
|
385
|
+
/************************************************/
|
386
|
+
void ExternalAddresspFunction(
|
387
|
+
Environment *theEnv,
|
388
|
+
UDFContext *context,
|
389
|
+
UDFValue *returnValue)
|
390
|
+
{
|
391
|
+
UDFValue item;
|
392
|
+
|
393
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&item))
|
394
|
+
{ return; }
|
395
|
+
|
396
|
+
if (CVIsType(&item,EXTERNAL_ADDRESS_BIT))
|
397
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
398
|
+
else
|
399
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
400
|
+
}
|
401
|
+
|
402
|
+
/***********************************/
|
403
|
+
/* NotFunction: H/L access routine */
|
404
|
+
/* for the not function. */
|
405
|
+
/***********************************/
|
406
|
+
void NotFunction(
|
407
|
+
Environment *theEnv,
|
408
|
+
UDFContext *context,
|
409
|
+
UDFValue *returnValue)
|
410
|
+
{
|
411
|
+
UDFValue theArg;
|
412
|
+
|
413
|
+
if (! UDFFirstArgument(context,ANY_TYPE_BITS,&theArg))
|
414
|
+
{ return; }
|
415
|
+
|
416
|
+
if (theArg.value == FalseSymbol(theEnv))
|
417
|
+
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
|
418
|
+
else
|
419
|
+
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
|
420
|
+
}
|
421
|
+
|
422
|
+
/*************************************/
|
423
|
+
/* AndFunction: H/L access routine */
|
424
|
+
/* for the and function. */
|
425
|
+
/*************************************/
|
426
|
+
void AndFunction(
|
427
|
+
Environment *theEnv,
|
428
|
+
UDFContext *context,
|
429
|
+
UDFValue *returnValue)
|
430
|
+
{
|
431
|
+
UDFValue theArg;
|
432
|
+
|
433
|
+
while (UDFHasNextArgument(context))
|
434
|
+
{
|
435
|
+
if (! UDFNextArgument(context,ANY_TYPE_BITS,&theArg))
|
436
|
+
{ return; }
|
437
|
+
|
438
|
+
if (theArg.value == FalseSymbol(theEnv))
|
439
|
+
{
|
440
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
441
|
+
return;
|
442
|
+
}
|
443
|
+
}
|
444
|
+
|
445
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
446
|
+
}
|
447
|
+
|
448
|
+
/************************************/
|
449
|
+
/* OrFunction: H/L access routine */
|
450
|
+
/* for the or function. */
|
451
|
+
/************************************/
|
452
|
+
void OrFunction(
|
453
|
+
Environment *theEnv,
|
454
|
+
UDFContext *context,
|
455
|
+
UDFValue *returnValue)
|
456
|
+
{
|
457
|
+
UDFValue theArg;
|
458
|
+
|
459
|
+
while (UDFHasNextArgument(context))
|
460
|
+
{
|
461
|
+
if (! UDFNextArgument(context,ANY_TYPE_BITS,&theArg))
|
462
|
+
{ return; }
|
463
|
+
|
464
|
+
if (theArg.value != FalseSymbol(theEnv))
|
465
|
+
{
|
466
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
467
|
+
return;
|
468
|
+
}
|
469
|
+
}
|
470
|
+
|
471
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
472
|
+
}
|
473
|
+
|
474
|
+
/*****************************************/
|
475
|
+
/* LessThanOrEqualFunction: H/L access */
|
476
|
+
/* routine for the <= function. */
|
477
|
+
/*****************************************/
|
478
|
+
void LessThanOrEqualFunction(
|
479
|
+
Environment *theEnv,
|
480
|
+
UDFContext *context,
|
481
|
+
UDFValue *returnValue)
|
482
|
+
{
|
483
|
+
UDFValue rv1, rv2;
|
484
|
+
|
485
|
+
/*=========================*/
|
486
|
+
/* Get the first argument. */
|
487
|
+
/*=========================*/
|
488
|
+
|
489
|
+
if (! UDFFirstArgument(context,NUMBER_BITS,&rv1))
|
490
|
+
{ return; }
|
491
|
+
|
492
|
+
/*====================================================*/
|
493
|
+
/* Compare each of the subsequent arguments to its */
|
494
|
+
/* predecessor. If any is greater, then return FALSE. */
|
495
|
+
/*====================================================*/
|
496
|
+
|
497
|
+
while (UDFHasNextArgument(context))
|
498
|
+
{
|
499
|
+
if (! UDFNextArgument(context,NUMBER_BITS,&rv2))
|
500
|
+
{ return; }
|
501
|
+
|
502
|
+
if (CVIsType(&rv1,INTEGER_BIT) && CVIsType(&rv2,INTEGER_BIT))
|
503
|
+
{
|
504
|
+
if (rv1.integerValue->contents > rv2.integerValue->contents)
|
505
|
+
{
|
506
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
507
|
+
return;
|
508
|
+
}
|
509
|
+
}
|
510
|
+
else
|
511
|
+
{
|
512
|
+
if (CVCoerceToFloat(&rv1) > CVCoerceToFloat(&rv2))
|
513
|
+
{
|
514
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
515
|
+
return;
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
rv1.value = rv2.value;
|
520
|
+
}
|
521
|
+
|
522
|
+
/*======================================*/
|
523
|
+
/* Each argument was less than or equal */
|
524
|
+
/* to its predecessor. Return TRUE. */
|
525
|
+
/*======================================*/
|
526
|
+
|
527
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
528
|
+
}
|
529
|
+
|
530
|
+
/********************************************/
|
531
|
+
/* GreaterThanOrEqualFunction: H/L access */
|
532
|
+
/* routine for the >= function. */
|
533
|
+
/********************************************/
|
534
|
+
void GreaterThanOrEqualFunction(
|
535
|
+
Environment *theEnv,
|
536
|
+
UDFContext *context,
|
537
|
+
UDFValue *returnValue)
|
538
|
+
{
|
539
|
+
UDFValue rv1, rv2;
|
540
|
+
|
541
|
+
/*=========================*/
|
542
|
+
/* Get the first argument. */
|
543
|
+
/*=========================*/
|
544
|
+
|
545
|
+
if (! UDFFirstArgument(context,NUMBER_BITS,&rv1))
|
546
|
+
{ return; }
|
547
|
+
|
548
|
+
/*===================================================*/
|
549
|
+
/* Compare each of the subsequent arguments to its */
|
550
|
+
/* predecessor. If any is lesser, then return false. */
|
551
|
+
/*===================================================*/
|
552
|
+
|
553
|
+
while (UDFHasNextArgument(context))
|
554
|
+
{
|
555
|
+
if (! UDFNextArgument(context,NUMBER_BITS,&rv2))
|
556
|
+
{ return; }
|
557
|
+
|
558
|
+
if (CVIsType(&rv1,INTEGER_BIT) && CVIsType(&rv2,INTEGER_BIT))
|
559
|
+
{
|
560
|
+
if (rv1.integerValue->contents < rv2.integerValue->contents)
|
561
|
+
{
|
562
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
563
|
+
return;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
else
|
567
|
+
{
|
568
|
+
if (CVCoerceToFloat(&rv1) < CVCoerceToFloat(&rv2))
|
569
|
+
{
|
570
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
571
|
+
return;
|
572
|
+
}
|
573
|
+
}
|
574
|
+
|
575
|
+
rv1.value = rv2.value;
|
576
|
+
}
|
577
|
+
|
578
|
+
/*=========================================*/
|
579
|
+
/* Each argument was greater than or equal */
|
580
|
+
/* to its predecessor. Return TRUE. */
|
581
|
+
/*=========================================*/
|
582
|
+
|
583
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
584
|
+
}
|
585
|
+
|
586
|
+
/**********************************/
|
587
|
+
/* LessThanFunction: H/L access */
|
588
|
+
/* routine for the < function. */
|
589
|
+
/**********************************/
|
590
|
+
void LessThanFunction(
|
591
|
+
Environment *theEnv,
|
592
|
+
UDFContext *context,
|
593
|
+
UDFValue *returnValue)
|
594
|
+
{
|
595
|
+
UDFValue rv1, rv2;
|
596
|
+
|
597
|
+
/*=========================*/
|
598
|
+
/* Get the first argument. */
|
599
|
+
/*=========================*/
|
600
|
+
|
601
|
+
if (! UDFFirstArgument(context,NUMBER_BITS,&rv1))
|
602
|
+
{ return; }
|
603
|
+
|
604
|
+
/*==========================================*/
|
605
|
+
/* Compare each of the subsequent arguments */
|
606
|
+
/* to its predecessor. If any is greater or */
|
607
|
+
/* equal, then return FALSE. */
|
608
|
+
/*==========================================*/
|
609
|
+
|
610
|
+
while (UDFHasNextArgument(context))
|
611
|
+
{
|
612
|
+
if (! UDFNextArgument(context,NUMBER_BITS,&rv2))
|
613
|
+
{ return; }
|
614
|
+
|
615
|
+
if (CVIsType(&rv1,INTEGER_BIT) && CVIsType(&rv2,INTEGER_BIT))
|
616
|
+
{
|
617
|
+
if (rv1.integerValue->contents >= rv2.integerValue->contents)
|
618
|
+
{
|
619
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
620
|
+
return;
|
621
|
+
}
|
622
|
+
}
|
623
|
+
else
|
624
|
+
{
|
625
|
+
if (CVCoerceToFloat(&rv1) >= CVCoerceToFloat(&rv2))
|
626
|
+
{
|
627
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
628
|
+
return;
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
rv1.value = rv2.value;
|
633
|
+
}
|
634
|
+
|
635
|
+
/*=================================*/
|
636
|
+
/* Each argument was less than its */
|
637
|
+
/* predecessor. Return TRUE. */
|
638
|
+
/*=================================*/
|
639
|
+
|
640
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
641
|
+
}
|
642
|
+
|
643
|
+
/*************************************/
|
644
|
+
/* GreaterThanFunction: H/L access */
|
645
|
+
/* routine for the > function. */
|
646
|
+
/*************************************/
|
647
|
+
void GreaterThanFunction(
|
648
|
+
Environment *theEnv,
|
649
|
+
UDFContext *context,
|
650
|
+
UDFValue *returnValue)
|
651
|
+
{
|
652
|
+
UDFValue rv1, rv2;
|
653
|
+
|
654
|
+
/*=========================*/
|
655
|
+
/* Get the first argument. */
|
656
|
+
/*=========================*/
|
657
|
+
|
658
|
+
if (! UDFFirstArgument(context,NUMBER_BITS,&rv1))
|
659
|
+
{ return; }
|
660
|
+
|
661
|
+
/*==========================================*/
|
662
|
+
/* Compare each of the subsequent arguments */
|
663
|
+
/* to its predecessor. If any is lesser or */
|
664
|
+
/* equal, then return FALSE. */
|
665
|
+
/*==========================================*/
|
666
|
+
|
667
|
+
while (UDFHasNextArgument(context))
|
668
|
+
{
|
669
|
+
if (! UDFNextArgument(context,NUMBER_BITS,&rv2))
|
670
|
+
{ return; }
|
671
|
+
|
672
|
+
if (CVIsType(&rv1,INTEGER_BIT) && CVIsType(&rv2,INTEGER_BIT))
|
673
|
+
{
|
674
|
+
if (rv1.integerValue->contents <= rv2.integerValue->contents)
|
675
|
+
{
|
676
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
677
|
+
return;
|
678
|
+
}
|
679
|
+
}
|
680
|
+
else
|
681
|
+
{
|
682
|
+
if (CVCoerceToFloat(&rv1) <= CVCoerceToFloat(&rv2))
|
683
|
+
{
|
684
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
685
|
+
return;
|
686
|
+
}
|
687
|
+
}
|
688
|
+
|
689
|
+
rv1.value = rv2.value;
|
690
|
+
}
|
691
|
+
|
692
|
+
/*================================*/
|
693
|
+
/* Each argument was greater than */
|
694
|
+
/* its predecessor. Return TRUE. */
|
695
|
+
/*================================*/
|
696
|
+
|
697
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
698
|
+
}
|
699
|
+
|
700
|
+
/**************************************/
|
701
|
+
/* NumericEqualFunction: H/L access */
|
702
|
+
/* routine for the = function. */
|
703
|
+
/**************************************/
|
704
|
+
void NumericEqualFunction(
|
705
|
+
Environment *theEnv,
|
706
|
+
UDFContext *context,
|
707
|
+
UDFValue *returnValue)
|
708
|
+
{
|
709
|
+
UDFValue rv1, rv2;
|
710
|
+
|
711
|
+
/*=========================*/
|
712
|
+
/* Get the first argument. */
|
713
|
+
/*=========================*/
|
714
|
+
|
715
|
+
if (! UDFFirstArgument(context,NUMBER_BITS,&rv1))
|
716
|
+
{ return; }
|
717
|
+
|
718
|
+
/*=================================================*/
|
719
|
+
/* Compare each of the subsequent arguments to the */
|
720
|
+
/* first. If any is unequal, then return FALSE. */
|
721
|
+
/*=================================================*/
|
722
|
+
|
723
|
+
while (UDFHasNextArgument(context))
|
724
|
+
{
|
725
|
+
if (! UDFNextArgument(context,NUMBER_BITS,&rv2))
|
726
|
+
{ return; }
|
727
|
+
|
728
|
+
if (CVIsType(&rv1,INTEGER_BIT) && CVIsType(&rv2,INTEGER_BIT))
|
729
|
+
{
|
730
|
+
if (rv1.integerValue->contents != rv2.integerValue->contents)
|
731
|
+
{
|
732
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
733
|
+
return;
|
734
|
+
}
|
735
|
+
}
|
736
|
+
else
|
737
|
+
{
|
738
|
+
if (CVCoerceToFloat(&rv1) != CVCoerceToFloat(&rv2))
|
739
|
+
{
|
740
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
741
|
+
return;
|
742
|
+
}
|
743
|
+
}
|
744
|
+
}
|
745
|
+
|
746
|
+
/*=================================*/
|
747
|
+
/* All arguments were equal to the */
|
748
|
+
/* first argument. Return TRUE. */
|
749
|
+
/*=================================*/
|
750
|
+
|
751
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
752
|
+
}
|
753
|
+
|
754
|
+
/*****************************************/
|
755
|
+
/* NumericNotEqualFunction: H/L access */
|
756
|
+
/* routine for the <> function. */
|
757
|
+
/*****************************************/
|
758
|
+
void NumericNotEqualFunction(
|
759
|
+
Environment *theEnv,
|
760
|
+
UDFContext *context,
|
761
|
+
UDFValue *returnValue)
|
762
|
+
{
|
763
|
+
UDFValue rv1, rv2;
|
764
|
+
|
765
|
+
/*=========================*/
|
766
|
+
/* Get the first argument. */
|
767
|
+
/*=========================*/
|
768
|
+
|
769
|
+
if (! UDFFirstArgument(context,NUMBER_BITS,&rv1))
|
770
|
+
{ return; }
|
771
|
+
|
772
|
+
/*=================================================*/
|
773
|
+
/* Compare each of the subsequent arguments to the */
|
774
|
+
/* first. If any is equal, then return FALSE. */
|
775
|
+
/*=================================================*/
|
776
|
+
|
777
|
+
while (UDFHasNextArgument(context))
|
778
|
+
{
|
779
|
+
if (! UDFNextArgument(context,NUMBER_BITS,&rv2))
|
780
|
+
{ return; }
|
781
|
+
|
782
|
+
if (CVIsType(&rv1,INTEGER_BIT) && CVIsType(&rv2,INTEGER_BIT))
|
783
|
+
{
|
784
|
+
if (rv1.integerValue->contents == rv2.integerValue->contents)
|
785
|
+
{
|
786
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
787
|
+
return;
|
788
|
+
}
|
789
|
+
}
|
790
|
+
else
|
791
|
+
{
|
792
|
+
if (CVCoerceToFloat(&rv1) == CVCoerceToFloat(&rv2))
|
793
|
+
{
|
794
|
+
returnValue->lexemeValue = FalseSymbol(theEnv);
|
795
|
+
return;
|
796
|
+
}
|
797
|
+
}
|
798
|
+
}
|
799
|
+
|
800
|
+
/*===================================*/
|
801
|
+
/* All arguments were unequal to the */
|
802
|
+
/* first argument. Return TRUE. */
|
803
|
+
/*===================================*/
|
804
|
+
|
805
|
+
returnValue->lexemeValue = TrueSymbol(theEnv);
|
806
|
+
}
|
807
|
+
|
808
|
+
/**************************************/
|
809
|
+
/* OddpFunction: H/L access routine */
|
810
|
+
/* for the oddp function. */
|
811
|
+
/**************************************/
|
812
|
+
void OddpFunction(
|
813
|
+
Environment *theEnv,
|
814
|
+
UDFContext *context,
|
815
|
+
UDFValue *returnValue)
|
816
|
+
{
|
817
|
+
UDFValue item;
|
818
|
+
long long num, halfnum;
|
819
|
+
|
820
|
+
/*===========================================*/
|
821
|
+
/* Check for the correct types of arguments. */
|
822
|
+
/*===========================================*/
|
823
|
+
|
824
|
+
if (! UDFFirstArgument(context,INTEGER_BIT,&item))
|
825
|
+
{ return; }
|
826
|
+
|
827
|
+
/*===========================*/
|
828
|
+
/* Compute the return value. */
|
829
|
+
/*===========================*/
|
830
|
+
|
831
|
+
num = item.integerValue->contents;
|
832
|
+
halfnum = (num / 2) * 2;
|
833
|
+
|
834
|
+
if (num == halfnum) returnValue->lexemeValue = FalseSymbol(theEnv);
|
835
|
+
else returnValue->lexemeValue = TrueSymbol(theEnv);
|
836
|
+
}
|
837
|
+
|
838
|
+
/***************************************/
|
839
|
+
/* EvenpFunction: H/L access routine */
|
840
|
+
/* for the evenp function. */
|
841
|
+
/***************************************/
|
842
|
+
void EvenpFunction(
|
843
|
+
Environment *theEnv,
|
844
|
+
UDFContext *context,
|
845
|
+
UDFValue *returnValue)
|
846
|
+
{
|
847
|
+
UDFValue item;
|
848
|
+
long long num, halfnum;
|
849
|
+
|
850
|
+
/*===========================================*/
|
851
|
+
/* Check for the correct types of arguments. */
|
852
|
+
/*===========================================*/
|
853
|
+
|
854
|
+
if (! UDFFirstArgument(context,INTEGER_BIT,&item))
|
855
|
+
{ return; }
|
856
|
+
|
857
|
+
/*===========================*/
|
858
|
+
/* Compute the return value. */
|
859
|
+
/*===========================*/
|
860
|
+
|
861
|
+
num = item.integerValue->contents;;
|
862
|
+
halfnum = (num / 2) * 2;
|
863
|
+
|
864
|
+
if (num != halfnum) returnValue->lexemeValue = FalseSymbol(theEnv);
|
865
|
+
else returnValue->lexemeValue = TrueSymbol(theEnv);
|
866
|
+
}
|
867
|
+
|
868
|
+
|
869
|
+
|