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,2017 @@
|
|
1
|
+
/*******************************************************/
|
2
|
+
/* "C" Language Integrated Production System */
|
3
|
+
/* */
|
4
|
+
/* CLIPS Version 6.40 02/19/20 */
|
5
|
+
/* */
|
6
|
+
/* */
|
7
|
+
/*******************************************************/
|
8
|
+
|
9
|
+
/*************************************************************/
|
10
|
+
/* Purpose: Generic Functions Interface Routines */
|
11
|
+
/* */
|
12
|
+
/* Principal Programmer(s): */
|
13
|
+
/* Brian L. Dantes */
|
14
|
+
/* */
|
15
|
+
/* Contributing Programmer(s): */
|
16
|
+
/* */
|
17
|
+
/* Revision History: */
|
18
|
+
/* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */
|
19
|
+
/* */
|
20
|
+
/* Corrected compilation errors for files */
|
21
|
+
/* generated by constructs-to-c. DR0861 */
|
22
|
+
/* */
|
23
|
+
/* Changed name of variable log to logName */
|
24
|
+
/* because of Unix compiler warnings of shadowed */
|
25
|
+
/* definitions. */
|
26
|
+
/* */
|
27
|
+
/* 6.24: Removed IMPERATIVE_METHODS compilation flag. */
|
28
|
+
/* */
|
29
|
+
/* Renamed BOOLEAN macro type to intBool. */
|
30
|
+
/* */
|
31
|
+
/* Corrected code to remove run-time program */
|
32
|
+
/* compiler warning. */
|
33
|
+
/* */
|
34
|
+
/* 6.30: Removed conditional code for unsupported */
|
35
|
+
/* compilers/operating systems (IBM_MCW, */
|
36
|
+
/* MAC_MCW, and IBM_TBC). */
|
37
|
+
/* */
|
38
|
+
/* Changed integer type/precision. */
|
39
|
+
/* */
|
40
|
+
/* Added const qualifiers to remove C++ */
|
41
|
+
/* deprecation warnings. */
|
42
|
+
/* */
|
43
|
+
/* Converted API macros to function calls. */
|
44
|
+
/* */
|
45
|
+
/* Fixed linkage issue when DEBUGGING_FUNCTIONS */
|
46
|
+
/* is set to 0 and PROFILING_FUNCTIONS is set to */
|
47
|
+
/* 1. */
|
48
|
+
/* */
|
49
|
+
/* Changed find construct functionality so that */
|
50
|
+
/* imported modules are search when locating a */
|
51
|
+
/* named construct. */
|
52
|
+
/* */
|
53
|
+
/* Added code to keep track of pointers to */
|
54
|
+
/* constructs that are contained externally to */
|
55
|
+
/* to constructs, DanglingConstructs. */
|
56
|
+
/* */
|
57
|
+
/* 6.40: Added Env prefix to GetEvaluationError and */
|
58
|
+
/* SetEvaluationError functions. */
|
59
|
+
/* */
|
60
|
+
/* Pragma once and other inclusion changes. */
|
61
|
+
/* */
|
62
|
+
/* Added support for booleans with <stdbool.h>. */
|
63
|
+
/* */
|
64
|
+
/* Removed use of void pointers for specific */
|
65
|
+
/* data structures. */
|
66
|
+
/* */
|
67
|
+
/* ALLOW_ENVIRONMENT_GLOBALS no longer supported. */
|
68
|
+
/* */
|
69
|
+
/* UDF redesign. */
|
70
|
+
/* */
|
71
|
+
/* Pretty print functions accept optional logical */
|
72
|
+
/* name argument. */
|
73
|
+
/* */
|
74
|
+
/*************************************************************/
|
75
|
+
|
76
|
+
/* =========================================
|
77
|
+
*****************************************
|
78
|
+
EXTERNAL DEFINITIONS
|
79
|
+
=========================================
|
80
|
+
***************************************** */
|
81
|
+
#include "setup.h"
|
82
|
+
|
83
|
+
#if DEFGENERIC_CONSTRUCT
|
84
|
+
|
85
|
+
#include <string.h>
|
86
|
+
|
87
|
+
#include "argacces.h"
|
88
|
+
#if BLOAD || BLOAD_AND_BSAVE
|
89
|
+
#include "bload.h"
|
90
|
+
#endif
|
91
|
+
#if OBJECT_SYSTEM
|
92
|
+
#include "classcom.h"
|
93
|
+
#include "inscom.h"
|
94
|
+
#endif
|
95
|
+
#include "constrct.h"
|
96
|
+
#include "cstrccom.h"
|
97
|
+
#include "cstrcpsr.h"
|
98
|
+
#include "envrnmnt.h"
|
99
|
+
#include "evaluatn.h"
|
100
|
+
#include "extnfunc.h"
|
101
|
+
#if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE
|
102
|
+
#include "genrcbin.h"
|
103
|
+
#endif
|
104
|
+
#if CONSTRUCT_COMPILER
|
105
|
+
#include "genrccmp.h"
|
106
|
+
#endif
|
107
|
+
#include "genrcexe.h"
|
108
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
109
|
+
#include "genrcpsr.h"
|
110
|
+
#endif
|
111
|
+
#include "memalloc.h"
|
112
|
+
#include "modulpsr.h"
|
113
|
+
#include "modulutl.h"
|
114
|
+
#include "multifld.h"
|
115
|
+
#include "router.h"
|
116
|
+
#include "strngrtr.h"
|
117
|
+
#if DEBUGGING_FUNCTIONS
|
118
|
+
#include "watch.h"
|
119
|
+
#endif
|
120
|
+
#include "prntutil.h"
|
121
|
+
|
122
|
+
#include "genrccom.h"
|
123
|
+
|
124
|
+
/* =========================================
|
125
|
+
*****************************************
|
126
|
+
INTERNALLY VISIBLE FUNCTION HEADERS
|
127
|
+
=========================================
|
128
|
+
***************************************** */
|
129
|
+
|
130
|
+
static void PrintGenericCall(Environment *,const char *,Defgeneric *);
|
131
|
+
static bool EvaluateGenericCall(Environment *,Defgeneric *,UDFValue *);
|
132
|
+
static void DecrementGenericBusyCount(Environment *,Defgeneric *);
|
133
|
+
static void IncrementGenericBusyCount(Environment *,Defgeneric *);
|
134
|
+
static void DeallocateDefgenericData(Environment *);
|
135
|
+
|
136
|
+
#if ! RUN_TIME
|
137
|
+
static void DestroyDefgenericAction(Environment *,ConstructHeader *,void *);
|
138
|
+
#endif
|
139
|
+
|
140
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
141
|
+
|
142
|
+
static void SaveDefgenerics(Environment *,Defmodule *,const char *,void *);
|
143
|
+
static void SaveDefmethods(Environment *,Defmodule *,const char *,void *);
|
144
|
+
static void SaveDefmethodsForDefgeneric(Environment *,ConstructHeader *,void *);
|
145
|
+
static void RemoveDefgenericMethod(Environment *,Defgeneric *,unsigned short);
|
146
|
+
|
147
|
+
#endif
|
148
|
+
|
149
|
+
#if DEBUGGING_FUNCTIONS
|
150
|
+
static unsigned short ListMethodsForGeneric(Environment *,const char *,Defgeneric *);
|
151
|
+
static bool DefgenericWatchAccess(Environment *,int,bool,Expression *);
|
152
|
+
static bool DefgenericWatchPrint(Environment *,const char *,int,Expression *);
|
153
|
+
static bool DefmethodWatchAccess(Environment *,int,bool,Expression *);
|
154
|
+
static bool DefmethodWatchPrint(Environment *,const char *,int,Expression *);
|
155
|
+
static bool DefmethodWatchSupport(Environment *,const char *,const char *,bool,
|
156
|
+
void (*)(Environment *,const char *,Defgeneric *,unsigned short),
|
157
|
+
void (*)(Defgeneric *,unsigned short,bool),
|
158
|
+
Expression *);
|
159
|
+
static void PrintMethodWatchFlag(Environment *,const char *,Defgeneric *,unsigned short);
|
160
|
+
#endif
|
161
|
+
|
162
|
+
/* =========================================
|
163
|
+
*****************************************
|
164
|
+
EXTERNALLY VISIBLE FUNCTIONS
|
165
|
+
=========================================
|
166
|
+
***************************************** */
|
167
|
+
|
168
|
+
/***********************************************************
|
169
|
+
NAME : SetupGenericFunctions
|
170
|
+
DESCRIPTION : Initializes all generic function
|
171
|
+
data structures, constructs and functions
|
172
|
+
INPUTS : None
|
173
|
+
RETURNS : Nothing useful
|
174
|
+
SIDE EFFECTS : Generic function H/L functions set up
|
175
|
+
NOTES : None
|
176
|
+
***********************************************************/
|
177
|
+
void SetupGenericFunctions(
|
178
|
+
Environment *theEnv)
|
179
|
+
{
|
180
|
+
EntityRecord genericEntityRecord =
|
181
|
+
{ "GCALL", GCALL,0,0,1,
|
182
|
+
(EntityPrintFunction *) PrintGenericCall,
|
183
|
+
(EntityPrintFunction *) PrintGenericCall,
|
184
|
+
NULL,
|
185
|
+
(EntityEvaluationFunction *) EvaluateGenericCall,
|
186
|
+
NULL,
|
187
|
+
(EntityBusyCountFunction *) DecrementGenericBusyCount,
|
188
|
+
(EntityBusyCountFunction *) IncrementGenericBusyCount,
|
189
|
+
NULL,NULL,NULL,NULL,NULL };
|
190
|
+
|
191
|
+
AllocateEnvironmentData(theEnv,DEFGENERIC_DATA,sizeof(struct defgenericData),DeallocateDefgenericData);
|
192
|
+
memcpy(&DefgenericData(theEnv)->GenericEntityRecord,&genericEntityRecord,sizeof(struct entityRecord));
|
193
|
+
|
194
|
+
InstallPrimitive(theEnv,&DefgenericData(theEnv)->GenericEntityRecord,GCALL);
|
195
|
+
|
196
|
+
DefgenericData(theEnv)->DefgenericModuleIndex =
|
197
|
+
RegisterModuleItem(theEnv,"defgeneric",
|
198
|
+
#if (! RUN_TIME)
|
199
|
+
AllocateDefgenericModule,
|
200
|
+
FreeDefgenericModule,
|
201
|
+
#else
|
202
|
+
NULL,NULL,
|
203
|
+
#endif
|
204
|
+
#if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY
|
205
|
+
BloadDefgenericModuleReference,
|
206
|
+
#else
|
207
|
+
NULL,
|
208
|
+
#endif
|
209
|
+
#if CONSTRUCT_COMPILER && (! RUN_TIME)
|
210
|
+
DefgenericCModuleReference,
|
211
|
+
#else
|
212
|
+
NULL,
|
213
|
+
#endif
|
214
|
+
(FindConstructFunction *) FindDefgenericInModule);
|
215
|
+
|
216
|
+
DefgenericData(theEnv)->DefgenericConstruct = AddConstruct(theEnv,"defgeneric","defgenerics",
|
217
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
218
|
+
ParseDefgeneric,
|
219
|
+
#else
|
220
|
+
NULL,
|
221
|
+
#endif
|
222
|
+
(FindConstructFunction *) FindDefgeneric,
|
223
|
+
GetConstructNamePointer,GetConstructPPForm,
|
224
|
+
GetConstructModuleItem,
|
225
|
+
(GetNextConstructFunction *) GetNextDefgeneric,
|
226
|
+
SetNextConstruct,
|
227
|
+
(IsConstructDeletableFunction *) DefgenericIsDeletable,
|
228
|
+
(DeleteConstructFunction *) Undefgeneric,
|
229
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
230
|
+
(FreeConstructFunction *) RemoveDefgeneric
|
231
|
+
#else
|
232
|
+
NULL
|
233
|
+
#endif
|
234
|
+
);
|
235
|
+
|
236
|
+
|
237
|
+
#if ! RUN_TIME
|
238
|
+
AddClearReadyFunction(theEnv,"defgeneric",ClearDefgenericsReady,0,NULL);
|
239
|
+
|
240
|
+
#if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE
|
241
|
+
SetupGenericsBload(theEnv);
|
242
|
+
#endif
|
243
|
+
|
244
|
+
#if CONSTRUCT_COMPILER
|
245
|
+
SetupGenericsCompiler(theEnv);
|
246
|
+
#endif
|
247
|
+
|
248
|
+
#if ! BLOAD_ONLY
|
249
|
+
#if DEFMODULE_CONSTRUCT
|
250
|
+
AddPortConstructItem(theEnv,"defgeneric",SYMBOL_TOKEN);
|
251
|
+
#endif
|
252
|
+
AddConstruct(theEnv,"defmethod","defmethods",ParseDefmethod,
|
253
|
+
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
254
|
+
|
255
|
+
/* ================================================================
|
256
|
+
Make sure defmethods are cleared last, for other constructs may
|
257
|
+
be using them and need to be cleared first
|
258
|
+
|
259
|
+
Need to be cleared in two stages so that mutually dependent
|
260
|
+
constructs (like classes) can be cleared
|
261
|
+
================================================================ */
|
262
|
+
AddSaveFunction(theEnv,"defgeneric",SaveDefgenerics,1000,NULL);
|
263
|
+
AddSaveFunction(theEnv,"defmethod",SaveDefmethods,-1000,NULL);
|
264
|
+
AddUDF(theEnv,"undefgeneric","v",1,1,"y",UndefgenericCommand,"UndefgenericCommand",NULL);
|
265
|
+
AddUDF(theEnv,"undefmethod","v",2,2,"*;y;ly",UndefmethodCommand,"UndefmethodCommand",NULL);
|
266
|
+
#endif
|
267
|
+
|
268
|
+
AddUDF(theEnv,"call-next-method","*",0,0,NULL,CallNextMethod,"CallNextMethod",NULL);
|
269
|
+
FuncSeqOvlFlags(theEnv,"call-next-method",true,false);
|
270
|
+
AddUDF(theEnv,"call-specific-method","*",2,UNBOUNDED,"*;y;l",CallSpecificMethod,"CallSpecificMethod",NULL);
|
271
|
+
FuncSeqOvlFlags(theEnv,"call-specific-method",true,false);
|
272
|
+
AddUDF(theEnv,"override-next-method","*",0,UNBOUNDED,NULL,OverrideNextMethod,"OverrideNextMethod",NULL);
|
273
|
+
FuncSeqOvlFlags(theEnv,"override-next-method",true,false);
|
274
|
+
AddUDF(theEnv,"next-methodp","b",0,0,NULL,NextMethodPCommand,"NextMethodPCommand",NULL);
|
275
|
+
FuncSeqOvlFlags(theEnv,"next-methodp",true,false);
|
276
|
+
|
277
|
+
AddUDF(theEnv,"(gnrc-current-arg)","*",0,UNBOUNDED,NULL,GetGenericCurrentArgument,"GetGenericCurrentArgument",NULL);
|
278
|
+
|
279
|
+
#if DEBUGGING_FUNCTIONS
|
280
|
+
AddUDF(theEnv,"ppdefgeneric","vs",1,2,";y;ldsyn",PPDefgenericCommand,"PPDefgenericCommand",NULL);
|
281
|
+
AddUDF(theEnv,"list-defgenerics","v",0,1,"y",ListDefgenericsCommand,"ListDefgenericsCommand",NULL);
|
282
|
+
AddUDF(theEnv,"ppdefmethod","v",2,3,"*;y;l;ldsyn",PPDefmethodCommand,"PPDefmethodCommand",NULL);
|
283
|
+
AddUDF(theEnv,"list-defmethods","v",0,1,"y",ListDefmethodsCommand,"ListDefmethodsCommand",NULL);
|
284
|
+
AddUDF(theEnv,"preview-generic","v",1,UNBOUNDED,"*;y",PreviewGeneric,"PreviewGeneric",NULL);
|
285
|
+
#endif
|
286
|
+
|
287
|
+
AddUDF(theEnv,"get-defgeneric-list","m",0,1,"y",GetDefgenericListFunction,"GetDefgenericListFunction",NULL);
|
288
|
+
AddUDF(theEnv,"get-defmethod-list","m",0,1,"y",GetDefmethodListCommand,"GetDefmethodListCommand",NULL);
|
289
|
+
AddUDF(theEnv,"get-method-restrictions","m",2,2,"l;y",GetMethodRestrictionsCommand,"GetMethodRestrictionsCommand",NULL);
|
290
|
+
AddUDF(theEnv,"defgeneric-module","y",1,1,"y",GetDefgenericModuleCommand,"GetDefgenericModuleCommand",NULL);
|
291
|
+
|
292
|
+
#if OBJECT_SYSTEM
|
293
|
+
AddUDF(theEnv,"type","*",1,1,"*",ClassCommand,"ClassCommand",NULL);
|
294
|
+
#else
|
295
|
+
AddUDF(theEnv,"type","*",1,1,"*",TypeCommand,"TypeCommand",NULL);
|
296
|
+
#endif
|
297
|
+
|
298
|
+
#endif
|
299
|
+
|
300
|
+
#if DEBUGGING_FUNCTIONS
|
301
|
+
AddWatchItem(theEnv,"generic-functions",0,&DefgenericData(theEnv)->WatchGenerics,34,
|
302
|
+
DefgenericWatchAccess,DefgenericWatchPrint);
|
303
|
+
AddWatchItem(theEnv,"methods",0,&DefgenericData(theEnv)->WatchMethods,33,
|
304
|
+
DefmethodWatchAccess,DefmethodWatchPrint);
|
305
|
+
#endif
|
306
|
+
}
|
307
|
+
|
308
|
+
/*****************************************************/
|
309
|
+
/* DeallocateDefgenericData: Deallocates environment */
|
310
|
+
/* data for the defgeneric construct. */
|
311
|
+
/*****************************************************/
|
312
|
+
static void DeallocateDefgenericData(
|
313
|
+
Environment *theEnv)
|
314
|
+
{
|
315
|
+
#if ! RUN_TIME
|
316
|
+
struct defgenericModule *theModuleItem;
|
317
|
+
Defmodule *theModule;
|
318
|
+
|
319
|
+
#if BLOAD || BLOAD_AND_BSAVE
|
320
|
+
if (Bloaded(theEnv)) return;
|
321
|
+
#endif
|
322
|
+
|
323
|
+
DoForAllConstructs(theEnv,
|
324
|
+
DestroyDefgenericAction,
|
325
|
+
DefgenericData(theEnv)->DefgenericModuleIndex,false,NULL);
|
326
|
+
|
327
|
+
for (theModule = GetNextDefmodule(theEnv,NULL);
|
328
|
+
theModule != NULL;
|
329
|
+
theModule = GetNextDefmodule(theEnv,theModule))
|
330
|
+
{
|
331
|
+
theModuleItem = (struct defgenericModule *)
|
332
|
+
GetModuleItem(theEnv,theModule,
|
333
|
+
DefgenericData(theEnv)->DefgenericModuleIndex);
|
334
|
+
|
335
|
+
rtn_struct(theEnv,defgenericModule,theModuleItem);
|
336
|
+
}
|
337
|
+
#else
|
338
|
+
#if MAC_XCD
|
339
|
+
#pragma unused(theEnv)
|
340
|
+
#endif
|
341
|
+
#endif
|
342
|
+
}
|
343
|
+
|
344
|
+
#if ! RUN_TIME
|
345
|
+
/****************************************************/
|
346
|
+
/* DestroyDefgenericAction: Action used to remove */
|
347
|
+
/* defgenerics as a result of DestroyEnvironment. */
|
348
|
+
/****************************************************/
|
349
|
+
static void DestroyDefgenericAction(
|
350
|
+
Environment *theEnv,
|
351
|
+
ConstructHeader *theConstruct,
|
352
|
+
void *buffer)
|
353
|
+
{
|
354
|
+
#if MAC_XCD
|
355
|
+
#pragma unused(buffer)
|
356
|
+
#endif
|
357
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
358
|
+
Defgeneric *theDefgeneric = (Defgeneric *) theConstruct;
|
359
|
+
long i;
|
360
|
+
|
361
|
+
if (theDefgeneric == NULL) return;
|
362
|
+
|
363
|
+
for (i = 0 ; i < theDefgeneric->mcnt ; i++)
|
364
|
+
{ DestroyMethodInfo(theEnv,theDefgeneric,&theDefgeneric->methods[i]); }
|
365
|
+
|
366
|
+
if (theDefgeneric->mcnt != 0)
|
367
|
+
{ rm(theEnv,theDefgeneric->methods,(sizeof(Defmethod) * theDefgeneric->mcnt)); }
|
368
|
+
|
369
|
+
DestroyConstructHeader(theEnv,&theDefgeneric->header);
|
370
|
+
|
371
|
+
rtn_struct(theEnv,defgeneric,theDefgeneric);
|
372
|
+
#else
|
373
|
+
#if MAC_XCD
|
374
|
+
#pragma unused(theEnv,theConstruct)
|
375
|
+
#endif
|
376
|
+
#endif
|
377
|
+
}
|
378
|
+
#endif
|
379
|
+
|
380
|
+
/***************************************************
|
381
|
+
NAME : FindDefgeneric
|
382
|
+
DESCRIPTION : Searches for a generic
|
383
|
+
INPUTS : The name of the generic
|
384
|
+
(possibly including a module name)
|
385
|
+
RETURNS : Pointer to the generic if
|
386
|
+
found, otherwise NULL
|
387
|
+
SIDE EFFECTS : None
|
388
|
+
NOTES : None
|
389
|
+
***************************************************/
|
390
|
+
Defgeneric *FindDefgeneric(
|
391
|
+
Environment *theEnv,
|
392
|
+
const char *genericModuleAndName)
|
393
|
+
{
|
394
|
+
return (Defgeneric *) FindNamedConstructInModuleOrImports(theEnv,genericModuleAndName,DefgenericData(theEnv)->DefgenericConstruct);
|
395
|
+
}
|
396
|
+
|
397
|
+
/***************************************************
|
398
|
+
NAME : FindDefgenericInModule
|
399
|
+
DESCRIPTION : Searches for a generic
|
400
|
+
INPUTS : The name of the generic
|
401
|
+
(possibly including a module name)
|
402
|
+
RETURNS : Pointer to the generic if
|
403
|
+
found, otherwise NULL
|
404
|
+
SIDE EFFECTS : None
|
405
|
+
NOTES : None
|
406
|
+
***************************************************/
|
407
|
+
Defgeneric *FindDefgenericInModule(
|
408
|
+
Environment *theEnv,
|
409
|
+
const char *genericModuleAndName)
|
410
|
+
{
|
411
|
+
return (Defgeneric *) FindNamedConstructInModule(theEnv,genericModuleAndName,DefgenericData(theEnv)->DefgenericConstruct);
|
412
|
+
}
|
413
|
+
|
414
|
+
/***************************************************
|
415
|
+
NAME : LookupDefgenericByMdlOrScope
|
416
|
+
DESCRIPTION : Finds a defgeneric anywhere (if
|
417
|
+
module is specified) or in current
|
418
|
+
or imported modules
|
419
|
+
INPUTS : The defgeneric name
|
420
|
+
RETURNS : The defgeneric (NULL if not found)
|
421
|
+
SIDE EFFECTS : Error message printed on
|
422
|
+
ambiguous references
|
423
|
+
NOTES : None
|
424
|
+
***************************************************/
|
425
|
+
Defgeneric *LookupDefgenericByMdlOrScope(
|
426
|
+
Environment *theEnv,
|
427
|
+
const char *defgenericName)
|
428
|
+
{
|
429
|
+
return (Defgeneric *) LookupConstruct(theEnv,DefgenericData(theEnv)->DefgenericConstruct,defgenericName,true);
|
430
|
+
}
|
431
|
+
|
432
|
+
/***************************************************
|
433
|
+
NAME : LookupDefgenericInScope
|
434
|
+
DESCRIPTION : Finds a defgeneric in current or
|
435
|
+
imported modules (module
|
436
|
+
specifier is not allowed)
|
437
|
+
INPUTS : The defgeneric name
|
438
|
+
RETURNS : The defgeneric (NULL if not found)
|
439
|
+
SIDE EFFECTS : Error message printed on
|
440
|
+
ambiguous references
|
441
|
+
NOTES : None
|
442
|
+
***************************************************/
|
443
|
+
Defgeneric *LookupDefgenericInScope(
|
444
|
+
Environment *theEnv,
|
445
|
+
const char *defgenericName)
|
446
|
+
{
|
447
|
+
return (Defgeneric *) LookupConstruct(theEnv,DefgenericData(theEnv)->DefgenericConstruct,defgenericName,false);
|
448
|
+
}
|
449
|
+
|
450
|
+
/***********************************************************
|
451
|
+
NAME : GetNextDefgeneric
|
452
|
+
DESCRIPTION : Finds first or next generic function
|
453
|
+
INPUTS : The address of the current generic function
|
454
|
+
RETURNS : The address of the next generic function
|
455
|
+
(NULL if none)
|
456
|
+
SIDE EFFECTS : None
|
457
|
+
NOTES : If ptr == NULL, the first generic function
|
458
|
+
is returned.
|
459
|
+
***********************************************************/
|
460
|
+
Defgeneric *GetNextDefgeneric(
|
461
|
+
Environment *theEnv,
|
462
|
+
Defgeneric *theDefgeneric)
|
463
|
+
{
|
464
|
+
return (Defgeneric *) GetNextConstructItem(theEnv,&theDefgeneric->header,DefgenericData(theEnv)->DefgenericModuleIndex);
|
465
|
+
}
|
466
|
+
|
467
|
+
/***********************************************************
|
468
|
+
NAME : GetNextDefmethod
|
469
|
+
DESCRIPTION : Find the next method for a generic function
|
470
|
+
INPUTS : 1) The generic function address
|
471
|
+
2) The index of the current method
|
472
|
+
RETURNS : The index of the next method
|
473
|
+
(0 if none)
|
474
|
+
SIDE EFFECTS : None
|
475
|
+
NOTES : If index == 0, the index of the first
|
476
|
+
method is returned
|
477
|
+
***********************************************************/
|
478
|
+
unsigned short GetNextDefmethod(
|
479
|
+
Defgeneric *theDefgeneric,
|
480
|
+
unsigned short theIndex)
|
481
|
+
{
|
482
|
+
unsigned short mi;
|
483
|
+
|
484
|
+
if (theIndex == 0)
|
485
|
+
{
|
486
|
+
if (theDefgeneric->methods != NULL)
|
487
|
+
{ return theDefgeneric->methods[0].index; }
|
488
|
+
|
489
|
+
return 0;
|
490
|
+
}
|
491
|
+
|
492
|
+
mi = FindMethodByIndex(theDefgeneric,theIndex);
|
493
|
+
|
494
|
+
if ((mi+1) == theDefgeneric->mcnt)
|
495
|
+
{ return 0; }
|
496
|
+
|
497
|
+
return theDefgeneric->methods[mi+1].index;
|
498
|
+
}
|
499
|
+
|
500
|
+
/*****************************************************
|
501
|
+
NAME : GetDefmethodPointer
|
502
|
+
DESCRIPTION : Returns a pointer to a method
|
503
|
+
INPUTS : 1) Pointer to a defgeneric
|
504
|
+
2) Array index of method in generic's
|
505
|
+
method array (+1)
|
506
|
+
RETURNS : Pointer to the method.
|
507
|
+
SIDE EFFECTS : None
|
508
|
+
NOTES : None
|
509
|
+
*****************************************************/
|
510
|
+
Defmethod *GetDefmethodPointer(
|
511
|
+
Defgeneric *theDefgeneric,
|
512
|
+
long theIndex)
|
513
|
+
{
|
514
|
+
return &theDefgeneric->methods[theIndex-1];
|
515
|
+
}
|
516
|
+
|
517
|
+
/***************************************************
|
518
|
+
NAME : IsDefgenericDeletable
|
519
|
+
DESCRIPTION : Determines if a generic function
|
520
|
+
can be deleted
|
521
|
+
INPUTS : Address of the generic function
|
522
|
+
RETURNS : True if deletable, false otherwise
|
523
|
+
SIDE EFFECTS : None
|
524
|
+
NOTES : None
|
525
|
+
***************************************************/
|
526
|
+
bool DefgenericIsDeletable(
|
527
|
+
Defgeneric *theDefgeneric)
|
528
|
+
{
|
529
|
+
Environment *theEnv = theDefgeneric->header.env;
|
530
|
+
|
531
|
+
if (! ConstructsDeletable(theEnv))
|
532
|
+
{ return false; }
|
533
|
+
|
534
|
+
return (theDefgeneric->busy == 0) ? true : false;
|
535
|
+
}
|
536
|
+
|
537
|
+
/***************************************************
|
538
|
+
NAME : DefmethodIsDeletable
|
539
|
+
DESCRIPTION : Determines if a generic function
|
540
|
+
method can be deleted
|
541
|
+
INPUTS : 1) Address of the generic function
|
542
|
+
2) Index of the method
|
543
|
+
RETURNS : True if deletable, false otherwise
|
544
|
+
SIDE EFFECTS : None
|
545
|
+
NOTES : None
|
546
|
+
***************************************************/
|
547
|
+
bool DefmethodIsDeletable(
|
548
|
+
Defgeneric *theDefgeneric,
|
549
|
+
unsigned short theIndex)
|
550
|
+
{
|
551
|
+
Environment *theEnv = theDefgeneric->header.env;
|
552
|
+
unsigned short mi;
|
553
|
+
|
554
|
+
if (! ConstructsDeletable(theEnv))
|
555
|
+
{ return false; }
|
556
|
+
|
557
|
+
mi = FindMethodByIndex(theDefgeneric,theIndex);
|
558
|
+
if (mi == METHOD_NOT_FOUND) return false;
|
559
|
+
|
560
|
+
if (theDefgeneric->methods[mi].system)
|
561
|
+
return false;
|
562
|
+
|
563
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
564
|
+
return (MethodsExecuting(theDefgeneric) == false) ? true : false;
|
565
|
+
#else
|
566
|
+
return false;
|
567
|
+
#endif
|
568
|
+
}
|
569
|
+
|
570
|
+
/**********************************************************
|
571
|
+
NAME : UndefgenericCommand
|
572
|
+
DESCRIPTION : Deletes all methods for a generic function
|
573
|
+
INPUTS : None
|
574
|
+
RETURNS : Nothing useful
|
575
|
+
SIDE EFFECTS : methods deallocated
|
576
|
+
NOTES : H/L Syntax: (undefgeneric <name> | *)
|
577
|
+
**********************************************************/
|
578
|
+
void UndefgenericCommand(
|
579
|
+
Environment *theEnv,
|
580
|
+
UDFContext *context,
|
581
|
+
UDFValue *returnValue)
|
582
|
+
{
|
583
|
+
UndefconstructCommand(context,"undefgeneric",DefgenericData(theEnv)->DefgenericConstruct);
|
584
|
+
}
|
585
|
+
|
586
|
+
/****************************************************************
|
587
|
+
NAME : GetDefgenericModuleCommand
|
588
|
+
DESCRIPTION : Determines to which module a defgeneric belongs
|
589
|
+
INPUTS : None
|
590
|
+
RETURNS : The symbolic name of the module
|
591
|
+
SIDE EFFECTS : None
|
592
|
+
NOTES : H/L Syntax: (defgeneric-module <generic-name>)
|
593
|
+
****************************************************************/
|
594
|
+
void GetDefgenericModuleCommand(
|
595
|
+
Environment *theEnv,
|
596
|
+
UDFContext *context,
|
597
|
+
UDFValue *returnValue)
|
598
|
+
{
|
599
|
+
returnValue->value = GetConstructModuleCommand(context,"defgeneric-module",DefgenericData(theEnv)->DefgenericConstruct);
|
600
|
+
}
|
601
|
+
|
602
|
+
/**************************************************************
|
603
|
+
NAME : UndefmethodCommand
|
604
|
+
DESCRIPTION : Deletes one method for a generic function
|
605
|
+
INPUTS : None
|
606
|
+
RETURNS : Nothing useful
|
607
|
+
SIDE EFFECTS : methods deallocated
|
608
|
+
NOTES : H/L Syntax: (undefmethod <name> <index> | *)
|
609
|
+
**************************************************************/
|
610
|
+
void UndefmethodCommand(
|
611
|
+
Environment *theEnv,
|
612
|
+
UDFContext *context,
|
613
|
+
UDFValue *returnValue)
|
614
|
+
{
|
615
|
+
UDFValue theArg;
|
616
|
+
Defgeneric *gfunc;
|
617
|
+
unsigned short mi;
|
618
|
+
|
619
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg)) return;
|
620
|
+
|
621
|
+
gfunc = LookupDefgenericByMdlOrScope(theEnv,theArg.lexemeValue->contents);
|
622
|
+
if ((gfunc == NULL) ? (strcmp(theArg.lexemeValue->contents,"*") != 0) : false)
|
623
|
+
{
|
624
|
+
PrintErrorID(theEnv,"GENRCCOM",1,false);
|
625
|
+
WriteString(theEnv,STDERR,"No such generic function '");
|
626
|
+
WriteString(theEnv,STDERR,theArg.lexemeValue->contents);
|
627
|
+
WriteString(theEnv,STDERR,"' in function undefmethod.\n");
|
628
|
+
return;
|
629
|
+
}
|
630
|
+
|
631
|
+
if (! UDFNextArgument(context,ANY_TYPE_BITS,&theArg)) return;
|
632
|
+
|
633
|
+
if (CVIsType(&theArg,SYMBOL_BIT))
|
634
|
+
{
|
635
|
+
if (strcmp(theArg.lexemeValue->contents,"*") != 0)
|
636
|
+
{
|
637
|
+
PrintErrorID(theEnv,"GENRCCOM",2,false);
|
638
|
+
WriteString(theEnv,STDERR,"Expected a valid method index in function undefmethod.\n");
|
639
|
+
return;
|
640
|
+
}
|
641
|
+
mi = 0;
|
642
|
+
}
|
643
|
+
else if (CVIsType(&theArg,INTEGER_BIT))
|
644
|
+
{
|
645
|
+
mi = (unsigned short) theArg.integerValue->contents;
|
646
|
+
if (mi == 0)
|
647
|
+
{
|
648
|
+
PrintErrorID(theEnv,"GENRCCOM",2,false);
|
649
|
+
WriteString(theEnv,STDERR,"Expected a valid method index in function undefmethod.\n");
|
650
|
+
return;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
else
|
654
|
+
{
|
655
|
+
PrintErrorID(theEnv,"GENRCCOM",2,false);
|
656
|
+
WriteString(theEnv,STDERR,"Expected a valid method index in function undefmethod.\n");
|
657
|
+
return;
|
658
|
+
}
|
659
|
+
Undefmethod(gfunc,mi,theEnv);
|
660
|
+
}
|
661
|
+
|
662
|
+
/**************************************************************
|
663
|
+
NAME : EnvUndefgeneric
|
664
|
+
DESCRIPTION : Deletes all methods for a generic function
|
665
|
+
INPUTS : The generic-function address (NULL for all)
|
666
|
+
RETURNS : True if generic successfully deleted,
|
667
|
+
false otherwise
|
668
|
+
SIDE EFFECTS : methods deallocated
|
669
|
+
NOTES : None
|
670
|
+
**************************************************************/
|
671
|
+
bool Undefgeneric(
|
672
|
+
Defgeneric *theDefgeneric,
|
673
|
+
Environment *allEnv)
|
674
|
+
{
|
675
|
+
#if RUN_TIME || BLOAD_ONLY
|
676
|
+
return false;
|
677
|
+
#else
|
678
|
+
Environment *theEnv;
|
679
|
+
bool success = true;
|
680
|
+
GCBlock gcb;
|
681
|
+
|
682
|
+
if (theDefgeneric == NULL)
|
683
|
+
{ theEnv = allEnv; }
|
684
|
+
else
|
685
|
+
{ theEnv = theDefgeneric->header.env; }
|
686
|
+
|
687
|
+
GCBlockStart(theEnv,&gcb);
|
688
|
+
if (theDefgeneric == NULL)
|
689
|
+
{
|
690
|
+
if (ClearDefmethods(theEnv) == false)
|
691
|
+
success = false;
|
692
|
+
if (ClearDefgenerics(theEnv) == false)
|
693
|
+
success = false;
|
694
|
+
|
695
|
+
GCBlockEnd(theEnv,&gcb);
|
696
|
+
|
697
|
+
return success ;
|
698
|
+
}
|
699
|
+
|
700
|
+
if (DefgenericIsDeletable(theDefgeneric) == false)
|
701
|
+
{
|
702
|
+
GCBlockEnd(theEnv,&gcb);
|
703
|
+
return false;
|
704
|
+
}
|
705
|
+
|
706
|
+
RemoveConstructFromModule(theEnv,&theDefgeneric->header);
|
707
|
+
RemoveDefgeneric(theEnv,theDefgeneric);
|
708
|
+
|
709
|
+
GCBlockEnd(theEnv,&gcb);
|
710
|
+
|
711
|
+
return true;
|
712
|
+
#endif
|
713
|
+
}
|
714
|
+
|
715
|
+
/**************************************************************
|
716
|
+
NAME : Undefmethod
|
717
|
+
DESCRIPTION : Deletes one method for a generic function
|
718
|
+
INPUTS : 1) Address of generic function (can be NULL)
|
719
|
+
2) Method index (0 for all)
|
720
|
+
RETURNS : True if method deleted successfully,
|
721
|
+
false otherwise
|
722
|
+
SIDE EFFECTS : methods deallocated
|
723
|
+
NOTES : None
|
724
|
+
**************************************************************/
|
725
|
+
bool Undefmethod(
|
726
|
+
Defgeneric *theDefgeneric,
|
727
|
+
unsigned short mi,
|
728
|
+
Environment *allEnv)
|
729
|
+
{
|
730
|
+
Environment *theEnv;
|
731
|
+
#if (! RUN_TIME) && (! BLOAD_ONLY)
|
732
|
+
GCBlock gcb;
|
733
|
+
#endif
|
734
|
+
|
735
|
+
if (theDefgeneric == NULL)
|
736
|
+
{ theEnv = allEnv; }
|
737
|
+
else
|
738
|
+
{ theEnv = theDefgeneric->header.env; }
|
739
|
+
|
740
|
+
#if RUN_TIME || BLOAD_ONLY
|
741
|
+
PrintErrorID(theEnv,"PRNTUTIL",4,false);
|
742
|
+
WriteString(theEnv,STDERR,"Unable to delete method ");
|
743
|
+
if (theDefgeneric != NULL)
|
744
|
+
{
|
745
|
+
WriteString(theEnv,STDERR,"'");
|
746
|
+
PrintGenericName(theEnv,STDERR,theDefgeneric);
|
747
|
+
WriteString(theEnv,STDERR,"'");
|
748
|
+
WriteString(theEnv,STDERR," #");
|
749
|
+
PrintUnsignedInteger(theEnv,STDERR,mi);
|
750
|
+
}
|
751
|
+
else
|
752
|
+
WriteString(theEnv,STDERR,"*");
|
753
|
+
WriteString(theEnv,STDERR,".\n");
|
754
|
+
return false;
|
755
|
+
#else
|
756
|
+
|
757
|
+
#if BLOAD || BLOAD_AND_BSAVE
|
758
|
+
if (Bloaded(theEnv) == true)
|
759
|
+
{
|
760
|
+
PrintErrorID(theEnv,"PRNTUTIL",4,false);
|
761
|
+
WriteString(theEnv,STDERR,"Unable to delete method ");
|
762
|
+
if (theDefgeneric != NULL)
|
763
|
+
{
|
764
|
+
WriteString(theEnv,STDERR,"'");
|
765
|
+
WriteString(theEnv,STDERR,DefgenericName(theDefgeneric));
|
766
|
+
WriteString(theEnv,STDERR,"'");
|
767
|
+
WriteString(theEnv,STDERR," #");
|
768
|
+
PrintUnsignedInteger(theEnv,STDERR,mi);
|
769
|
+
}
|
770
|
+
else
|
771
|
+
WriteString(theEnv,STDERR,"*");
|
772
|
+
WriteString(theEnv,STDERR,".\n");
|
773
|
+
return false;
|
774
|
+
}
|
775
|
+
#endif
|
776
|
+
|
777
|
+
GCBlockStart(theEnv,&gcb);
|
778
|
+
if (theDefgeneric == NULL)
|
779
|
+
{
|
780
|
+
bool success;
|
781
|
+
|
782
|
+
if (mi != 0)
|
783
|
+
{
|
784
|
+
PrintErrorID(theEnv,"GENRCCOM",3,false);
|
785
|
+
WriteString(theEnv,STDERR,"Incomplete method specification for deletion.\n");
|
786
|
+
GCBlockEnd(theEnv,&gcb);
|
787
|
+
return false;
|
788
|
+
}
|
789
|
+
|
790
|
+
success = ClearDefmethods(theEnv);
|
791
|
+
GCBlockEnd(theEnv,&gcb);
|
792
|
+
return success;
|
793
|
+
}
|
794
|
+
|
795
|
+
if (MethodsExecuting(theDefgeneric))
|
796
|
+
{
|
797
|
+
MethodAlterError(theEnv,theDefgeneric);
|
798
|
+
GCBlockEnd(theEnv,&gcb);
|
799
|
+
return false;
|
800
|
+
}
|
801
|
+
|
802
|
+
if (mi == 0)
|
803
|
+
{ RemoveAllExplicitMethods(theEnv,theDefgeneric); }
|
804
|
+
else
|
805
|
+
{
|
806
|
+
unsigned short nmi = CheckMethodExists(theEnv,"undefmethod",theDefgeneric,mi);
|
807
|
+
if (nmi == METHOD_NOT_FOUND)
|
808
|
+
{
|
809
|
+
GCBlockEnd(theEnv,&gcb);
|
810
|
+
return false;
|
811
|
+
}
|
812
|
+
RemoveDefgenericMethod(theEnv,theDefgeneric,nmi);
|
813
|
+
}
|
814
|
+
|
815
|
+
GCBlockEnd(theEnv,&gcb);
|
816
|
+
return true;
|
817
|
+
#endif
|
818
|
+
}
|
819
|
+
|
820
|
+
#if DEBUGGING_FUNCTIONS || PROFILING_FUNCTIONS
|
821
|
+
|
822
|
+
/*****************************************************
|
823
|
+
NAME : DefmethodDescription
|
824
|
+
DESCRIPTION : Prints a synopsis of method parameter
|
825
|
+
restrictions into caller's buffer
|
826
|
+
INPUTS : 1) Caller's buffer
|
827
|
+
2) Buffer size (not including space
|
828
|
+
for terminating '\0')
|
829
|
+
3) Address of generic function
|
830
|
+
4) Index of method
|
831
|
+
RETURNS : Nothing useful
|
832
|
+
SIDE EFFECTS : Caller's buffer written
|
833
|
+
NOTES : Terminating '\n' not written
|
834
|
+
*****************************************************/
|
835
|
+
void DefmethodDescription(
|
836
|
+
Defgeneric *theDefgeneric,
|
837
|
+
unsigned short theIndex,
|
838
|
+
StringBuilder *theSB)
|
839
|
+
{
|
840
|
+
long mi;
|
841
|
+
Environment *theEnv = theDefgeneric->header.env;
|
842
|
+
|
843
|
+
mi = FindMethodByIndex(theDefgeneric,theIndex);
|
844
|
+
|
845
|
+
OpenStringBuilderDestination(theEnv,"MethodDescription",theSB);
|
846
|
+
|
847
|
+
if (mi != METHOD_NOT_FOUND)
|
848
|
+
{ PrintMethod(theEnv,&theDefgeneric->methods[mi],theSB); }
|
849
|
+
|
850
|
+
CloseStringBuilderDestination(theEnv,"MethodDescription");
|
851
|
+
|
852
|
+
}
|
853
|
+
#endif /* DEBUGGING_FUNCTIONS || PROFILING_FUNCTIONS */
|
854
|
+
|
855
|
+
#if DEBUGGING_FUNCTIONS
|
856
|
+
|
857
|
+
/*********************************************************
|
858
|
+
NAME : GetDefgenericWatch
|
859
|
+
DESCRIPTION : Determines if trace messages are
|
860
|
+
gnerated when executing generic function
|
861
|
+
INPUTS : A pointer to the generic
|
862
|
+
RETURNS : True if a trace is active,
|
863
|
+
false otherwise
|
864
|
+
SIDE EFFECTS : None
|
865
|
+
NOTES : None
|
866
|
+
*********************************************************/
|
867
|
+
bool DefgenericGetWatch(
|
868
|
+
Defgeneric *theGeneric)
|
869
|
+
{
|
870
|
+
return theGeneric->trace;
|
871
|
+
}
|
872
|
+
|
873
|
+
/*********************************************************
|
874
|
+
NAME : SetDefgenericWatch
|
875
|
+
DESCRIPTION : Sets the trace to ON/OFF for the
|
876
|
+
generic function
|
877
|
+
INPUTS : 1) True to set the trace on,
|
878
|
+
False to set it off
|
879
|
+
2) A pointer to the generic
|
880
|
+
RETURNS : Nothing useful
|
881
|
+
SIDE EFFECTS : Watch flag for the generic set
|
882
|
+
NOTES : None
|
883
|
+
*********************************************************/
|
884
|
+
void DefgenericSetWatch(
|
885
|
+
Defgeneric *theGeneric,
|
886
|
+
bool newState)
|
887
|
+
{
|
888
|
+
theGeneric->trace = newState;
|
889
|
+
}
|
890
|
+
|
891
|
+
/*********************************************************
|
892
|
+
NAME : DefmethodGetWatch
|
893
|
+
DESCRIPTION : Determines if trace messages for calls
|
894
|
+
to this method will be generated or not
|
895
|
+
INPUTS : 1) A pointer to the generic
|
896
|
+
2) The index of the method
|
897
|
+
RETURNS : True if a trace is active,
|
898
|
+
false otherwise
|
899
|
+
SIDE EFFECTS : None
|
900
|
+
NOTES : None
|
901
|
+
*********************************************************/
|
902
|
+
bool DefmethodGetWatch(
|
903
|
+
Defgeneric *theGeneric,
|
904
|
+
unsigned short theIndex)
|
905
|
+
{
|
906
|
+
unsigned short mi;
|
907
|
+
|
908
|
+
mi = FindMethodByIndex(theGeneric,theIndex);
|
909
|
+
|
910
|
+
if (mi != METHOD_NOT_FOUND)
|
911
|
+
{ return theGeneric->methods[mi].trace; }
|
912
|
+
|
913
|
+
return false;
|
914
|
+
}
|
915
|
+
|
916
|
+
/*********************************************************
|
917
|
+
NAME : DefmethodSetWatch
|
918
|
+
DESCRIPTION : Sets the trace to ON/OFF for the
|
919
|
+
calling of the method
|
920
|
+
INPUTS : 1) True to set the trace on,
|
921
|
+
false to set it off
|
922
|
+
2) A pointer to the generic
|
923
|
+
3) The index of the method
|
924
|
+
RETURNS : Nothing useful
|
925
|
+
SIDE EFFECTS : Watch flag for the method set
|
926
|
+
NOTES : None
|
927
|
+
*********************************************************/
|
928
|
+
void DefmethodSetWatch(
|
929
|
+
Defgeneric *theGeneric,
|
930
|
+
unsigned short theIndex,
|
931
|
+
bool newState)
|
932
|
+
{
|
933
|
+
unsigned short mi;
|
934
|
+
|
935
|
+
mi = FindMethodByIndex(theGeneric,theIndex);
|
936
|
+
|
937
|
+
if (mi != METHOD_NOT_FOUND)
|
938
|
+
{ theGeneric->methods[mi].trace = newState; }
|
939
|
+
}
|
940
|
+
|
941
|
+
|
942
|
+
/********************************************************
|
943
|
+
NAME : PPDefgenericCommand
|
944
|
+
DESCRIPTION : Displays the pretty-print form of
|
945
|
+
a generic function header
|
946
|
+
INPUTS : None
|
947
|
+
RETURNS : Nothing useful
|
948
|
+
SIDE EFFECTS : None
|
949
|
+
NOTES : H/L Syntax: (ppdefgeneric <name>)
|
950
|
+
********************************************************/
|
951
|
+
void PPDefgenericCommand(
|
952
|
+
Environment *theEnv,
|
953
|
+
UDFContext *context,
|
954
|
+
UDFValue *returnValue)
|
955
|
+
{
|
956
|
+
PPConstructCommand(context,"ppdefgeneric",DefgenericData(theEnv)->DefgenericConstruct,returnValue);
|
957
|
+
}
|
958
|
+
|
959
|
+
/**********************************************************
|
960
|
+
NAME : PPDefmethodCommand
|
961
|
+
DESCRIPTION : Displays the pretty-print form of
|
962
|
+
a method
|
963
|
+
INPUTS : None
|
964
|
+
RETURNS : Nothing useful
|
965
|
+
SIDE EFFECTS : None
|
966
|
+
NOTES : H/L Syntax: (ppdefmethod <name> <index>)
|
967
|
+
**********************************************************/
|
968
|
+
void PPDefmethodCommand(
|
969
|
+
Environment *theEnv,
|
970
|
+
UDFContext *context,
|
971
|
+
UDFValue *returnValue)
|
972
|
+
{
|
973
|
+
UDFValue theArg;
|
974
|
+
const char *gname;
|
975
|
+
const char *logicalName;
|
976
|
+
Defgeneric *gfunc;
|
977
|
+
unsigned short gi;
|
978
|
+
|
979
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg)) return;
|
980
|
+
gname = theArg.lexemeValue->contents;
|
981
|
+
|
982
|
+
if (! UDFNextArgument(context,INTEGER_BIT,&theArg)) return;
|
983
|
+
|
984
|
+
if (UDFHasNextArgument(context))
|
985
|
+
{
|
986
|
+
logicalName = GetLogicalName(context,STDOUT);
|
987
|
+
if (logicalName == NULL)
|
988
|
+
{
|
989
|
+
IllegalLogicalNameMessage(theEnv,"ppdefmethod");
|
990
|
+
SetHaltExecution(theEnv,true);
|
991
|
+
SetEvaluationError(theEnv,true);
|
992
|
+
return;
|
993
|
+
}
|
994
|
+
}
|
995
|
+
else
|
996
|
+
{ logicalName = STDOUT; }
|
997
|
+
|
998
|
+
gfunc = CheckGenericExists(theEnv,"ppdefmethod",gname);
|
999
|
+
if (gfunc == NULL)
|
1000
|
+
return;
|
1001
|
+
|
1002
|
+
gi = CheckMethodExists(theEnv,"ppdefmethod",gfunc,(unsigned short) theArg.integerValue->contents);
|
1003
|
+
if (gi == METHOD_NOT_FOUND)
|
1004
|
+
return;
|
1005
|
+
|
1006
|
+
if (strcmp(logicalName,"nil") == 0)
|
1007
|
+
{
|
1008
|
+
if (gfunc->methods[gi].header.ppForm != NULL)
|
1009
|
+
{ returnValue->lexemeValue = CreateString(theEnv,gfunc->methods[gi].header.ppForm); }
|
1010
|
+
else
|
1011
|
+
{ returnValue->lexemeValue = CreateString(theEnv,""); }
|
1012
|
+
}
|
1013
|
+
else
|
1014
|
+
{
|
1015
|
+
if (gfunc->methods[gi].header.ppForm != NULL)
|
1016
|
+
WriteString(theEnv,logicalName,gfunc->methods[gi].header.ppForm);
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
/******************************************************
|
1021
|
+
NAME : ListDefmethodsCommand
|
1022
|
+
DESCRIPTION : Lists a brief description of methods
|
1023
|
+
for a particular generic function
|
1024
|
+
INPUTS : None
|
1025
|
+
RETURNS : Nothing useful
|
1026
|
+
SIDE EFFECTS : None
|
1027
|
+
NOTES : H/L Syntax: (list-defmethods <name>)
|
1028
|
+
******************************************************/
|
1029
|
+
void ListDefmethodsCommand(
|
1030
|
+
Environment *theEnv,
|
1031
|
+
UDFContext *context,
|
1032
|
+
UDFValue *returnValue)
|
1033
|
+
{
|
1034
|
+
UDFValue theArg;
|
1035
|
+
Defgeneric *gfunc;
|
1036
|
+
|
1037
|
+
if (! UDFHasNextArgument(context))
|
1038
|
+
{ ListDefmethods(theEnv,STDOUT,NULL); }
|
1039
|
+
else
|
1040
|
+
{
|
1041
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg)) return;
|
1042
|
+
|
1043
|
+
gfunc = CheckGenericExists(theEnv,"list-defmethods",theArg.lexemeValue->contents);
|
1044
|
+
if (gfunc != NULL)
|
1045
|
+
{ ListDefmethods(theEnv,STDOUT,gfunc); }
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
/***************************************************************
|
1050
|
+
NAME : DefmethodPPForm
|
1051
|
+
DESCRIPTION : Getsa generic function method pretty print form
|
1052
|
+
INPUTS : 1) Address of the generic function
|
1053
|
+
2) Index of the method
|
1054
|
+
RETURNS : Method ppform
|
1055
|
+
SIDE EFFECTS : None
|
1056
|
+
NOTES : None
|
1057
|
+
***************************************************************/
|
1058
|
+
const char *DefmethodPPForm(
|
1059
|
+
Defgeneric *theDefgeneric,
|
1060
|
+
unsigned short theIndex)
|
1061
|
+
{
|
1062
|
+
unsigned short mi;
|
1063
|
+
|
1064
|
+
mi = FindMethodByIndex(theDefgeneric,theIndex);
|
1065
|
+
|
1066
|
+
if (mi != METHOD_NOT_FOUND)
|
1067
|
+
{ return theDefgeneric->methods[mi].header.ppForm; }
|
1068
|
+
|
1069
|
+
return "";
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
/***************************************************
|
1073
|
+
NAME : ListDefgenericsCommand
|
1074
|
+
DESCRIPTION : Displays all defgeneric names
|
1075
|
+
INPUTS : None
|
1076
|
+
RETURNS : Nothing useful
|
1077
|
+
SIDE EFFECTS : Defgeneric names printed
|
1078
|
+
NOTES : H/L Interface
|
1079
|
+
***************************************************/
|
1080
|
+
void ListDefgenericsCommand(
|
1081
|
+
Environment *theEnv,
|
1082
|
+
UDFContext *context,
|
1083
|
+
UDFValue *returnValue)
|
1084
|
+
{
|
1085
|
+
ListConstructCommand(context,DefgenericData(theEnv)->DefgenericConstruct);
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
/***************************************************
|
1089
|
+
NAME : ListDefgenerics
|
1090
|
+
DESCRIPTION : Displays all defgeneric names
|
1091
|
+
INPUTS : 1) The logical name of the output
|
1092
|
+
2) The module
|
1093
|
+
RETURNS : Nothing useful
|
1094
|
+
SIDE EFFECTS : Defgeneric names printed
|
1095
|
+
NOTES : C Interface
|
1096
|
+
***************************************************/
|
1097
|
+
void ListDefgenerics(
|
1098
|
+
Environment *theEnv,
|
1099
|
+
const char *logicalName,
|
1100
|
+
Defmodule *theModule)
|
1101
|
+
{
|
1102
|
+
ListConstruct(theEnv,DefgenericData(theEnv)->DefgenericConstruct,logicalName,theModule);
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
/******************************************************
|
1106
|
+
NAME : ListDefmethods
|
1107
|
+
DESCRIPTION : Lists a brief description of methods
|
1108
|
+
for a particular generic function
|
1109
|
+
INPUTS : 1) The logical name of the output
|
1110
|
+
2) Generic function to list methods for
|
1111
|
+
(NULL means list all methods)
|
1112
|
+
RETURNS : Nothing useful
|
1113
|
+
SIDE EFFECTS : None
|
1114
|
+
NOTES : None
|
1115
|
+
******************************************************/
|
1116
|
+
void ListDefmethods(
|
1117
|
+
Environment *theEnv,
|
1118
|
+
const char *logicalName,
|
1119
|
+
Defgeneric *theDefgeneric)
|
1120
|
+
{
|
1121
|
+
Defgeneric *gfunc;
|
1122
|
+
unsigned long count;
|
1123
|
+
if (theDefgeneric != NULL)
|
1124
|
+
count = ListMethodsForGeneric(theEnv,logicalName,theDefgeneric);
|
1125
|
+
else
|
1126
|
+
{
|
1127
|
+
count = 0;
|
1128
|
+
for (gfunc = GetNextDefgeneric(theEnv,NULL) ;
|
1129
|
+
gfunc != NULL ;
|
1130
|
+
gfunc = GetNextDefgeneric(theEnv,gfunc))
|
1131
|
+
{
|
1132
|
+
count += ListMethodsForGeneric(theEnv,logicalName,gfunc);
|
1133
|
+
if (GetNextDefgeneric(theEnv,gfunc) != NULL)
|
1134
|
+
WriteString(theEnv,logicalName,"\n");
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
PrintTally(theEnv,logicalName,count,"method","methods");
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
#endif /* DEBUGGING_FUNCTIONS */
|
1141
|
+
|
1142
|
+
/***************************************************************
|
1143
|
+
NAME : GetDefgenericListFunction
|
1144
|
+
DESCRIPTION : Groups all defgeneric names into
|
1145
|
+
a multifield list
|
1146
|
+
INPUTS : A data object buffer to hold
|
1147
|
+
the multifield result
|
1148
|
+
RETURNS : Nothing useful
|
1149
|
+
SIDE EFFECTS : Multifield allocated and filled
|
1150
|
+
NOTES : H/L Syntax: (get-defgeneric-list [<module>])
|
1151
|
+
***************************************************************/
|
1152
|
+
void GetDefgenericListFunction(
|
1153
|
+
Environment *theEnv,
|
1154
|
+
UDFContext *context,
|
1155
|
+
UDFValue *returnValue)
|
1156
|
+
{
|
1157
|
+
GetConstructListFunction(context,returnValue,DefgenericData(theEnv)->DefgenericConstruct);
|
1158
|
+
}
|
1159
|
+
|
1160
|
+
/***************************************************************
|
1161
|
+
NAME : GetDefgenericList
|
1162
|
+
DESCRIPTION : Groups all defgeneric names into
|
1163
|
+
a multifield list
|
1164
|
+
INPUTS : 1) A data object buffer to hold
|
1165
|
+
the multifield result
|
1166
|
+
2) The module from which to obtain defgenerics
|
1167
|
+
RETURNS : Nothing useful
|
1168
|
+
SIDE EFFECTS : Multifield allocated and filled
|
1169
|
+
NOTES : External C access
|
1170
|
+
***************************************************************/
|
1171
|
+
void GetDefgenericList(
|
1172
|
+
Environment *theEnv,
|
1173
|
+
CLIPSValue *returnValue,
|
1174
|
+
Defmodule *theModule)
|
1175
|
+
{
|
1176
|
+
UDFValue result;
|
1177
|
+
|
1178
|
+
GetConstructList(theEnv,&result,DefgenericData(theEnv)->DefgenericConstruct,theModule);
|
1179
|
+
NormalizeMultifield(theEnv,&result);
|
1180
|
+
returnValue->value = result.value;
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
/***********************************************************
|
1184
|
+
NAME : GetDefmethodListCommand
|
1185
|
+
DESCRIPTION : Groups indices of all methdos for a generic
|
1186
|
+
function into a multifield variable
|
1187
|
+
(NULL means get methods for all generics)
|
1188
|
+
INPUTS : A data object buffer
|
1189
|
+
RETURNS : Nothing useful
|
1190
|
+
SIDE EFFECTS : Multifield set to list of method indices
|
1191
|
+
NOTES : None
|
1192
|
+
***********************************************************/
|
1193
|
+
void GetDefmethodListCommand(
|
1194
|
+
Environment *theEnv,
|
1195
|
+
UDFContext *context,
|
1196
|
+
UDFValue *returnValue)
|
1197
|
+
{
|
1198
|
+
UDFValue theArg;
|
1199
|
+
Defgeneric *gfunc;
|
1200
|
+
CLIPSValue result;
|
1201
|
+
|
1202
|
+
if (! UDFHasNextArgument(context))
|
1203
|
+
{
|
1204
|
+
GetDefmethodList(theEnv,&result,NULL);
|
1205
|
+
CLIPSToUDFValue(&result,returnValue);
|
1206
|
+
}
|
1207
|
+
else
|
1208
|
+
{
|
1209
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg))
|
1210
|
+
{ return; }
|
1211
|
+
gfunc = CheckGenericExists(theEnv,"get-defmethod-list",theArg.lexemeValue->contents);
|
1212
|
+
if (gfunc != NULL)
|
1213
|
+
{
|
1214
|
+
GetDefmethodList(theEnv,&result,gfunc);
|
1215
|
+
CLIPSToUDFValue(&result,returnValue);
|
1216
|
+
}
|
1217
|
+
else
|
1218
|
+
{ SetMultifieldErrorValue(theEnv,returnValue); }
|
1219
|
+
}
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
/***********************************************************
|
1223
|
+
NAME : GetDefmethodList
|
1224
|
+
DESCRIPTION : Groups indices of all methdos for a generic
|
1225
|
+
function into a multifield variable
|
1226
|
+
(NULL means get methods for all generics)
|
1227
|
+
INPUTS : 1) A pointer to a generic function
|
1228
|
+
2) A data object buffer
|
1229
|
+
RETURNS : Nothing useful
|
1230
|
+
SIDE EFFECTS : Multifield set to list of method indices
|
1231
|
+
NOTES : None
|
1232
|
+
***********************************************************/
|
1233
|
+
void GetDefmethodList(
|
1234
|
+
Environment *theEnv,
|
1235
|
+
CLIPSValue *returnValue,
|
1236
|
+
Defgeneric *theDefgeneric)
|
1237
|
+
{
|
1238
|
+
Defgeneric *gfunc, *svg, *svnxt;
|
1239
|
+
long i,j;
|
1240
|
+
unsigned long count;
|
1241
|
+
Multifield *theList;
|
1242
|
+
|
1243
|
+
if (theDefgeneric != NULL)
|
1244
|
+
{
|
1245
|
+
gfunc = theDefgeneric;
|
1246
|
+
svnxt = GetNextDefgeneric(theEnv,theDefgeneric);
|
1247
|
+
SetNextDefgeneric(theDefgeneric,NULL);
|
1248
|
+
}
|
1249
|
+
else
|
1250
|
+
{
|
1251
|
+
gfunc = GetNextDefgeneric(theEnv,NULL);
|
1252
|
+
svnxt = (gfunc != NULL) ? GetNextDefgeneric(theEnv,gfunc) : NULL;
|
1253
|
+
}
|
1254
|
+
count = 0;
|
1255
|
+
for (svg = gfunc ;
|
1256
|
+
gfunc != NULL ;
|
1257
|
+
gfunc = GetNextDefgeneric(theEnv,gfunc))
|
1258
|
+
count += gfunc->mcnt;
|
1259
|
+
count *= 2;
|
1260
|
+
theList = CreateMultifield(theEnv,count);
|
1261
|
+
returnValue->value = theList;
|
1262
|
+
for (gfunc = svg , i = 0 ;
|
1263
|
+
gfunc != NULL ;
|
1264
|
+
gfunc = GetNextDefgeneric(theEnv,gfunc))
|
1265
|
+
{
|
1266
|
+
for (j = 0 ; j < gfunc->mcnt ; j++)
|
1267
|
+
{
|
1268
|
+
theList->contents[i++].value = GetDefgenericNamePointer(gfunc);
|
1269
|
+
theList->contents[i++].integerValue = CreateInteger(theEnv,(long long) gfunc->methods[j].index);
|
1270
|
+
}
|
1271
|
+
}
|
1272
|
+
if (svg != NULL)
|
1273
|
+
SetNextDefgeneric(svg,svnxt);
|
1274
|
+
}
|
1275
|
+
|
1276
|
+
/***********************************************************************************
|
1277
|
+
NAME : GetMethodRestrictionsCommand
|
1278
|
+
DESCRIPTION : Stores restrictions of a method in multifield
|
1279
|
+
INPUTS : A data object buffer to hold a multifield
|
1280
|
+
RETURNS : Nothing useful
|
1281
|
+
SIDE EFFECTS : Multifield created (length zero on errors)
|
1282
|
+
NOTES : Syntax: (get-method-restrictions <generic-function> <method-index>)
|
1283
|
+
***********************************************************************************/
|
1284
|
+
void GetMethodRestrictionsCommand(
|
1285
|
+
Environment *theEnv,
|
1286
|
+
UDFContext *context,
|
1287
|
+
UDFValue *returnValue)
|
1288
|
+
{
|
1289
|
+
UDFValue theArg;
|
1290
|
+
Defgeneric *gfunc;
|
1291
|
+
CLIPSValue result;
|
1292
|
+
unsigned short mi;
|
1293
|
+
|
1294
|
+
if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg))
|
1295
|
+
{ return; }
|
1296
|
+
gfunc = CheckGenericExists(theEnv,"get-method-restrictions",theArg.lexemeValue->contents);
|
1297
|
+
if (gfunc == NULL)
|
1298
|
+
{
|
1299
|
+
SetMultifieldErrorValue(theEnv,returnValue);
|
1300
|
+
return;
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
if (! UDFNextArgument(context,INTEGER_BIT,&theArg))
|
1304
|
+
{ return; }
|
1305
|
+
|
1306
|
+
mi = (unsigned short) theArg.integerValue->contents;
|
1307
|
+
|
1308
|
+
if (CheckMethodExists(theEnv,"get-method-restrictions",gfunc,mi) == METHOD_NOT_FOUND)
|
1309
|
+
{
|
1310
|
+
SetMultifieldErrorValue(theEnv,returnValue);
|
1311
|
+
return;
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
GetMethodRestrictions(gfunc,mi,&result);
|
1315
|
+
CLIPSToUDFValue(&result,returnValue);
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
/***********************************************************************
|
1319
|
+
NAME : GetMethodRestrictions
|
1320
|
+
DESCRIPTION : Stores restrictions of a method in multifield
|
1321
|
+
INPUTS : 1) Pointer to the generic function
|
1322
|
+
2) The method index
|
1323
|
+
3) A data object buffer to hold a multifield
|
1324
|
+
RETURNS : Nothing useful
|
1325
|
+
SIDE EFFECTS : Multifield created (length zero on errors)
|
1326
|
+
NOTES : The restrictions are stored in the multifield
|
1327
|
+
in the following format:
|
1328
|
+
|
1329
|
+
<min-number-of-arguments>
|
1330
|
+
<max-number-of-arguments> (-1 if wildcard allowed)
|
1331
|
+
<restriction-count>
|
1332
|
+
<index of 1st restriction>
|
1333
|
+
.
|
1334
|
+
.
|
1335
|
+
<index of nth restriction>
|
1336
|
+
<restriction 1>
|
1337
|
+
<query TRUE/FALSE>
|
1338
|
+
<number-of-classes>
|
1339
|
+
<class 1>
|
1340
|
+
.
|
1341
|
+
.
|
1342
|
+
<class n>
|
1343
|
+
.
|
1344
|
+
.
|
1345
|
+
.
|
1346
|
+
<restriction n>
|
1347
|
+
|
1348
|
+
Thus, for the method
|
1349
|
+
(defmethod foo ((?a NUMBER SYMBOL_TYPE) (?b (= 1 1)) $?c))
|
1350
|
+
(get-method-restrictions foo 1) would yield
|
1351
|
+
|
1352
|
+
(2 -1 3 7 11 13 FALSE 2 NUMBER SYMBOL_TYPE TRUE 0 FALSE 0)
|
1353
|
+
***********************************************************************/
|
1354
|
+
void GetMethodRestrictions(
|
1355
|
+
Defgeneric *theDefgeneric,
|
1356
|
+
unsigned short mi,
|
1357
|
+
CLIPSValue *returnValue)
|
1358
|
+
{
|
1359
|
+
short i,j;
|
1360
|
+
Defmethod *meth;
|
1361
|
+
RESTRICTION *rptr;
|
1362
|
+
size_t count;
|
1363
|
+
int roffset,rstrctIndex;
|
1364
|
+
Multifield *theList;
|
1365
|
+
Environment *theEnv = theDefgeneric->header.env;
|
1366
|
+
|
1367
|
+
meth = theDefgeneric->methods + FindMethodByIndex(theDefgeneric,mi);
|
1368
|
+
count = 3;
|
1369
|
+
for (i = 0 ; i < meth->restrictionCount ; i++)
|
1370
|
+
count += meth->restrictions[i].tcnt + 3;
|
1371
|
+
theList = CreateMultifield(theEnv,count);
|
1372
|
+
|
1373
|
+
returnValue->value = theList;
|
1374
|
+
if (meth->minRestrictions == RESTRICTIONS_UNBOUNDED)
|
1375
|
+
{ theList->contents[0].integerValue = CreateInteger(theEnv,-1); }
|
1376
|
+
else
|
1377
|
+
{ theList->contents[0].integerValue = CreateInteger(theEnv,(long long) meth->minRestrictions); }
|
1378
|
+
if (meth->maxRestrictions == RESTRICTIONS_UNBOUNDED)
|
1379
|
+
{ theList->contents[1].integerValue = CreateInteger(theEnv,-1); }
|
1380
|
+
else
|
1381
|
+
{ theList->contents[1].integerValue = CreateInteger(theEnv,(long long) meth->maxRestrictions); }
|
1382
|
+
theList->contents[2].integerValue = CreateInteger(theEnv,(long long) meth->restrictionCount);
|
1383
|
+
roffset = 3 + meth->restrictionCount;
|
1384
|
+
rstrctIndex = 3;
|
1385
|
+
for (i = 0 ; i < meth->restrictionCount ; i++)
|
1386
|
+
{
|
1387
|
+
rptr = meth->restrictions + i;
|
1388
|
+
theList->contents[rstrctIndex++].integerValue = CreateInteger(theEnv,(long long) roffset + 1);
|
1389
|
+
theList->contents[roffset++].lexemeValue = (rptr->query != NULL) ? TrueSymbol(theEnv) : FalseSymbol(theEnv);
|
1390
|
+
theList->contents[roffset++].integerValue = CreateInteger(theEnv,(long long) rptr->tcnt);
|
1391
|
+
for (j = 0 ; j < rptr->tcnt ; j++)
|
1392
|
+
{
|
1393
|
+
#if OBJECT_SYSTEM
|
1394
|
+
theList->contents[roffset++].lexemeValue = CreateSymbol(theEnv,DefclassName((Defclass *) rptr->types[j]));
|
1395
|
+
#else
|
1396
|
+
theList->contents[roffset++].lexemeValue = CreateSymbol(theEnv,TypeName(theEnv,((CLIPSInteger *) rptr->types[j])->contents));
|
1397
|
+
#endif
|
1398
|
+
}
|
1399
|
+
}
|
1400
|
+
}
|
1401
|
+
|
1402
|
+
/* =========================================
|
1403
|
+
*****************************************
|
1404
|
+
INTERNALLY VISIBLE FUNCTIONS
|
1405
|
+
=========================================
|
1406
|
+
***************************************** */
|
1407
|
+
|
1408
|
+
/***************************************************
|
1409
|
+
NAME : PrintGenericCall
|
1410
|
+
DESCRIPTION : PrintExpression() support function
|
1411
|
+
for generic function calls
|
1412
|
+
INPUTS : 1) The output logical name
|
1413
|
+
2) The generic function
|
1414
|
+
RETURNS : Nothing useful
|
1415
|
+
SIDE EFFECTS : Call expression printed
|
1416
|
+
NOTES : None
|
1417
|
+
***************************************************/
|
1418
|
+
static void PrintGenericCall(
|
1419
|
+
Environment *theEnv,
|
1420
|
+
const char *logName,
|
1421
|
+
Defgeneric *theDefgeneric)
|
1422
|
+
{
|
1423
|
+
#if DEVELOPER
|
1424
|
+
|
1425
|
+
WriteString(theEnv,logName,"(");
|
1426
|
+
WriteString(theEnv,logName,DefgenericName(theDefgeneric));
|
1427
|
+
if (GetFirstArgument() != NULL)
|
1428
|
+
{
|
1429
|
+
WriteString(theEnv,logName," ");
|
1430
|
+
PrintExpression(theEnv,logName,GetFirstArgument());
|
1431
|
+
}
|
1432
|
+
WriteString(theEnv,logName,")");
|
1433
|
+
#else
|
1434
|
+
#if MAC_XCD
|
1435
|
+
#pragma unused(theEnv)
|
1436
|
+
#pragma unused(logName)
|
1437
|
+
#pragma unused(theDefgeneric)
|
1438
|
+
#endif
|
1439
|
+
#endif
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
/*******************************************************
|
1443
|
+
NAME : EvaluateGenericCall
|
1444
|
+
DESCRIPTION : Primitive support function for
|
1445
|
+
calling a generic function
|
1446
|
+
INPUTS : 1) The generic function
|
1447
|
+
2) A data object buffer to hold
|
1448
|
+
the evaluation result
|
1449
|
+
RETURNS : False if the generic function
|
1450
|
+
returns the symbol false,
|
1451
|
+
true otherwise
|
1452
|
+
SIDE EFFECTS : Data obejct buffer set and any
|
1453
|
+
side-effects of calling the generic
|
1454
|
+
NOTES : None
|
1455
|
+
*******************************************************/
|
1456
|
+
static bool EvaluateGenericCall(
|
1457
|
+
Environment *theEnv,
|
1458
|
+
Defgeneric *theDefgeneric,
|
1459
|
+
UDFValue *returnValue)
|
1460
|
+
{
|
1461
|
+
GenericDispatch(theEnv,theDefgeneric,NULL,NULL,GetFirstArgument(),returnValue);
|
1462
|
+
if ((returnValue->header->type == SYMBOL_TYPE) &&
|
1463
|
+
(returnValue->value == FalseSymbol(theEnv)))
|
1464
|
+
return false;
|
1465
|
+
return true;
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
/***************************************************
|
1469
|
+
NAME : DecrementGenericBusyCount
|
1470
|
+
DESCRIPTION : Lowers the busy count of a
|
1471
|
+
generic function construct
|
1472
|
+
INPUTS : The generic function
|
1473
|
+
RETURNS : Nothing useful
|
1474
|
+
SIDE EFFECTS : Busy count decremented if a clear
|
1475
|
+
is not in progress (see comment)
|
1476
|
+
NOTES : None
|
1477
|
+
***************************************************/
|
1478
|
+
static void DecrementGenericBusyCount(
|
1479
|
+
Environment *theEnv,
|
1480
|
+
Defgeneric *theDefgeneric)
|
1481
|
+
{
|
1482
|
+
/* ==============================================
|
1483
|
+
The generics to which expressions in other
|
1484
|
+
constructs may refer may already have been
|
1485
|
+
deleted - thus, it is important not to modify
|
1486
|
+
the busy flag during a clear.
|
1487
|
+
============================================== */
|
1488
|
+
if (! ConstructData(theEnv)->ClearInProgress)
|
1489
|
+
{ theDefgeneric->busy--; }
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
/***************************************************
|
1493
|
+
NAME : IncrementGenericBusyCount
|
1494
|
+
DESCRIPTION : Raises the busy count of a
|
1495
|
+
generic function construct
|
1496
|
+
INPUTS : The generic function
|
1497
|
+
RETURNS : Nothing useful
|
1498
|
+
SIDE EFFECTS : Busy count incremented
|
1499
|
+
NOTES : None
|
1500
|
+
***************************************************/
|
1501
|
+
static void IncrementGenericBusyCount(
|
1502
|
+
Environment *theEnv,
|
1503
|
+
Defgeneric *theDefgeneric)
|
1504
|
+
{
|
1505
|
+
#if MAC_XCD
|
1506
|
+
#pragma unused(theEnv)
|
1507
|
+
#endif
|
1508
|
+
#if (! RUN_TIME) && (! BLOAD_ONLY)
|
1509
|
+
if (! ConstructData(theEnv)->ParsingConstruct)
|
1510
|
+
{ ConstructData(theEnv)->DanglingConstructs++; }
|
1511
|
+
#endif
|
1512
|
+
|
1513
|
+
theDefgeneric->busy++;
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
#if (! BLOAD_ONLY) && (! RUN_TIME)
|
1517
|
+
|
1518
|
+
/**********************************************************************
|
1519
|
+
NAME : SaveDefgenerics
|
1520
|
+
DESCRIPTION : Outputs pretty-print forms of generic function headers
|
1521
|
+
INPUTS : The logical name of the output
|
1522
|
+
RETURNS : Nothing useful
|
1523
|
+
SIDE EFFECTS : None
|
1524
|
+
NOTES : None
|
1525
|
+
**********************************************************************/
|
1526
|
+
static void SaveDefgenerics(
|
1527
|
+
Environment *theEnv,
|
1528
|
+
Defmodule *theModule,
|
1529
|
+
const char *logName,
|
1530
|
+
void *context)
|
1531
|
+
{
|
1532
|
+
SaveConstruct(theEnv,theModule,logName,DefgenericData(theEnv)->DefgenericConstruct);
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
/**********************************************************************
|
1536
|
+
NAME : SaveDefmethods
|
1537
|
+
DESCRIPTION : Outputs pretty-print forms of generic function methods
|
1538
|
+
INPUTS : The logical name of the output
|
1539
|
+
RETURNS : Nothing useful
|
1540
|
+
SIDE EFFECTS : None
|
1541
|
+
NOTES : None
|
1542
|
+
**********************************************************************/
|
1543
|
+
static void SaveDefmethods(
|
1544
|
+
Environment *theEnv,
|
1545
|
+
Defmodule *theModule,
|
1546
|
+
const char *logName,
|
1547
|
+
void *context)
|
1548
|
+
{
|
1549
|
+
DoForAllConstructsInModule(theEnv,theModule,
|
1550
|
+
SaveDefmethodsForDefgeneric,
|
1551
|
+
DefgenericData(theEnv)->DefgenericModuleIndex,
|
1552
|
+
false,(void *) logName);
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
/***************************************************
|
1556
|
+
NAME : SaveDefmethodsForDefgeneric
|
1557
|
+
DESCRIPTION : Save the pretty-print forms of
|
1558
|
+
all methods for a generic function
|
1559
|
+
to a file
|
1560
|
+
INPUTS : 1) The defgeneric
|
1561
|
+
2) The logical name of the output
|
1562
|
+
RETURNS : Nothing useful
|
1563
|
+
SIDE EFFECTS : Methods written
|
1564
|
+
NOTES : None
|
1565
|
+
***************************************************/
|
1566
|
+
static void SaveDefmethodsForDefgeneric(
|
1567
|
+
Environment *theEnv,
|
1568
|
+
ConstructHeader *theDefgeneric,
|
1569
|
+
void *userBuffer)
|
1570
|
+
{
|
1571
|
+
Defgeneric *gfunc = (Defgeneric *) theDefgeneric;
|
1572
|
+
const char *logName = (const char *) userBuffer;
|
1573
|
+
long i;
|
1574
|
+
|
1575
|
+
for (i = 0 ; i < gfunc->mcnt ; i++)
|
1576
|
+
{
|
1577
|
+
if (gfunc->methods[i].header.ppForm != NULL)
|
1578
|
+
{
|
1579
|
+
WriteString(theEnv,logName,gfunc->methods[i].header.ppForm);
|
1580
|
+
WriteString(theEnv,logName,"\n");
|
1581
|
+
}
|
1582
|
+
}
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
/****************************************************
|
1586
|
+
NAME : RemoveDefgenericMethod
|
1587
|
+
DESCRIPTION : Removes a generic function method
|
1588
|
+
from the array and removes the
|
1589
|
+
generic too if its the last method
|
1590
|
+
INPUTS : 1) The generic function
|
1591
|
+
2) The array index of the method
|
1592
|
+
RETURNS : Nothing useful
|
1593
|
+
SIDE EFFECTS : List adjusted
|
1594
|
+
Nodes deallocated
|
1595
|
+
NOTES : Assumes deletion is safe
|
1596
|
+
****************************************************/
|
1597
|
+
static void RemoveDefgenericMethod(
|
1598
|
+
Environment *theEnv,
|
1599
|
+
Defgeneric *gfunc,
|
1600
|
+
unsigned short gi)
|
1601
|
+
{
|
1602
|
+
Defmethod *narr;
|
1603
|
+
unsigned short b,e;
|
1604
|
+
|
1605
|
+
if (gfunc->methods[gi].system)
|
1606
|
+
{
|
1607
|
+
SetEvaluationError(theEnv,true);
|
1608
|
+
PrintErrorID(theEnv,"GENRCCOM",4,false);
|
1609
|
+
WriteString(theEnv,STDERR,"Cannot remove implicit system function method for generic function '");
|
1610
|
+
WriteString(theEnv,STDERR,DefgenericName(gfunc));
|
1611
|
+
WriteString(theEnv,STDERR,"'.\n");
|
1612
|
+
return;
|
1613
|
+
}
|
1614
|
+
DeleteMethodInfo(theEnv,gfunc,&gfunc->methods[gi]);
|
1615
|
+
if (gfunc->mcnt == 1)
|
1616
|
+
{
|
1617
|
+
rm(theEnv,gfunc->methods,sizeof(Defmethod));
|
1618
|
+
gfunc->mcnt = 0;
|
1619
|
+
gfunc->methods = NULL;
|
1620
|
+
}
|
1621
|
+
else
|
1622
|
+
{
|
1623
|
+
gfunc->mcnt--;
|
1624
|
+
narr = (Defmethod *) gm2(theEnv,(sizeof(Defmethod) * gfunc->mcnt));
|
1625
|
+
for (b = e = 0 ; b < gfunc->mcnt ; b++ , e++)
|
1626
|
+
{
|
1627
|
+
if (b == gi)
|
1628
|
+
e++;
|
1629
|
+
GenCopyMemory(Defmethod,1,&narr[b],&gfunc->methods[e]);
|
1630
|
+
}
|
1631
|
+
rm(theEnv,gfunc->methods,(sizeof(Defmethod) * (gfunc->mcnt+1)));
|
1632
|
+
gfunc->methods = narr;
|
1633
|
+
}
|
1634
|
+
}
|
1635
|
+
|
1636
|
+
#endif
|
1637
|
+
|
1638
|
+
#if DEBUGGING_FUNCTIONS
|
1639
|
+
|
1640
|
+
/******************************************************
|
1641
|
+
NAME : ListMethodsForGeneric
|
1642
|
+
DESCRIPTION : Lists a brief description of methods
|
1643
|
+
for a particular generic function
|
1644
|
+
INPUTS : 1) The logical name of the output
|
1645
|
+
2) Generic function to list methods for
|
1646
|
+
RETURNS : The number of methods printed
|
1647
|
+
SIDE EFFECTS : None
|
1648
|
+
NOTES : None
|
1649
|
+
******************************************************/
|
1650
|
+
static unsigned short ListMethodsForGeneric(
|
1651
|
+
Environment *theEnv,
|
1652
|
+
const char *logicalName,
|
1653
|
+
Defgeneric *gfunc)
|
1654
|
+
{
|
1655
|
+
unsigned short gi;
|
1656
|
+
StringBuilder *theSB;
|
1657
|
+
|
1658
|
+
theSB = CreateStringBuilder(theEnv,256);
|
1659
|
+
|
1660
|
+
for (gi = 0 ; gi < gfunc->mcnt ; gi++)
|
1661
|
+
{
|
1662
|
+
WriteString(theEnv,logicalName,DefgenericName(gfunc));
|
1663
|
+
WriteString(theEnv,logicalName," #");
|
1664
|
+
PrintMethod(theEnv,&gfunc->methods[gi],theSB);
|
1665
|
+
WriteString(theEnv,logicalName,theSB->contents);
|
1666
|
+
WriteString(theEnv,logicalName,"\n");
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
SBDispose(theSB);
|
1670
|
+
|
1671
|
+
return gfunc->mcnt;
|
1672
|
+
}
|
1673
|
+
|
1674
|
+
/******************************************************************
|
1675
|
+
NAME : DefgenericWatchAccess
|
1676
|
+
DESCRIPTION : Parses a list of generic names passed by
|
1677
|
+
AddWatchItem() and sets the traces accordingly
|
1678
|
+
INPUTS : 1) A code indicating which trace flag is to be set
|
1679
|
+
Ignored
|
1680
|
+
2) The value to which to set the trace flags
|
1681
|
+
3) A list of expressions containing the names
|
1682
|
+
of the generics for which to set traces
|
1683
|
+
RETURNS : True if all OK, false otherwise
|
1684
|
+
SIDE EFFECTS : Watch flags set in specified generics
|
1685
|
+
NOTES : Accessory function for AddWatchItem()
|
1686
|
+
******************************************************************/
|
1687
|
+
static bool DefgenericWatchAccess(
|
1688
|
+
Environment *theEnv,
|
1689
|
+
int code,
|
1690
|
+
bool newState,
|
1691
|
+
Expression *argExprs)
|
1692
|
+
{
|
1693
|
+
#if MAC_XCD
|
1694
|
+
#pragma unused(code)
|
1695
|
+
#endif
|
1696
|
+
|
1697
|
+
return(ConstructSetWatchAccess(theEnv,DefgenericData(theEnv)->DefgenericConstruct,newState,argExprs,
|
1698
|
+
(ConstructGetWatchFunction *) DefgenericGetWatch,
|
1699
|
+
(ConstructSetWatchFunction *) DefgenericSetWatch));
|
1700
|
+
}
|
1701
|
+
|
1702
|
+
/***********************************************************************
|
1703
|
+
NAME : DefgenericWatchPrint
|
1704
|
+
DESCRIPTION : Parses a list of generic names passed by
|
1705
|
+
AddWatchItem() and displays the traces accordingly
|
1706
|
+
INPUTS : 1) The logical name of the output
|
1707
|
+
2) A code indicating which trace flag is to be examined
|
1708
|
+
Ignored
|
1709
|
+
3) A list of expressions containing the names
|
1710
|
+
of the generics for which to examine traces
|
1711
|
+
RETURNS : True if all OK, false otherwise
|
1712
|
+
SIDE EFFECTS : Watch flags displayed for specified generics
|
1713
|
+
NOTES : Accessory function for AddWatchItem()
|
1714
|
+
***********************************************************************/
|
1715
|
+
static bool DefgenericWatchPrint(
|
1716
|
+
Environment *theEnv,
|
1717
|
+
const char *logName,
|
1718
|
+
int code,
|
1719
|
+
Expression *argExprs)
|
1720
|
+
{
|
1721
|
+
#if MAC_XCD
|
1722
|
+
#pragma unused(code)
|
1723
|
+
#endif
|
1724
|
+
|
1725
|
+
return(ConstructPrintWatchAccess(theEnv,DefgenericData(theEnv)->DefgenericConstruct,logName,argExprs,
|
1726
|
+
(ConstructGetWatchFunction *) DefgenericGetWatch,
|
1727
|
+
(ConstructSetWatchFunction *) DefgenericSetWatch));
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
/******************************************************************
|
1731
|
+
NAME : DefmethodWatchAccess
|
1732
|
+
DESCRIPTION : Parses a list of methods passed by
|
1733
|
+
AddWatchItem() and sets the traces accordingly
|
1734
|
+
INPUTS : 1) A code indicating which trace flag is to be set
|
1735
|
+
Ignored
|
1736
|
+
2) The value to which to set the trace flags
|
1737
|
+
3) A list of expressions containing the methods
|
1738
|
+
for which to set traces
|
1739
|
+
RETURNS : True if all OK, false otherwise
|
1740
|
+
SIDE EFFECTS : Watch flags set in specified methods
|
1741
|
+
NOTES : Accessory function for AddWatchItem()
|
1742
|
+
******************************************************************/
|
1743
|
+
static bool DefmethodWatchAccess(
|
1744
|
+
Environment *theEnv,
|
1745
|
+
int code,
|
1746
|
+
bool newState,
|
1747
|
+
Expression *argExprs)
|
1748
|
+
{
|
1749
|
+
#if MAC_XCD
|
1750
|
+
#pragma unused(code)
|
1751
|
+
#endif
|
1752
|
+
if (newState)
|
1753
|
+
return(DefmethodWatchSupport(theEnv,"watch",NULL,newState,NULL,DefmethodSetWatch,argExprs));
|
1754
|
+
else
|
1755
|
+
return(DefmethodWatchSupport(theEnv,"unwatch",NULL,newState,NULL,DefmethodSetWatch,argExprs));
|
1756
|
+
}
|
1757
|
+
|
1758
|
+
/***********************************************************************
|
1759
|
+
NAME : DefmethodWatchPrint
|
1760
|
+
DESCRIPTION : Parses a list of methods passed by
|
1761
|
+
AddWatchItem() and displays the traces accordingly
|
1762
|
+
INPUTS : 1) The logical name of the output
|
1763
|
+
2) A code indicating which trace flag is to be examined
|
1764
|
+
Ignored
|
1765
|
+
3) A list of expressions containing the methods for
|
1766
|
+
which to examine traces
|
1767
|
+
RETURNS : True if all OK, false otherwise
|
1768
|
+
SIDE EFFECTS : Watch flags displayed for specified methods
|
1769
|
+
NOTES : Accessory function for AddWatchItem()
|
1770
|
+
***********************************************************************/
|
1771
|
+
static bool DefmethodWatchPrint(
|
1772
|
+
Environment *theEnv,
|
1773
|
+
const char *logName,
|
1774
|
+
int code,
|
1775
|
+
Expression *argExprs)
|
1776
|
+
{
|
1777
|
+
#if MAC_XCD
|
1778
|
+
#pragma unused(code)
|
1779
|
+
#endif
|
1780
|
+
return(DefmethodWatchSupport(theEnv,"list-watch-items",logName,0,
|
1781
|
+
PrintMethodWatchFlag,NULL,argExprs));
|
1782
|
+
}
|
1783
|
+
|
1784
|
+
/*******************************************************
|
1785
|
+
NAME : DefmethodWatchSupport
|
1786
|
+
DESCRIPTION : Sets or displays methods specified
|
1787
|
+
INPUTS : 1) The calling function name
|
1788
|
+
2) The logical output name for displays
|
1789
|
+
(can be NULL)
|
1790
|
+
3) The new set state
|
1791
|
+
4) The print function (can be NULL)
|
1792
|
+
5) The trace function (can be NULL)
|
1793
|
+
6) The methods expression list
|
1794
|
+
RETURNS : True if all OK,
|
1795
|
+
false otherwise
|
1796
|
+
SIDE EFFECTS : Method trace flags set or displayed
|
1797
|
+
NOTES : None
|
1798
|
+
*******************************************************/
|
1799
|
+
static bool DefmethodWatchSupport(
|
1800
|
+
Environment *theEnv,
|
1801
|
+
const char *funcName,
|
1802
|
+
const char *logName,
|
1803
|
+
bool newState,
|
1804
|
+
void (*printFunc)(Environment *,const char *,Defgeneric *,unsigned short),
|
1805
|
+
void (*traceFunc)(Defgeneric *,unsigned short,bool),
|
1806
|
+
Expression *argExprs)
|
1807
|
+
{
|
1808
|
+
Defgeneric *theGeneric = NULL;
|
1809
|
+
unsigned short theMethod = 0;
|
1810
|
+
unsigned int argIndex = 2;
|
1811
|
+
UDFValue genericName, methodIndex;
|
1812
|
+
Defmodule *theModule;
|
1813
|
+
|
1814
|
+
/* ==============================
|
1815
|
+
If no methods are specified,
|
1816
|
+
show the trace for all methods
|
1817
|
+
in all generics
|
1818
|
+
============================== */
|
1819
|
+
if (argExprs == NULL)
|
1820
|
+
{
|
1821
|
+
SaveCurrentModule(theEnv);
|
1822
|
+
theModule = GetNextDefmodule(theEnv,NULL);
|
1823
|
+
while (theModule != NULL)
|
1824
|
+
{
|
1825
|
+
SetCurrentModule(theEnv,theModule);
|
1826
|
+
if (traceFunc == NULL)
|
1827
|
+
{
|
1828
|
+
WriteString(theEnv,logName,DefmoduleName(theModule));
|
1829
|
+
WriteString(theEnv,logName,":\n");
|
1830
|
+
}
|
1831
|
+
theGeneric = GetNextDefgeneric(theEnv,NULL);
|
1832
|
+
while (theGeneric != NULL)
|
1833
|
+
{
|
1834
|
+
theMethod = GetNextDefmethod(theGeneric,0);
|
1835
|
+
while (theMethod != 0)
|
1836
|
+
{
|
1837
|
+
if (traceFunc != NULL)
|
1838
|
+
(*traceFunc)(theGeneric,theMethod,newState);
|
1839
|
+
else
|
1840
|
+
{
|
1841
|
+
WriteString(theEnv,logName," ");
|
1842
|
+
(*printFunc)(theEnv,logName,theGeneric,theMethod);
|
1843
|
+
}
|
1844
|
+
theMethod = GetNextDefmethod(theGeneric,theMethod);
|
1845
|
+
}
|
1846
|
+
theGeneric = GetNextDefgeneric(theEnv,theGeneric);
|
1847
|
+
}
|
1848
|
+
theModule = GetNextDefmodule(theEnv,theModule);
|
1849
|
+
}
|
1850
|
+
RestoreCurrentModule(theEnv);
|
1851
|
+
return true;
|
1852
|
+
}
|
1853
|
+
|
1854
|
+
/* =========================================
|
1855
|
+
Set the traces for every method specified
|
1856
|
+
========================================= */
|
1857
|
+
while (argExprs != NULL)
|
1858
|
+
{
|
1859
|
+
if (EvaluateExpression(theEnv,argExprs,&genericName))
|
1860
|
+
return false;
|
1861
|
+
if ((genericName.header->type != SYMBOL_TYPE) ? true :
|
1862
|
+
((theGeneric =
|
1863
|
+
LookupDefgenericByMdlOrScope(theEnv,genericName.lexemeValue->contents)) == NULL))
|
1864
|
+
{
|
1865
|
+
ExpectedTypeError1(theEnv,funcName,argIndex,"'generic function name'");
|
1866
|
+
return false;
|
1867
|
+
}
|
1868
|
+
if (GetNextArgument(argExprs) == NULL)
|
1869
|
+
theMethod = 0;
|
1870
|
+
else
|
1871
|
+
{
|
1872
|
+
argExprs = GetNextArgument(argExprs);
|
1873
|
+
argIndex++;
|
1874
|
+
if (EvaluateExpression(theEnv,argExprs,&methodIndex))
|
1875
|
+
return false;
|
1876
|
+
if ((methodIndex.header->type != INTEGER_TYPE) ? false :
|
1877
|
+
((methodIndex.integerValue->contents <= 0) ? false :
|
1878
|
+
(FindMethodByIndex(theGeneric,theMethod) != METHOD_NOT_FOUND)))
|
1879
|
+
theMethod = (unsigned short) methodIndex.integerValue->contents;
|
1880
|
+
else
|
1881
|
+
{
|
1882
|
+
ExpectedTypeError1(theEnv,funcName,argIndex,"'method index'");
|
1883
|
+
return false;
|
1884
|
+
}
|
1885
|
+
}
|
1886
|
+
if (theMethod == 0)
|
1887
|
+
{
|
1888
|
+
theMethod = GetNextDefmethod(theGeneric,0);
|
1889
|
+
while (theMethod != 0)
|
1890
|
+
{
|
1891
|
+
if (traceFunc != NULL)
|
1892
|
+
(*traceFunc)(theGeneric,theMethod,newState);
|
1893
|
+
else
|
1894
|
+
(*printFunc)(theEnv,logName,theGeneric,theMethod);
|
1895
|
+
theMethod = GetNextDefmethod(theGeneric,theMethod);
|
1896
|
+
}
|
1897
|
+
}
|
1898
|
+
else
|
1899
|
+
{
|
1900
|
+
if (traceFunc != NULL)
|
1901
|
+
(*traceFunc)(theGeneric,theMethod,newState);
|
1902
|
+
else
|
1903
|
+
(*printFunc)(theEnv,logName,theGeneric,theMethod);
|
1904
|
+
}
|
1905
|
+
argExprs = GetNextArgument(argExprs);
|
1906
|
+
argIndex++;
|
1907
|
+
}
|
1908
|
+
return true;
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
/***************************************************
|
1912
|
+
NAME : PrintMethodWatchFlag
|
1913
|
+
DESCRIPTION : Displays trace value for method
|
1914
|
+
INPUTS : 1) The logical name of the output
|
1915
|
+
2) The generic function
|
1916
|
+
3) The method index
|
1917
|
+
RETURNS : Nothing useful
|
1918
|
+
SIDE EFFECTS : None
|
1919
|
+
NOTES : None
|
1920
|
+
***************************************************/
|
1921
|
+
static void PrintMethodWatchFlag(
|
1922
|
+
Environment *theEnv,
|
1923
|
+
const char *logName,
|
1924
|
+
Defgeneric *theGeneric,
|
1925
|
+
unsigned short theMethod)
|
1926
|
+
{
|
1927
|
+
StringBuilder *theSB = CreateStringBuilder(theEnv,60);
|
1928
|
+
|
1929
|
+
WriteString(theEnv,logName,DefgenericName(theGeneric));
|
1930
|
+
WriteString(theEnv,logName," ");
|
1931
|
+
DefmethodDescription(theGeneric,theMethod,theSB);
|
1932
|
+
WriteString(theEnv,logName,theSB->contents);
|
1933
|
+
if (DefmethodGetWatch(theGeneric,theMethod))
|
1934
|
+
WriteString(theEnv,logName," = on\n");
|
1935
|
+
else
|
1936
|
+
WriteString(theEnv,logName," = off\n");
|
1937
|
+
|
1938
|
+
SBDispose(theSB);
|
1939
|
+
}
|
1940
|
+
|
1941
|
+
#endif
|
1942
|
+
|
1943
|
+
#if ! OBJECT_SYSTEM
|
1944
|
+
|
1945
|
+
/***************************************************
|
1946
|
+
NAME : TypeCommand
|
1947
|
+
DESCRIPTION : Works like "class" in COOL
|
1948
|
+
INPUTS : None
|
1949
|
+
RETURNS : Nothing useful
|
1950
|
+
SIDE EFFECTS : None
|
1951
|
+
NOTES : H/L Syntax: (type <primitive>)
|
1952
|
+
***************************************************/
|
1953
|
+
void TypeCommand(
|
1954
|
+
Environment *theEnv,
|
1955
|
+
UDFContext *context,
|
1956
|
+
UDFValue *returnValue)
|
1957
|
+
{
|
1958
|
+
UDFValue result;
|
1959
|
+
|
1960
|
+
EvaluateExpression(theEnv,GetFirstArgument(),&result);
|
1961
|
+
|
1962
|
+
returnValue->lexemeValue = CreateSymbol(theEnv,TypeName(theEnv,result.header->type));
|
1963
|
+
}
|
1964
|
+
|
1965
|
+
#endif
|
1966
|
+
|
1967
|
+
/*#############################*/
|
1968
|
+
/* Additional Access Functions */
|
1969
|
+
/*#############################*/
|
1970
|
+
|
1971
|
+
void SetNextDefgeneric(
|
1972
|
+
Defgeneric *theDefgeneric,
|
1973
|
+
Defgeneric *targetDefgeneric)
|
1974
|
+
{
|
1975
|
+
SetNextConstruct(&theDefgeneric->header,
|
1976
|
+
&targetDefgeneric->header);
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
/*##################################*/
|
1980
|
+
/* Additional Environment Functions */
|
1981
|
+
/*##################################*/
|
1982
|
+
|
1983
|
+
const char *DefgenericModule(
|
1984
|
+
Defgeneric *theDefgeneric)
|
1985
|
+
{
|
1986
|
+
return GetConstructModuleName(&theDefgeneric->header);
|
1987
|
+
}
|
1988
|
+
|
1989
|
+
const char *DefgenericName(
|
1990
|
+
Defgeneric *theDefgeneric)
|
1991
|
+
{
|
1992
|
+
return GetConstructNameString(&theDefgeneric->header);
|
1993
|
+
}
|
1994
|
+
|
1995
|
+
const char *DefgenericPPForm(
|
1996
|
+
Defgeneric *theDefgeneric)
|
1997
|
+
{
|
1998
|
+
return GetConstructPPForm(&theDefgeneric->header);
|
1999
|
+
}
|
2000
|
+
|
2001
|
+
CLIPSLexeme *GetDefgenericNamePointer(
|
2002
|
+
Defgeneric *theDefgeneric)
|
2003
|
+
{
|
2004
|
+
return GetConstructNamePointer(&theDefgeneric->header);
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
void SetDefgenericPPForm(
|
2008
|
+
Environment *theEnv,
|
2009
|
+
Defgeneric *theDefgeneric,
|
2010
|
+
const char *thePPForm)
|
2011
|
+
{
|
2012
|
+
SetConstructPPForm(theEnv,&theDefgeneric->header,thePPForm);
|
2013
|
+
}
|
2014
|
+
|
2015
|
+
|
2016
|
+
#endif /* DEFGENERIC_CONSTRUCT */
|
2017
|
+
|