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,607 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 07/30/16 */
|
5
|
+
/* */
|
6
|
+
/* DEFMODULE BSAVE/BLOAD MODULE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Implements the binary save/load feature for the */
|
11
|
+
/* defmodule construct. */
|
12
|
+
/* */
|
13
|
+
/* Principal Programmer(s): */
|
14
|
+
/* Gary D. Riley */
|
15
|
+
/* */
|
16
|
+
/* Contributing Programmer(s): */
|
17
|
+
/* Brian L. Dantes */
|
18
|
+
/* */
|
19
|
+
/* Revision History: */
|
20
|
+
/* */
|
21
|
+
/* 6.30: Changed integer type/precision. */
|
22
|
+
/* */
|
23
|
+
/* 6.40: Pragma once and other inclusion changes. */
|
24
|
+
/* */
|
25
|
+
/* Added support for booleans with <stdbool.h>. */
|
26
|
+
/* */
|
27
|
+
/* Removed use of void pointers for specific */
|
28
|
+
/* data structures. */
|
29
|
+
/* */
|
30
|
+
/*************************************************************/
|
31
|
+
|
32
|
+
#include "setup.h"
|
33
|
+
|
34
|
+
#if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME)
|
35
|
+
|
36
|
+
#include <stdio.h>
|
37
|
+
|
38
|
+
#include "bload.h"
|
39
|
+
#include "bsave.h"
|
40
|
+
#include "constrct.h"
|
41
|
+
#include "cstrcbin.h"
|
42
|
+
#include "envrnmnt.h"
|
43
|
+
#include "memalloc.h"
|
44
|
+
#include "moduldef.h"
|
45
|
+
|
46
|
+
#include "modulbin.h"
|
47
|
+
|
48
|
+
/***************************************/
|
49
|
+
/* LOCAL INTERNAL FUNCTION DEFINITIONS */
|
50
|
+
/***************************************/
|
51
|
+
|
52
|
+
#if BLOAD_AND_BSAVE
|
53
|
+
static void BsaveFind(Environment *);
|
54
|
+
static void BsaveStorage(Environment *,FILE *);
|
55
|
+
static void BsaveBinaryItem(Environment *,FILE *);
|
56
|
+
#endif
|
57
|
+
static void BloadStorage(Environment *);
|
58
|
+
static void BloadBinaryItem(Environment *);
|
59
|
+
static void UpdateDefmodule(Environment *,void *,unsigned long);
|
60
|
+
static void UpdatePortItem(Environment *,void *,unsigned long);
|
61
|
+
static void ClearBload(Environment *);
|
62
|
+
|
63
|
+
/*********************************************/
|
64
|
+
/* DefmoduleBinarySetup: Installs the binary */
|
65
|
+
/* save/load feature for defmodules. */
|
66
|
+
/*********************************************/
|
67
|
+
void DefmoduleBinarySetup(
|
68
|
+
Environment *theEnv)
|
69
|
+
{
|
70
|
+
AddBeforeBloadFunction(theEnv,"defmodule",RemoveAllDefmodules,2000,NULL);
|
71
|
+
|
72
|
+
#if BLOAD_AND_BSAVE
|
73
|
+
AddBinaryItem(theEnv,"defmodule",0,BsaveFind,NULL,
|
74
|
+
BsaveStorage,BsaveBinaryItem,
|
75
|
+
BloadStorage,BloadBinaryItem,
|
76
|
+
ClearBload);
|
77
|
+
#endif
|
78
|
+
|
79
|
+
AddAbortBloadFunction(theEnv,"defmodule",CreateMainModule,0,NULL);
|
80
|
+
|
81
|
+
#if (BLOAD || BLOAD_ONLY)
|
82
|
+
AddBinaryItem(theEnv,"defmodule",0,NULL,NULL,NULL,NULL,
|
83
|
+
BloadStorage,BloadBinaryItem,
|
84
|
+
ClearBload);
|
85
|
+
#endif
|
86
|
+
}
|
87
|
+
|
88
|
+
/**************************************************************/
|
89
|
+
/* UpdateDefmoduleItemHeader: Updates the values in defmodule */
|
90
|
+
/* item headers for the loaded binary image. */
|
91
|
+
/**************************************************************/
|
92
|
+
void UpdateDefmoduleItemHeader(
|
93
|
+
Environment *theEnv,
|
94
|
+
struct bsaveDefmoduleItemHeader *theBsaveHeader,
|
95
|
+
struct defmoduleItemHeader *theHeader,
|
96
|
+
size_t itemSize,
|
97
|
+
void *itemArray)
|
98
|
+
{
|
99
|
+
size_t firstOffset, lastOffset;
|
100
|
+
|
101
|
+
theHeader->theModule = ModulePointer(theBsaveHeader->theModule);
|
102
|
+
if (theBsaveHeader->firstItem == ULONG_MAX)
|
103
|
+
{
|
104
|
+
theHeader->firstItem = NULL;
|
105
|
+
theHeader->lastItem = NULL;
|
106
|
+
}
|
107
|
+
else
|
108
|
+
{
|
109
|
+
firstOffset = itemSize * theBsaveHeader->firstItem;
|
110
|
+
lastOffset = itemSize * theBsaveHeader->lastItem;
|
111
|
+
theHeader->firstItem =
|
112
|
+
(ConstructHeader *) &((char *) itemArray)[firstOffset];
|
113
|
+
theHeader->lastItem =
|
114
|
+
(ConstructHeader *) &((char *) itemArray)[lastOffset];
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
#if BLOAD_AND_BSAVE
|
119
|
+
|
120
|
+
/*********************************************************/
|
121
|
+
/* AssignBsaveDefmdlItemHdrVals: Assigns the appropriate */
|
122
|
+
/* values to a bsave defmodule item header record. */
|
123
|
+
/*********************************************************/
|
124
|
+
void AssignBsaveDefmdlItemHdrVals(
|
125
|
+
struct bsaveDefmoduleItemHeader *theBsaveHeader,
|
126
|
+
struct defmoduleItemHeader *theHeader)
|
127
|
+
{
|
128
|
+
theBsaveHeader->theModule = theHeader->theModule->header.bsaveID;
|
129
|
+
if (theHeader->firstItem == NULL)
|
130
|
+
{
|
131
|
+
theBsaveHeader->firstItem = ULONG_MAX;
|
132
|
+
theBsaveHeader->lastItem = ULONG_MAX;
|
133
|
+
}
|
134
|
+
else
|
135
|
+
{
|
136
|
+
theBsaveHeader->firstItem = theHeader->firstItem->bsaveID;
|
137
|
+
theBsaveHeader->lastItem = theHeader->lastItem->bsaveID;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
/**********************************************************/
|
142
|
+
/* BsaveFind: Counts the number of data structures which */
|
143
|
+
/* must be saved in the binary image for the defmodules */
|
144
|
+
/* in the current environment. */
|
145
|
+
/**********************************************************/
|
146
|
+
static void BsaveFind(
|
147
|
+
Environment *theEnv)
|
148
|
+
{
|
149
|
+
Defmodule *defmodulePtr;
|
150
|
+
struct portItem *theList;
|
151
|
+
|
152
|
+
/*=======================================================*/
|
153
|
+
/* If a binary image is already loaded, then temporarily */
|
154
|
+
/* save the count values since these will be overwritten */
|
155
|
+
/* in the process of saving the binary image. */
|
156
|
+
/*=======================================================*/
|
157
|
+
|
158
|
+
SaveBloadCount(theEnv,DefmoduleData(theEnv)->BNumberOfDefmodules);
|
159
|
+
SaveBloadCount(theEnv,DefmoduleData(theEnv)->NumberOfPortItems);
|
160
|
+
|
161
|
+
/*==========================================*/
|
162
|
+
/* Set the count of defmodule and defmodule */
|
163
|
+
/* port items data structures to zero. */
|
164
|
+
/*==========================================*/
|
165
|
+
|
166
|
+
DefmoduleData(theEnv)->BNumberOfDefmodules = 0;
|
167
|
+
DefmoduleData(theEnv)->NumberOfPortItems = 0;
|
168
|
+
|
169
|
+
/*===========================*/
|
170
|
+
/* Loop through each module. */
|
171
|
+
/*===========================*/
|
172
|
+
|
173
|
+
for (defmodulePtr = GetNextDefmodule(theEnv,NULL);
|
174
|
+
defmodulePtr != NULL;
|
175
|
+
defmodulePtr = GetNextDefmodule(theEnv,defmodulePtr))
|
176
|
+
{
|
177
|
+
/*==============================================*/
|
178
|
+
/* Increment the number of modules encountered. */
|
179
|
+
/*==============================================*/
|
180
|
+
|
181
|
+
DefmoduleData(theEnv)->BNumberOfDefmodules++;
|
182
|
+
|
183
|
+
/*===========================*/
|
184
|
+
/* Mark the defmodule's name */
|
185
|
+
/* as being a needed symbol. */
|
186
|
+
/*===========================*/
|
187
|
+
|
188
|
+
MarkConstructHeaderNeededItems(&defmodulePtr->header,defmodulePtr->header.bsaveID);
|
189
|
+
|
190
|
+
/*==============================================*/
|
191
|
+
/* Loop through each of the port items in the */
|
192
|
+
/* defmodule's import list incrementing the */
|
193
|
+
/* number of port items encountered and marking */
|
194
|
+
/* needed symbols. */
|
195
|
+
/*==============================================*/
|
196
|
+
|
197
|
+
for (theList = defmodulePtr->importList;
|
198
|
+
theList != NULL;
|
199
|
+
theList = theList->next)
|
200
|
+
{
|
201
|
+
DefmoduleData(theEnv)->NumberOfPortItems++;
|
202
|
+
if (theList->moduleName != NULL)
|
203
|
+
{ theList->moduleName->neededSymbol = true; }
|
204
|
+
if (theList->constructType != NULL)
|
205
|
+
{ theList->constructType->neededSymbol = true; }
|
206
|
+
if (theList->constructName != NULL)
|
207
|
+
{ theList->constructName->neededSymbol = true; }
|
208
|
+
}
|
209
|
+
|
210
|
+
/*==============================================*/
|
211
|
+
/* Loop through each of the port items in the */
|
212
|
+
/* defmodule's export list incrementing the */
|
213
|
+
/* number of port items encountered and marking */
|
214
|
+
/* needed symbols. */
|
215
|
+
/*==============================================*/
|
216
|
+
|
217
|
+
for (theList = defmodulePtr->exportList;
|
218
|
+
theList != NULL;
|
219
|
+
theList = theList->next)
|
220
|
+
{
|
221
|
+
DefmoduleData(theEnv)->NumberOfPortItems++;
|
222
|
+
if (theList->moduleName != NULL)
|
223
|
+
{ theList->moduleName->neededSymbol = true; }
|
224
|
+
if (theList->constructType != NULL)
|
225
|
+
{ theList->constructType->neededSymbol = true; }
|
226
|
+
if (theList->constructName != NULL)
|
227
|
+
{ theList->constructName->neededSymbol = true; }
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
/*********************************************************/
|
233
|
+
/* BsaveStorage: Writes out the storage requirements for */
|
234
|
+
/* all defmodule structures to the binary file. */
|
235
|
+
/*********************************************************/
|
236
|
+
static void BsaveStorage(
|
237
|
+
Environment *theEnv,
|
238
|
+
FILE *fp)
|
239
|
+
{
|
240
|
+
size_t space;
|
241
|
+
|
242
|
+
space = sizeof(long) * 2;
|
243
|
+
GenWrite(&space,sizeof(size_t),fp);
|
244
|
+
GenWrite(&DefmoduleData(theEnv)->BNumberOfDefmodules,sizeof(long),fp);
|
245
|
+
GenWrite(&DefmoduleData(theEnv)->NumberOfPortItems,sizeof(long),fp);
|
246
|
+
}
|
247
|
+
|
248
|
+
/*********************************************/
|
249
|
+
/* BsaveBinaryItem: Writes out all defmodule */
|
250
|
+
/* structures to the binary file. */
|
251
|
+
/*********************************************/
|
252
|
+
static void BsaveBinaryItem(
|
253
|
+
Environment *theEnv,
|
254
|
+
FILE *fp)
|
255
|
+
{
|
256
|
+
size_t space;
|
257
|
+
Defmodule *defmodulePtr;
|
258
|
+
struct bsaveDefmodule newDefmodule;
|
259
|
+
struct bsavePortItem newPortItem;
|
260
|
+
struct portItem *theList;
|
261
|
+
|
262
|
+
/*=========================================================*/
|
263
|
+
/* Write out the amount of space taken up by the defmodule */
|
264
|
+
/* and port item data structures in the binary image. */
|
265
|
+
/*=========================================================*/
|
266
|
+
|
267
|
+
space = DefmoduleData(theEnv)->BNumberOfDefmodules * sizeof(struct bsaveDefmodule);
|
268
|
+
space += DefmoduleData(theEnv)->NumberOfPortItems * sizeof(struct bsavePortItem);
|
269
|
+
GenWrite(&space,sizeof(size_t),fp);
|
270
|
+
|
271
|
+
/*==========================================*/
|
272
|
+
/* Write out each defmodule data structure. */
|
273
|
+
/*==========================================*/
|
274
|
+
|
275
|
+
DefmoduleData(theEnv)->BNumberOfDefmodules = 0;
|
276
|
+
DefmoduleData(theEnv)->NumberOfPortItems = 0;
|
277
|
+
for (defmodulePtr = GetNextDefmodule(theEnv,NULL);
|
278
|
+
defmodulePtr != NULL;
|
279
|
+
defmodulePtr = GetNextDefmodule(theEnv,defmodulePtr))
|
280
|
+
{
|
281
|
+
AssignBsaveConstructHeaderVals(&newDefmodule.header,&defmodulePtr->header);
|
282
|
+
|
283
|
+
DefmoduleData(theEnv)->BNumberOfDefmodules++;
|
284
|
+
|
285
|
+
if (defmodulePtr->importList == NULL)
|
286
|
+
{ newDefmodule.importList = ULONG_MAX; }
|
287
|
+
else
|
288
|
+
{
|
289
|
+
newDefmodule.importList = DefmoduleData(theEnv)->NumberOfPortItems;
|
290
|
+
for (theList = defmodulePtr->importList;
|
291
|
+
theList != NULL;
|
292
|
+
theList = theList->next)
|
293
|
+
{ DefmoduleData(theEnv)->NumberOfPortItems++; }
|
294
|
+
}
|
295
|
+
|
296
|
+
if (defmodulePtr->exportList == NULL)
|
297
|
+
{ newDefmodule.exportList = ULONG_MAX; }
|
298
|
+
else
|
299
|
+
{
|
300
|
+
newDefmodule.exportList = DefmoduleData(theEnv)->NumberOfPortItems;
|
301
|
+
for (theList = defmodulePtr->exportList;
|
302
|
+
theList != NULL;
|
303
|
+
theList = theList->next)
|
304
|
+
{ DefmoduleData(theEnv)->NumberOfPortItems++; }
|
305
|
+
}
|
306
|
+
|
307
|
+
newDefmodule.bsaveID = defmodulePtr->header.bsaveID;
|
308
|
+
GenWrite(&newDefmodule,sizeof(struct bsaveDefmodule),fp);
|
309
|
+
}
|
310
|
+
|
311
|
+
/*==========================================*/
|
312
|
+
/* Write out each port item data structure. */
|
313
|
+
/*==========================================*/
|
314
|
+
|
315
|
+
DefmoduleData(theEnv)->NumberOfPortItems = 0;
|
316
|
+
defmodulePtr = GetNextDefmodule(theEnv,NULL);
|
317
|
+
while (defmodulePtr != NULL)
|
318
|
+
{
|
319
|
+
for (theList = defmodulePtr->importList;
|
320
|
+
theList != NULL;
|
321
|
+
theList = theList->next)
|
322
|
+
{
|
323
|
+
DefmoduleData(theEnv)->NumberOfPortItems++;
|
324
|
+
if (theList->moduleName == NULL) newPortItem.moduleName = ULONG_MAX;
|
325
|
+
else newPortItem.moduleName = theList->moduleName->bucket;
|
326
|
+
|
327
|
+
if (theList->constructType == NULL) newPortItem.constructType = ULONG_MAX;
|
328
|
+
else newPortItem.constructType = theList->constructType->bucket;
|
329
|
+
|
330
|
+
if (theList->constructName == NULL) newPortItem.constructName = ULONG_MAX;
|
331
|
+
else newPortItem.constructName = theList->constructName->bucket;
|
332
|
+
|
333
|
+
if (theList->next == NULL) newPortItem.next = ULONG_MAX;
|
334
|
+
else newPortItem.next = DefmoduleData(theEnv)->NumberOfPortItems;
|
335
|
+
|
336
|
+
GenWrite(&newPortItem,sizeof(struct bsavePortItem),fp);
|
337
|
+
}
|
338
|
+
|
339
|
+
for (theList = defmodulePtr->exportList;
|
340
|
+
theList != NULL;
|
341
|
+
theList = theList->next)
|
342
|
+
{
|
343
|
+
DefmoduleData(theEnv)->NumberOfPortItems++;
|
344
|
+
if (theList->moduleName == NULL) newPortItem.moduleName = ULONG_MAX;
|
345
|
+
else newPortItem.moduleName = theList->moduleName->bucket;
|
346
|
+
|
347
|
+
if (theList->constructType == NULL) newPortItem.constructType = ULONG_MAX;
|
348
|
+
else newPortItem.constructType = theList->constructType->bucket;
|
349
|
+
|
350
|
+
if (theList->constructName == NULL) newPortItem.constructName = ULONG_MAX;
|
351
|
+
else newPortItem.constructName = theList->constructName->bucket;
|
352
|
+
|
353
|
+
if (theList->next == NULL) newPortItem.next = ULONG_MAX;
|
354
|
+
else newPortItem.next = DefmoduleData(theEnv)->NumberOfPortItems;
|
355
|
+
|
356
|
+
GenWrite(&newPortItem,sizeof(struct bsavePortItem),fp);
|
357
|
+
}
|
358
|
+
|
359
|
+
defmodulePtr = GetNextDefmodule(theEnv,defmodulePtr);
|
360
|
+
}
|
361
|
+
|
362
|
+
/*=============================================================*/
|
363
|
+
/* If a binary image was already loaded when the bsave command */
|
364
|
+
/* was issued, then restore the counts indicating the number */
|
365
|
+
/* of defmodule and port items in the binary image (these were */
|
366
|
+
/* overwritten by the binary save). */
|
367
|
+
/*=============================================================*/
|
368
|
+
|
369
|
+
RestoreBloadCount(theEnv,&DefmoduleData(theEnv)->BNumberOfDefmodules);
|
370
|
+
RestoreBloadCount(theEnv,&DefmoduleData(theEnv)->NumberOfPortItems);
|
371
|
+
}
|
372
|
+
|
373
|
+
#endif /* BLOAD_AND_BSAVE */
|
374
|
+
|
375
|
+
/**********************************************************/
|
376
|
+
/* BloadStorage: Allocates storage requirements for the */
|
377
|
+
/* defmodules and port items used by this binary image. */
|
378
|
+
/**********************************************************/
|
379
|
+
static void BloadStorage(
|
380
|
+
Environment *theEnv)
|
381
|
+
{
|
382
|
+
size_t space;
|
383
|
+
|
384
|
+
/*=======================================*/
|
385
|
+
/* Determine the number of defmodule and */
|
386
|
+
/* port item data structures to be read. */
|
387
|
+
/*=======================================*/
|
388
|
+
|
389
|
+
GenReadBinary(theEnv,&space,sizeof(size_t));
|
390
|
+
GenReadBinary(theEnv,&DefmoduleData(theEnv)->BNumberOfDefmodules,sizeof(unsigned long));
|
391
|
+
GenReadBinary(theEnv,&DefmoduleData(theEnv)->NumberOfPortItems,sizeof(unsigned long));
|
392
|
+
|
393
|
+
/*================================*/
|
394
|
+
/* Allocate the space needed for */
|
395
|
+
/* the defmodule data structures. */
|
396
|
+
/*================================*/
|
397
|
+
|
398
|
+
if (DefmoduleData(theEnv)->BNumberOfDefmodules == 0)
|
399
|
+
{
|
400
|
+
DefmoduleData(theEnv)->DefmoduleArray = NULL;
|
401
|
+
return;
|
402
|
+
}
|
403
|
+
|
404
|
+
space = (DefmoduleData(theEnv)->BNumberOfDefmodules * sizeof(Defmodule));
|
405
|
+
DefmoduleData(theEnv)->DefmoduleArray = (Defmodule *) genalloc(theEnv,space);
|
406
|
+
|
407
|
+
/*================================*/
|
408
|
+
/* Allocate the space needed for */
|
409
|
+
/* the port item data structures. */
|
410
|
+
/*================================*/
|
411
|
+
|
412
|
+
if (DefmoduleData(theEnv)->NumberOfPortItems == 0)
|
413
|
+
{
|
414
|
+
DefmoduleData(theEnv)->PortItemArray = NULL;
|
415
|
+
return;
|
416
|
+
}
|
417
|
+
|
418
|
+
space = (DefmoduleData(theEnv)->NumberOfPortItems * sizeof(struct portItem));
|
419
|
+
DefmoduleData(theEnv)->PortItemArray = (struct portItem *) genalloc(theEnv,space);
|
420
|
+
}
|
421
|
+
|
422
|
+
/********************************************/
|
423
|
+
/* BloadBinaryItem: Loads and refreshes the */
|
424
|
+
/* defmodules used by this binary image. */
|
425
|
+
/********************************************/
|
426
|
+
static void BloadBinaryItem(
|
427
|
+
Environment *theEnv)
|
428
|
+
{
|
429
|
+
size_t space;
|
430
|
+
|
431
|
+
GenReadBinary(theEnv,&space,sizeof(size_t));
|
432
|
+
if (DefmoduleData(theEnv)->BNumberOfDefmodules == 0) return;
|
433
|
+
|
434
|
+
BloadandRefresh(theEnv,DefmoduleData(theEnv)->BNumberOfDefmodules,sizeof(struct bsaveDefmodule),UpdateDefmodule);
|
435
|
+
BloadandRefresh(theEnv,DefmoduleData(theEnv)->NumberOfPortItems,sizeof(struct bsavePortItem),UpdatePortItem);
|
436
|
+
|
437
|
+
SetListOfDefmodules(theEnv,DefmoduleData(theEnv)->DefmoduleArray);
|
438
|
+
SetCurrentModule(theEnv,GetNextDefmodule(theEnv,NULL));
|
439
|
+
}
|
440
|
+
|
441
|
+
/******************************************/
|
442
|
+
/* UpdateDefmodule: Bload refresh routine */
|
443
|
+
/* for defmodule data structure. */
|
444
|
+
/******************************************/
|
445
|
+
static void UpdateDefmodule(
|
446
|
+
Environment *theEnv,
|
447
|
+
void *buf,
|
448
|
+
unsigned long obji)
|
449
|
+
{
|
450
|
+
struct bsaveDefmodule *bdp;
|
451
|
+
struct moduleItem *theItem;
|
452
|
+
unsigned int i;
|
453
|
+
|
454
|
+
bdp = (struct bsaveDefmodule *) buf;
|
455
|
+
|
456
|
+
UpdateConstructHeader(theEnv,&bdp->header,&DefmoduleData(theEnv)->DefmoduleArray[obji].header,DEFMODULE,
|
457
|
+
0,NULL,sizeof(Defmodule),DefmoduleData(theEnv)->DefmoduleArray);
|
458
|
+
|
459
|
+
if (GetNumberOfModuleItems(theEnv) == 0)
|
460
|
+
{ DefmoduleData(theEnv)->DefmoduleArray[obji].itemsArray = NULL; }
|
461
|
+
else
|
462
|
+
{
|
463
|
+
DefmoduleData(theEnv)->DefmoduleArray[obji].itemsArray =
|
464
|
+
(struct defmoduleItemHeader **) gm2(theEnv,sizeof(void *) * GetNumberOfModuleItems(theEnv));
|
465
|
+
}
|
466
|
+
|
467
|
+
for (i = 0, theItem = GetListOfModuleItems(theEnv);
|
468
|
+
(i < GetNumberOfModuleItems(theEnv)) && (theItem != NULL) ;
|
469
|
+
i++, theItem = theItem->next)
|
470
|
+
{
|
471
|
+
if (theItem->bloadModuleReference == NULL)
|
472
|
+
{ DefmoduleData(theEnv)->DefmoduleArray[obji].itemsArray[i] = NULL; }
|
473
|
+
else
|
474
|
+
{
|
475
|
+
DefmoduleData(theEnv)->DefmoduleArray[obji].itemsArray[i] =
|
476
|
+
(struct defmoduleItemHeader *)
|
477
|
+
(*theItem->bloadModuleReference)(theEnv,obji);
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
DefmoduleData(theEnv)->DefmoduleArray[obji].header.ppForm = NULL;
|
482
|
+
|
483
|
+
if (bdp->importList != ULONG_MAX)
|
484
|
+
{ DefmoduleData(theEnv)->DefmoduleArray[obji].importList = (struct portItem *) &DefmoduleData(theEnv)->PortItemArray[bdp->importList]; }
|
485
|
+
else
|
486
|
+
{ DefmoduleData(theEnv)->DefmoduleArray[obji].importList = NULL; }
|
487
|
+
|
488
|
+
if (bdp->exportList != ULONG_MAX)
|
489
|
+
{ DefmoduleData(theEnv)->DefmoduleArray[obji].exportList = (struct portItem *) &DefmoduleData(theEnv)->PortItemArray[bdp->exportList]; }
|
490
|
+
else
|
491
|
+
{ DefmoduleData(theEnv)->DefmoduleArray[obji].exportList = NULL; }
|
492
|
+
DefmoduleData(theEnv)->DefmoduleArray[obji].header.bsaveID = bdp->bsaveID;
|
493
|
+
}
|
494
|
+
|
495
|
+
/*****************************************/
|
496
|
+
/* UpdatePortItem: Bload refresh routine */
|
497
|
+
/* for port item data structure. */
|
498
|
+
/*****************************************/
|
499
|
+
static void UpdatePortItem(
|
500
|
+
Environment *theEnv,
|
501
|
+
void *buf,
|
502
|
+
unsigned long obji)
|
503
|
+
{
|
504
|
+
struct bsavePortItem *bdp;
|
505
|
+
|
506
|
+
bdp = (struct bsavePortItem *) buf;
|
507
|
+
|
508
|
+
if (bdp->moduleName != ULONG_MAX)
|
509
|
+
{
|
510
|
+
DefmoduleData(theEnv)->PortItemArray[obji].moduleName = SymbolPointer(bdp->moduleName);
|
511
|
+
IncrementLexemeCount(DefmoduleData(theEnv)->PortItemArray[obji].moduleName);
|
512
|
+
}
|
513
|
+
else
|
514
|
+
{ DefmoduleData(theEnv)->PortItemArray[obji].moduleName = NULL; }
|
515
|
+
|
516
|
+
if (bdp->constructType != ULONG_MAX)
|
517
|
+
{
|
518
|
+
DefmoduleData(theEnv)->PortItemArray[obji].constructType = SymbolPointer(bdp->constructType);
|
519
|
+
IncrementLexemeCount(DefmoduleData(theEnv)->PortItemArray[obji].constructType);
|
520
|
+
}
|
521
|
+
else
|
522
|
+
{ DefmoduleData(theEnv)->PortItemArray[obji].constructType = NULL; }
|
523
|
+
|
524
|
+
if (bdp->constructName != ULONG_MAX)
|
525
|
+
{
|
526
|
+
DefmoduleData(theEnv)->PortItemArray[obji].constructName = SymbolPointer(bdp->constructName);
|
527
|
+
IncrementLexemeCount(DefmoduleData(theEnv)->PortItemArray[obji].constructName);
|
528
|
+
}
|
529
|
+
else
|
530
|
+
{ DefmoduleData(theEnv)->PortItemArray[obji].constructName = NULL; }
|
531
|
+
|
532
|
+
if (bdp->next != ULONG_MAX)
|
533
|
+
{ DefmoduleData(theEnv)->PortItemArray[obji].next = (struct portItem *) &DefmoduleData(theEnv)->PortItemArray[bdp->next]; }
|
534
|
+
else
|
535
|
+
{ DefmoduleData(theEnv)->PortItemArray[obji].next = NULL; }
|
536
|
+
}
|
537
|
+
|
538
|
+
/***************************************/
|
539
|
+
/* ClearBload: Defmodule clear routine */
|
540
|
+
/* when a binary load is in effect. */
|
541
|
+
/***************************************/
|
542
|
+
static void ClearBload(
|
543
|
+
Environment *theEnv)
|
544
|
+
{
|
545
|
+
unsigned long i;
|
546
|
+
size_t space;
|
547
|
+
struct portItem *theList;
|
548
|
+
|
549
|
+
/*===========================*/
|
550
|
+
/* Decrement in use counters */
|
551
|
+
/* used by the binary image. */
|
552
|
+
/*===========================*/
|
553
|
+
|
554
|
+
for (i = 0; i < DefmoduleData(theEnv)->BNumberOfDefmodules; i++)
|
555
|
+
{
|
556
|
+
ReleaseLexeme(theEnv,DefmoduleData(theEnv)->DefmoduleArray[i].header.name);
|
557
|
+
for (theList = DefmoduleData(theEnv)->DefmoduleArray[i].importList;
|
558
|
+
theList != NULL;
|
559
|
+
theList = theList->next)
|
560
|
+
{
|
561
|
+
if (theList->moduleName != NULL) ReleaseLexeme(theEnv,theList->moduleName);
|
562
|
+
if (theList->constructType != NULL) ReleaseLexeme(theEnv,theList->constructType);
|
563
|
+
if (theList->constructName != NULL) ReleaseLexeme(theEnv,theList->constructName);
|
564
|
+
}
|
565
|
+
|
566
|
+
for (theList = DefmoduleData(theEnv)->DefmoduleArray[i].exportList;
|
567
|
+
theList != NULL;
|
568
|
+
theList = theList->next)
|
569
|
+
{
|
570
|
+
if (theList->moduleName != NULL) ReleaseLexeme(theEnv,theList->moduleName);
|
571
|
+
if (theList->constructType != NULL) ReleaseLexeme(theEnv,theList->constructType);
|
572
|
+
if (theList->constructName != NULL) ReleaseLexeme(theEnv,theList->constructName);
|
573
|
+
}
|
574
|
+
|
575
|
+
rm(theEnv,DefmoduleData(theEnv)->DefmoduleArray[i].itemsArray,sizeof(void *) * GetNumberOfModuleItems(theEnv));
|
576
|
+
}
|
577
|
+
|
578
|
+
/*================================*/
|
579
|
+
/* Deallocate the space used for */
|
580
|
+
/* the defmodule data structures. */
|
581
|
+
/*================================*/
|
582
|
+
|
583
|
+
space = DefmoduleData(theEnv)->BNumberOfDefmodules * sizeof(Defmodule);
|
584
|
+
if (space != 0) genfree(theEnv,DefmoduleData(theEnv)->DefmoduleArray,space);
|
585
|
+
DefmoduleData(theEnv)->BNumberOfDefmodules = 0;
|
586
|
+
|
587
|
+
/*================================*/
|
588
|
+
/* Deallocate the space used for */
|
589
|
+
/* the port item data structures. */
|
590
|
+
/*================================*/
|
591
|
+
|
592
|
+
space = DefmoduleData(theEnv)->NumberOfPortItems * sizeof(struct portItem);
|
593
|
+
if (space != 0) genfree(theEnv,DefmoduleData(theEnv)->PortItemArray,space);
|
594
|
+
DefmoduleData(theEnv)->NumberOfPortItems = 0;
|
595
|
+
|
596
|
+
/*===========================*/
|
597
|
+
/* Reset module information. */
|
598
|
+
/*===========================*/
|
599
|
+
|
600
|
+
SetListOfDefmodules(theEnv,NULL);
|
601
|
+
CreateMainModule(theEnv,NULL);
|
602
|
+
DefmoduleData(theEnv)->MainModuleRedefinable = true;
|
603
|
+
}
|
604
|
+
|
605
|
+
#endif /* (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME) */
|
606
|
+
|
607
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 07/30/16 */
|
5
|
+
/* */
|
6
|
+
/* DEFMODULE BSAVE/BLOAD HEADER FILE */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Gary D. Riley */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* Brian L. Dantes */
|
17
|
+
/* */
|
18
|
+
/* Revision History: */
|
19
|
+
/* */
|
20
|
+
/* 6.30: Changed integer type/precision. */
|
21
|
+
/* */
|
22
|
+
/* 6.40: Removed LOCALE definition. */
|
23
|
+
/* */
|
24
|
+
/* Pragma once and other inclusion changes. */
|
25
|
+
/* */
|
26
|
+
/* Removed use of void pointers for specific */
|
27
|
+
/* data structures. */
|
28
|
+
/* */
|
29
|
+
/*************************************************************/
|
30
|
+
|
31
|
+
#ifndef _H_modulbin
|
32
|
+
|
33
|
+
#pragma once
|
34
|
+
|
35
|
+
#define _H_modulbin
|
36
|
+
|
37
|
+
#include "moduldef.h"
|
38
|
+
#include "modulbin.h"
|
39
|
+
#include "cstrcbin.h"
|
40
|
+
|
41
|
+
#if (! RUN_TIME)
|
42
|
+
|
43
|
+
struct bsaveDefmodule
|
44
|
+
{
|
45
|
+
struct bsaveConstructHeader header;
|
46
|
+
unsigned long importList;
|
47
|
+
unsigned long exportList;
|
48
|
+
unsigned long bsaveID;
|
49
|
+
};
|
50
|
+
|
51
|
+
struct bsaveDefmoduleItemHeader
|
52
|
+
{
|
53
|
+
unsigned long theModule;
|
54
|
+
unsigned long firstItem;
|
55
|
+
unsigned long lastItem;
|
56
|
+
};
|
57
|
+
|
58
|
+
struct bsavePortItem
|
59
|
+
{
|
60
|
+
unsigned long moduleName;
|
61
|
+
unsigned long constructType;
|
62
|
+
unsigned long constructName;
|
63
|
+
unsigned long next;
|
64
|
+
};
|
65
|
+
|
66
|
+
#define ModulePointer(i) ((Defmodule *) (&DefmoduleData(theEnv)->DefmoduleArray[i]))
|
67
|
+
|
68
|
+
void DefmoduleBinarySetup(Environment *);
|
69
|
+
void UpdateDefmoduleItemHeader
|
70
|
+
(Environment *,struct bsaveDefmoduleItemHeader *,
|
71
|
+
struct defmoduleItemHeader *,size_t,void *);
|
72
|
+
|
73
|
+
#if BLOAD_AND_BSAVE
|
74
|
+
void AssignBsaveDefmdlItemHdrVals
|
75
|
+
(struct bsaveDefmoduleItemHeader *,
|
76
|
+
struct defmoduleItemHeader *);
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#endif /* RUN_TIME */
|
80
|
+
|
81
|
+
#endif /* _H_modulbin */
|
82
|
+
|
83
|
+
|
84
|
+
|