aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-10-29 18:30:08 +0000
committerdos-reis <gdr@axiomatics.org>2011-10-29 18:30:08 +0000
commitd36e49b1da407f6cced17a9a0af2bdad8d08fd0f (patch)
treeb66847b9da49c20fcddd981be3794c98ff8cedef
parent3cb1a587dfe4e2c84232aad18a4c695f8dabea96 (diff)
downloadopen-axiom-d36e49b1da407f6cced17a9a0af2bdad8d08fd0f.tar.gz
* interp/define.boot ($atList, $sigList): Remove.
(compSignature): Take a fourth parameter. (compCategoryItem): Take two more parameters. (compCategory): Create references to signature and attribute lists and pass them to callees.
-rw-r--r--src/ChangeLog8
-rw-r--r--src/interp/define.boot55
2 files changed, 38 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2b3f8191..bd4d6233 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
2011-10-29 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/define.boot ($atList, $sigList): Remove.
+ (compSignature): Take a fourth parameter.
+ (compCategoryItem): Take two more parameters.
+ (compCategory): Create references to signature and attribute lists
+ and pass them to callees.
+
+2011-10-29 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/lisplib.boot (makePredicateBitVector): Take a DB argument.
Set dbPredicates.
(compConLib1): Set dbPredicates to nil.
diff --git a/src/interp/define.boot b/src/interp/define.boot
index 3d282ec6..fd2b3f9e 100644
--- a/src/interp/define.boot
+++ b/src/interp/define.boot
@@ -89,8 +89,6 @@ $CapsuleModemapFrame := nil
$CapsuleDomainsInScope := nil
$signatureOfForm := nil
$addFormLhs := nil
-$sigList := []
-$atList := []
++ List of declarations appearing as side conditions of a where-expression.
$whereDecls := nil
@@ -2446,42 +2444,48 @@ DomainSubstitutionFunction(parameters,body) ==
++ Subroutine of compCategoryItem.
++ Compile exported signature `opsig' under predicate `pred' in
-++ environment `env'.
-compSignature(opsig,pred,env) ==
+++ environment `env'. The parameters `sigs' is a reference to a list
+++ of signatures elaborated so far.
+compSignature(opsig,pred,env,sigs) ==
[op,:sig] := opsig
cons? op =>
for y in op repeat
- compSignature([y,:sig],pred,env)
+ compSignature([y,:sig],pred,env,sigs)
op in '(per rep) =>
stackSemanticError(['"cannot export signature for", :bright op],nil)
nil
noteExport(opsig,pred)
- PUSH(MKQ [opsig,pred],$sigList)
+ deref(sigs) := [MKQ [opsig,pred],:deref sigs]
-compCategoryItem(x,predl,env) ==
+++ Subroutine of comCategory.
+++ Elaborate a category-level item `x' under the predicates `predl'.
+++ The parameters `sigs' and `atts' are references to list of
+++ signatures and attributes elaborated so far.
+compCategoryItem(x,predl,env,sigs,atts) ==
x is nil => nil
--1. if x is a conditional expression, recurse; otherwise, form the predicate
x is ['%when,[p,e]] =>
predl':= [p,:predl]
e is ["PROGN",:l] =>
- for y in l repeat compCategoryItem(y,predl',env)
- compCategoryItem(e,predl',env)
+ for y in l repeat compCategoryItem(y,predl',env,sigs,atts)
+ compCategoryItem(e,predl',env,sigs,atts)
x is ["IF",a,b,c] =>
- a is ["not",p] => compCategoryItem(["IF",p,c,b],predl,env)
+ a is ["not",p] => compCategoryItem(["IF",p,c,b],predl,env,sigs,atts)
a is ["and",p,q] =>
- compCategoryItem(["IF",p,["IF",q,b,c],COPY c],predl,env)
+ compCategoryItem(["IF",p,["IF",q,b,c],COPY c],predl,env,sigs,atts)
a is ["or",p,q] =>
- compCategoryItem(["IF",p,b,["IF",q,COPY b,c]],predl,env)
+ compCategoryItem(["IF",p,b,["IF",q,COPY b,c]],predl,env,sigs,atts)
predl':= [a,:predl]
if b~="%noBranch" then
b is ["PROGN",:l] =>
- for y in l repeat compCategoryItem(y,predl',env)
- compCategoryItem(b,predl',env)
+ for y in l repeat compCategoryItem(y,predl',env,sigs,atts)
+ compCategoryItem(b,predl',env,sigs,atts)
c="%noBranch" => nil
predl':= [["not",a],:predl]
c is ["PROGN",:l] =>
- for y in l repeat compCategoryItem(y,predl',env)
- compCategoryItem(c,predl',env)
+ for y in l repeat
+ compCategoryItem(y,predl',env,sigs,atts)
+ compCategoryItem(c,predl',env,sigs,atts)
pred := (predl => MKPF(predl,"AND"); true)
--2. if attribute, push it and return
@@ -2489,28 +2493,29 @@ compCategoryItem(x,predl,env) ==
-- Attribute 'nil' carries no semantics.
y = "nil" => nil
noteExport(y,pred)
- PUSH(MKQ [y,pred],$atList)
+ deref(atts) := [MKQ [y,pred],:deref atts]
--3. it may be a list, with PROGN as the first, and some information as the rest
x is ["PROGN",:l] =>
for u in l repeat
- compCategoryItem(u,predl,env)
+ compCategoryItem(u,predl,env,sigs,atts)
-- 4. otherwise, x gives a signature for a
-- single operator name or a list of names; if a list of names,
-- recurse
- x is ["SIGNATURE",:opsig] => compSignature(opsig,pred,env)
+ x is ["SIGNATURE",:opsig] => compSignature(opsig,pred,env,sigs)
systemErrorHere ["compCategoryItem",x]
compCategory: (%Form,%Mode,%Env) -> %Maybe %Triple
compCategory(x,m,e) ==
clearExportsTable()
- (m:= resolve(m,$Category))=$Category and x is ['CATEGORY,
- domainOrPackage,:l] =>
- $sigList: local := nil
- $atList: local := nil
- for x in l repeat compCategoryItem(x,nil,e)
- rep:= mkExplicitCategoryFunction(domainOrPackage,$sigList,$atList)
+ m := resolve(m,$Category)
+ m = $Category and x is ['CATEGORY,kind,:l] =>
+ sigs := ref nil
+ atts := ref nil
+ for x in l repeat
+ compCategoryItem(x,nil,e,sigs,atts)
+ rep := mkExplicitCategoryFunction(kind,deref sigs,deref atts)
--if inside compDefineCategory, provide for category argument substitution
[rep,m,e]
systemErrorHere ["compCategory",x]