aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-05-18 19:55:44 +0000
committerdos-reis <gdr@axiomatics.org>2011-05-18 19:55:44 +0000
commit8fd728f1eb83adab31f40b158ef4eda4dcf02c51 (patch)
treee58e2816a33fdbc7fa0a0f1176f5284c8b8f1d2f /src
parent05cfbe1549263c70656adce66f06d8ffe8bfa29a (diff)
downloadopen-axiom-8fd728f1eb83adab31f40b158ef4eda4dcf02c51.tar.gz
* interp/buildom.boot (mkEnumerationFunList): Include enum
constants in the operation list.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/interp/buildom.boot21
2 files changed, 16 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3f372bf1..2be3f121 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2011-05-18 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/buildom.boot (mkEnumerationFunList): Include enum
+ constants in the operation list.
+
+2011-05-18 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/buildom.boot (Enumeration): Provide implementation of
constants.
diff --git a/src/interp/buildom.boot b/src/interp/buildom.boot
index 2907bb8d..a1e0db1a 100644
--- a/src/interp/buildom.boot
+++ b/src/interp/buildom.boot
@@ -519,7 +519,7 @@ Enumeration(:"args") ==
nargs := #args
dom := newShell(2 * nargs + 9)
-- JHD added an extra slot to cache EQUAL methods
- canonicalForm(dom) := ["Enumeration", :args]
+ canonicalForm(dom) := ["Enumeration",:args]
domainRef(dom,1) :=
["lookupInTable",dom,
[["=",[[$Boolean,"$","$"],:oldSlotCode nargs]],
@@ -613,7 +613,7 @@ mkNewUnionFunList(name,form is ["Union",:listOfEntries],e) ==
m := dollarIfRepHack name
--2. create coercions from subtypes to subUnion
cList:=
- [["=",[$Boolean,name ,name],["ELT",dc,$FirstParamSlot+nargs]],
+ [["=",[$Boolean,name,name],["ELT",dc,$FirstParamSlot+nargs]],
["~=",[$Boolean,name,name],["ELT",dc,0]],
["hash",[$SingleInteger,name],["ELT",dc,0]],
["coerce",[$OutputForm,name],["ELT",dc,$FirstParamSlot+nargs+1]],:
@@ -634,16 +634,17 @@ mkNewUnionFunList(name,form is ["Union",:listOfEntries],e) ==
["%tail",gg]]]
[cList,e]
-mkEnumerationFunList(nam,["Enumeration",:SL],e) ==
- len:= #SL
- dc := nam
+mkEnumerationFunList(dc,["Enumeration",:SL],e) ==
+ len := #SL
cList :=
[nil,
- ["=",[$Boolean,nam ,nam],["ELT",dc,$FirstParamSlot+len]],
- ["~=",[$Boolean,nam ,nam],["ELT",dc,0]],
- ["coerce",[nam, ["Symbol"]], ["ELT", dc,$FirstParamSlot+len+1]],
- ["coerce",[["OutputForm"],nam],["ELT",dc,$FirstParamSlot+len+2]]]
- [substitute(nam, dc, cList),e]
+ ["=",[$Boolean,dc,dc],["XLAM",["#1","#2"],['%ieq,"#1","#2"]]],
+ ["~=",[$Boolean,dc,dc],["XLAM",["#1","#2"],['%not,['%ieq,"#1","#2"]]]],
+ ["coerce",[dc,$Symbol],["ELT",dc,$FirstParamSlot+len+1]],
+ ["coerce",[$OutputForm,dc],["ELT",dc,$FirstParamSlot+len+2]],
+ :[[arg,[dc],["XLAM",[],v]] for arg in SL for v in 0..]
+ ]
+ [cList,e]
mkUnionFunList(op,form is ["Union",:listOfEntries],e) ==
first listOfEntries is [":",.,.] => mkNewUnionFunList(op,form,e)