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,640 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 07/30/16 */
|
5
|
+
/* */
|
6
|
+
/* */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Generic Function Construct Compiler Code */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Brian L. Dantes */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* */
|
17
|
+
/* Revision History: */
|
18
|
+
/* */
|
19
|
+
/* 6.24: Added pragmas to remove unused parameter */
|
20
|
+
/* warnings. */
|
21
|
+
/* */
|
22
|
+
/* 6.30: Added support for path name argument to */
|
23
|
+
/* constructs-to-c. */
|
24
|
+
/* */
|
25
|
+
/* Changed integer type/precision. */
|
26
|
+
/* */
|
27
|
+
/* Removed conditional code for unsupported */
|
28
|
+
/* compilers/operating systems (IBM_MCW and */
|
29
|
+
/* MAC_MCW). */
|
30
|
+
/* */
|
31
|
+
/* Added const qualifiers to remove C++ */
|
32
|
+
/* deprecation warnings. */
|
33
|
+
/* */
|
34
|
+
/* 6.40: Pragma once and other inclusion changes. */
|
35
|
+
/* */
|
36
|
+
/* Added support for booleans with <stdbool.h>. */
|
37
|
+
/* */
|
38
|
+
/* Removed use of void pointers for specific */
|
39
|
+
/* data structures. */
|
40
|
+
/* */
|
41
|
+
/*************************************************************/
|
42
|
+
|
43
|
+
/* =========================================
|
44
|
+
*****************************************
|
45
|
+
EXTERNAL DEFINITIONS
|
46
|
+
=========================================
|
47
|
+
***************************************** */
|
48
|
+
#include "setup.h"
|
49
|
+
|
50
|
+
#if DEFGENERIC_CONSTRUCT && CONSTRUCT_COMPILER && (! RUN_TIME)
|
51
|
+
|
52
|
+
#include "conscomp.h"
|
53
|
+
#include "envrnmnt.h"
|
54
|
+
#include "genrccom.h"
|
55
|
+
#if DEFRULE_CONSTRUCT
|
56
|
+
#include "network.h"
|
57
|
+
#endif
|
58
|
+
#if OBJECT_SYSTEM
|
59
|
+
#include "objcmp.h"
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#include "genrccmp.h"
|
63
|
+
|
64
|
+
/* =========================================
|
65
|
+
*****************************************
|
66
|
+
CONSTANTS
|
67
|
+
=========================================
|
68
|
+
***************************************** */
|
69
|
+
#define MODULEI 0
|
70
|
+
#define GENERICI 1
|
71
|
+
#define METHODI 2
|
72
|
+
#define RESTRICTIONI 3
|
73
|
+
#define TYPEI 4
|
74
|
+
|
75
|
+
#define SAVE_ITEMS 5
|
76
|
+
|
77
|
+
/* =========================================
|
78
|
+
*****************************************
|
79
|
+
MACROS AND TYPES
|
80
|
+
=========================================
|
81
|
+
***************************************** */
|
82
|
+
#define MethodPrefix() ArbitraryPrefix(DefgenericData(theEnv)->DefgenericCodeItem,2)
|
83
|
+
#define RestrictionPrefix() ArbitraryPrefix(DefgenericData(theEnv)->DefgenericCodeItem,3)
|
84
|
+
#define TypePrefix() ArbitraryPrefix(DefgenericData(theEnv)->DefgenericCodeItem,4)
|
85
|
+
|
86
|
+
/***************************************/
|
87
|
+
/* LOCAL INTERNAL FUNCTION DEFINITIONS */
|
88
|
+
/***************************************/
|
89
|
+
|
90
|
+
static void ReadyDefgenericsForCode(Environment *);
|
91
|
+
static bool DefgenericsToCode(Environment *,const char *,const char *,char *,
|
92
|
+
unsigned int,FILE *,unsigned int,unsigned int);
|
93
|
+
static void CloseDefgenericFiles(Environment *,FILE *[SAVE_ITEMS],bool [SAVE_ITEMS],
|
94
|
+
struct CodeGeneratorFile [SAVE_ITEMS],unsigned int);
|
95
|
+
static void DefgenericModuleToCode(Environment *,FILE *,Defmodule *,unsigned int,unsigned int);
|
96
|
+
static void SingleDefgenericToCode(Environment *,FILE *,unsigned int,unsigned int,
|
97
|
+
Defgeneric *,unsigned int,unsigned int,unsigned int);
|
98
|
+
static void MethodToCode(Environment *,FILE *,unsigned int,unsigned int,Defmethod *,
|
99
|
+
unsigned int,unsigned int,unsigned int);
|
100
|
+
static void RestrictionToCode(Environment *,FILE *,unsigned int,RESTRICTION *,
|
101
|
+
unsigned int,unsigned int);
|
102
|
+
static void TypeToCode(Environment *,FILE *,unsigned int,void *,unsigned int);
|
103
|
+
static void InitDefgenericsCode(Environment *,FILE *,unsigned int,unsigned int);
|
104
|
+
|
105
|
+
/* =========================================
|
106
|
+
*****************************************
|
107
|
+
EXTERNALLY VISIBLE FUNCTIONS
|
108
|
+
=========================================
|
109
|
+
***************************************** */
|
110
|
+
|
111
|
+
/***************************************************
|
112
|
+
NAME : SetupGenericsCompiler
|
113
|
+
DESCRIPTION : Initializes the construct compiler
|
114
|
+
item for generic functions
|
115
|
+
INPUTS : None
|
116
|
+
RETURNS : Nothing useful
|
117
|
+
SIDE EFFECTS : Code generator item initialized
|
118
|
+
NOTES : None
|
119
|
+
***************************************************/
|
120
|
+
void SetupGenericsCompiler(
|
121
|
+
Environment *theEnv)
|
122
|
+
{
|
123
|
+
DefgenericData(theEnv)->DefgenericCodeItem = AddCodeGeneratorItem(theEnv,"generics",0,ReadyDefgenericsForCode,
|
124
|
+
InitDefgenericsCode,DefgenericsToCode,5);
|
125
|
+
}
|
126
|
+
|
127
|
+
/***************************************************
|
128
|
+
NAME : PrintGenericFunctionReference
|
129
|
+
DESCRIPTION : Prints a reference to the run-time
|
130
|
+
generic array for the construct
|
131
|
+
compiler
|
132
|
+
INPUTS : 1) The file output destination
|
133
|
+
2) A pointer to the generic
|
134
|
+
3) The id of the run-time image
|
135
|
+
4) The maximum number of indices
|
136
|
+
in any array
|
137
|
+
RETURNS : Nothing useful
|
138
|
+
SIDE EFFECTS : Reference printed
|
139
|
+
NOTES : None
|
140
|
+
***************************************************/
|
141
|
+
void PrintGenericFunctionReference(
|
142
|
+
Environment *theEnv,
|
143
|
+
FILE *fp,
|
144
|
+
Defgeneric *gfunc,
|
145
|
+
unsigned imageID,
|
146
|
+
unsigned maxIndices)
|
147
|
+
{
|
148
|
+
if (gfunc == NULL)
|
149
|
+
fprintf(fp,"NULL");
|
150
|
+
else
|
151
|
+
fprintf(fp,"&%s%d_%lu[%lul]",ConstructPrefix(DefgenericData(theEnv)->DefgenericCodeItem),imageID,
|
152
|
+
(gfunc->header.bsaveID / maxIndices) + 1,
|
153
|
+
(gfunc->header.bsaveID % maxIndices));
|
154
|
+
}
|
155
|
+
|
156
|
+
/****************************************************
|
157
|
+
NAME : DefgenericCModuleReference
|
158
|
+
DESCRIPTION : Prints out a reference to a
|
159
|
+
defgeneric module
|
160
|
+
INPUTS : 1) The output file
|
161
|
+
2) The id of the module item
|
162
|
+
3) The id of the image
|
163
|
+
4) The maximum number of elements
|
164
|
+
allowed in an array
|
165
|
+
RETURNS : Nothing useful
|
166
|
+
SIDE EFFECTS : Defgeneric module reference printed
|
167
|
+
NOTES : None
|
168
|
+
****************************************************/
|
169
|
+
void DefgenericCModuleReference(
|
170
|
+
Environment *theEnv,
|
171
|
+
FILE *theFile,
|
172
|
+
unsigned long count,
|
173
|
+
unsigned int imageID,
|
174
|
+
unsigned int maxIndices)
|
175
|
+
{
|
176
|
+
fprintf(theFile,"MIHS &%s%u_%lu[%lu]",
|
177
|
+
ModulePrefix(DefgenericData(theEnv)->DefgenericCodeItem),
|
178
|
+
imageID,
|
179
|
+
(count / maxIndices) + 1,
|
180
|
+
(count % maxIndices));
|
181
|
+
}
|
182
|
+
|
183
|
+
/* =========================================
|
184
|
+
*****************************************
|
185
|
+
INTERNALLY VISIBLE FUNCTIONS
|
186
|
+
=========================================
|
187
|
+
***************************************** */
|
188
|
+
|
189
|
+
/***************************************************
|
190
|
+
NAME : ReadyDefgenericsForCode
|
191
|
+
DESCRIPTION : Sets index of generic-functions
|
192
|
+
for use in compiled expressions
|
193
|
+
INPUTS : None
|
194
|
+
RETURNS : Nothing useful
|
195
|
+
SIDE EFFECTS : BsaveIndices set
|
196
|
+
NOTES : None
|
197
|
+
***************************************************/
|
198
|
+
static void ReadyDefgenericsForCode(
|
199
|
+
Environment *theEnv)
|
200
|
+
{
|
201
|
+
MarkConstructBsaveIDs(theEnv,DefgenericData(theEnv)->DefgenericModuleIndex);
|
202
|
+
}
|
203
|
+
|
204
|
+
/**************************************************/
|
205
|
+
/* InitDefgenericsCode: Writes out initialization */
|
206
|
+
/* code for defgenerics for a run-time module. */
|
207
|
+
/**************************************************/
|
208
|
+
static void InitDefgenericsCode(
|
209
|
+
Environment *theEnv,
|
210
|
+
FILE *initFP,
|
211
|
+
unsigned int imageID,
|
212
|
+
unsigned int maxIndices)
|
213
|
+
{
|
214
|
+
#if MAC_XCD
|
215
|
+
#pragma unused(maxIndices)
|
216
|
+
#pragma unused(imageID)
|
217
|
+
#pragma unused(theEnv)
|
218
|
+
#endif
|
219
|
+
fprintf(initFP," DefgenericRunTimeInitialize(theEnv);\n");
|
220
|
+
}
|
221
|
+
|
222
|
+
/*******************************************************
|
223
|
+
NAME : DefgenericsToCode
|
224
|
+
DESCRIPTION : Writes out static array code for
|
225
|
+
generic functions, methods, etc.
|
226
|
+
INPUTS : 1) The base name of the construct set
|
227
|
+
2) The base id for this construct
|
228
|
+
3) The file pointer for the header file
|
229
|
+
4) The base id for the construct set
|
230
|
+
5) The max number of indices allowed
|
231
|
+
in an array
|
232
|
+
RETURNS : False on errors,
|
233
|
+
true if generic functions written
|
234
|
+
SIDE EFFECTS : Code written to files
|
235
|
+
NOTES : None
|
236
|
+
*******************************************************/
|
237
|
+
static bool DefgenericsToCode(
|
238
|
+
Environment *theEnv,
|
239
|
+
const char *fileName,
|
240
|
+
const char *pathName,
|
241
|
+
char *fileNameBuffer,
|
242
|
+
unsigned int fileID,
|
243
|
+
FILE *headerFP,
|
244
|
+
unsigned int imageID,
|
245
|
+
unsigned int maxIndices)
|
246
|
+
{
|
247
|
+
unsigned int fileCount = 1;
|
248
|
+
Defmodule *theModule;
|
249
|
+
Defgeneric *theDefgeneric;
|
250
|
+
Defmethod *theMethod;
|
251
|
+
RESTRICTION *theRestriction;
|
252
|
+
short i,j,k;
|
253
|
+
unsigned int moduleCount = 0;
|
254
|
+
unsigned int itemArrayCounts[SAVE_ITEMS];
|
255
|
+
unsigned int itemArrayVersions[SAVE_ITEMS];
|
256
|
+
FILE *itemFiles[SAVE_ITEMS];
|
257
|
+
bool itemReopenFlags[SAVE_ITEMS];
|
258
|
+
struct CodeGeneratorFile itemCodeFiles[SAVE_ITEMS];
|
259
|
+
|
260
|
+
for (i = 0 ; i < SAVE_ITEMS ; i++)
|
261
|
+
{
|
262
|
+
itemArrayCounts[i] = 0;
|
263
|
+
itemArrayVersions[i] = 1;
|
264
|
+
itemFiles[i] = NULL;
|
265
|
+
itemReopenFlags[i] = false;
|
266
|
+
itemCodeFiles[i].filePrefix = NULL;
|
267
|
+
itemCodeFiles[i].pathName = pathName;
|
268
|
+
itemCodeFiles[i].fileNameBuffer = fileNameBuffer;
|
269
|
+
}
|
270
|
+
|
271
|
+
/* ===========================================
|
272
|
+
Include the appropriate generic header file
|
273
|
+
=========================================== */
|
274
|
+
fprintf(headerFP,"#include \"genrcfun.h\"\n");
|
275
|
+
|
276
|
+
/* =============================================================
|
277
|
+
Loop through all the modules and all the defgenerics writing
|
278
|
+
their C code representation to the file as they are traversed
|
279
|
+
============================================================= */
|
280
|
+
theModule = GetNextDefmodule(theEnv,NULL);
|
281
|
+
|
282
|
+
while (theModule != NULL)
|
283
|
+
{
|
284
|
+
SetCurrentModule(theEnv,theModule);
|
285
|
+
|
286
|
+
itemFiles[MODULEI] =
|
287
|
+
OpenFileIfNeeded(theEnv,itemFiles[MODULEI],fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount,
|
288
|
+
itemArrayVersions[MODULEI],headerFP,
|
289
|
+
"DEFGENERIC_MODULE",ModulePrefix(DefgenericData(theEnv)->DefgenericCodeItem),
|
290
|
+
itemReopenFlags[MODULEI],&itemCodeFiles[MODULEI]);
|
291
|
+
if (itemFiles[MODULEI] == NULL)
|
292
|
+
goto GenericCodeError;
|
293
|
+
|
294
|
+
DefgenericModuleToCode(theEnv,itemFiles[MODULEI],theModule,imageID,maxIndices);
|
295
|
+
itemFiles[MODULEI] =
|
296
|
+
CloseFileIfNeeded(theEnv,itemFiles[MODULEI],&itemArrayCounts[MODULEI],
|
297
|
+
&itemArrayVersions[MODULEI],maxIndices,
|
298
|
+
&itemReopenFlags[MODULEI],&itemCodeFiles[MODULEI]);
|
299
|
+
|
300
|
+
theDefgeneric = GetNextDefgeneric(theEnv,NULL);
|
301
|
+
|
302
|
+
while (theDefgeneric != NULL)
|
303
|
+
{
|
304
|
+
itemFiles[GENERICI] =
|
305
|
+
OpenFileIfNeeded(theEnv,itemFiles[GENERICI],fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount,
|
306
|
+
itemArrayVersions[GENERICI],headerFP,
|
307
|
+
"Defgeneric",ConstructPrefix(DefgenericData(theEnv)->DefgenericCodeItem),
|
308
|
+
itemReopenFlags[GENERICI],&itemCodeFiles[GENERICI]);
|
309
|
+
if (itemFiles[GENERICI] == NULL)
|
310
|
+
goto GenericCodeError;
|
311
|
+
|
312
|
+
SingleDefgenericToCode(theEnv,itemFiles[GENERICI],imageID,maxIndices,theDefgeneric,
|
313
|
+
moduleCount,itemArrayVersions[METHODI],
|
314
|
+
itemArrayCounts[METHODI]);
|
315
|
+
itemArrayCounts[GENERICI]++;
|
316
|
+
itemFiles[GENERICI] =
|
317
|
+
CloseFileIfNeeded(theEnv,itemFiles[GENERICI],&itemArrayCounts[GENERICI],
|
318
|
+
&itemArrayVersions[GENERICI],maxIndices,
|
319
|
+
&itemReopenFlags[GENERICI],&itemCodeFiles[GENERICI]);
|
320
|
+
if (theDefgeneric->mcnt > 0)
|
321
|
+
{
|
322
|
+
|
323
|
+
/* ===========================================
|
324
|
+
Make sure that all methods for a particular
|
325
|
+
generic function go into the same array
|
326
|
+
=========================================== */
|
327
|
+
itemFiles[METHODI] =
|
328
|
+
OpenFileIfNeeded(theEnv,itemFiles[METHODI],fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount,
|
329
|
+
itemArrayVersions[METHODI],headerFP,
|
330
|
+
"Defmethod",MethodPrefix(),
|
331
|
+
itemReopenFlags[METHODI],&itemCodeFiles[METHODI]);
|
332
|
+
if (itemFiles[METHODI] == NULL)
|
333
|
+
goto GenericCodeError;
|
334
|
+
|
335
|
+
for (i = 0 ; i < theDefgeneric->mcnt ; i++)
|
336
|
+
{
|
337
|
+
theMethod = &theDefgeneric->methods[i];
|
338
|
+
if (i > 0)
|
339
|
+
fprintf(itemFiles[METHODI],",\n");
|
340
|
+
MethodToCode(theEnv,itemFiles[METHODI],imageID,maxIndices,theMethod,moduleCount,
|
341
|
+
itemArrayVersions[RESTRICTIONI],itemArrayCounts[RESTRICTIONI]);
|
342
|
+
if (theMethod->restrictionCount > 0)
|
343
|
+
{
|
344
|
+
/* ========================================
|
345
|
+
Make sure that all restrictions for a
|
346
|
+
particular method go into the same array
|
347
|
+
======================================== */
|
348
|
+
itemFiles[RESTRICTIONI] =
|
349
|
+
OpenFileIfNeeded(theEnv,itemFiles[RESTRICTIONI],fileName,pathName,fileNameBuffer,fileID,
|
350
|
+
imageID,&fileCount,
|
351
|
+
itemArrayVersions[RESTRICTIONI],headerFP,
|
352
|
+
"RESTRICTION",RestrictionPrefix(),
|
353
|
+
itemReopenFlags[RESTRICTIONI],&itemCodeFiles[RESTRICTIONI]);
|
354
|
+
if (itemFiles[RESTRICTIONI] == NULL)
|
355
|
+
goto GenericCodeError;
|
356
|
+
for (j = 0 ; j < theMethod->restrictionCount ; j++)
|
357
|
+
{
|
358
|
+
theRestriction = &theMethod->restrictions[j];
|
359
|
+
if (j > 0)
|
360
|
+
fprintf(itemFiles[RESTRICTIONI],",\n");
|
361
|
+
RestrictionToCode(theEnv,itemFiles[RESTRICTIONI],imageID,theRestriction,
|
362
|
+
itemArrayVersions[TYPEI],itemArrayCounts[TYPEI]);
|
363
|
+
|
364
|
+
if (theRestriction->tcnt > 0)
|
365
|
+
{
|
366
|
+
/* =========================================
|
367
|
+
Make sure that all types for a particular
|
368
|
+
restriction go into the same array
|
369
|
+
========================================= */
|
370
|
+
itemFiles[TYPEI] =
|
371
|
+
OpenFileIfNeeded(theEnv,itemFiles[TYPEI],fileName,pathName,fileNameBuffer,fileID,
|
372
|
+
imageID,&fileCount,
|
373
|
+
itemArrayVersions[TYPEI],headerFP,
|
374
|
+
"void *",TypePrefix(),
|
375
|
+
itemReopenFlags[TYPEI],&itemCodeFiles[TYPEI]);
|
376
|
+
if (itemFiles[TYPEI] == NULL)
|
377
|
+
goto GenericCodeError;
|
378
|
+
for (k = 0 ; k < theRestriction->tcnt ; k++)
|
379
|
+
{
|
380
|
+
if (k > 0)
|
381
|
+
fprintf(itemFiles[TYPEI],",\n");
|
382
|
+
TypeToCode(theEnv,itemFiles[TYPEI],imageID,
|
383
|
+
theRestriction->types[k],maxIndices);
|
384
|
+
}
|
385
|
+
itemArrayCounts[TYPEI] += theRestriction->tcnt;
|
386
|
+
itemFiles[TYPEI] =
|
387
|
+
CloseFileIfNeeded(theEnv,itemFiles[TYPEI],&itemArrayCounts[TYPEI],
|
388
|
+
&itemArrayVersions[TYPEI],maxIndices,
|
389
|
+
&itemReopenFlags[TYPEI],&itemCodeFiles[TYPEI]);
|
390
|
+
}
|
391
|
+
}
|
392
|
+
itemArrayCounts[RESTRICTIONI] += theMethod->restrictionCount;
|
393
|
+
itemFiles[RESTRICTIONI] =
|
394
|
+
CloseFileIfNeeded(theEnv,itemFiles[RESTRICTIONI],&itemArrayCounts[RESTRICTIONI],
|
395
|
+
&itemArrayVersions[RESTRICTIONI],maxIndices,
|
396
|
+
&itemReopenFlags[RESTRICTIONI],&itemCodeFiles[RESTRICTIONI]);
|
397
|
+
}
|
398
|
+
}
|
399
|
+
itemArrayCounts[METHODI] += theDefgeneric->mcnt;
|
400
|
+
itemFiles[METHODI] =
|
401
|
+
CloseFileIfNeeded(theEnv,itemFiles[METHODI],&itemArrayCounts[METHODI],
|
402
|
+
&itemArrayVersions[METHODI],maxIndices,
|
403
|
+
&itemReopenFlags[METHODI],&itemCodeFiles[METHODI]);
|
404
|
+
}
|
405
|
+
theDefgeneric = GetNextDefgeneric(theEnv,theDefgeneric);
|
406
|
+
}
|
407
|
+
|
408
|
+
theModule = GetNextDefmodule(theEnv,theModule);
|
409
|
+
moduleCount++;
|
410
|
+
itemArrayCounts[MODULEI]++;
|
411
|
+
}
|
412
|
+
CloseDefgenericFiles(theEnv,itemFiles,itemReopenFlags,itemCodeFiles,maxIndices);
|
413
|
+
return true;
|
414
|
+
|
415
|
+
GenericCodeError:
|
416
|
+
CloseDefgenericFiles(theEnv,itemFiles,itemReopenFlags,itemCodeFiles,maxIndices);
|
417
|
+
return false;
|
418
|
+
}
|
419
|
+
|
420
|
+
/******************************************************
|
421
|
+
NAME : CloseDefgenericFiles
|
422
|
+
DESCRIPTION : Closes construct compiler files
|
423
|
+
for defgeneric structures
|
424
|
+
INPUTS : 1) An array containing all the
|
425
|
+
pertinent file pointers
|
426
|
+
2) An array containing all the
|
427
|
+
pertinent file reopen flags
|
428
|
+
3) An array containing all the
|
429
|
+
pertinent file name/id/version info
|
430
|
+
4) The maximum number of indices
|
431
|
+
allowed in an array
|
432
|
+
RETURNS : Nothing useful
|
433
|
+
SIDE EFFECTS : Files closed
|
434
|
+
NOTES : None
|
435
|
+
*****************************************************/
|
436
|
+
static void CloseDefgenericFiles(
|
437
|
+
Environment *theEnv,
|
438
|
+
FILE *itemFiles[SAVE_ITEMS],
|
439
|
+
bool itemReopenFlags[SAVE_ITEMS],
|
440
|
+
struct CodeGeneratorFile itemCodeFiles[SAVE_ITEMS],
|
441
|
+
unsigned int maxIndices)
|
442
|
+
{
|
443
|
+
unsigned int count = maxIndices;
|
444
|
+
unsigned int arrayVersion = 0;
|
445
|
+
unsigned int i;
|
446
|
+
|
447
|
+
for (i = 0 ; i < SAVE_ITEMS ; i++)
|
448
|
+
{
|
449
|
+
count = maxIndices;
|
450
|
+
itemFiles[i] = CloseFileIfNeeded(theEnv,itemFiles[i],&count,&arrayVersion,
|
451
|
+
maxIndices,&itemReopenFlags[i],
|
452
|
+
&itemCodeFiles[i]);
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
/***************************************************
|
457
|
+
NAME : DefgenericModuleToCode
|
458
|
+
DESCRIPTION : Writes out the C values for a
|
459
|
+
defgeneric module item
|
460
|
+
INPUTS : 1) The output file
|
461
|
+
2) The module for the defgenerics
|
462
|
+
3) The compile image id
|
463
|
+
4) The maximum number of elements
|
464
|
+
in an array
|
465
|
+
RETURNS : Nothing useful
|
466
|
+
SIDE EFFECTS : Defgeneric module item written
|
467
|
+
NOTES : None
|
468
|
+
***************************************************/
|
469
|
+
static void DefgenericModuleToCode(
|
470
|
+
Environment *theEnv,
|
471
|
+
FILE *theFile,
|
472
|
+
Defmodule *theModule,
|
473
|
+
unsigned int imageID,
|
474
|
+
unsigned int maxIndices)
|
475
|
+
{
|
476
|
+
fprintf(theFile,"{");
|
477
|
+
ConstructModuleToCode(theEnv,theFile,theModule,imageID,maxIndices,
|
478
|
+
DefgenericData(theEnv)->DefgenericModuleIndex,ConstructPrefix(DefgenericData(theEnv)->DefgenericCodeItem));
|
479
|
+
fprintf(theFile,"}");
|
480
|
+
}
|
481
|
+
|
482
|
+
/****************************************************************
|
483
|
+
NAME : SingleDefgenericToCode
|
484
|
+
DESCRIPTION : Writes out a single defgeneric's
|
485
|
+
data to the file
|
486
|
+
INPUTS : 1) The output file
|
487
|
+
2) The compile image id
|
488
|
+
3) The maximum number of
|
489
|
+
elements in an array
|
490
|
+
4) The defgeneric
|
491
|
+
5) The module index
|
492
|
+
6) The partition holding the
|
493
|
+
generic methods
|
494
|
+
7) The relative index of the
|
495
|
+
generics methods in the partition
|
496
|
+
RETURNS : Nothing useful
|
497
|
+
SIDE EFFECTS : Defgeneric data written
|
498
|
+
NOTES : None
|
499
|
+
***************************************************************/
|
500
|
+
static void SingleDefgenericToCode(
|
501
|
+
Environment *theEnv,
|
502
|
+
FILE *theFile,
|
503
|
+
unsigned int imageID,
|
504
|
+
unsigned int maxIndices,
|
505
|
+
Defgeneric *theDefgeneric,
|
506
|
+
unsigned int moduleCount,
|
507
|
+
unsigned int methodArrayVersion,
|
508
|
+
unsigned int methodArrayCount)
|
509
|
+
{
|
510
|
+
/* ==================
|
511
|
+
Defgeneric Header
|
512
|
+
================== */
|
513
|
+
fprintf(theFile,"{");
|
514
|
+
ConstructHeaderToCode(theEnv,theFile,&theDefgeneric->header,imageID,maxIndices,moduleCount,
|
515
|
+
ModulePrefix(DefgenericData(theEnv)->DefgenericCodeItem),
|
516
|
+
ConstructPrefix(DefgenericData(theEnv)->DefgenericCodeItem));
|
517
|
+
|
518
|
+
/* =========================
|
519
|
+
Defgeneric specific data
|
520
|
+
========================= */
|
521
|
+
fprintf(theFile,",0,0,");
|
522
|
+
if (theDefgeneric->methods == NULL)
|
523
|
+
fprintf(theFile,"NULL");
|
524
|
+
else
|
525
|
+
{
|
526
|
+
fprintf(theFile,"&%s%d_%d[%d]",MethodPrefix(),imageID,
|
527
|
+
methodArrayVersion,methodArrayCount);
|
528
|
+
}
|
529
|
+
fprintf(theFile,",%hd,0}",theDefgeneric->mcnt);
|
530
|
+
}
|
531
|
+
|
532
|
+
/****************************************************************
|
533
|
+
NAME : MethodToCode
|
534
|
+
DESCRIPTION : Writes out a single method's
|
535
|
+
data to the file
|
536
|
+
INPUTS : 1) The output file
|
537
|
+
2) The compile image id
|
538
|
+
3) The method
|
539
|
+
4) The partition holding the
|
540
|
+
method restrictions
|
541
|
+
5) The relative index of the
|
542
|
+
method restrictions in the partition
|
543
|
+
RETURNS : Nothing useful
|
544
|
+
SIDE EFFECTS : Method data written
|
545
|
+
NOTES : None
|
546
|
+
***************************************************************/
|
547
|
+
static void MethodToCode(
|
548
|
+
Environment *theEnv,
|
549
|
+
FILE *theFile,
|
550
|
+
unsigned int imageID,
|
551
|
+
unsigned int maxIndices,
|
552
|
+
Defmethod *theMethod,
|
553
|
+
unsigned int moduleCount,
|
554
|
+
unsigned int restrictionArrayVersion,
|
555
|
+
unsigned int restrictionArrayCount)
|
556
|
+
{
|
557
|
+
fprintf(theFile,"{");
|
558
|
+
ConstructHeaderToCode(theEnv,theFile,&theMethod->header,imageID,maxIndices,moduleCount,
|
559
|
+
ModulePrefix(DefgenericData(theEnv)->DefgenericCodeItem),
|
560
|
+
"");
|
561
|
+
|
562
|
+
fprintf(theFile,",%u,0,%hd,%hu,%hu,%hd,%u,0,",
|
563
|
+
theMethod->index,theMethod->restrictionCount,
|
564
|
+
theMethod->minRestrictions,theMethod->maxRestrictions,
|
565
|
+
theMethod->localVarCount,theMethod->system);
|
566
|
+
if (theMethod->restrictions == NULL)
|
567
|
+
fprintf(theFile,"NULL,");
|
568
|
+
else
|
569
|
+
fprintf(theFile,"&%s%d_%d[%d],",RestrictionPrefix(),imageID,
|
570
|
+
restrictionArrayVersion,restrictionArrayCount);
|
571
|
+
ExpressionToCode(theEnv,theFile,theMethod->actions);
|
572
|
+
fprintf(theFile,"}");
|
573
|
+
}
|
574
|
+
|
575
|
+
/****************************************************************
|
576
|
+
NAME : RestrictionToCode
|
577
|
+
DESCRIPTION : Writes out a single restriction's
|
578
|
+
data to the file
|
579
|
+
INPUTS : 1) The output file
|
580
|
+
2) The compile image id
|
581
|
+
3) The restriction
|
582
|
+
4) The partition holding the
|
583
|
+
restriction types
|
584
|
+
5) The relative index of the
|
585
|
+
restriction types in the partition
|
586
|
+
RETURNS : Nothing useful
|
587
|
+
SIDE EFFECTS : Restriction data written
|
588
|
+
NOTES : None
|
589
|
+
***************************************************************/
|
590
|
+
static void RestrictionToCode(
|
591
|
+
Environment *theEnv,
|
592
|
+
FILE *theFile,
|
593
|
+
unsigned int imageID,
|
594
|
+
RESTRICTION *theRestriction,
|
595
|
+
unsigned int typeArrayVersion,
|
596
|
+
unsigned int typeArrayCount)
|
597
|
+
{
|
598
|
+
fprintf(theFile,"{");
|
599
|
+
if (theRestriction->types == NULL)
|
600
|
+
fprintf(theFile,"NULL,");
|
601
|
+
else
|
602
|
+
fprintf(theFile,"&%s%d_%d[%d],",TypePrefix(),imageID,
|
603
|
+
typeArrayVersion,typeArrayCount);
|
604
|
+
ExpressionToCode(theEnv,theFile,theRestriction->query);
|
605
|
+
fprintf(theFile,",%hd}",theRestriction->tcnt);
|
606
|
+
}
|
607
|
+
|
608
|
+
/****************************************************************
|
609
|
+
NAME : TypeToCode
|
610
|
+
DESCRIPTION : Writes out a single type's
|
611
|
+
data to the file
|
612
|
+
INPUTS : 1) The output file
|
613
|
+
2) The compile image id
|
614
|
+
3) The type
|
615
|
+
RETURNS : Nothing useful
|
616
|
+
SIDE EFFECTS : Type data written
|
617
|
+
NOTES : None
|
618
|
+
***************************************************************/
|
619
|
+
static void TypeToCode(
|
620
|
+
Environment *theEnv,
|
621
|
+
FILE *theFile,
|
622
|
+
unsigned int imageID,
|
623
|
+
void *theType,
|
624
|
+
unsigned int maxIndices)
|
625
|
+
{
|
626
|
+
#if OBJECT_SYSTEM
|
627
|
+
fprintf(theFile,"VS ");
|
628
|
+
PrintClassReference(theEnv,theFile,(Defclass *) theType,imageID,maxIndices);
|
629
|
+
#else
|
630
|
+
|
631
|
+
#if MAC_XCD
|
632
|
+
#pragma unused(imageID)
|
633
|
+
#pragma unused(maxIndices)
|
634
|
+
#endif
|
635
|
+
|
636
|
+
PrintIntegerReference(theEnv,theFile,(CLIPSInteger *) theType);
|
637
|
+
#endif
|
638
|
+
}
|
639
|
+
|
640
|
+
#endif
|