From 4a8c82c52e9cf88d925c1de807307b6ec8d26c9b Mon Sep 17 00:00:00 2001 From: dos-reis Date: Thu, 15 Oct 2009 09:52:30 +0000 Subject: * interp/buildom.boot: Tidy. --- src/ChangeLog | 4 ++++ src/interp/buildom.boot | 25 +++++++++++++++++-------- src/interp/i-funsel.boot | 3 ++- src/testsuite/interpreter/builtin.input | 12 ++++++++++++ 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 src/testsuite/interpreter/builtin.input diff --git a/src/ChangeLog b/src/ChangeLog index 20f386c8..8c9a8334 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2009-10-15 Gabriel Dos Reis + * interp/buildom.boot: Tidy. + +2009-10-15 Gabriel Dos Reis + * interp/i-syscmd.boot (reportOpsFromUnitDirectly): Tidy. 2009-10-14 Gabriel Dos Reis diff --git a/src/interp/buildom.boot b/src/interp/buildom.boot index 65beaa4c..0aff103a 100644 --- a/src/interp/buildom.boot +++ b/src/interp/buildom.boot @@ -89,8 +89,9 @@ Record(:args) == dom.1 := ["lookupInTable",dom, [["=",[[$Boolean,"$","$"],:oldSlotCode nargs]], - ["~=",[[$Boolean,"$","$"],:0]], - ["coerce",[[$OutputForm,"$"],:oldSlotCode(nargs + 1)]]]] + ["~=",[[$Boolean,"$","$"],:0]], + ["hash",[[$SingleInteger,"$"],:0]], + ["coerce",[[$OutputForm,"$"],:oldSlotCode(nargs + 1)]]]] dom.2 := NIL dom.3 := ["RecordCategory",:QCDR dom.0] dom.4 := [$commonCategoryDefaults, $commonCategoryAncestors] @@ -164,7 +165,8 @@ Union(:args) == ["lookupInTable",dom, [["=",[[$Boolean,"$","$"],:oldSlotCode nargs]], ["~=",[[$Boolean,"$","$"],:0]], - ["coerce",[[$OutputForm,"$"],:oldSlotCode (nargs+1)]]]] + ["hash", [[$SingleInteger,"$"],:0]], + ["coerce",[[$OutputForm,"$"],:oldSlotCode (nargs+1)]]]] dom.2 := NIL dom.3 := ["UnionCategory",:QCDR dom.0] dom.4 := [$commonCategoryDefaults, $commonCategoryAncestors] @@ -219,7 +221,8 @@ Mapping(:args) == ["lookupInTable",dom, [["=",[[$Boolean,"$","$"],:oldSlotCode nargs]], ["~=",[[$Boolean,"$","$"],:0]], - ["coerce",[[$OutputForm,"$"],:oldSlotCode(nargs + 1)]]]] + ["hash", [[$SingleInteger,"$"],:0]], + ["coerce",[[$OutputForm,"$"],:oldSlotCode(nargs + 1)]]]] dom.2 := NIL dom.3 := '(SetCategory) dom.4 := [$commonCategoryDefaults, $commonCategoryAncestors] @@ -254,9 +257,10 @@ Enumeration(:"args") == ["lookupInTable",dom, [["=",[[$Boolean,"$","$"],:oldSlotCode nargs]], ["~=",[[$Boolean,"$","$"],:0]], - ["coerce",[[$OutputForm,"$"],:oldSlotCode(nargs+1)], - [["$", $Symbol], :oldSlotCode(nargs+2)]] - ]] + ["hash", [[$SingleInteger,"$"],:0]], + ["coerce",[[$OutputForm,"$"],:oldSlotCode(nargs+1)], + [["$", $Symbol], :oldSlotCode(nargs+2)]] + ]] dom.2 := NIL dom.3 := ["EnumerationCategory",:QCDR dom.0] dom.4 := [$commonCategoryDefaults, $commonCategoryAncestors] @@ -308,7 +312,9 @@ mkMappingFunList(nam,mapForm,e) == sigFunAlist:= [["=",[$Boolean,nam ,nam], ["ELT",dc,$FirstParamSlot + nargs]], ["~=",[$Boolean,nam,nam],["ELT",dc,0]], - ["coerce",[$OutputForm,nam], ["ELT",dc,$FirstParamSlot + nargs + 1]]] + ["hash",[$SingleInteger,nam],["ELT",dc,0]], + ["coerce",[$OutputForm,nam], + ["ELT",dc,$FirstParamSlot + nargs + 1]]] [substitute(nam,dc,substituteDollarIfRepHack sigFunAlist),e] mkRecordFunList(nam,["Record",:Alist],e) == @@ -318,6 +324,7 @@ mkRecordFunList(nam,["Record",:Alist],e) == [["construct",[nam,:[A for [.,a,A] in Alist]],"mkRecord"], ["=",[$Boolean,nam ,nam],["ELT",dc,$FirstParamSlot + len]], ["~=",[$Boolean,nam,nam],["ELT",dc,0]], + ["hash",[$SingleInteger,nam],["ELT",dc,0]], ["coerce",[$OutputForm,nam],["ELT",dc,$FirstParamSlot+len+1]],: [["elt",[A,nam,PNAME a],["XLAM",["$1","$2"],["RECORDELT","$1",i,len]]] for i in 0.. for [.,a,A] in Alist],: @@ -336,6 +343,7 @@ mkNewUnionFunList(name,form is ["Union",:listOfEntries],e) == cList:= [["=",[$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]],: ("append"/ [[["construct",[name,type],["XLAM",["#1"],["CONS",i,"#1"]]], @@ -373,6 +381,7 @@ mkUnionFunList(op,form is ["Union",:listOfEntries],e) == cList:= [["=",[$Boolean,g ,g],["ELT",op,$FirstParamSlot + nargs]], ["~=",[$Boolean,g,g],["ELT",op,0]], + ["hash",[$SingleInteger,g],["ELT",op,0]], ["coerce",[$OutputForm,g],["ELT",op,$FirstParamSlot+nargs+1]],: ("append"/ [[["autoCoerce",[g,t],upFun], diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot index 069c37a8..68c93033 100644 --- a/src/interp/i-funsel.boot +++ b/src/interp/i-funsel.boot @@ -890,7 +890,8 @@ findFunctionInCategory(op,dc,tar,args1,args2,$Coerce,$SubDom) == if CONSP(xargs) then maxargs := MAX(maxargs,#xargs) else maxargs := MAX(maxargs,1) impls := cons([b,nil,true,d],impls) - impls := cons([b,d,true,d],impls) + d isnt [k,"$",n] => systemErrorHere ["findFunctionInCategory",d] + impls := [[b,n,true,k],:impls] impls := nreverse impls if maxargs ~= -1 then SL:= NIL diff --git a/src/testsuite/interpreter/builtin.input b/src/testsuite/interpreter/builtin.input new file mode 100644 index 00000000..7ceb0cd0 --- /dev/null +++ b/src/testsuite/interpreter/builtin.input @@ -0,0 +1,12 @@ +-- test operations from builtin domains. + +T := Record(f: Integer) + +t0 := [9]@T + +t1 := [1]@T + +hash t0 +t0 ~= t1 + + -- cgit v1.2.3