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.
Files changed (346) hide show
  1. checksums.yaml +7 -0
  2. data/ext/clipsruby/agenda.c +1373 -0
  3. data/ext/clipsruby/agenda.h +169 -0
  4. data/ext/clipsruby/analysis.c +1142 -0
  5. data/ext/clipsruby/analysis.h +61 -0
  6. data/ext/clipsruby/argacces.c +526 -0
  7. data/ext/clipsruby/argacces.h +77 -0
  8. data/ext/clipsruby/bload.c +884 -0
  9. data/ext/clipsruby/bload.h +94 -0
  10. data/ext/clipsruby/bmathfun.c +557 -0
  11. data/ext/clipsruby/bmathfun.h +66 -0
  12. data/ext/clipsruby/bsave.c +634 -0
  13. data/ext/clipsruby/bsave.h +130 -0
  14. data/ext/clipsruby/classcom.c +976 -0
  15. data/ext/clipsruby/classcom.h +115 -0
  16. data/ext/clipsruby/classexm.c +1376 -0
  17. data/ext/clipsruby/classexm.h +97 -0
  18. data/ext/clipsruby/classfun.c +1392 -0
  19. data/ext/clipsruby/classfun.h +164 -0
  20. data/ext/clipsruby/classinf.c +1245 -0
  21. data/ext/clipsruby/classinf.h +94 -0
  22. data/ext/clipsruby/classini.c +843 -0
  23. data/ext/clipsruby/classini.h +75 -0
  24. data/ext/clipsruby/classpsr.c +957 -0
  25. data/ext/clipsruby/classpsr.h +73 -0
  26. data/ext/clipsruby/clips.h +133 -0
  27. data/ext/clipsruby/clipsruby.c +619 -0
  28. data/ext/clipsruby/clsltpsr.c +931 -0
  29. data/ext/clipsruby/clsltpsr.h +72 -0
  30. data/ext/clipsruby/commline.c +1217 -0
  31. data/ext/clipsruby/commline.h +131 -0
  32. data/ext/clipsruby/conscomp.c +1593 -0
  33. data/ext/clipsruby/conscomp.h +150 -0
  34. data/ext/clipsruby/constant.h +264 -0
  35. data/ext/clipsruby/constrct.c +1090 -0
  36. data/ext/clipsruby/constrct.h +216 -0
  37. data/ext/clipsruby/constrnt.c +554 -0
  38. data/ext/clipsruby/constrnt.h +132 -0
  39. data/ext/clipsruby/crstrtgy.c +1088 -0
  40. data/ext/clipsruby/crstrtgy.h +85 -0
  41. data/ext/clipsruby/cstrcbin.c +185 -0
  42. data/ext/clipsruby/cstrcbin.h +61 -0
  43. data/ext/clipsruby/cstrccmp.h +43 -0
  44. data/ext/clipsruby/cstrccom.c +1791 -0
  45. data/ext/clipsruby/cstrccom.h +115 -0
  46. data/ext/clipsruby/cstrcpsr.c +835 -0
  47. data/ext/clipsruby/cstrcpsr.h +97 -0
  48. data/ext/clipsruby/cstrnbin.c +282 -0
  49. data/ext/clipsruby/cstrnbin.h +55 -0
  50. data/ext/clipsruby/cstrnchk.c +826 -0
  51. data/ext/clipsruby/cstrnchk.h +91 -0
  52. data/ext/clipsruby/cstrncmp.c +238 -0
  53. data/ext/clipsruby/cstrncmp.h +57 -0
  54. data/ext/clipsruby/cstrnops.c +1176 -0
  55. data/ext/clipsruby/cstrnops.h +47 -0
  56. data/ext/clipsruby/cstrnpsr.c +1394 -0
  57. data/ext/clipsruby/cstrnpsr.h +88 -0
  58. data/ext/clipsruby/cstrnutl.c +564 -0
  59. data/ext/clipsruby/cstrnutl.h +54 -0
  60. data/ext/clipsruby/default.c +454 -0
  61. data/ext/clipsruby/default.h +57 -0
  62. data/ext/clipsruby/defins.c +971 -0
  63. data/ext/clipsruby/defins.h +127 -0
  64. data/ext/clipsruby/developr.c +677 -0
  65. data/ext/clipsruby/developr.h +69 -0
  66. data/ext/clipsruby/dffctbin.c +477 -0
  67. data/ext/clipsruby/dffctbin.h +76 -0
  68. data/ext/clipsruby/dffctbsc.c +308 -0
  69. data/ext/clipsruby/dffctbsc.h +72 -0
  70. data/ext/clipsruby/dffctcmp.c +297 -0
  71. data/ext/clipsruby/dffctcmp.h +44 -0
  72. data/ext/clipsruby/dffctdef.c +364 -0
  73. data/ext/clipsruby/dffctdef.h +104 -0
  74. data/ext/clipsruby/dffctpsr.c +179 -0
  75. data/ext/clipsruby/dffctpsr.h +49 -0
  76. data/ext/clipsruby/dffnxbin.c +520 -0
  77. data/ext/clipsruby/dffnxbin.h +67 -0
  78. data/ext/clipsruby/dffnxcmp.c +378 -0
  79. data/ext/clipsruby/dffnxcmp.h +54 -0
  80. data/ext/clipsruby/dffnxexe.c +241 -0
  81. data/ext/clipsruby/dffnxexe.h +58 -0
  82. data/ext/clipsruby/dffnxfun.c +1192 -0
  83. data/ext/clipsruby/dffnxfun.h +155 -0
  84. data/ext/clipsruby/dffnxpsr.c +514 -0
  85. data/ext/clipsruby/dffnxpsr.h +57 -0
  86. data/ext/clipsruby/dfinsbin.c +509 -0
  87. data/ext/clipsruby/dfinsbin.h +66 -0
  88. data/ext/clipsruby/dfinscmp.c +345 -0
  89. data/ext/clipsruby/dfinscmp.h +48 -0
  90. data/ext/clipsruby/drive.c +1191 -0
  91. data/ext/clipsruby/drive.h +65 -0
  92. data/ext/clipsruby/emathfun.c +1213 -0
  93. data/ext/clipsruby/emathfun.h +99 -0
  94. data/ext/clipsruby/engine.c +1568 -0
  95. data/ext/clipsruby/engine.h +203 -0
  96. data/ext/clipsruby/entities.h +276 -0
  97. data/ext/clipsruby/envrnbld.c +514 -0
  98. data/ext/clipsruby/envrnbld.h +40 -0
  99. data/ext/clipsruby/envrnmnt.c +257 -0
  100. data/ext/clipsruby/envrnmnt.h +112 -0
  101. data/ext/clipsruby/evaluatn.c +1736 -0
  102. data/ext/clipsruby/evaluatn.h +211 -0
  103. data/ext/clipsruby/expressn.c +494 -0
  104. data/ext/clipsruby/expressn.h +154 -0
  105. data/ext/clipsruby/exprnbin.c +538 -0
  106. data/ext/clipsruby/exprnbin.h +60 -0
  107. data/ext/clipsruby/exprnops.c +564 -0
  108. data/ext/clipsruby/exprnops.h +67 -0
  109. data/ext/clipsruby/exprnpsr.c +1112 -0
  110. data/ext/clipsruby/exprnpsr.h +98 -0
  111. data/ext/clipsruby/extconf.rb +2 -0
  112. data/ext/clipsruby/extnfunc.c +1015 -0
  113. data/ext/clipsruby/extnfunc.h +157 -0
  114. data/ext/clipsruby/factbin.c +447 -0
  115. data/ext/clipsruby/factbin.h +56 -0
  116. data/ext/clipsruby/factbld.c +1035 -0
  117. data/ext/clipsruby/factbld.h +63 -0
  118. data/ext/clipsruby/factcmp.c +386 -0
  119. data/ext/clipsruby/factcmp.h +46 -0
  120. data/ext/clipsruby/factcom.c +759 -0
  121. data/ext/clipsruby/factcom.h +80 -0
  122. data/ext/clipsruby/factfile.c +1761 -0
  123. data/ext/clipsruby/factfile.h +54 -0
  124. data/ext/clipsruby/factfun.c +682 -0
  125. data/ext/clipsruby/factfun.h +77 -0
  126. data/ext/clipsruby/factgen.c +1305 -0
  127. data/ext/clipsruby/factgen.h +229 -0
  128. data/ext/clipsruby/facthsh.c +438 -0
  129. data/ext/clipsruby/facthsh.h +81 -0
  130. data/ext/clipsruby/factlhs.c +250 -0
  131. data/ext/clipsruby/factlhs.h +54 -0
  132. data/ext/clipsruby/factmch.c +905 -0
  133. data/ext/clipsruby/factmch.h +68 -0
  134. data/ext/clipsruby/factmngr.c +3373 -0
  135. data/ext/clipsruby/factmngr.h +325 -0
  136. data/ext/clipsruby/factprt.c +498 -0
  137. data/ext/clipsruby/factprt.h +60 -0
  138. data/ext/clipsruby/factqpsr.c +796 -0
  139. data/ext/clipsruby/factqpsr.h +61 -0
  140. data/ext/clipsruby/factqury.c +1267 -0
  141. data/ext/clipsruby/factqury.h +112 -0
  142. data/ext/clipsruby/factrete.c +978 -0
  143. data/ext/clipsruby/factrete.h +70 -0
  144. data/ext/clipsruby/factrhs.c +667 -0
  145. data/ext/clipsruby/factrhs.h +55 -0
  146. data/ext/clipsruby/filecom.c +353 -0
  147. data/ext/clipsruby/filecom.h +137 -0
  148. data/ext/clipsruby/filertr.c +481 -0
  149. data/ext/clipsruby/filertr.h +94 -0
  150. data/ext/clipsruby/fileutil.c +1020 -0
  151. data/ext/clipsruby/fileutil.h +50 -0
  152. data/ext/clipsruby/generate.c +1079 -0
  153. data/ext/clipsruby/generate.h +57 -0
  154. data/ext/clipsruby/genrcbin.c +902 -0
  155. data/ext/clipsruby/genrcbin.h +69 -0
  156. data/ext/clipsruby/genrccmp.c +640 -0
  157. data/ext/clipsruby/genrccmp.h +59 -0
  158. data/ext/clipsruby/genrccom.c +2017 -0
  159. data/ext/clipsruby/genrccom.h +119 -0
  160. data/ext/clipsruby/genrcexe.c +737 -0
  161. data/ext/clipsruby/genrcexe.h +73 -0
  162. data/ext/clipsruby/genrcfun.c +890 -0
  163. data/ext/clipsruby/genrcfun.h +185 -0
  164. data/ext/clipsruby/genrcpsr.c +1618 -0
  165. data/ext/clipsruby/genrcpsr.h +80 -0
  166. data/ext/clipsruby/globlbin.c +458 -0
  167. data/ext/clipsruby/globlbin.h +71 -0
  168. data/ext/clipsruby/globlbsc.c +361 -0
  169. data/ext/clipsruby/globlbsc.h +83 -0
  170. data/ext/clipsruby/globlcmp.c +330 -0
  171. data/ext/clipsruby/globlcmp.h +52 -0
  172. data/ext/clipsruby/globlcom.c +289 -0
  173. data/ext/clipsruby/globlcom.h +63 -0
  174. data/ext/clipsruby/globldef.c +1087 -0
  175. data/ext/clipsruby/globldef.h +151 -0
  176. data/ext/clipsruby/globlpsr.c +530 -0
  177. data/ext/clipsruby/globlpsr.h +59 -0
  178. data/ext/clipsruby/immthpsr.c +431 -0
  179. data/ext/clipsruby/immthpsr.h +55 -0
  180. data/ext/clipsruby/incrrset.c +530 -0
  181. data/ext/clipsruby/incrrset.h +73 -0
  182. data/ext/clipsruby/inherpsr.c +850 -0
  183. data/ext/clipsruby/inherpsr.h +52 -0
  184. data/ext/clipsruby/inscom.c +2076 -0
  185. data/ext/clipsruby/inscom.h +182 -0
  186. data/ext/clipsruby/insfile.c +1764 -0
  187. data/ext/clipsruby/insfile.h +96 -0
  188. data/ext/clipsruby/insfun.c +1451 -0
  189. data/ext/clipsruby/insfun.h +134 -0
  190. data/ext/clipsruby/insmngr.c +2550 -0
  191. data/ext/clipsruby/insmngr.h +125 -0
  192. data/ext/clipsruby/insmoddp.c +1041 -0
  193. data/ext/clipsruby/insmoddp.h +91 -0
  194. data/ext/clipsruby/insmult.c +804 -0
  195. data/ext/clipsruby/insmult.h +62 -0
  196. data/ext/clipsruby/inspsr.c +602 -0
  197. data/ext/clipsruby/inspsr.h +60 -0
  198. data/ext/clipsruby/insquery.c +1278 -0
  199. data/ext/clipsruby/insquery.h +115 -0
  200. data/ext/clipsruby/insqypsr.c +729 -0
  201. data/ext/clipsruby/insqypsr.h +63 -0
  202. data/ext/clipsruby/iofun.c +2045 -0
  203. data/ext/clipsruby/iofun.h +116 -0
  204. data/ext/clipsruby/lgcldpnd.c +644 -0
  205. data/ext/clipsruby/lgcldpnd.h +75 -0
  206. data/ext/clipsruby/main.c +112 -0
  207. data/ext/clipsruby/match.h +142 -0
  208. data/ext/clipsruby/memalloc.c +481 -0
  209. data/ext/clipsruby/memalloc.h +197 -0
  210. data/ext/clipsruby/miscfun.c +1801 -0
  211. data/ext/clipsruby/miscfun.h +132 -0
  212. data/ext/clipsruby/modulbin.c +607 -0
  213. data/ext/clipsruby/modulbin.h +84 -0
  214. data/ext/clipsruby/modulbsc.c +347 -0
  215. data/ext/clipsruby/modulbsc.h +67 -0
  216. data/ext/clipsruby/modulcmp.c +499 -0
  217. data/ext/clipsruby/modulcmp.h +54 -0
  218. data/ext/clipsruby/moduldef.c +817 -0
  219. data/ext/clipsruby/moduldef.h +271 -0
  220. data/ext/clipsruby/modulpsr.c +1150 -0
  221. data/ext/clipsruby/modulpsr.h +69 -0
  222. data/ext/clipsruby/modulutl.c +1036 -0
  223. data/ext/clipsruby/modulutl.h +84 -0
  224. data/ext/clipsruby/msgcom.c +1221 -0
  225. data/ext/clipsruby/msgcom.h +125 -0
  226. data/ext/clipsruby/msgfun.c +1076 -0
  227. data/ext/clipsruby/msgfun.h +118 -0
  228. data/ext/clipsruby/msgpass.c +1441 -0
  229. data/ext/clipsruby/msgpass.h +103 -0
  230. data/ext/clipsruby/msgpsr.c +698 -0
  231. data/ext/clipsruby/msgpsr.h +73 -0
  232. data/ext/clipsruby/multifld.c +1404 -0
  233. data/ext/clipsruby/multifld.h +130 -0
  234. data/ext/clipsruby/multifun.c +2182 -0
  235. data/ext/clipsruby/multifun.h +102 -0
  236. data/ext/clipsruby/network.h +142 -0
  237. data/ext/clipsruby/objbin.c +1522 -0
  238. data/ext/clipsruby/objbin.h +79 -0
  239. data/ext/clipsruby/objcmp.c +1507 -0
  240. data/ext/clipsruby/objcmp.h +71 -0
  241. data/ext/clipsruby/object.h +260 -0
  242. data/ext/clipsruby/objrtbin.c +701 -0
  243. data/ext/clipsruby/objrtbin.h +79 -0
  244. data/ext/clipsruby/objrtbld.c +2393 -0
  245. data/ext/clipsruby/objrtbld.h +66 -0
  246. data/ext/clipsruby/objrtcmp.c +734 -0
  247. data/ext/clipsruby/objrtcmp.h +66 -0
  248. data/ext/clipsruby/objrtfnx.c +1330 -0
  249. data/ext/clipsruby/objrtfnx.h +222 -0
  250. data/ext/clipsruby/objrtgen.c +736 -0
  251. data/ext/clipsruby/objrtgen.h +63 -0
  252. data/ext/clipsruby/objrtmch.c +1524 -0
  253. data/ext/clipsruby/objrtmch.h +160 -0
  254. data/ext/clipsruby/parsefun.c +415 -0
  255. data/ext/clipsruby/parsefun.h +67 -0
  256. data/ext/clipsruby/pattern.c +1265 -0
  257. data/ext/clipsruby/pattern.h +163 -0
  258. data/ext/clipsruby/pprint.c +328 -0
  259. data/ext/clipsruby/pprint.h +79 -0
  260. data/ext/clipsruby/prccode.c +1478 -0
  261. data/ext/clipsruby/prccode.h +145 -0
  262. data/ext/clipsruby/prcdrfun.c +640 -0
  263. data/ext/clipsruby/prcdrfun.h +95 -0
  264. data/ext/clipsruby/prcdrpsr.c +1068 -0
  265. data/ext/clipsruby/prcdrpsr.h +79 -0
  266. data/ext/clipsruby/prdctfun.c +869 -0
  267. data/ext/clipsruby/prdctfun.h +77 -0
  268. data/ext/clipsruby/prntutil.c +878 -0
  269. data/ext/clipsruby/prntutil.h +125 -0
  270. data/ext/clipsruby/proflfun.c +827 -0
  271. data/ext/clipsruby/proflfun.h +118 -0
  272. data/ext/clipsruby/reorder.c +2082 -0
  273. data/ext/clipsruby/reorder.h +172 -0
  274. data/ext/clipsruby/reteutil.c +1732 -0
  275. data/ext/clipsruby/reteutil.h +111 -0
  276. data/ext/clipsruby/retract.c +710 -0
  277. data/ext/clipsruby/retract.h +74 -0
  278. data/ext/clipsruby/router.c +737 -0
  279. data/ext/clipsruby/router.h +147 -0
  280. data/ext/clipsruby/rulebin.c +1136 -0
  281. data/ext/clipsruby/rulebin.h +153 -0
  282. data/ext/clipsruby/rulebld.c +1328 -0
  283. data/ext/clipsruby/rulebld.h +62 -0
  284. data/ext/clipsruby/rulebsc.c +517 -0
  285. data/ext/clipsruby/rulebsc.h +91 -0
  286. data/ext/clipsruby/rulecmp.c +733 -0
  287. data/ext/clipsruby/rulecmp.h +63 -0
  288. data/ext/clipsruby/rulecom.c +1583 -0
  289. data/ext/clipsruby/rulecom.h +116 -0
  290. data/ext/clipsruby/rulecstr.c +892 -0
  291. data/ext/clipsruby/rulecstr.h +53 -0
  292. data/ext/clipsruby/ruledef.c +559 -0
  293. data/ext/clipsruby/ruledef.h +179 -0
  294. data/ext/clipsruby/ruledlt.c +599 -0
  295. data/ext/clipsruby/ruledlt.h +58 -0
  296. data/ext/clipsruby/rulelhs.c +1216 -0
  297. data/ext/clipsruby/rulelhs.h +52 -0
  298. data/ext/clipsruby/rulepsr.c +1073 -0
  299. data/ext/clipsruby/rulepsr.h +61 -0
  300. data/ext/clipsruby/scanner.c +856 -0
  301. data/ext/clipsruby/scanner.h +112 -0
  302. data/ext/clipsruby/setup.h +488 -0
  303. data/ext/clipsruby/sortfun.c +433 -0
  304. data/ext/clipsruby/sortfun.h +55 -0
  305. data/ext/clipsruby/strngfun.c +1173 -0
  306. data/ext/clipsruby/strngfun.h +96 -0
  307. data/ext/clipsruby/strngrtr.c +523 -0
  308. data/ext/clipsruby/strngrtr.h +97 -0
  309. data/ext/clipsruby/symblbin.c +648 -0
  310. data/ext/clipsruby/symblbin.h +64 -0
  311. data/ext/clipsruby/symblcmp.c +893 -0
  312. data/ext/clipsruby/symblcmp.h +61 -0
  313. data/ext/clipsruby/symbol.c +1961 -0
  314. data/ext/clipsruby/symbol.h +243 -0
  315. data/ext/clipsruby/sysdep.c +894 -0
  316. data/ext/clipsruby/sysdep.h +164 -0
  317. data/ext/clipsruby/textpro.c +1388 -0
  318. data/ext/clipsruby/textpro.h +77 -0
  319. data/ext/clipsruby/tmpltbin.c +609 -0
  320. data/ext/clipsruby/tmpltbin.h +108 -0
  321. data/ext/clipsruby/tmpltbsc.c +327 -0
  322. data/ext/clipsruby/tmpltbsc.h +87 -0
  323. data/ext/clipsruby/tmpltcmp.c +450 -0
  324. data/ext/clipsruby/tmpltcmp.h +57 -0
  325. data/ext/clipsruby/tmpltdef.c +584 -0
  326. data/ext/clipsruby/tmpltdef.h +155 -0
  327. data/ext/clipsruby/tmpltfun.c +2477 -0
  328. data/ext/clipsruby/tmpltfun.h +122 -0
  329. data/ext/clipsruby/tmpltlhs.c +379 -0
  330. data/ext/clipsruby/tmpltlhs.h +50 -0
  331. data/ext/clipsruby/tmpltpsr.c +819 -0
  332. data/ext/clipsruby/tmpltpsr.h +59 -0
  333. data/ext/clipsruby/tmpltrhs.c +595 -0
  334. data/ext/clipsruby/tmpltrhs.h +55 -0
  335. data/ext/clipsruby/tmpltutl.c +637 -0
  336. data/ext/clipsruby/tmpltutl.h +82 -0
  337. data/ext/clipsruby/userdata.c +156 -0
  338. data/ext/clipsruby/userdata.h +72 -0
  339. data/ext/clipsruby/userfunctions.c +70 -0
  340. data/ext/clipsruby/usrsetup.h +7 -0
  341. data/ext/clipsruby/utility.c +1594 -0
  342. data/ext/clipsruby/utility.h +250 -0
  343. data/ext/clipsruby/watch.c +865 -0
  344. data/ext/clipsruby/watch.h +124 -0
  345. data/lib/clipsruby.rb +1 -0
  346. metadata +388 -0
@@ -0,0 +1,1522 @@
1
+ /*******************************************************/
2
+ /* "C" Language Integrated Production System */
3
+ /* */
4
+ /* CLIPS Version 6.40 04/03/19 */
5
+ /* */
6
+ /* */
7
+ /*******************************************************/
8
+
9
+ /*************************************************************/
10
+ /* Purpose: Binary Load/Save Functions for Classes and their */
11
+ /* message-handlers */
12
+ /* */
13
+ /* Principal Programmer(s): */
14
+ /* Brian L. Dantes */
15
+ /* */
16
+ /* Contributing Programmer(s): */
17
+ /* */
18
+ /* Revision History: */
19
+ /* */
20
+ /* 6.24: Removed IMPERATIVE_MESSAGE_HANDLERS and */
21
+ /* AUXILIARY_MESSAGE_HANDLERS compilation flags. */
22
+ /* */
23
+ /* 6.30: Changed integer type/precision. */
24
+ /* */
25
+ /* Removed conditional code for unsupported */
26
+ /* compilers/operating systems (IBM_MCW, */
27
+ /* MAC_MCW, and IBM_TBC). */
28
+ /* */
29
+ /* 6.31: Optimization for marking relevant alpha nodes */
30
+ /* in the object pattern network. */
31
+ /* */
32
+ /* Changed allocation of multifield slot default */
33
+ /* from ephemeral to explicit deallocation. */
34
+ /* */
35
+ /* 6.40: Pragma once and other inclusion changes. */
36
+ /* */
37
+ /* Added support for booleans with <stdbool.h>. */
38
+ /* */
39
+ /* Removed use of void pointers for specific */
40
+ /* data structures. */
41
+ /* */
42
+ /* UDF redesign. */
43
+ /* */
44
+ /*************************************************************/
45
+
46
+ /* =========================================
47
+ *****************************************
48
+ EXTERNAL DEFINITIONS
49
+ =========================================
50
+ ***************************************** */
51
+
52
+ #include <stdlib.h>
53
+
54
+ #include "setup.h"
55
+
56
+ #if OBJECT_SYSTEM && (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE)
57
+
58
+ #include "bload.h"
59
+ #include "bsave.h"
60
+ #include "classcom.h"
61
+ #include "classfun.h"
62
+ #include "classini.h"
63
+ #include "cstrcbin.h"
64
+ #include "cstrnbin.h"
65
+ #include "envrnmnt.h"
66
+ #include "insfun.h"
67
+ #include "memalloc.h"
68
+ #include "modulbin.h"
69
+ #include "msgcom.h"
70
+ #include "msgfun.h"
71
+ #include "prntutil.h"
72
+ #include "router.h"
73
+
74
+ #if DEFRULE_CONSTRUCT
75
+ #include "objrtbin.h"
76
+ #endif
77
+
78
+ #include "objbin.h"
79
+
80
+ /* =========================================
81
+ *****************************************
82
+ MACROS AND TYPES
83
+ =========================================
84
+ ***************************************** */
85
+
86
+ #define SlotIndex(p) (((p) != NULL) ? (p)->bsaveIndex : ULONG_MAX)
87
+ #define SlotNameIndex(p) (p)->bsaveIndex
88
+
89
+ #define LinkPointer(i) (((i) == ULONG_MAX) ? NULL : (Defclass **) &ObjectBinaryData(theEnv)->LinkArray[i])
90
+ #define SlotPointer(i) (((i) == UINT_MAX) ? NULL : (SlotDescriptor *) &ObjectBinaryData(theEnv)->SlotArray[i])
91
+ #define TemplateSlotPointer(i) (((i) == ULONG_MAX) ? NULL : (SlotDescriptor **) &ObjectBinaryData(theEnv)->TmpslotArray[i])
92
+ #define OrderedSlotPointer(i) (((i) == ULONG_MAX) ? NULL : (unsigned *) &ObjectBinaryData(theEnv)->MapslotArray[i])
93
+ #define SlotNamePointer(i) ((SLOT_NAME *) &ObjectBinaryData(theEnv)->SlotNameArray[i])
94
+ #define HandlerPointer(i) (((i) == ULONG_MAX) ? NULL : &ObjectBinaryData(theEnv)->HandlerArray[i])
95
+ #define OrderedHandlerPointer(i) (((i) == ULONG_MAX) ? NULL : (unsigned *) &ObjectBinaryData(theEnv)->MaphandlerArray[i])
96
+
97
+ typedef struct bsaveDefclassModule
98
+ {
99
+ struct bsaveDefmoduleItemHeader header;
100
+ } BSAVE_DEFCLASS_MODULE;
101
+
102
+ typedef struct bsavePackedClassLinks
103
+ {
104
+ unsigned long classCount;
105
+ unsigned long classArray;
106
+ } BSAVE_PACKED_CLASS_LINKS;
107
+
108
+ typedef struct bsaveDefclass
109
+ {
110
+ struct bsaveConstructHeader header;
111
+ unsigned abstract : 1;
112
+ unsigned reactive : 1;
113
+ unsigned system : 1;
114
+ unsigned short id;
115
+ BSAVE_PACKED_CLASS_LINKS directSuperclasses;
116
+ BSAVE_PACKED_CLASS_LINKS directSubclasses;
117
+ BSAVE_PACKED_CLASS_LINKS allSuperclasses;
118
+ unsigned short slotCount;
119
+ unsigned short localInstanceSlotCount;
120
+ unsigned short instanceSlotCount;
121
+ unsigned short maxSlotNameID;
122
+ unsigned short handlerCount;
123
+ unsigned long slots;
124
+ unsigned long instanceTemplate;
125
+ unsigned long slotNameMap;
126
+ unsigned long handlers;
127
+ unsigned long scopeMap;
128
+ #if DEFRULE_CONSTRUCT
129
+ unsigned long relevant_terminal_alpha_nodes;
130
+ #endif
131
+ } BSAVE_DEFCLASS;
132
+
133
+ typedef struct bsaveSlotName
134
+ {
135
+ unsigned short id;
136
+ unsigned hashTableIndex;
137
+ unsigned long name;
138
+ unsigned long putHandlerName;
139
+ } BSAVE_SLOT_NAME;
140
+
141
+ typedef struct bsaveSlotDescriptor
142
+ {
143
+ unsigned shared : 1;
144
+ unsigned multiple : 1;
145
+ unsigned composite : 1;
146
+ unsigned noInherit : 1;
147
+ unsigned noWrite : 1;
148
+ unsigned initializeOnly : 1;
149
+ unsigned dynamicDefault : 1;
150
+ unsigned noDefault : 1;
151
+ unsigned reactive : 1;
152
+ unsigned publicVisibility : 1;
153
+ unsigned createReadAccessor : 1;
154
+ unsigned createWriteAccessor : 1;
155
+ unsigned long cls;
156
+ unsigned long slotName,
157
+ defaultValue,
158
+ constraint,
159
+ overrideMessage;
160
+ } BSAVE_SLOT_DESC;
161
+
162
+ typedef struct bsaveMessageHandler
163
+ {
164
+ struct bsaveConstructHeader header;
165
+ unsigned system : 1;
166
+ unsigned type : 2;
167
+ unsigned short minParams;
168
+ unsigned short maxParams;
169
+ unsigned short localVarCount;
170
+ unsigned long cls;
171
+ unsigned long actions;
172
+ } BSAVE_HANDLER;
173
+
174
+ typedef struct handlerBsaveInfo
175
+ {
176
+ DefmessageHandler *handlers;
177
+ unsigned *handlerOrderMap;
178
+ unsigned handlerCount;
179
+ } HANDLER_BSAVE_INFO;
180
+
181
+ /***************************************/
182
+ /* LOCAL INTERNAL FUNCTION DEFINITIONS */
183
+ /***************************************/
184
+
185
+ #if BLOAD_AND_BSAVE
186
+
187
+ static void BsaveObjectsFind(Environment *);
188
+ static void MarkDefclassItems(Environment *,ConstructHeader *,void *);
189
+ static void BsaveObjectsExpressions(Environment *,FILE *);
190
+ static void BsaveDefaultSlotExpressions(Environment *,ConstructHeader *,void *);
191
+ static void BsaveHandlerActionExpressions(Environment *,ConstructHeader *,void *);
192
+ static void BsaveStorageObjects(Environment *,FILE *);
193
+ static void BsaveObjects(Environment *,FILE *);
194
+ static void BsaveDefclass(Environment *,ConstructHeader *,void *);
195
+ static void BsaveClassLinks(Environment *,ConstructHeader *,void *);
196
+ static void BsaveSlots(Environment *,ConstructHeader *,void *);
197
+ static void BsaveTemplateSlots(Environment *,ConstructHeader *,void *);
198
+ static void BsaveSlotMap(Environment *,ConstructHeader *,void *);
199
+ static void BsaveHandlers(Environment *,ConstructHeader *,void *);
200
+ static void BsaveHandlerMap(Environment *,ConstructHeader *,void *);
201
+
202
+ #endif
203
+
204
+ static void BloadStorageObjects(Environment *);
205
+ static void BloadObjects(Environment *);
206
+ static void UpdatePrimitiveClassesMap(Environment *);
207
+ static void UpdateDefclassModule(Environment *,void *,unsigned long);
208
+ static void UpdateDefclass(Environment *,void *,unsigned long);
209
+ static void UpdateLink(Environment *,void *,unsigned long);
210
+ static void UpdateSlot(Environment *,void *,unsigned long);
211
+ static void UpdateSlotName(Environment *,void *,unsigned long);
212
+ static void UpdateTemplateSlot(Environment *,void *,unsigned long);
213
+ static void UpdateHandler(Environment *,void *,unsigned long);
214
+ static void ClearBloadObjects(Environment *);
215
+ static void DeallocateObjectBinaryData(Environment *);
216
+
217
+ /* =========================================
218
+ *****************************************
219
+ EXTERNALLY VISIBLE FUNCTIONS
220
+ =========================================
221
+ ***************************************** */
222
+
223
+ /***********************************************************
224
+ NAME : SetupObjectsBload
225
+ DESCRIPTION : Initializes data structures and
226
+ routines for binary loads of
227
+ generic function constructs
228
+ INPUTS : None
229
+ RETURNS : Nothing useful
230
+ SIDE EFFECTS : Routines defined and structures initialized
231
+ NOTES : None
232
+ ***********************************************************/
233
+ void SetupObjectsBload(
234
+ Environment *theEnv)
235
+ {
236
+ AllocateEnvironmentData(theEnv,OBJECTBIN_DATA,sizeof(struct objectBinaryData),DeallocateObjectBinaryData);
237
+
238
+ AddAbortBloadFunction(theEnv,"defclass",CreateSystemClasses,0,NULL);
239
+
240
+ #if BLOAD_AND_BSAVE
241
+ AddBinaryItem(theEnv,"defclass",0,BsaveObjectsFind,BsaveObjectsExpressions,
242
+ BsaveStorageObjects,BsaveObjects,
243
+ BloadStorageObjects,BloadObjects,
244
+ ClearBloadObjects);
245
+ #endif
246
+ #if BLOAD || BLOAD_ONLY
247
+ AddBinaryItem(theEnv,"defclass",0,NULL,NULL,NULL,NULL,
248
+ BloadStorageObjects,BloadObjects,
249
+ ClearBloadObjects);
250
+ #endif
251
+
252
+ }
253
+
254
+ /*******************************************************/
255
+ /* DeallocateObjectBinaryData: Deallocates environment */
256
+ /* data for object binary functionality. */
257
+ /*******************************************************/
258
+ static void DeallocateObjectBinaryData(
259
+ Environment *theEnv)
260
+ {
261
+ size_t space;
262
+ unsigned long i;
263
+
264
+ #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME)
265
+
266
+ space = (sizeof(DEFCLASS_MODULE) * ObjectBinaryData(theEnv)->ModuleCount);
267
+ if (space != 0) genfree(theEnv,ObjectBinaryData(theEnv)->ModuleArray,space);
268
+
269
+ if (ObjectBinaryData(theEnv)->ClassCount != 0)
270
+ {
271
+ if (DefclassData(theEnv)->ClassIDMap != NULL)
272
+ { rm(theEnv,DefclassData(theEnv)->ClassIDMap,(sizeof(Defclass *) * DefclassData(theEnv)->AvailClassID)); }
273
+
274
+ for (i = 0L ; i < ObjectBinaryData(theEnv)->SlotCount ; i++)
275
+ {
276
+ if ((ObjectBinaryData(theEnv)->SlotArray[i].defaultValue != NULL) && (ObjectBinaryData(theEnv)->SlotArray[i].dynamicDefault == 0))
277
+ {
278
+ UDFValue *theValue = (UDFValue *) ObjectBinaryData(theEnv)->SlotArray[i].defaultValue;
279
+ if (theValue->header->type == MULTIFIELD_TYPE)
280
+ { ReturnMultifield(theEnv,theValue->multifieldValue); }
281
+ rtn_struct(theEnv,udfValue,ObjectBinaryData(theEnv)->SlotArray[i].defaultValue);
282
+ }
283
+ }
284
+
285
+ space = (sizeof(Defclass) * ObjectBinaryData(theEnv)->ClassCount);
286
+ if (space != 0L)
287
+ { genfree(theEnv,ObjectBinaryData(theEnv)->DefclassArray,space); }
288
+
289
+ space = (sizeof(Defclass *) * ObjectBinaryData(theEnv)->LinkCount);
290
+ if (space != 0L)
291
+ { genfree(theEnv,ObjectBinaryData(theEnv)->LinkArray,space); }
292
+
293
+ space = (sizeof(SlotDescriptor) * ObjectBinaryData(theEnv)->SlotCount);
294
+ if (space != 0L)
295
+ { genfree(theEnv,ObjectBinaryData(theEnv)->SlotArray,space); }
296
+
297
+ space = (sizeof(SLOT_NAME) * ObjectBinaryData(theEnv)->SlotNameCount);
298
+ if (space != 0L)
299
+ { genfree(theEnv,ObjectBinaryData(theEnv)->SlotNameArray,space); }
300
+
301
+ space = (sizeof(SlotDescriptor *) * ObjectBinaryData(theEnv)->TemplateSlotCount);
302
+ if (space != 0L)
303
+ { genfree(theEnv,ObjectBinaryData(theEnv)->TmpslotArray,space); }
304
+
305
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->SlotNameMapCount);
306
+ if (space != 0L)
307
+ { genfree(theEnv,ObjectBinaryData(theEnv)->MapslotArray,space); }
308
+ }
309
+
310
+ if (ObjectBinaryData(theEnv)->HandlerCount != 0L)
311
+ {
312
+ space = (sizeof(DefmessageHandler) * ObjectBinaryData(theEnv)->HandlerCount);
313
+ if (space != 0L)
314
+ {
315
+ genfree(theEnv,ObjectBinaryData(theEnv)->HandlerArray,space);
316
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->HandlerCount);
317
+ genfree(theEnv,ObjectBinaryData(theEnv)->MaphandlerArray,space);
318
+ }
319
+ }
320
+ #endif
321
+ }
322
+
323
+ /***************************************************
324
+ NAME : BloadDefclassModuleReference
325
+ DESCRIPTION : Returns a pointer to the
326
+ appropriate defclass module
327
+ INPUTS : The index of the module
328
+ RETURNS : A pointer to the module
329
+ SIDE EFFECTS : None
330
+ NOTES : None
331
+ ***************************************************/
332
+ void *BloadDefclassModuleReference(
333
+ Environment *theEnv,
334
+ unsigned long theIndex)
335
+ {
336
+ return ((void *) &ObjectBinaryData(theEnv)->ModuleArray[theIndex]);
337
+ }
338
+
339
+ /* =========================================
340
+ *****************************************
341
+ INTERNALLY VISIBLE FUNCTIONS
342
+ =========================================
343
+ ***************************************** */
344
+
345
+ #if BLOAD_AND_BSAVE
346
+
347
+ /***************************************************************************
348
+ NAME : BsaveObjectsFind
349
+ DESCRIPTION : For all classes and their message-handlers, this routine
350
+ marks all the needed symbols and system functions.
351
+ Also, it also counts the number of expression structures
352
+ needed.
353
+ INPUTS : None
354
+ RETURNS : Nothing useful
355
+ SIDE EFFECTS : ExpressionCount (a global from BSAVE.C) is incremented
356
+ for every expression needed
357
+ Symbols are marked in their structures
358
+ NOTES : Also sets bsaveIndex for each class (assumes classes
359
+ will be bsaved in order of binary list)
360
+ ***************************************************************************/
361
+ static void BsaveObjectsFind(
362
+ Environment *theEnv)
363
+ {
364
+ unsigned i;
365
+ SLOT_NAME *snp;
366
+
367
+ /* ========================================================
368
+ The counts need to be saved in case a bload is in effect
369
+ ======================================================== */
370
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->ModuleCount);
371
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->ClassCount);
372
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->LinkCount);
373
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->SlotNameCount);
374
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->SlotCount);
375
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->TemplateSlotCount);
376
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->SlotNameMapCount);
377
+ SaveBloadCount(theEnv,ObjectBinaryData(theEnv)->HandlerCount);
378
+
379
+ ObjectBinaryData(theEnv)->ModuleCount= 0L;
380
+ ObjectBinaryData(theEnv)->ClassCount = 0L;
381
+ ObjectBinaryData(theEnv)->SlotCount = 0L;
382
+ ObjectBinaryData(theEnv)->SlotNameCount = 0L;
383
+ ObjectBinaryData(theEnv)->LinkCount = 0L;
384
+ ObjectBinaryData(theEnv)->TemplateSlotCount = 0L;
385
+ ObjectBinaryData(theEnv)->SlotNameMapCount = 0L;
386
+ ObjectBinaryData(theEnv)->HandlerCount = 0L;
387
+
388
+ /* ==============================================
389
+ Mark items needed by defclasses in all modules
390
+ ============================================== */
391
+
392
+ ObjectBinaryData(theEnv)->ModuleCount = GetNumberOfDefmodules(theEnv);
393
+
394
+ DoForAllConstructs(theEnv,MarkDefclassItems,
395
+ DefclassData(theEnv)->DefclassModuleIndex,
396
+ false,NULL);
397
+
398
+ /* =============================================
399
+ Mark items needed by canonicalized slot names
400
+ ============================================= */
401
+ for (i = 0 ; i < SLOT_NAME_TABLE_HASH_SIZE ; i++)
402
+ for (snp = DefclassData(theEnv)->SlotNameTable[i] ; snp != NULL ; snp = snp->nxt)
403
+ {
404
+ if ((snp->id != ISA_ID) && (snp->id != NAME_ID))
405
+ {
406
+ snp->bsaveIndex = ObjectBinaryData(theEnv)->SlotNameCount++;
407
+ snp->name->neededSymbol = true;
408
+ snp->putHandlerName->neededSymbol = true;
409
+ }
410
+ }
411
+ }
412
+
413
+ /***************************************************
414
+ NAME : MarkDefclassItems
415
+ DESCRIPTION : Marks needed items for a defclass
416
+ INPUTS : 1) The defclass
417
+ 2) User buffer (ignored)
418
+ RETURNS : Nothing useful
419
+ SIDE EFFECTS : Bsave indices set and needed
420
+ ephemerals marked
421
+ NOTES : None
422
+ ***************************************************/
423
+ static void MarkDefclassItems(
424
+ Environment *theEnv,
425
+ ConstructHeader *theDefclass,
426
+ void *buf)
427
+ {
428
+ #if MAC_XCD
429
+ #pragma unused(buf)
430
+ #endif
431
+ Defclass *cls = (Defclass *) theDefclass;
432
+ long i;
433
+ Expression *tmpexp;
434
+
435
+ MarkConstructHeaderNeededItems(&cls->header,ObjectBinaryData(theEnv)->ClassCount++);
436
+ ObjectBinaryData(theEnv)->LinkCount += cls->directSuperclasses.classCount +
437
+ cls->directSubclasses.classCount +
438
+ cls->allSuperclasses.classCount;
439
+
440
+ #if DEFMODULE_CONSTRUCT
441
+ cls->scopeMap->neededBitMap = true;
442
+ #endif
443
+
444
+ /* ===================================================
445
+ Mark items needed by slot default value expressions
446
+ =================================================== */
447
+ for (i = 0 ; i < cls->slotCount ; i++)
448
+ {
449
+ cls->slots[i].bsaveIndex = ObjectBinaryData(theEnv)->SlotCount++;
450
+ cls->slots[i].overrideMessage->neededSymbol = true;
451
+ if (cls->slots[i].defaultValue != NULL)
452
+ {
453
+ if (cls->slots[i].dynamicDefault)
454
+ {
455
+ ExpressionData(theEnv)->ExpressionCount +=
456
+ ExpressionSize((Expression *) cls->slots[i].defaultValue);
457
+ MarkNeededItems(theEnv,(Expression *) cls->slots[i].defaultValue);
458
+ }
459
+ else
460
+ {
461
+ /* =================================================
462
+ Static default values are stotred as data objects
463
+ and must be converted into expressions
464
+ ================================================= */
465
+ tmpexp =
466
+ ConvertValueToExpression(theEnv,(UDFValue *) cls->slots[i].defaultValue);
467
+ ExpressionData(theEnv)->ExpressionCount += ExpressionSize(tmpexp);
468
+ MarkNeededItems(theEnv,tmpexp);
469
+ ReturnExpression(theEnv,tmpexp);
470
+ }
471
+ }
472
+ }
473
+
474
+ /* ========================================
475
+ Count canonical slots needed by defclass
476
+ ======================================== */
477
+ ObjectBinaryData(theEnv)->TemplateSlotCount += cls->instanceSlotCount;
478
+ if (cls->instanceSlotCount != 0)
479
+ ObjectBinaryData(theEnv)->SlotNameMapCount += cls->maxSlotNameID + 1;
480
+
481
+ /* ===============================================
482
+ Mark items needed by defmessage-handler actions
483
+ =============================================== */
484
+ for (i = 0 ; i < cls->handlerCount ; i++)
485
+ {
486
+ cls->handlers[i].header.name->neededSymbol = true;
487
+ ExpressionData(theEnv)->ExpressionCount += ExpressionSize(cls->handlers[i].actions);
488
+ MarkNeededItems(theEnv,cls->handlers[i].actions);
489
+ }
490
+ ObjectBinaryData(theEnv)->HandlerCount += cls->handlerCount;
491
+ }
492
+
493
+ /***************************************************
494
+ NAME : BsaveObjectsExpressions
495
+ DESCRIPTION : Writes out all expressions needed
496
+ by classes and handlers
497
+ INPUTS : The file pointer of the binary file
498
+ RETURNS : Nothing useful
499
+ SIDE EFFECTS : File updated
500
+ NOTES : None
501
+ ***************************************************/
502
+ static void BsaveObjectsExpressions(
503
+ Environment *theEnv,
504
+ FILE *fp)
505
+ {
506
+ if ((ObjectBinaryData(theEnv)->ClassCount == 0L) && (ObjectBinaryData(theEnv)->HandlerCount == 0L))
507
+ return;
508
+
509
+ /* ================================================
510
+ Save the defclass slot default value expressions
511
+ ================================================ */
512
+ DoForAllConstructs(theEnv,BsaveDefaultSlotExpressions,DefclassData(theEnv)->DefclassModuleIndex,
513
+ false,fp);
514
+
515
+ /* ==============================================
516
+ Save the defmessage-handler action expressions
517
+ ============================================== */
518
+ DoForAllConstructs(theEnv,BsaveHandlerActionExpressions,DefclassData(theEnv)->DefclassModuleIndex,
519
+ false,fp);
520
+ }
521
+
522
+ /***************************************************
523
+ NAME : BsaveDefaultSlotExpressions
524
+ DESCRIPTION : Writes expressions for default
525
+ slot values to binary file
526
+ INPUTS : 1) The defclass
527
+ 2) The binary file pointer
528
+ RETURNS : Nothing useful
529
+ SIDE EFFECTS : Slot value expressions written
530
+ NOTES : None
531
+ ***************************************************/
532
+ static void BsaveDefaultSlotExpressions(
533
+ Environment *theEnv,
534
+ ConstructHeader *theDefclass,
535
+ void *buf)
536
+ {
537
+ Defclass *cls = (Defclass *) theDefclass;
538
+ long i;
539
+ Expression *tmpexp;
540
+
541
+ for (i = 0 ; i < cls->slotCount ; i++)
542
+ {
543
+ if (cls->slots[i].defaultValue != NULL)
544
+ {
545
+ if (cls->slots[i].dynamicDefault)
546
+ BsaveExpression(theEnv,(Expression *) cls->slots[i].defaultValue,(FILE *) buf);
547
+ else
548
+ {
549
+ /* =================================================
550
+ Static default values are stotred as data objects
551
+ and must be converted into expressions
552
+ ================================================= */
553
+ tmpexp =
554
+ ConvertValueToExpression(theEnv,(UDFValue *) cls->slots[i].defaultValue);
555
+ BsaveExpression(theEnv,tmpexp,(FILE *) buf);
556
+ ReturnExpression(theEnv,tmpexp);
557
+ }
558
+ }
559
+ }
560
+ }
561
+
562
+ /***************************************************
563
+ NAME : BsaveHandlerActionExpressions
564
+ DESCRIPTION : Writes expressions for handler
565
+ actions to binary file
566
+ INPUTS : 1) The defclass
567
+ 2) The binary file pointer
568
+ RETURNS : Nothing useful
569
+ SIDE EFFECTS : Handler actions expressions written
570
+ NOTES : None
571
+ ***************************************************/
572
+ static void BsaveHandlerActionExpressions(
573
+ Environment *theEnv,
574
+ ConstructHeader *theDefclass,
575
+ void *buf)
576
+ {
577
+ Defclass *cls = (Defclass *) theDefclass;
578
+ long i;
579
+
580
+ for (i = 0 ; i < cls->handlerCount ; i++)
581
+ BsaveExpression(theEnv,cls->handlers[i].actions,(FILE *) buf);
582
+ }
583
+
584
+ /*************************************************************************************
585
+ NAME : BsaveStorageObjects
586
+ DESCRIPTION : Writes out number of each type of structure required for COOL
587
+ Space required for counts (unsigned long)
588
+ Number of class modules (long)
589
+ Number of classes (long)
590
+ Number of links to classes (long)
591
+ Number of slots (long)
592
+ Number of instance template slots (long)
593
+ Number of handlers (long)
594
+ Number of definstances (long)
595
+ INPUTS : File pointer of binary file
596
+ RETURNS : Nothing useful
597
+ SIDE EFFECTS : Binary file adjusted
598
+ NOTES : None
599
+ *************************************************************************************/
600
+ static void BsaveStorageObjects(
601
+ Environment *theEnv,
602
+ FILE *fp)
603
+ {
604
+ size_t space;
605
+ long maxClassID;// TBD unsigned short
606
+
607
+ if ((ObjectBinaryData(theEnv)->ClassCount == 0L) && (ObjectBinaryData(theEnv)->HandlerCount == 0L))
608
+ {
609
+ space = 0L;
610
+ GenWrite(&space,sizeof(size_t),fp);
611
+ return;
612
+ }
613
+ space = sizeof(long) * 9;
614
+ GenWrite(&space,sizeof(size_t),fp); // 64-bit issue changed long to size_t
615
+ GenWrite(&ObjectBinaryData(theEnv)->ModuleCount,sizeof(long),fp);
616
+ GenWrite(&ObjectBinaryData(theEnv)->ClassCount,sizeof(long),fp);
617
+ GenWrite(&ObjectBinaryData(theEnv)->LinkCount,sizeof(long),fp);
618
+ GenWrite(&ObjectBinaryData(theEnv)->SlotNameCount,sizeof(long),fp);
619
+ GenWrite(&ObjectBinaryData(theEnv)->SlotCount,sizeof(long),fp);
620
+ GenWrite(&ObjectBinaryData(theEnv)->TemplateSlotCount,sizeof(long),fp);
621
+ GenWrite(&ObjectBinaryData(theEnv)->SlotNameMapCount,sizeof(long),fp);
622
+ GenWrite(&ObjectBinaryData(theEnv)->HandlerCount,sizeof(long),fp);
623
+ maxClassID = DefclassData(theEnv)->MaxClassID;
624
+ GenWrite(&maxClassID,sizeof(long),fp);
625
+ }
626
+
627
+ /*************************************************************************************
628
+ NAME : BsaveObjects
629
+ DESCRIPTION : Writes out classes and message-handlers in binary format
630
+ Space required (unsigned long)
631
+ Followed by the data structures in order
632
+ INPUTS : File pointer of binary file
633
+ RETURNS : Nothing useful
634
+ SIDE EFFECTS : Binary file adjusted
635
+ NOTES : None
636
+ *************************************************************************************/
637
+ static void BsaveObjects(
638
+ Environment *theEnv,
639
+ FILE *fp)
640
+ {
641
+ size_t space;
642
+ Defmodule *theModule;
643
+ DEFCLASS_MODULE *theModuleItem;
644
+ BSAVE_DEFCLASS_MODULE dummy_mitem;
645
+ BSAVE_SLOT_NAME dummy_slot_name;
646
+ SLOT_NAME *snp;
647
+ unsigned i;
648
+
649
+ if ((ObjectBinaryData(theEnv)->ClassCount == 0L) && (ObjectBinaryData(theEnv)->HandlerCount == 0L))
650
+ {
651
+ space = 0L;
652
+ GenWrite(&space,sizeof(size_t),fp);
653
+ return;
654
+ }
655
+ space = (ObjectBinaryData(theEnv)->ModuleCount * sizeof(BSAVE_DEFCLASS_MODULE)) +
656
+ (ObjectBinaryData(theEnv)->ClassCount * sizeof(BSAVE_DEFCLASS)) +
657
+ (ObjectBinaryData(theEnv)->LinkCount * sizeof(long)) +
658
+ (ObjectBinaryData(theEnv)->SlotCount * sizeof(BSAVE_SLOT_DESC)) +
659
+ (ObjectBinaryData(theEnv)->SlotNameCount * sizeof(BSAVE_SLOT_NAME)) +
660
+ (ObjectBinaryData(theEnv)->TemplateSlotCount * sizeof(long)) +
661
+ (ObjectBinaryData(theEnv)->SlotNameMapCount * sizeof(unsigned)) +
662
+ (ObjectBinaryData(theEnv)->HandlerCount * sizeof(BSAVE_HANDLER)) +
663
+ (ObjectBinaryData(theEnv)->HandlerCount * sizeof(unsigned));
664
+ GenWrite(&space,sizeof(size_t),fp);
665
+
666
+ ObjectBinaryData(theEnv)->ClassCount = 0L;
667
+ ObjectBinaryData(theEnv)->LinkCount = 0L;
668
+ ObjectBinaryData(theEnv)->SlotCount = 0L;
669
+ ObjectBinaryData(theEnv)->SlotNameCount = 0L;
670
+ ObjectBinaryData(theEnv)->TemplateSlotCount = 0L;
671
+ ObjectBinaryData(theEnv)->SlotNameMapCount = 0L;
672
+ ObjectBinaryData(theEnv)->HandlerCount = 0L;
673
+
674
+ /* =================================
675
+ Write out each defclass module
676
+ ================================= */
677
+ theModule = GetNextDefmodule(theEnv,NULL);
678
+ while (theModule != NULL)
679
+ {
680
+ theModuleItem = (DEFCLASS_MODULE *)
681
+ GetModuleItem(theEnv,theModule,FindModuleItem(theEnv,"defclass")->moduleIndex);
682
+ AssignBsaveDefmdlItemHdrVals(&dummy_mitem.header,&theModuleItem->header);
683
+ GenWrite(&dummy_mitem,sizeof(BSAVE_DEFCLASS_MODULE),fp);
684
+ theModule = GetNextDefmodule(theEnv,theModule);
685
+ }
686
+
687
+ /* =====================
688
+ Write out the classes
689
+ ===================== */
690
+ DoForAllConstructs(theEnv,BsaveDefclass,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
691
+
692
+ /* =========================
693
+ Write out the class links
694
+ ========================= */
695
+ ObjectBinaryData(theEnv)->LinkCount = 0L;
696
+ DoForAllConstructs(theEnv,BsaveClassLinks,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
697
+
698
+ /* ===============================
699
+ Write out the slot name entries
700
+ =============================== */
701
+ for (i = 0 ; i < SLOT_NAME_TABLE_HASH_SIZE ; i++)
702
+ for (snp = DefclassData(theEnv)->SlotNameTable[i] ; snp != NULL ; snp = snp->nxt)
703
+ {
704
+ if ((snp->id != ISA_ID) && (snp->id != NAME_ID))
705
+ {
706
+ dummy_slot_name.id = snp->id;
707
+ dummy_slot_name.hashTableIndex = snp->hashTableIndex;
708
+ dummy_slot_name.name = snp->name->bucket;
709
+ dummy_slot_name.putHandlerName = snp->putHandlerName->bucket;
710
+ GenWrite(&dummy_slot_name,sizeof(BSAVE_SLOT_NAME),fp);
711
+ }
712
+ }
713
+
714
+ /* ===================
715
+ Write out the slots
716
+ =================== */
717
+ DoForAllConstructs(theEnv,BsaveSlots,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
718
+
719
+ /* =====================================
720
+ Write out the template instance slots
721
+ ===================================== */
722
+ DoForAllConstructs(theEnv,BsaveTemplateSlots,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
723
+
724
+ /* =============================================
725
+ Write out the ordered instance slot name maps
726
+ ============================================= */
727
+ DoForAllConstructs(theEnv,BsaveSlotMap,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
728
+
729
+ /* ==============================
730
+ Write out the message-handlers
731
+ ============================== */
732
+ DoForAllConstructs(theEnv,BsaveHandlers,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
733
+
734
+ /* ==========================================
735
+ Write out the ordered message-handler maps
736
+ ========================================== */
737
+ DoForAllConstructs(theEnv,BsaveHandlerMap,DefclassData(theEnv)->DefclassModuleIndex,false,fp);
738
+
739
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->ModuleCount);
740
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->ClassCount);
741
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->LinkCount);
742
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->SlotCount);
743
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->SlotNameCount);
744
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->TemplateSlotCount);
745
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->SlotNameMapCount);
746
+ RestoreBloadCount(theEnv,&ObjectBinaryData(theEnv)->HandlerCount);
747
+ }
748
+
749
+ /***************************************************
750
+ NAME : BsaveDefclass
751
+ DESCRIPTION : Writes defclass binary data
752
+ INPUTS : 1) The defclass
753
+ 2) The binary file pointer
754
+ RETURNS : Nothing useful
755
+ SIDE EFFECTS : Defclass binary data written
756
+ NOTES : None
757
+ ***************************************************/
758
+ static void BsaveDefclass(
759
+ Environment *theEnv,
760
+ ConstructHeader *theDefclass,
761
+ void *buf)
762
+ {
763
+ Defclass *cls = (Defclass *) theDefclass;
764
+ BSAVE_DEFCLASS dummy_class;
765
+
766
+ AssignBsaveConstructHeaderVals(&dummy_class.header,&cls->header);
767
+ dummy_class.abstract = cls->abstract;
768
+ dummy_class.reactive = cls->reactive;
769
+ dummy_class.system = cls->system;
770
+ dummy_class.id = cls->id;
771
+ dummy_class.slotCount = cls->slotCount;
772
+ dummy_class.instanceSlotCount = cls->instanceSlotCount;
773
+ dummy_class.localInstanceSlotCount = cls->localInstanceSlotCount;
774
+ dummy_class.maxSlotNameID = cls->maxSlotNameID;
775
+ dummy_class.handlerCount = cls->handlerCount;
776
+ dummy_class.directSuperclasses.classCount = cls->directSuperclasses.classCount;
777
+ dummy_class.directSubclasses.classCount = cls->directSubclasses.classCount;
778
+ dummy_class.allSuperclasses.classCount = cls->allSuperclasses.classCount;
779
+ if (cls->directSuperclasses.classCount != 0)
780
+ {
781
+ dummy_class.directSuperclasses.classArray = ObjectBinaryData(theEnv)->LinkCount;
782
+ ObjectBinaryData(theEnv)->LinkCount += cls->directSuperclasses.classCount;
783
+ }
784
+ else
785
+ dummy_class.directSuperclasses.classArray = ULONG_MAX;
786
+ if (cls->directSubclasses.classCount != 0)
787
+ {
788
+ dummy_class.directSubclasses.classArray = ObjectBinaryData(theEnv)->LinkCount;
789
+ ObjectBinaryData(theEnv)->LinkCount += cls->directSubclasses.classCount;
790
+ }
791
+ else
792
+ dummy_class.directSubclasses.classArray = ULONG_MAX;
793
+ if (cls->allSuperclasses.classCount != 0)
794
+ {
795
+ dummy_class.allSuperclasses.classArray = ObjectBinaryData(theEnv)->LinkCount;
796
+ ObjectBinaryData(theEnv)->LinkCount += cls->allSuperclasses.classCount;
797
+ }
798
+ else
799
+ dummy_class.allSuperclasses.classArray = ULONG_MAX;
800
+ if (cls->slots != NULL)
801
+ {
802
+ dummy_class.slots = ObjectBinaryData(theEnv)->SlotCount;
803
+ ObjectBinaryData(theEnv)->SlotCount += cls->slotCount;
804
+ }
805
+ else
806
+ dummy_class.slots = ULONG_MAX;
807
+ if (cls->instanceTemplate != NULL)
808
+ {
809
+ dummy_class.instanceTemplate = ObjectBinaryData(theEnv)->TemplateSlotCount;
810
+ ObjectBinaryData(theEnv)->TemplateSlotCount += cls->instanceSlotCount;
811
+ dummy_class.slotNameMap = ObjectBinaryData(theEnv)->SlotNameMapCount;
812
+ ObjectBinaryData(theEnv)->SlotNameMapCount += cls->maxSlotNameID + 1;
813
+ }
814
+ else
815
+ {
816
+ dummy_class.instanceTemplate = ULONG_MAX;
817
+ dummy_class.slotNameMap = ULONG_MAX;
818
+ }
819
+ if (cls->handlers != NULL)
820
+ {
821
+ dummy_class.handlers = ObjectBinaryData(theEnv)->HandlerCount;
822
+ ObjectBinaryData(theEnv)->HandlerCount += cls->handlerCount;
823
+ }
824
+ else
825
+ dummy_class.handlers = ULONG_MAX;
826
+
827
+ #if DEFMODULE_CONSTRUCT
828
+ dummy_class.scopeMap = cls->scopeMap->bucket;
829
+ #else
830
+ dummy_class.scopeMap = ULONG_MAX;
831
+ #endif
832
+
833
+ #if DEFRULE_CONSTRUCT
834
+ if (cls->relevant_terminal_alpha_nodes != NULL)
835
+ { dummy_class.relevant_terminal_alpha_nodes = cls->relevant_terminal_alpha_nodes->bsaveID; }
836
+ else
837
+ { dummy_class.relevant_terminal_alpha_nodes = ULONG_MAX; }
838
+ #endif
839
+
840
+ GenWrite(&dummy_class,sizeof(BSAVE_DEFCLASS),(FILE *) buf);
841
+ }
842
+
843
+ /***************************************************
844
+ NAME : BsaveClassLinks
845
+ DESCRIPTION : Writes class links binary data
846
+ INPUTS : 1) The defclass
847
+ 2) The binary file pointer
848
+ RETURNS : Nothing useful
849
+ SIDE EFFECTS : Defclass links binary data written
850
+ NOTES : None
851
+ ***************************************************/
852
+ static void BsaveClassLinks(
853
+ Environment *theEnv,
854
+ ConstructHeader *theDefclass,
855
+ void *buf)
856
+ {
857
+ Defclass *cls = (Defclass *) theDefclass;
858
+ unsigned long i;
859
+ unsigned long dummy_class_index;
860
+ for (i = 0 ; i < cls->directSuperclasses.classCount ; i++)
861
+ {
862
+ dummy_class_index = DefclassIndex(cls->directSuperclasses.classArray[i]);
863
+ GenWrite(&dummy_class_index,sizeof(long),(FILE *) buf);
864
+ }
865
+ ObjectBinaryData(theEnv)->LinkCount += cls->directSuperclasses.classCount;
866
+ for (i = 0 ; i < cls->directSubclasses.classCount ; i++)
867
+ {
868
+ dummy_class_index = DefclassIndex(cls->directSubclasses.classArray[i]);
869
+ GenWrite(&dummy_class_index,sizeof(long),(FILE *) buf);
870
+ }
871
+ ObjectBinaryData(theEnv)->LinkCount += cls->directSubclasses.classCount;
872
+ for (i = 0 ; i < cls->allSuperclasses.classCount ; i++)
873
+ {
874
+ dummy_class_index = DefclassIndex(cls->allSuperclasses.classArray[i]);
875
+ GenWrite(&dummy_class_index,sizeof(long),(FILE *) buf);
876
+ }
877
+ ObjectBinaryData(theEnv)->LinkCount += cls->allSuperclasses.classCount;
878
+ }
879
+
880
+ /***************************************************
881
+ NAME : BsaveSlots
882
+ DESCRIPTION : Writes class slots binary data
883
+ INPUTS : 1) The defclass
884
+ 2) The binary file pointer
885
+ RETURNS : Nothing useful
886
+ SIDE EFFECTS : Defclass slots binary data written
887
+ NOTES : None
888
+ ***************************************************/
889
+ static void BsaveSlots(
890
+ Environment *theEnv,
891
+ ConstructHeader *theDefclass,
892
+ void *buf)
893
+ {
894
+ Defclass *cls = (Defclass *) theDefclass;
895
+ long i;
896
+ BSAVE_SLOT_DESC dummy_slot;
897
+ SlotDescriptor *sp;
898
+ Expression *tmpexp;
899
+
900
+ for (i = 0 ; i < cls->slotCount ; i++)
901
+ {
902
+ sp = &cls->slots[i];
903
+ dummy_slot.dynamicDefault = sp->dynamicDefault;
904
+ dummy_slot.noDefault = sp->noDefault;
905
+ dummy_slot.shared = sp->shared;
906
+ dummy_slot.multiple = sp->multiple;
907
+ dummy_slot.composite = sp->composite;
908
+ dummy_slot.noInherit = sp->noInherit;
909
+ dummy_slot.noWrite = sp->noWrite;
910
+ dummy_slot.initializeOnly = sp->initializeOnly;
911
+ dummy_slot.reactive = sp->reactive;
912
+ dummy_slot.publicVisibility = sp->publicVisibility;
913
+ dummy_slot.createReadAccessor = sp->createReadAccessor;
914
+ dummy_slot.createWriteAccessor = sp->createWriteAccessor;
915
+ dummy_slot.cls = DefclassIndex(sp->cls);
916
+ dummy_slot.slotName = SlotNameIndex(sp->slotName);
917
+ dummy_slot.overrideMessage = sp->overrideMessage->bucket;
918
+ if (sp->defaultValue != NULL)
919
+ {
920
+ dummy_slot.defaultValue = ExpressionData(theEnv)->ExpressionCount;
921
+ if (sp->dynamicDefault)
922
+ ExpressionData(theEnv)->ExpressionCount += ExpressionSize((Expression *) sp->defaultValue);
923
+ else
924
+ {
925
+ tmpexp = ConvertValueToExpression(theEnv,(UDFValue *) sp->defaultValue);
926
+ ExpressionData(theEnv)->ExpressionCount += ExpressionSize(tmpexp);
927
+ ReturnExpression(theEnv,tmpexp);
928
+ }
929
+ }
930
+ else
931
+ dummy_slot.defaultValue = ULONG_MAX;
932
+ dummy_slot.constraint = ConstraintIndex(sp->constraint);
933
+ GenWrite(&dummy_slot,sizeof(BSAVE_SLOT_DESC),(FILE *) buf);
934
+ }
935
+ }
936
+
937
+ /**************************************************************
938
+ NAME : BsaveTemplateSlots
939
+ DESCRIPTION : Writes class instance template binary data
940
+ INPUTS : 1) The defclass
941
+ 2) The binary file pointer
942
+ RETURNS : Nothing useful
943
+ SIDE EFFECTS : Defclass instance template binary data written
944
+ NOTES : None
945
+ **************************************************************/
946
+ static void BsaveTemplateSlots(
947
+ Environment *theEnv,
948
+ ConstructHeader *theDefclass,
949
+ void *buf)
950
+ {
951
+ Defclass *cls = (Defclass *) theDefclass;
952
+ unsigned long i;
953
+ unsigned long tsp;
954
+ #if MAC_XCD
955
+ #pragma unused(theEnv)
956
+ #endif
957
+
958
+ for (i = 0 ; i < cls->instanceSlotCount ; i++)
959
+ {
960
+ tsp = SlotIndex(cls->instanceTemplate[i]);
961
+ GenWrite(&tsp,sizeof(unsigned long),(FILE *) buf);
962
+ }
963
+ }
964
+
965
+ /***************************************************************
966
+ NAME : BsaveSlotMap
967
+ DESCRIPTION : Writes class canonical slot map binary data
968
+ INPUTS : 1) The defclass
969
+ 2) The binary file pointer
970
+ RETURNS : Nothing useful
971
+ SIDE EFFECTS : Defclass canonical slot map binary data written
972
+ NOTES : None
973
+ ***************************************************************/
974
+ static void BsaveSlotMap(
975
+ Environment *theEnv,
976
+ ConstructHeader *theDefclass,
977
+ void *buf)
978
+ {
979
+ Defclass *cls = (Defclass *) theDefclass;
980
+ #if MAC_XCD
981
+ #pragma unused(theEnv)
982
+ #endif
983
+
984
+ if (cls->instanceSlotCount != 0)
985
+ GenWrite(cls->slotNameMap,
986
+ (sizeof(unsigned) * (cls->maxSlotNameID + 1)),(FILE *) buf);
987
+ }
988
+
989
+ /************************************************************
990
+ NAME : BsaveHandlers
991
+ DESCRIPTION : Writes class message-handlers binary data
992
+ INPUTS : 1) The defclass
993
+ 2) The binary file pointer
994
+ RETURNS : Nothing useful
995
+ SIDE EFFECTS : Defclass message-handler binary data written
996
+ NOTES : None
997
+ ************************************************************/
998
+ static void BsaveHandlers(
999
+ Environment *theEnv,
1000
+ ConstructHeader *theDefclass,
1001
+ void *buf)
1002
+ {
1003
+ Defclass *cls = (Defclass *) theDefclass;
1004
+ unsigned long i;
1005
+ BSAVE_HANDLER dummy_handler;
1006
+ DefmessageHandler *hnd;
1007
+
1008
+ for (i = 0 ; i < cls->handlerCount ; i++)
1009
+ {
1010
+ hnd = &cls->handlers[i];
1011
+
1012
+ AssignBsaveConstructHeaderVals(&dummy_handler.header,&hnd->header);
1013
+
1014
+ dummy_handler.system = hnd->system;
1015
+ dummy_handler.type = hnd->type;
1016
+ dummy_handler.minParams = hnd->minParams;
1017
+ dummy_handler.maxParams = hnd->maxParams;
1018
+ dummy_handler.localVarCount = hnd->localVarCount;
1019
+ dummy_handler.cls = DefclassIndex(hnd->cls);
1020
+ if (hnd->actions != NULL)
1021
+ {
1022
+ dummy_handler.actions = ExpressionData(theEnv)->ExpressionCount;
1023
+ ExpressionData(theEnv)->ExpressionCount += ExpressionSize(hnd->actions);
1024
+ }
1025
+ else
1026
+ dummy_handler.actions = ULONG_MAX;
1027
+ GenWrite(&dummy_handler,sizeof(BSAVE_HANDLER),(FILE *) buf);
1028
+ }
1029
+ }
1030
+
1031
+ /****************************************************************
1032
+ NAME : BsaveHandlerMap
1033
+ DESCRIPTION : Writes class message-handler map binary data
1034
+ INPUTS : 1) The defclass
1035
+ 2) The binary file pointer
1036
+ RETURNS : Nothing useful
1037
+ SIDE EFFECTS : Defclass message-handler map binary data written
1038
+ NOTES : None
1039
+ ****************************************************************/
1040
+ static void BsaveHandlerMap(
1041
+ Environment *theEnv,
1042
+ ConstructHeader *theDefclass,
1043
+ void *buf)
1044
+ {
1045
+ Defclass *cls = (Defclass *) theDefclass;
1046
+ #if MAC_XCD
1047
+ #pragma unused(theEnv)
1048
+ #endif
1049
+
1050
+ GenWrite(cls->handlerOrderMap,
1051
+ (sizeof(unsigned) * cls->handlerCount),(FILE *) buf);
1052
+ }
1053
+
1054
+ #endif
1055
+
1056
+ /***********************************************************************
1057
+ NAME : BloadStorageObjects
1058
+ DESCRIPTION : This routine reads class and handler information from
1059
+ a binary file in five chunks:
1060
+ Class count
1061
+ Handler count
1062
+ Class array
1063
+ Handler array
1064
+ INPUTS : Notthing
1065
+ RETURNS : Nothing useful
1066
+ SIDE EFFECTS : Arrays allocated and set
1067
+ NOTES : This routine makes no attempt to reset any pointers
1068
+ within the structures
1069
+ Bload fails if there are still classes in the system!!
1070
+ ***********************************************************************/
1071
+ static void BloadStorageObjects(
1072
+ Environment *theEnv)
1073
+ {
1074
+ size_t space;
1075
+ unsigned long counts[9];
1076
+
1077
+ if ((DefclassData(theEnv)->ClassIDMap != NULL) || (DefclassData(theEnv)->MaxClassID != 0))
1078
+ {
1079
+ SystemError(theEnv,"OBJBIN",1);
1080
+ ExitRouter(theEnv,EXIT_FAILURE);
1081
+ }
1082
+ GenReadBinary(theEnv,&space,sizeof(size_t));
1083
+ if (space == 0L)
1084
+ {
1085
+ ObjectBinaryData(theEnv)->ClassCount = ObjectBinaryData(theEnv)->HandlerCount = 0L;
1086
+ return;
1087
+ }
1088
+ GenReadBinary(theEnv,counts,space);
1089
+ ObjectBinaryData(theEnv)->ModuleCount = counts[0];
1090
+ ObjectBinaryData(theEnv)->ClassCount = counts[1];
1091
+ ObjectBinaryData(theEnv)->LinkCount = counts[2];
1092
+ ObjectBinaryData(theEnv)->SlotNameCount = counts[3];
1093
+ ObjectBinaryData(theEnv)->SlotCount = counts[4];
1094
+ ObjectBinaryData(theEnv)->TemplateSlotCount = counts[5];
1095
+ ObjectBinaryData(theEnv)->SlotNameMapCount = counts[6];
1096
+ ObjectBinaryData(theEnv)->HandlerCount = counts[7];
1097
+ DefclassData(theEnv)->MaxClassID = (unsigned short) counts[8];
1098
+ DefclassData(theEnv)->AvailClassID = (unsigned short) counts[8];
1099
+ if (ObjectBinaryData(theEnv)->ModuleCount != 0L)
1100
+ {
1101
+ space = (sizeof(DEFCLASS_MODULE) * ObjectBinaryData(theEnv)->ModuleCount);
1102
+ ObjectBinaryData(theEnv)->ModuleArray = (DEFCLASS_MODULE *) genalloc(theEnv,space);
1103
+ }
1104
+ if (ObjectBinaryData(theEnv)->ClassCount != 0L)
1105
+ {
1106
+ space = (sizeof(Defclass) * ObjectBinaryData(theEnv)->ClassCount);
1107
+ ObjectBinaryData(theEnv)->DefclassArray = (Defclass *) genalloc(theEnv,space);
1108
+ DefclassData(theEnv)->ClassIDMap = (Defclass **) gm2(theEnv,(sizeof(Defclass *) * DefclassData(theEnv)->MaxClassID));
1109
+ }
1110
+ if (ObjectBinaryData(theEnv)->LinkCount != 0L)
1111
+ {
1112
+ space = (sizeof(Defclass *) * ObjectBinaryData(theEnv)->LinkCount);
1113
+ ObjectBinaryData(theEnv)->LinkArray = (Defclass **) genalloc(theEnv,space);
1114
+ }
1115
+ if (ObjectBinaryData(theEnv)->SlotCount != 0L)
1116
+ {
1117
+ space = (sizeof(SlotDescriptor) * ObjectBinaryData(theEnv)->SlotCount);
1118
+ ObjectBinaryData(theEnv)->SlotArray = (SlotDescriptor *) genalloc(theEnv,space);
1119
+ }
1120
+ if (ObjectBinaryData(theEnv)->SlotNameCount != 0L)
1121
+ {
1122
+ space = (sizeof(SLOT_NAME) * ObjectBinaryData(theEnv)->SlotNameCount);
1123
+ ObjectBinaryData(theEnv)->SlotNameArray = (SLOT_NAME *) genalloc(theEnv,space);
1124
+ }
1125
+ if (ObjectBinaryData(theEnv)->TemplateSlotCount != 0L)
1126
+ {
1127
+ space = (sizeof(SlotDescriptor *) * ObjectBinaryData(theEnv)->TemplateSlotCount);
1128
+ ObjectBinaryData(theEnv)->TmpslotArray = (SlotDescriptor **) genalloc(theEnv,space);
1129
+ }
1130
+ if (ObjectBinaryData(theEnv)->SlotNameMapCount != 0L)
1131
+ {
1132
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->SlotNameMapCount);
1133
+ ObjectBinaryData(theEnv)->MapslotArray = (unsigned *) genalloc(theEnv,space);
1134
+ }
1135
+ if (ObjectBinaryData(theEnv)->HandlerCount != 0L)
1136
+ {
1137
+ space = (sizeof(DefmessageHandler) * ObjectBinaryData(theEnv)->HandlerCount);
1138
+ ObjectBinaryData(theEnv)->HandlerArray = (DefmessageHandler *) genalloc(theEnv,space);
1139
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->HandlerCount);
1140
+ ObjectBinaryData(theEnv)->MaphandlerArray = (unsigned *) genalloc(theEnv,space);
1141
+ }
1142
+ }
1143
+
1144
+ /***************************************************************
1145
+ NAME : BloadObjects
1146
+ DESCRIPTION : This routine moves through the class and handler
1147
+ binary arrays updating pointers
1148
+ INPUTS : None
1149
+ RETURNS : Nothing useful
1150
+ SIDE EFFECTS : Pointers reset from array indices
1151
+ NOTES : Assumes all loading is finished
1152
+ **************************************************************/
1153
+ static void BloadObjects(
1154
+ Environment *theEnv)
1155
+ {
1156
+ size_t space;
1157
+
1158
+ GenReadBinary(theEnv,&space,sizeof(size_t));
1159
+ if (space == 0L)
1160
+ return;
1161
+ if (ObjectBinaryData(theEnv)->ModuleCount != 0L)
1162
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->ModuleCount,sizeof(BSAVE_DEFCLASS_MODULE),UpdateDefclassModule);
1163
+ if (ObjectBinaryData(theEnv)->ClassCount != 0L)
1164
+ {
1165
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->ClassCount,sizeof(BSAVE_DEFCLASS),UpdateDefclass);
1166
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->LinkCount,sizeof(long),UpdateLink); // 64-bit bug fix: Defclass * replaced with long
1167
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->SlotNameCount,sizeof(BSAVE_SLOT_NAME),UpdateSlotName);
1168
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->SlotCount,sizeof(BSAVE_SLOT_DESC),UpdateSlot);
1169
+ if (ObjectBinaryData(theEnv)->TemplateSlotCount != 0L)
1170
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->TemplateSlotCount,sizeof(long),UpdateTemplateSlot);
1171
+ if (ObjectBinaryData(theEnv)->SlotNameMapCount != 0L)
1172
+ {
1173
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->SlotNameMapCount);
1174
+ GenReadBinary(theEnv,ObjectBinaryData(theEnv)->MapslotArray,space);
1175
+ }
1176
+ if (ObjectBinaryData(theEnv)->HandlerCount != 0L)
1177
+ {
1178
+ BloadandRefresh(theEnv,ObjectBinaryData(theEnv)->HandlerCount,sizeof(BSAVE_HANDLER),UpdateHandler);
1179
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->HandlerCount);
1180
+ GenReadBinary(theEnv,ObjectBinaryData(theEnv)->MaphandlerArray,space);
1181
+ }
1182
+ UpdatePrimitiveClassesMap(theEnv);
1183
+ }
1184
+ }
1185
+
1186
+ /***************************************************
1187
+ NAME : UpdatePrimitiveClassesMap
1188
+ DESCRIPTION : Resets the pointers for the global
1189
+ primitive classes map
1190
+ INPUTS : None
1191
+ RETURNS : Nothing useful
1192
+ SIDE EFFECTS : PrimitiveClassMap pointers set
1193
+ into bload array
1194
+ NOTES : Looks at first nine primitive type
1195
+ codes in the source file CONSTANT.H
1196
+ ***************************************************/
1197
+ static void UpdatePrimitiveClassesMap(
1198
+ Environment *theEnv)
1199
+ {
1200
+ unsigned i;
1201
+
1202
+ for (i = 0 ; i < OBJECT_TYPE_CODE ; i++)
1203
+ DefclassData(theEnv)->PrimitiveClassMap[i] = (Defclass *) &ObjectBinaryData(theEnv)->DefclassArray[i];
1204
+ }
1205
+
1206
+ /*********************************************************
1207
+ Refresh update routines for bsaved COOL structures
1208
+ *********************************************************/
1209
+ static void UpdateDefclassModule(
1210
+ Environment *theEnv,
1211
+ void *buf,
1212
+ unsigned long obji)
1213
+ {
1214
+ BSAVE_DEFCLASS_MODULE *bdptr;
1215
+
1216
+ bdptr = (BSAVE_DEFCLASS_MODULE *) buf;
1217
+ UpdateDefmoduleItemHeader(theEnv,&bdptr->header,&ObjectBinaryData(theEnv)->ModuleArray[obji].header,
1218
+ sizeof(Defclass),ObjectBinaryData(theEnv)->DefclassArray);
1219
+ }
1220
+
1221
+ static void UpdateDefclass(
1222
+ Environment *theEnv,
1223
+ void *buf,
1224
+ unsigned long obji)
1225
+ {
1226
+ BSAVE_DEFCLASS *bcls;
1227
+ Defclass *cls;
1228
+
1229
+ bcls = (BSAVE_DEFCLASS *) buf;
1230
+ cls = &ObjectBinaryData(theEnv)->DefclassArray[obji];
1231
+
1232
+ UpdateConstructHeader(theEnv,&bcls->header,&cls->header,DEFCLASS,
1233
+ sizeof(DEFCLASS_MODULE),ObjectBinaryData(theEnv)->ModuleArray,
1234
+ sizeof(Defclass),ObjectBinaryData(theEnv)->DefclassArray);
1235
+ cls->abstract = bcls->abstract;
1236
+ cls->reactive = bcls->reactive;
1237
+ cls->system = bcls->system;
1238
+ cls->id = bcls->id;
1239
+ DefclassData(theEnv)->ClassIDMap[cls->id] = cls;
1240
+ #if DEBUGGING_FUNCTIONS
1241
+ cls->traceInstances = DefclassData(theEnv)->WatchInstances;
1242
+ cls->traceSlots = DefclassData(theEnv)->WatchSlots;
1243
+ #endif
1244
+ cls->slotCount = bcls->slotCount;
1245
+ cls->instanceSlotCount = bcls->instanceSlotCount;
1246
+ cls->localInstanceSlotCount = bcls->localInstanceSlotCount;
1247
+ cls->maxSlotNameID = bcls->maxSlotNameID;
1248
+ cls->handlerCount = bcls->handlerCount;
1249
+ cls->directSuperclasses.classCount = bcls->directSuperclasses.classCount;
1250
+ cls->directSuperclasses.classArray = LinkPointer(bcls->directSuperclasses.classArray);
1251
+ cls->directSubclasses.classCount = bcls->directSubclasses.classCount;
1252
+ cls->directSubclasses.classArray = LinkPointer(bcls->directSubclasses.classArray);
1253
+ cls->allSuperclasses.classCount = bcls->allSuperclasses.classCount;
1254
+ cls->allSuperclasses.classArray = LinkPointer(bcls->allSuperclasses.classArray);
1255
+ cls->slots = SlotPointer(bcls->slots);
1256
+ cls->instanceTemplate = TemplateSlotPointer(bcls->instanceTemplate);
1257
+ cls->slotNameMap = OrderedSlotPointer(bcls->slotNameMap);
1258
+ cls->instanceList = NULL;
1259
+ cls->handlers = HandlerPointer(bcls->handlers);
1260
+ cls->handlerOrderMap = OrderedHandlerPointer(bcls->handlers);
1261
+ cls->installed = 1;
1262
+ cls->busy = 0;
1263
+ cls->instanceList = NULL;
1264
+ cls->instanceListBottom = NULL;
1265
+ #if DEFRULE_CONSTRUCT
1266
+ cls->relevant_terminal_alpha_nodes = ClassAlphaPointer(bcls->relevant_terminal_alpha_nodes);
1267
+ #endif
1268
+ #if DEFMODULE_CONSTRUCT
1269
+ cls->scopeMap = BitMapPointer(bcls->scopeMap);
1270
+ IncrementBitMapCount(cls->scopeMap);
1271
+ #else
1272
+ cls->scopeMap = NULL;
1273
+ #endif
1274
+ PutClassInTable(theEnv,cls);
1275
+ }
1276
+
1277
+ static void UpdateLink(
1278
+ Environment *theEnv,
1279
+ void *buf,
1280
+ unsigned long obji)
1281
+ {
1282
+ unsigned long *blink;
1283
+
1284
+ blink = (unsigned long *) buf;
1285
+ ObjectBinaryData(theEnv)->LinkArray[obji] = DefclassPointer(*blink);
1286
+ }
1287
+
1288
+ static void UpdateSlot(
1289
+ Environment *theEnv,
1290
+ void *buf,
1291
+ unsigned long obji)
1292
+ {
1293
+ SlotDescriptor *sp;
1294
+ BSAVE_SLOT_DESC *bsp;
1295
+
1296
+ sp = (SlotDescriptor *) &ObjectBinaryData(theEnv)->SlotArray[obji];
1297
+ bsp = (BSAVE_SLOT_DESC *) buf;
1298
+ sp->dynamicDefault = bsp->dynamicDefault;
1299
+ sp->noDefault = bsp->noDefault;
1300
+ sp->shared = bsp->shared;
1301
+ sp->multiple = bsp->multiple;
1302
+ sp->composite = bsp->composite;
1303
+ sp->noInherit = bsp->noInherit;
1304
+ sp->noWrite = bsp->noWrite;
1305
+ sp->initializeOnly = bsp->initializeOnly;
1306
+ sp->reactive = bsp->reactive;
1307
+ sp->publicVisibility = bsp->publicVisibility;
1308
+ sp->createReadAccessor = bsp->createReadAccessor;
1309
+ sp->createWriteAccessor = bsp->createWriteAccessor;
1310
+ sp->cls = DefclassPointer(bsp->cls);
1311
+ sp->slotName = SlotNamePointer(bsp->slotName);
1312
+ sp->overrideMessage = SymbolPointer(bsp->overrideMessage);
1313
+ IncrementLexemeCount(sp->overrideMessage);
1314
+ if (bsp->defaultValue != ULONG_MAX)
1315
+ {
1316
+ if (sp->dynamicDefault)
1317
+ sp->defaultValue = ExpressionPointer(bsp->defaultValue);
1318
+ else
1319
+ {
1320
+ sp->defaultValue = get_struct(theEnv,udfValue);
1321
+ EvaluateAndStoreInDataObject(theEnv,sp->multiple,ExpressionPointer(bsp->defaultValue),
1322
+ (UDFValue *) sp->defaultValue,false);
1323
+ RetainUDFV(theEnv,(UDFValue *) sp->defaultValue);
1324
+ }
1325
+ }
1326
+ else
1327
+ sp->defaultValue = NULL;
1328
+ sp->constraint = ConstraintPointer(bsp->constraint);
1329
+ sp->sharedCount = 0;
1330
+ sp->sharedValue.value = NULL;
1331
+ sp->bsaveIndex = 0L;
1332
+ if (sp->shared)
1333
+ {
1334
+ sp->sharedValue.desc = sp;
1335
+ sp->sharedValue.value = NULL;
1336
+ }
1337
+ }
1338
+
1339
+ static void UpdateSlotName(
1340
+ Environment *theEnv,
1341
+ void *buf,
1342
+ unsigned long obji)
1343
+ {
1344
+ SLOT_NAME *snp;
1345
+ BSAVE_SLOT_NAME *bsnp;
1346
+
1347
+ bsnp = (BSAVE_SLOT_NAME *) buf;
1348
+ snp = (SLOT_NAME *) &ObjectBinaryData(theEnv)->SlotNameArray[obji];
1349
+ snp->id = bsnp->id;
1350
+ snp->name = SymbolPointer(bsnp->name);
1351
+ IncrementLexemeCount(snp->name);
1352
+ snp->putHandlerName = SymbolPointer(bsnp->putHandlerName);
1353
+ IncrementLexemeCount(snp->putHandlerName);
1354
+ snp->hashTableIndex = bsnp->hashTableIndex;
1355
+ snp->nxt = DefclassData(theEnv)->SlotNameTable[snp->hashTableIndex];
1356
+ DefclassData(theEnv)->SlotNameTable[snp->hashTableIndex] = snp;
1357
+ }
1358
+
1359
+ static void UpdateTemplateSlot(
1360
+ Environment *theEnv,
1361
+ void *buf,
1362
+ unsigned long obji)
1363
+ {
1364
+ ObjectBinaryData(theEnv)->TmpslotArray[obji] = SlotPointer(* (long *) buf);
1365
+ }
1366
+
1367
+ static void UpdateHandler(
1368
+ Environment *theEnv,
1369
+ void *buf,
1370
+ unsigned long obji)
1371
+ {
1372
+ DefmessageHandler *hnd;
1373
+ BSAVE_HANDLER *bhnd;
1374
+
1375
+ hnd = &ObjectBinaryData(theEnv)->HandlerArray[obji];
1376
+ bhnd = (BSAVE_HANDLER *) buf;
1377
+ hnd->system = bhnd->system;
1378
+ hnd->type = bhnd->type;
1379
+
1380
+ UpdateConstructHeader(theEnv,&bhnd->header,&hnd->header,DEFMESSAGE_HANDLER,
1381
+ sizeof(DEFCLASS_MODULE),ObjectBinaryData(theEnv)->ModuleArray,
1382
+ sizeof(DefmessageHandler),ObjectBinaryData(theEnv)->HandlerArray);
1383
+
1384
+ hnd->minParams = bhnd->minParams;
1385
+ hnd->maxParams = bhnd->maxParams;
1386
+ hnd->localVarCount = bhnd->localVarCount;
1387
+ hnd->cls = DefclassPointer(bhnd->cls);
1388
+ //IncrementLexemeCount(hnd->header.name);
1389
+ hnd->actions = ExpressionPointer(bhnd->actions);
1390
+ hnd->header.ppForm = NULL;
1391
+ hnd->busy = 0;
1392
+ hnd->mark = 0;
1393
+ hnd->header.usrData = NULL;
1394
+ #if DEBUGGING_FUNCTIONS
1395
+ hnd->trace = MessageHandlerData(theEnv)->WatchHandlers;
1396
+ #endif
1397
+ }
1398
+
1399
+ /***************************************************************
1400
+ NAME : ClearBloadObjects
1401
+ DESCRIPTION : Release all binary-loaded class and handler
1402
+ structure arrays (and others)
1403
+ INPUTS : None
1404
+ RETURNS : Nothing useful
1405
+ SIDE EFFECTS : Memory cleared
1406
+ NOTES : None
1407
+ ***************************************************************/
1408
+ static void ClearBloadObjects(
1409
+ Environment *theEnv)
1410
+ {
1411
+ unsigned long i;
1412
+ size_t space;
1413
+
1414
+ space = (sizeof(DEFCLASS_MODULE) * ObjectBinaryData(theEnv)->ModuleCount);
1415
+ if (space == 0L)
1416
+ return;
1417
+ genfree(theEnv,ObjectBinaryData(theEnv)->ModuleArray,space);
1418
+ ObjectBinaryData(theEnv)->ModuleArray = NULL;
1419
+ ObjectBinaryData(theEnv)->ModuleCount = 0L;
1420
+
1421
+ if (ObjectBinaryData(theEnv)->ClassCount != 0L)
1422
+ {
1423
+ rm(theEnv,DefclassData(theEnv)->ClassIDMap,(sizeof(Defclass *) * DefclassData(theEnv)->AvailClassID));
1424
+ DefclassData(theEnv)->ClassIDMap = NULL;
1425
+ DefclassData(theEnv)->MaxClassID = 0;
1426
+ DefclassData(theEnv)->AvailClassID = 0;
1427
+ for (i = 0 ; i < ObjectBinaryData(theEnv)->ClassCount ; i++)
1428
+ {
1429
+ UnmarkConstructHeader(theEnv,&ObjectBinaryData(theEnv)->DefclassArray[i].header);
1430
+ #if DEFMODULE_CONSTRUCT
1431
+ DecrementBitMapReferenceCount(theEnv,ObjectBinaryData(theEnv)->DefclassArray[i].scopeMap);
1432
+ #endif
1433
+ RemoveClassFromTable(theEnv,&ObjectBinaryData(theEnv)->DefclassArray[i]);
1434
+ }
1435
+ for (i = 0 ; i < ObjectBinaryData(theEnv)->SlotCount ; i++)
1436
+ {
1437
+ ReleaseLexeme(theEnv,ObjectBinaryData(theEnv)->SlotArray[i].overrideMessage);
1438
+ if ((ObjectBinaryData(theEnv)->SlotArray[i].defaultValue != NULL) && (ObjectBinaryData(theEnv)->SlotArray[i].dynamicDefault == 0))
1439
+ {
1440
+ UDFValue *theValue = (UDFValue *) ObjectBinaryData(theEnv)->SlotArray[i].defaultValue;
1441
+ ReleaseUDFV(theEnv,(UDFValue *) ObjectBinaryData(theEnv)->SlotArray[i].defaultValue);
1442
+ if (theValue->header->type == MULTIFIELD_TYPE)
1443
+ { ReturnMultifield(theEnv,theValue->multifieldValue); }
1444
+ rtn_struct(theEnv,udfValue,ObjectBinaryData(theEnv)->SlotArray[i].defaultValue);
1445
+ }
1446
+ }
1447
+ for (i = 0 ; i < ObjectBinaryData(theEnv)->SlotNameCount ; i++)
1448
+ {
1449
+ DefclassData(theEnv)->SlotNameTable[ObjectBinaryData(theEnv)->SlotNameArray[i].hashTableIndex] = NULL;
1450
+ ReleaseLexeme(theEnv,ObjectBinaryData(theEnv)->SlotNameArray[i].name);
1451
+ ReleaseLexeme(theEnv,ObjectBinaryData(theEnv)->SlotNameArray[i].putHandlerName);
1452
+ }
1453
+
1454
+ space = (sizeof(Defclass) * ObjectBinaryData(theEnv)->ClassCount);
1455
+ if (space != 0L)
1456
+ {
1457
+ genfree(theEnv,ObjectBinaryData(theEnv)->DefclassArray,space);
1458
+ ObjectBinaryData(theEnv)->DefclassArray = NULL;
1459
+ ObjectBinaryData(theEnv)->ClassCount = 0L;
1460
+ }
1461
+
1462
+ space = (sizeof(Defclass *) * ObjectBinaryData(theEnv)->LinkCount);
1463
+ if (space != 0L)
1464
+ {
1465
+ genfree(theEnv,ObjectBinaryData(theEnv)->LinkArray,space);
1466
+ ObjectBinaryData(theEnv)->LinkArray = NULL;
1467
+ ObjectBinaryData(theEnv)->LinkCount = 0L;
1468
+ }
1469
+
1470
+ space = (sizeof(SlotDescriptor) * ObjectBinaryData(theEnv)->SlotCount);
1471
+ if (space != 0L)
1472
+ {
1473
+ genfree(theEnv,ObjectBinaryData(theEnv)->SlotArray,space);
1474
+ ObjectBinaryData(theEnv)->SlotArray = NULL;
1475
+ ObjectBinaryData(theEnv)->SlotCount = 0L;
1476
+ }
1477
+
1478
+ space = (sizeof(SLOT_NAME) * ObjectBinaryData(theEnv)->SlotNameCount);
1479
+ if (space != 0L)
1480
+ {
1481
+ genfree(theEnv,ObjectBinaryData(theEnv)->SlotNameArray,space);
1482
+ ObjectBinaryData(theEnv)->SlotNameArray = NULL;
1483
+ ObjectBinaryData(theEnv)->SlotNameCount = 0L;
1484
+ }
1485
+
1486
+ space = (sizeof(SlotDescriptor *) * ObjectBinaryData(theEnv)->TemplateSlotCount);
1487
+ if (space != 0L)
1488
+ {
1489
+ genfree(theEnv,ObjectBinaryData(theEnv)->TmpslotArray,space);
1490
+ ObjectBinaryData(theEnv)->TmpslotArray = NULL;
1491
+ ObjectBinaryData(theEnv)->TemplateSlotCount = 0L;
1492
+ }
1493
+
1494
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->SlotNameMapCount);
1495
+ if (space != 0L)
1496
+ {
1497
+ genfree(theEnv,ObjectBinaryData(theEnv)->MapslotArray,space);
1498
+ ObjectBinaryData(theEnv)->MapslotArray = NULL;
1499
+ ObjectBinaryData(theEnv)->SlotNameMapCount = 0L;
1500
+ }
1501
+ }
1502
+
1503
+ if (ObjectBinaryData(theEnv)->HandlerCount != 0L)
1504
+ {
1505
+ for (i = 0L ; i < ObjectBinaryData(theEnv)->HandlerCount ; i++)
1506
+ ReleaseLexeme(theEnv,ObjectBinaryData(theEnv)->HandlerArray[i].header.name);
1507
+
1508
+ space = (sizeof(DefmessageHandler) * ObjectBinaryData(theEnv)->HandlerCount);
1509
+ if (space != 0L)
1510
+ {
1511
+ genfree(theEnv,ObjectBinaryData(theEnv)->HandlerArray,space);
1512
+ ObjectBinaryData(theEnv)->HandlerArray = NULL;
1513
+ space = (sizeof(unsigned) * ObjectBinaryData(theEnv)->HandlerCount);
1514
+ genfree(theEnv,ObjectBinaryData(theEnv)->MaphandlerArray,space);
1515
+ ObjectBinaryData(theEnv)->MaphandlerArray = NULL;
1516
+ ObjectBinaryData(theEnv)->HandlerCount = 0L;
1517
+ }
1518
+ }
1519
+ }
1520
+
1521
+ #endif
1522
+