aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-05-17 15:37:57 +0000
committerdos-reis <gdr@axiomatics.org>2011-05-17 15:37:57 +0000
commite6d8d5bae2f449dac29859066530aafe8aa47006 (patch)
tree4e49c1c793cd5b2f3b7f81ec65b12956fd0cedbb
parent86a5494a7187d226750c7cf49ce2c6505ec87079 (diff)
downloadopen-axiom-e6d8d5bae2f449dac29859066530aafe8aa47006.tar.gz
* interp/buildom.boot (EnumerationCategory): Rewrite.
* interp/compiler.boot (compEnumCat): New. Compile EnumerationCategory forms.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/buildom.boot13
-rw-r--r--src/interp/compiler.boot9
-rw-r--r--src/interp/debug.lisp2
4 files changed, 25 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c8e4b572..a06b69f5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-17 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/buildom.boot (EnumerationCategory): Rewrite.
+ * interp/compiler.boot (compEnumCat): New. Compile
+ EnumerationCategory forms.
+
2011-05-16 Gabriel Dos Reis <gdr@cs.tamu.edu>
* boot/ast.boot (bfAtScope): New.
diff --git a/src/interp/buildom.boot b/src/interp/buildom.boot
index 508c325c..a7765057 100644
--- a/src/interp/buildom.boot
+++ b/src/interp/buildom.boot
@@ -481,6 +481,14 @@ coerceMap2E(x) ==
--% Enumeration
+EnumerationCategory(:"args") ==
+ cat := eval ['Join,$SetCategory,
+ ['mkCategory,quoteForm 'domain,
+ quoteForm [[[arg,['$],'constant],'T] for arg in args],
+ [], [], nil]]
+ canonicalForm(cat) := ['EnumerationCategory,:args]
+ cat
+
Enumeration(:"args") ==
nargs := #args
dom := newShell(nargs + 9)
@@ -498,7 +506,8 @@ Enumeration(:"args") ==
vectorRef(dom,3) := ["EnumerationCategory",:instantiationArgs dom]
vectorRef(dom,4) := [$commonCategoryDefaults, $commonCategoryAncestors]
vectorRef(dom,5) := nil
- for i in $FirstParamSlot.. for a in args repeat dom.i := a
+ for i in $FirstParamSlot.. for a in args repeat
+ dom.i := a
dom.($FirstParamSlot + nargs) := [function EnumEqual, :dom]
dom.($FirstParamSlot + nargs + 1) := [function EnumPrint, :dom]
dom.($FirstParamSlot + nargs + 2) := [function createEnum, :dom]
@@ -522,8 +531,6 @@ createEnum(sym, dom) ==
RecordCategory(:"x") == constructorCategory ["Record",:x]
-EnumerationCategory(:"x") == constructorCategory ["Enumeration",:x]
-
UnionCategory(:"x") == constructorCategory ["Union",:x]
constructorCategory (title is [op,:.]) ==
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index e165751e..df460c2c 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -735,6 +735,12 @@ substituteIntoFunctorModemap(argl,modemap is [[dc,:sig],:.],e) ==
compConstructorCategory(x,m,e) == [x,resolve($Category,m),e]
+compEnumCat(x,m,e) ==
+ for arg in x.args repeat
+ IDENTP arg => nil -- OK
+ stackAndThrow('"all arguments to %1b must be identifiers",[x.op])
+ [x,resolve($Category,m),e]
+
--% SUBSET CATEGORY
compSubsetCategory: (%Form,%Mode,%Env) -> %Maybe %Triple
@@ -2639,6 +2645,7 @@ for x in [["|", :"compSuchthat"],_
["DEF", :"compDefine"],_
["elt", :"compElt"],_
["Enumeration", :"compCat"],_
+ ["EnumerationCategory", :"compEnumCat"],_
["exit", :"compExit"],_
["has", :"compHas"],_
["IF", : "compIf"],_
@@ -2659,9 +2666,9 @@ for x in [["|", :"compSuchthat"],_
["SEQ", :"compSeq"],_
["SubDomain", :"compSubDomain"],_
["SubsetCategory", :"compSubsetCategory"],_
- ["Union", :"compCat"],_
["Mapping", :"compCat"],_
["MappingCategory", :"compConstructorCategory"],_
+ ["Union", :"compCat"],_
["UnionCategory", :"compConstructorCategory"],_
["where", :"compWhere"],_
["per",:"compPer"],_
diff --git a/src/interp/debug.lisp b/src/interp/debug.lisp
index a9ca2349..7e409ff3 100644
--- a/src/interp/debug.lisp
+++ b/src/interp/debug.lisp
@@ -720,7 +720,7 @@ EXAMINE (SETQ RECNO (NOTE |$InputStream|))
(T (COND (|$mathTrace| (TERPRI)))
(PRINMATHOR0 VAL CURSTRM)))))))
-(DEFUN MONITOR-BLANKS (N) (PRINC (MAKE-FULL-CVEC N " ") CURSTRM))
+(DEFUN MONITOR-BLANKS (N) (PRINC (|makeString| N (|char| " ")) CURSTRM))
(DEFUN MONITOR-EVALBEFORE (X) (EVAL (MONITOR-EVALTRAN X NIL)) X)