From b2eb2e7744d9947f6b5cf61c917014d9d5a4da7d Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sat, 16 Jan 2016 13:47:40 -0800 Subject: Reduce dependencies on databases to catgeory.daase during algebra build --- configure | 20 ++--- configure.ac | 2 +- src/ChangeLog | 24 ++++++ src/algebra/Makefile.am | 9 +- src/algebra/Makefile.in | 9 +- src/algebra/compiler.spad.pamphlet | 21 +++-- src/algebra/crfp.spad.pamphlet | 3 +- src/algebra/data.spad.pamphlet | 7 +- src/algebra/generic.spad.pamphlet | 3 +- src/algebra/java.spad.pamphlet | 14 ++-- src/algebra/oderf.spad.pamphlet | 2 +- src/algebra/syntax.spad.pamphlet | 165 ++++++++++++------------------------- src/interp/c-util.boot | 7 +- src/interp/daase.lisp | 12 --- src/interp/database.boot | 84 ++++++++++++------- src/interp/i-funsel.boot | 5 +- src/interp/i-special.boot | 3 +- src/interp/lisplib.boot | 7 +- src/interp/spad-parser.boot | 6 +- src/interp/sys-driver.boot | 8 +- 20 files changed, 205 insertions(+), 206 deletions(-) diff --git a/configure b/configure index e683bb96..1afe1529 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for OpenAxiom 1.5.0-2016-01-01. +# Generated by GNU Autoconf 2.69 for OpenAxiom 1.5.0-2016-01-16. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenAxiom' PACKAGE_TARNAME='openaxiom' -PACKAGE_VERSION='1.5.0-2016-01-01' -PACKAGE_STRING='OpenAxiom 1.5.0-2016-01-01' +PACKAGE_VERSION='1.5.0-2016-01-16' +PACKAGE_STRING='OpenAxiom 1.5.0-2016-01-16' PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net' PACKAGE_URL='' @@ -1421,7 +1421,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenAxiom 1.5.0-2016-01-01 to adapt to many kinds of systems. +\`configure' configures OpenAxiom 1.5.0-2016-01-16 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1496,7 +1496,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenAxiom 1.5.0-2016-01-01:";; + short | recursive ) echo "Configuration of OpenAxiom 1.5.0-2016-01-16:";; esac cat <<\_ACEOF @@ -1613,7 +1613,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenAxiom configure 1.5.0-2016-01-01 +OpenAxiom configure 1.5.0-2016-01-16 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2430,7 +2430,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenAxiom $as_me 1.5.0-2016-01-01, which was +It was created by OpenAxiom $as_me 1.5.0-2016-01-16, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3449,7 +3449,7 @@ fi # Define the identity of the package. PACKAGE='openaxiom' - VERSION='1.5.0-2016-01-01' + VERSION='1.5.0-2016-01-16' cat >>confdefs.h <<_ACEOF @@ -20053,7 +20053,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenAxiom $as_me 1.5.0-2016-01-01, which was +This file was extended by OpenAxiom $as_me 1.5.0-2016-01-16, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20123,7 +20123,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -OpenAxiom config.status 1.5.0-2016-01-01 +OpenAxiom config.status 1.5.0-2016-01-16 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 849c4dd6..c46054ed 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ dnl Makefiles for building OpenAxiom interpreter, compiler, libraries, and dnl auxiliary tools where appropriate. dnl -AC_INIT([OpenAxiom], [1.5.0-2016-01-01], +AC_INIT([OpenAxiom], [1.5.0-2016-01-16], [open-axiom-bugs@lists.sf.net]) dnl Most of the macros used in this configure.ac are defined in files diff --git a/src/ChangeLog b/src/ChangeLog index ff786850..b7d639da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +2016-01-16 Gabriel Dos Reis + + * interp/sys-driver.boot (initializeDatabase): Be frugal when + building the algebra. + * interp/i-funsel.boot (isOpInDomain): Tidy. + (findUniqueOpInDomain): Likewise. + (hasSig): Likewise. + * interp/i-special.boot (constantInDomain?): Likewise. + * interp/lisplib.boot (isFunctor): Likewise. + * interp/spad-parser.boot (storeBlanks!): Define. + * interp/database.boot (getConstructorModemap): Take directly from + generated code. + (getConstructorOperationsFromDB): Likewise. + (getSuperDomainFromDB): Tidy. + * interp/daase.lisp (GETDATABASE): Remove CONSTRUCTORMODEMAP and + OPERATIONALIST cases. + (defaultPackageForm): New. + (simpleMacro?): Likewise. + (macroDefined?): Likewise. + (writeMinimalDB): New. Split out of printInitdbInfo. + * interp/c-util.boot (completeDefaultPackageParameters): New. + (makeDefaultPackageParameters): Likewise. + * algebra/oderf.spad.pamphlet: Fix decades-old syntax error. + 2016-01-07 Gabriel Dos Reis * interp/br-data.boot (parentsOf): Remove. Adjust users. diff --git a/src/algebra/Makefile.am b/src/algebra/Makefile.am index a7cd3084..6d182dab 100644 --- a/src/algebra/Makefile.am +++ b/src/algebra/Makefile.am @@ -1711,7 +1711,8 @@ strap-2/SASTCAT.$(FASLEXT): strap-2/HOMOTOP.$(FASLEXT) \ strap-1/ASTCAT.$(FASLEXT) strap-1/SYNTAX.$(FASLEXT) strap-2/CATAST.$(FASLEXT): strap-1/CTORKIND.$(FASLEXT) -strap-2/TYPEAST.$(FASLEXT): strap-1/SPADAST.$(FASLEXT) +strap-2/TYPEAST.$(FASLEXT): strap-1/SPADAST.$(FASLEXT) \ + strap-1/OUTFORM.$(FASLEXT) strap-2/IRFORM.$(FASLEXT): strap-1/ITFORM.$(FASLEXT) strap-2/LINELT.$(FASLEXT): strap-1/LINBASIS.$(FASLEXT) strap-2/FR2.$(FASLEXT): strap-1/COMPLEX.$(FASLEXT) @@ -1853,6 +1854,10 @@ SPADFILES= \ $(OUTSRC)/supxs.spad $(OUTSRC)/suts.spad $(OUTSRC)/symbol.spad \ $(OUTSRC)/syntax.spad \ $(OUTSRC)/term.spad \ + $(OUTSRC)/data.spad \ + $(OUTSRC)/net.spad \ + $(OUTSRC)/compiler.spad \ + $(OUTSRC)/java.spad \ $(OUTSRC)/syssolp.spad $(OUTSRC)/system.spad \ $(OUTSRC)/tableau.spad $(OUTSRC)/table.spad $(OUTSRC)/taylor.spad \ $(OUTSRC)/tex.spad $(OUTSRC)/tools.spad $(OUTSRC)/transsolve.spad \ @@ -2058,8 +2063,6 @@ $(OUT)/INS.$(FASLEXT): $(OUT)/UFD.$(FASLEXT) $(OUT)/EUCDOM.$(FASLEXT) \ $(OUT)/CHARZ.$(FASLEXT): $(OUT)/RING.$(FASLEXT) $(OUT)/CHARNZ.$(FASLEXT): $(OUT)/RING.$(FASLEXT) -$(OUT)/MAYBE.$(FASLEXT): $(OUT)/KOERCE.$(FASLEXT) $(OUT)/RETRACT.$(FASLEXT) - $(OUT)/SRING.$(FASLEXT): $(OUT)/ABELMON.$(FASLEXT) $(OUT)/MONOID.$(FASLEXT) $(OUT)/RING.$(FASLEXT): $(OUT)/RNG.$(FASLEXT) $(OUT)/SRING.$(FASLEXT) \ $(OUT)/LMODULE.$(FASLEXT) $(OUT)/KOERCE.$(FASLEXT) diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index 5a040a02..67e6a05f 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -733,6 +733,10 @@ SPADFILES = \ $(OUTSRC)/supxs.spad $(OUTSRC)/suts.spad $(OUTSRC)/symbol.spad \ $(OUTSRC)/syntax.spad \ $(OUTSRC)/term.spad \ + $(OUTSRC)/data.spad \ + $(OUTSRC)/net.spad \ + $(OUTSRC)/compiler.spad \ + $(OUTSRC)/java.spad \ $(OUTSRC)/syssolp.spad $(OUTSRC)/system.spad \ $(OUTSRC)/tableau.spad $(OUTSRC)/table.spad $(OUTSRC)/taylor.spad \ $(OUTSRC)/tex.spad $(OUTSRC)/tools.spad $(OUTSRC)/transsolve.spad \ @@ -3216,7 +3220,8 @@ strap-2/SASTCAT.$(FASLEXT): strap-2/HOMOTOP.$(FASLEXT) \ strap-1/ASTCAT.$(FASLEXT) strap-1/SYNTAX.$(FASLEXT) strap-2/CATAST.$(FASLEXT): strap-1/CTORKIND.$(FASLEXT) -strap-2/TYPEAST.$(FASLEXT): strap-1/SPADAST.$(FASLEXT) +strap-2/TYPEAST.$(FASLEXT): strap-1/SPADAST.$(FASLEXT) \ + strap-1/OUTFORM.$(FASLEXT) strap-2/IRFORM.$(FASLEXT): strap-1/ITFORM.$(FASLEXT) strap-2/LINELT.$(FASLEXT): strap-1/LINBASIS.$(FASLEXT) strap-2/FR2.$(FASLEXT): strap-1/COMPLEX.$(FASLEXT) @@ -3365,8 +3370,6 @@ $(OUT)/INS.$(FASLEXT): $(OUT)/UFD.$(FASLEXT) $(OUT)/EUCDOM.$(FASLEXT) \ $(OUT)/CHARZ.$(FASLEXT): $(OUT)/RING.$(FASLEXT) $(OUT)/CHARNZ.$(FASLEXT): $(OUT)/RING.$(FASLEXT) -$(OUT)/MAYBE.$(FASLEXT): $(OUT)/KOERCE.$(FASLEXT) $(OUT)/RETRACT.$(FASLEXT) - $(OUT)/SRING.$(FASLEXT): $(OUT)/ABELMON.$(FASLEXT) $(OUT)/MONOID.$(FASLEXT) $(OUT)/RING.$(FASLEXT): $(OUT)/RNG.$(FASLEXT) $(OUT)/SRING.$(FASLEXT) \ $(OUT)/LMODULE.$(FASLEXT) $(OUT)/KOERCE.$(FASLEXT) diff --git a/src/algebra/compiler.spad.pamphlet b/src/algebra/compiler.spad.pamphlet index 49d87f80..e85ee1f7 100644 --- a/src/algebra/compiler.spad.pamphlet +++ b/src/algebra/compiler.spad.pamphlet @@ -22,7 +22,7 @@ ++ Description: ++ This domain provides representations for the intermediate ++ form data structure used by the Spad elaborator. -InternalRepresentationForm(): Public == Private where +InternalRepresentationForm: Public == Private where Public == Join(SetCategory, HomotopicTo Syntax) with irVar: (Identifier, InternalTypeForm) -> % ++ \spad{irVar(x,t)} returns an IR for a variable reference @@ -40,13 +40,13 @@ InternalRepresentationForm(): Public == Private where coerce(x: Syntax): % == per x irVar(x,t) == - buildSyntax('%irVar,[x::Syntax,t::Syntax])::% + per buildSyntax('%irVar,[x::Syntax,t::Syntax]) irCtor(x,t) == - buildSyntax('%irCtor,[x::Syntax,t::Syntax])::% + per buildSyntax('%irCtor,[x::Syntax,t::Syntax]) irDef(f,ts,e) == - buildSyntax('%irDef,[f::Syntax, ts::Syntax, e::Syntax])::% + per buildSyntax('%irDef,[f::Syntax, ts::Syntax, e::Syntax]) @ @@ -57,7 +57,7 @@ InternalRepresentationForm(): Public == Private where ++ Date Last Modified: March 12, 2010 ++ Description: ++ This domain provides representations for internal type form. -InternalTypeForm(): Public == Private where +InternalTypeForm: Public == Private where Public == Join(SetCategory, HomotopicTo Syntax) with jokerMode: % ++ \spad{jokerMode} is a constant that stands for any mode @@ -85,7 +85,7 @@ InternalTypeForm(): Public == Private where \section{Elaboration domain} <>= )abbrev domain ELABOR Elaboration -Elaboration(): Public == Private where +Elaboration: Public == Private where Public == CoercibleTo OutputForm with elaboration: (InternalRepresentationForm, InternalTypeForm, Environment) -> % ++ \spad{elaboration(ir,ty,env)} construct an elaboration object for @@ -114,7 +114,7 @@ Elaboration(): Public == Private where <>= )abbrev domain CMPCTXT CompilationContext -CompilationContext(): Public == Private where +CompilationContext: Public == Private where Public == SetCategory with getExitMode: (%,Integer) -> InternalTypeForm pushExitMode!: (%, InternalTypeForm) -> % @@ -131,7 +131,7 @@ CompilationContext(): Public == Private where ++ Date Last Modified: March 12, 2010 ++ Description: ++ This package implements a Spad compiler. -CompilerPackage(): Public == Private where +CompilerPackage: Public == Private where Public == Type with macroExpand: (SpadAst, Environment) -> SpadAst ++ \spad{macroExpand(s,e)} traverses the syntax object \spad{s} @@ -249,7 +249,7 @@ CompilerPackage(): Public == Private where \section{License} <>= ---Copyright (C) 2007-2010, Gabriel Dos Reis. +--Copyright (C) 2007-2016, Gabriel Dos Reis. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without @@ -286,6 +286,9 @@ CompilerPackage(): Public == Private where <> <> +<> +<> +<> <> @ diff --git a/src/algebra/crfp.spad.pamphlet b/src/algebra/crfp.spad.pamphlet index 7ba3af33..6189e1c5 100644 --- a/src/algebra/crfp.spad.pamphlet +++ b/src/algebra/crfp.spad.pamphlet @@ -546,7 +546,7 @@ ComplexRootFindingPackage(R, UP): public == private where -- num/den r -- this is nonsense, perhaps a Newton iteration for x**n-r here -)fin +)if false -- for late use: graeffe2 p == @@ -590,6 +590,7 @@ ComplexRootFindingPackage(R, UP): public == private where ++ graeffe2 p determines q such that \spad{q(-z**2) = p(z)*p(-z)}. ++ Note that the roots of q are the squares of the roots of p. +)endif @ \section{License} <>= diff --git a/src/algebra/data.spad.pamphlet b/src/algebra/data.spad.pamphlet index db84d244..e529ba4a 100644 --- a/src/algebra/data.spad.pamphlet +++ b/src/algebra/data.spad.pamphlet @@ -424,7 +424,7 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where \section{License} <>= ---Copyright (C) 2007-2009, Gabriel Dos Reis. +--Copyright (C) 2007-2016, Gabriel Dos Reis. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without @@ -460,8 +460,7 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where <<*>>= <> <> -<> -<> +<> <> <> @@ -476,6 +475,8 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where <> <> +<> +<> @ diff --git a/src/algebra/generic.spad.pamphlet b/src/algebra/generic.spad.pamphlet index f25c87b4..37ef3170 100644 --- a/src/algebra/generic.spad.pamphlet +++ b/src/algebra/generic.spad.pamphlet @@ -289,7 +289,7 @@ GenericNonAssociativeAlgebra(R : CommutativeRing, n : PositiveInteger,_ generic(s: S): % == generic(s, basis()$%) -)fin +)if false -- variations on eval --coefOfa : List FPR := entries coordinates a --ls : List Symbol := entries symbolsForCoef @@ -307,6 +307,7 @@ GenericNonAssociativeAlgebra(R : CommutativeRing, n : PositiveInteger,_ --eval(rf, ls, coefOfa)$FPR --le : List Equation PR := [equation(lh,rh) for lh in ls for rh in coefOfa] +)endif @ \section{package CVMP CoerceVectorMatrixPackage} <>= diff --git a/src/algebra/java.spad.pamphlet b/src/algebra/java.spad.pamphlet index 11d69455..e046fdf2 100644 --- a/src/algebra/java.spad.pamphlet +++ b/src/algebra/java.spad.pamphlet @@ -18,7 +18,7 @@ ++ Date Created: July 18, 2008 ++ Data Last Modified: July 18, 2010 ++ Description: JVM class file access bitmask and values. -JVMClassFileAccess(): Public == Private where +JVMClassFileAccess: Public == Private where Public == Join(SetCategory,Logic) with jvmPublic: % ++ The class was declared public, therefore may be accessed @@ -48,7 +48,7 @@ JVMClassFileAccess(): Public == Private where ++ Data Last Modified: July 18, 2010 ++ Description: ++ JVM class field access bitmask and values. -JVMFieldAccess(): Public == Private where +JVMFieldAccess: Public == Private where Public == Join(SetCategory,Logic) with jvmPublic: % ++ The field was declared public; therefore mey accessed from @@ -88,7 +88,7 @@ JVMFieldAccess(): Public == Private where ++ Data Last Modified: July 18, 2010 ++ Description: ++ JVM class method access bitmask and values. -JVMMethodAccess(): Public == Private where +JVMMethodAccess: Public == Private where Public == Join(SetCategory,Logic) with jvmPublic: % ++ The method was declared public; therefore mey accessed from @@ -136,7 +136,7 @@ JVMMethodAccess(): Public == Private where ++ Data Last Modified: July 18, 2010 ++ Description: ++ JVM class file constant pool tags. -JVMConstantTag(): Public == Private where +JVMConstantTag: Public == Private where Public == Join(SetCategory,CoercibleTo Byte) with jvmUTF8ConstantTag: % ++ The corresponding constant pool entry is sequence of bytes @@ -187,7 +187,7 @@ JVMConstantTag(): Public == Private where ++ Data Last Modified: July 18, 2010 ++ Description: ++ This is the datatype for the JVM bytecodes. -JVMBytecode(): Public == Private where +JVMBytecode: Public == Private where Public == Join(SetCategory, HomotopicTo Byte) Private == Byte add coerce(b: Byte): % == @@ -205,7 +205,7 @@ JVMBytecode(): Public == Private where ++ Data Last Modified: July 18, 2010 ++ Description: ++ This is the datatype for the JVM opcodes. -JVMOpcode(): Public == Private where +JVMOpcode: Public == Private where Public == Join(SetCategory,HomotopicTo JVMBytecode,HomotopicTo Byte) Private == JVMBytecode add -- mnemonics equivalent of bytecodes. @@ -274,7 +274,7 @@ JVMOpcode(): Public == Private where \section{License} <>= ---Copyright (C) 2007-2010, Gabriel Dos Reis. +--Copyright (C) 2007-2016, Gabriel Dos Reis. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without diff --git a/src/algebra/oderf.spad.pamphlet b/src/algebra/oderf.spad.pamphlet index d6c3c0dc..048606ce 100644 --- a/src/algebra/oderf.spad.pamphlet +++ b/src/algebra/oderf.spad.pamphlet @@ -51,7 +51,7 @@ BalancedFactorisation(R, UP): Exports == Implementation where empty?(ll := select(#1 ~= 0, l)) => error "balancedFactorisation: 2nd argument is empty or all 0" sa := squareFree a - unit(sa) * */[balSqfr(f.factor,f.exponent,ll) for f in factors sa]) + unit(sa) * */[balSqfr(f.factor,f.exponent,ll) for f in factors sa] @ \section{package BOUNDZRO BoundIntegerRoots} diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet index 11b8613f..eda1ce0a 100644 --- a/src/algebra/syntax.spad.pamphlet +++ b/src/algebra/syntax.spad.pamphlet @@ -38,7 +38,7 @@ import SExpression ++ Integer, DoubleFloat, Identifier, String, SExpression. ++ See Also: SExpression, InputForm. ++ The equality supported by this domain is structural. -Syntax(): Public == Private where +Syntax: Public == Private where Public == Join(UnionType, SetCategory, RetractableTo Integer, RetractableTo DoubleFloat, RetractableTo Identifier, RetractableTo String, CoercibleTo InputForm) with @@ -256,7 +256,7 @@ import SExpression ++ Date Last Updated: April 20, 2009 ++ Description: This domains an expresion as elaborated by the interpreter. ++ See Also: -ElaboratedExpression(): Public == Private where +ElaboratedExpression: Public == Private where Public ==> CoercibleTo OutputForm with type: % -> Syntax ++ type(e) returns the type of the expression as computed by @@ -311,7 +311,7 @@ ElaboratedExpression(): Public == Private where "failed" @ -\section{SpadAbstractSyntaxCategory} +\section{AbstractSyntaxCategory} <>= import SetCategory @@ -321,7 +321,7 @@ import CoercibleTo Syntax ++ Date Created: July 5, 2008 ++ Date Last Modified: September 21, 2008 ++ Description: This is the category of Spad abstract syntax trees. -AbstractSyntaxCategory(): Category == +AbstractSyntaxCategory: Category == Join(SetCategory, HomotopicTo Syntax) add coerce(x: %): Syntax == @@ -340,7 +340,7 @@ AbstractSyntaxCategory(): Category == ++ Date Created: July 5, 2008 ++ Date Last Modified: September 3, 2008 ++ Description: This is the category of Spad syntax objects. -SpadSyntaxCategory(): Category == AbstractSyntaxCategory +SpadSyntaxCategory: Category == AbstractSyntaxCategory @ \subsection{The Exports of SpadAst} @@ -352,7 +352,7 @@ SpadSyntaxCategory(): Category == AbstractSyntaxCategory ++ Date Last Modified: September 21, 2008 ++ Description: This category describes the exported ++ signatures of the SpadAst domain. -SpadAstExports(): Category == Join(SpadSyntaxCategory, UnionType) with +SpadAstExports: Category == Join(SpadSyntaxCategory, UnionType) with case: (%, [|ImportAst|]) -> Boolean ++ s case ImportAst holds if `s' represents an `import' statement. autoCoerce: % -> ImportAst @@ -361,7 +361,7 @@ SpadAstExports(): Category == Join(SpadSyntaxCategory, UnionType) with case: (%, [|DefinitionAst|]) -> Boolean ++ s case DefinitionAst holds if `s' represents a definition. - autoCoerce: % -> DefinitionAst() + autoCoerce: % -> DefinitionAst ++ autoCoerce(s) returns the DefinitionAst view of `s'. Left at the ++ discretion of the compiler. @@ -399,13 +399,13 @@ SpadAstExports(): Category == Join(SpadSyntaxCategory, UnionType) with case: (%, [|SignatureAst|]) -> Boolean ++ s case SignatureAst holds if `s' represents a signature export. - autoCoerce: % -> SignatureAst() + autoCoerce: % -> SignatureAst ++ autoCoerce(s) returns the SignatureAst view of `s'. Left at the ++ discretion of the compiler. case: (%, [|AttributeAst|]) -> Boolean ++ s case AttributeAst holds if `s' represents an attribute. - autoCoerce: % -> AttributeAst() + autoCoerce: % -> AttributeAst ++ autoCoerce(s) returns the AttributeAst view of `s'. Left at the ++ discretion of the compiler. @@ -586,7 +586,7 @@ Literal(T: SetCategory): Public == Private where ++ of scripting. It is a plain basic data structure. ++ )abbrev domain IDENT Identifier -Identifier(): Public == Private where +Identifier: Public == Private where Public == SetCategory with gensym: () -> % ++ \spad{gensym()} returns a new identifier, different from @@ -611,7 +611,7 @@ Identifier(): Public == Private where ++ Representation of parameters to functions or constructors. ++ For the most part, they are Identifiers. However, in very ++ cases, they are "flags", e.g. string literals. -ParameterAst(): Public == Private where +ParameterAst: Public == Private where Public == Join(SpadSyntaxCategory, UnionType) with case: (%, [| Identifier |]) -> Boolean ++ \spad{x case Identifier} if the parameter AST object @@ -665,7 +665,7 @@ import List Identifier ++ Date Created: November 10, 2007 ++ Date Last Modified: November 08, 2009 ++ Description: This domain represents the header of a definition. -HeadAst(): Public == Private where +HeadAst: Public == Private where Public == SpadSyntaxCategory with headAst: (Identifier,List ParameterAst) -> % ++ headAst(f,[x1,..,xn]) constructs a function definition header. @@ -689,17 +689,16 @@ HeadAst(): Public == Private where \subsection{The TypeAst domain} <>= -SpadAst(): SpadAstExports - -import AbstractSyntaxCategory +import SpadSyntaxCategory )abbrev domain TYPEAST TypeAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents a type AST. -TypeAst(): Public == Private where +TypeAst: Public == Private where Public == SpadSyntaxCategory Private == add + import SpadAst coerce(x: %): OutputForm == (x : SpadAst)::OutputForm @ @@ -715,7 +714,7 @@ import TypeAst ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents an `import' of types. -ImportAst(): Public == Private where +ImportAst: Public == Private where Public == SpadSyntaxCategory with coerce: List TypeAst -> % ++ ts::ImportAst constructs an ImportAst for the list if types `ts'. @@ -741,7 +740,7 @@ ImportAst(): Public == Private where ++ Description: This domain represents a mapping type AST. A mapping AST ++ is a syntactic description of a function type, e.g. its result ++ type and the list of its argument types. -MappingAst(): Public == Private where +MappingAst: Public == Private where Public == Join(SpadSyntaxCategory, CoercibleTo TypeAst) with coerce: Signature -> % ++ sig::MappingAst builds a MappingAst from the Signature `sig'. @@ -776,7 +775,7 @@ MappingAst(): Public == Private where ++ Description: This domain represents a signature AST. A signature AST ++ is a description of an exported operation, e.g. its name, result ++ type, and the list of its argument types. -SignatureAst(): Public == Private where +SignatureAst: Public == Private where Public == SpadSyntaxCategory with signatureAst: (Identifier, Signature) -> % ++ signatureAst(n,s,t) builds the signature AST n: s -> t @@ -801,15 +800,13 @@ SignatureAst(): Public == Private where \subsection{The AttributeAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain ATTRAST AttributeAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents the syntax of an attribute in ++ a category expression. -AttributeAst(): Public == Private where +AttributeAst: Public == Private where Public == SpadSyntaxCategory with name: % -> SpadAst ++ name(a) returns the name of the attribute `a'. Note, this @@ -830,7 +827,7 @@ AttributeAst(): Public == Private where ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents the join of categories ASTs. -JoinAst(): Public == Private where +JoinAst: Public == Private where Public == Join(SpadSyntaxCategory, CoercibleTo TypeAst) with coerce: List TypeAst -> % ++ ts::JoinAst construct the AST for a join of the types `ts'. @@ -848,14 +845,12 @@ JoinAst(): Public == Private where \subsection{The IfAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain IFAST IfAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents AST for conditional expressions. -IfAst(): Public == Private where +IfAst: Public == Private where Public == SpadSyntaxCategory with condition: % -> SpadAst ++ condition(e) returns the condition of the if-expression `e'. @@ -880,14 +875,12 @@ IfAst(): Public == Private where \subsection{The RepeatAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain RPTAST RepeatAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the `repeat' iterator syntax. -RepeatAst(): Public == Private where +RepeatAst: Public == Private where Public == SpadSyntaxCategory with iterators: % -> List SpadAst ++ iterators(e) returns the list of iterators controlling the loop `e'. @@ -908,14 +901,12 @@ RepeatAst(): Public == Private where \subsection{The WhileAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain WHILEAST WhileAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents the `while' iterator syntax. -WhileAst(): Public == Private where +WhileAst: Public == Private where Public == SpadSyntaxCategory with condition: % -> SpadAst ++ condition(i) returns the condition of the while iterator `i'. @@ -931,14 +922,12 @@ WhileAst(): Public == Private where \subsection{The InAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain INAST InAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents the `in' iterator syntax. -InAst(): Public == Private where +InAst: Public == Private where Public == SpadSyntaxCategory with iterationVar: % -> Identifier ++ iterationVar(i) returns the name of the iterating @@ -966,7 +955,7 @@ InAst(): Public == Private where ++ Description: ++ This domain represents an arithmetic progression iterator syntax. )abbrev domain STEPAST StepAst -StepAst(): Public == Private where +StepAst: Public == Private where Public == SpadSyntaxCategory with iterationVar: % -> Identifier ++ \spad{iterationVar(i)} returns the name of the iterating @@ -1012,14 +1001,12 @@ StepAst(): Public == Private where \subsection{The CollectAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain CLLCTAST CollectAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents list comprehension syntax. -CollectAst(): Public == Private where +CollectAst: Public == Private where Public == SpadSyntaxCategory with iterators: % -> List SpadAst ++ iterators(e) returns the list of the iterators of @@ -1044,14 +1031,12 @@ CollectAst(): Public == Private where \subsection{The ReduceAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain RDUCEAST ReduceAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents list reduction syntax. -ReduceAst(): Public == Private where +ReduceAst: Public == Private where Public == SpadSyntaxCategory with operator: % -> SpadAst ++ operator(e) returns the magma operation being applied. @@ -1067,14 +1052,12 @@ ReduceAst(): Public == Private where \subsection{The ConstructAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain LSTAST ConstructAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents `literal sequence' syntax. -ConstructAst(): Public == Private where +ConstructAst: Public == Private where Public == SpadSyntaxCategory with elements: % -> List SpadAst ++ elements(e) returns the list of expressions in the @@ -1092,14 +1075,12 @@ ConstructAst(): Public == Private where \subsection{The ExitAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain EXITAST ExitAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents exit expressions. -ExitAst(): Public == Private where +ExitAst: Public == Private where Public == SpadSyntaxCategory with expression: % -> SpadAst ++ expression(e) returns the exit expression of `e'. @@ -1119,14 +1100,12 @@ ExitAst(): Public == Private where \subsection{The ReturnAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain RETAST ReturnAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents `return' expressions. -ReturnAst(): Public == Private where +ReturnAst: Public == Private where Public == SpadSyntaxCategory with expression: % -> SpadAst ++ expression(e) returns the expression returned by `e'. @@ -1142,14 +1121,12 @@ ReturnAst(): Public == Private where \subsection{The SequenceAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain SEQAST SequenceAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents a block of expressions. -SequenceAst(): Public == Private where +SequenceAst: Public == Private where Public == SpadSyntaxCategory with body: % -> List SpadAst ++ body(e) returns the list of expressions in the sequence @@ -1168,14 +1145,13 @@ SequenceAst(): Public == Private where \subsection{The LetAst domain} <>= -SpadAst(): SpadAstExports import List )abbrev domain LETAST LetAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents assignment expressions. -LetAst(): Public == Private where +LetAst: Public == Private where Public == SpadSyntaxCategory with lhs: % -> SpadAst ++ lhs(e) returns the left hand side of the assignment expression `e'. @@ -1195,14 +1171,12 @@ LetAst(): Public == Private where \subsection{The PretendAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain PRTDAST PretendAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents `pretend' expressions. -PretendAst(): Public == Private where +PretendAst: Public == Private where Public == SpadSyntaxCategory with expression: % -> SpadAst ++ expression(e) returns the expression being converted. @@ -1222,14 +1196,12 @@ PretendAst(): Public == Private where \subsection{The CoerceAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain CRCEAST CoerceAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents `coerce' expressions. -CoerceAst(): Public == Private where +CoerceAst: Public == Private where Public == SpadSyntaxCategory with expression: % -> SpadAst ++ expression(e) returns the expression being converted. @@ -1250,14 +1222,12 @@ CoerceAst(): Public == Private where \subsection{The RestrictAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain RSTRCAST RestrictAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents `restrict' expressions. -RestrictAst(): Public == Private where +RestrictAst: Public == Private where Public == SpadSyntaxCategory with expression: % -> SpadAst ++ expression(e) returns the expression being converted. @@ -1277,15 +1247,13 @@ RestrictAst(): Public == Private where \subsection{The CallAst domain} <>= -SpadAst(): SpadAstExports - import List )abbrev domain CALLAST CallAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents calls. -CallAst(): Public == Private where +CallAst: Public == Private where Public == SpadSyntaxCategory with operator: % -> SpadAst ++ operation(e) returns the operation being called in `e'. @@ -1305,14 +1273,12 @@ CallAst(): Public == Private where \subsection{The SegmentAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain SEGAST SegmentAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents segement expressions. -SegmentAst(): Public == Private where +SegmentAst: Public == Private where Public == SpadSyntaxCategory with bounds: % -> List SpadAst ++ bounds(s) returns the bounds of the segment `s'. If @@ -1331,14 +1297,12 @@ SegmentAst(): Public == Private where \subsection{The SuchThatAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain SUCHTAST SuchThatAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the filter iterator syntax. -SuchThatAst(): Public == Private where +SuchThatAst: Public == Private where Public == SpadSyntaxCategory with predicate: % -> SpadAst ++ predicate(e) returns the syntax object for the predicate @@ -1354,15 +1318,13 @@ SuchThatAst(): Public == Private where \subsection{The ColonAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain COLONAST ColonAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents type specification ++ for an identifier or expression. -ColonAst(): Public == Private where +ColonAst: Public == Private where Public == SpadSyntaxCategory with lhs: % -> SpadAst ++ lhs(e) returns the left hand side of the colon expression `e'. @@ -1381,14 +1343,12 @@ ColonAst(): Public == Private where \subsection{The AddAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain ADDAST AddAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the syntax for an add-expression. -AddAst(): Public == Private where +AddAst: Public == Private where Public == SpadSyntaxCategory with base: % -> SpadAst ++ base(d) returns the base domain(s) of the add-domain expression. @@ -1408,14 +1368,12 @@ AddAst(): Public == Private where \subsection{The CapsuleAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain CAPSLAST CapsuleAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents the capsule of a domain definition. -CapsuleAst(): Public == Private where +CapsuleAst: Public == Private where Public == SpadSyntaxCategory with body: % -> List SpadAst ++ body(c) returns the list of top level expressions appearing in `c'. @@ -1430,14 +1388,12 @@ CapsuleAst(): Public == Private where \subsection{The CaseAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain CASEAST CaseAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents a `case' expression. -CaseAst(): Public == Private where +CaseAst: Public == Private where Public == SpadSyntaxCategory with lhs: % -> SpadAst ++ lhs(e) returns the left hand side of the case expression `e'. @@ -1457,14 +1413,12 @@ CaseAst(): Public == Private where \subsection{The HasAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain HASAST HasAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents a `has' expression. -HasAst(): Public == Private where +HasAst: Public == Private where Public == SpadSyntaxCategory with lhs: % -> SpadAst ++ lhs(e) returns the left hand side of the has expression `e'. @@ -1483,14 +1437,12 @@ HasAst(): Public == Private where \subsection{The IsAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain ISAST IsAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents a `has' expression. -IsAst(): Public == Private where +IsAst: Public == Private where Public == SpadSyntaxCategory with lhs: % -> SpadAst ++ lhs(e) returns the left hand side of the is expression `e'. @@ -1509,15 +1461,13 @@ IsAst(): Public == Private where \subsection{The CategoryAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain CATAST CategoryAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: April 20, 2009 ++ Description: This domain represents the unnamed category defined ++ by a list of exported signatures -CategoryAst(): Public == Private where +CategoryAst: Public == Private where Public == SpadSyntaxCategory with kind: % -> ConstructorKind ++ kind(c) returns the kind of unnamed category, either @@ -1537,14 +1487,12 @@ CategoryAst(): Public == Private where \subsection{The WhereAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain WHEREAST WhereAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the syntax of a `where' expression. -WhereAst(): Public == Private where +WhereAst: Public == Private where Public == SpadSyntaxCategory with mainExpression: % -> SpadAst ++ mainExpression(e) returns the main expression of the @@ -1564,15 +1512,13 @@ WhereAst(): Public == Private where \subsection{The CommaAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain COMMAAST CommaAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the syntax of a comma-separated ++ list of expressions. -CommaAst(): Public == Private where +CommaAst: Public == Private where Public == SpadSyntaxCategory with body: % -> List SpadAst ++ body(e) returns the list of expressions making up `e'. @@ -1588,15 +1534,13 @@ CommaAst(): Public == Private where \subsection{The QuasiquoteAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain QQUTAST QuasiquoteAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the syntax of a quasiquote ++ expression. -QuasiquoteAst(): Public == Private where +QuasiquoteAst: Public == Private where Public == SpadSyntaxCategory with expression: % -> SpadAst ++ expression(e) returns the syntax for the expression being quoted. @@ -1612,14 +1556,12 @@ QuasiquoteAst(): Public == Private where \subsection{The DefinitionAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain DEFAST DefinitionAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the syntax of a definition. -DefinitionAst(): Public == Private where +DefinitionAst: Public == Private where Public == SpadSyntaxCategory with head: % -> HeadAst ++ head(d) returns the head of the definition `d'. This is a @@ -1648,14 +1590,12 @@ DefinitionAst(): Public == Private where \subsection{The MacroAst domain} <>= -SpadAst(): SpadAstExports - )abbrev domain MACROAST MacroAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 ++ Date Last Modified: September 21, 2008 ++ Description: This domain represents the syntax of a macro definition. -MacroAst(): Public == Private where +MacroAst: Public == Private where Public == SpadSyntaxCategory with head: % -> HeadAst ++ head(m) returns the head of the macro definition `m'. This is a @@ -1687,7 +1627,7 @@ MacroAst(): Public == Private where ++ for Spad syntax domain. It merely exists as a kind of ++ of abstract base in object-oriented programming language. ++ However, this is not an abstract class. -SpadAst(): SpadAstExports() == add +SpadAst: SpadAstExports == add isAst(x: %, tag: Identifier): Boolean == (op := getOperator(x::Syntax)) case Identifier and op = tag @@ -1835,7 +1775,7 @@ SpadAst(): SpadAstExports() == add \section{License} <>= ---Copyright (C) 2007-2009, Gabriel Dos Reis. +--Copyright (C) 2007-2016, Gabriel Dos Reis. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without @@ -1878,6 +1818,7 @@ SpadAst(): SpadAstExports() == add <> <> +<> <> <> <> diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index cd030a21..3c8bee94 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -53,6 +53,7 @@ module c_-util where dbInfovec: %Symbol -> %Maybe %FunctorData makeDefaultPackageParameters: %Database -> %List %Symbol makeDefaultPackageAbbreviation: %Database -> %Symbol + completeDefaultPackageParameters: %List %Symbol -> %List %Symbol --% Accessors of domain and category objects @@ -237,11 +238,13 @@ $SetCategory == --% -makeDefaultPackageParameters db == - parms := dbConstructorForm(db).args +completeDefaultPackageParameters parms == dollar := first setDifference('(S A B C D E F G H I),parms) [dollar,:parms] +makeDefaultPackageParameters db == + completeDefaultPackageParameters dbConstructorForm(db).args + makeDefaultPackageAbbreviation db == makeSymbol strconc(symbolName dbAbbreviation db,'"-") diff --git a/src/interp/daase.lisp b/src/interp/daase.lisp index ed761760..3e799091 100644 --- a/src/interp/daase.lisp +++ b/src/interp/daase.lisp @@ -640,18 +640,10 @@ (operation (setq stream *operation-stream*) (setq data (gethash constructor *operation-hash*))) - (constructormodemap - (setq stream *interp-stream*) - (when struct - (setq data (|dbConstructorModemap| struct)))) (constructorcategory (setq stream *interp-stream*) (when struct (setq data (|dbCategory| struct)))) - (operationalist - (setq stream *interp-stream*) - (when struct - (setq data (|dbOperations| struct)))) (modemaps (setq stream *interp-stream*) (when struct @@ -712,12 +704,8 @@ (setf (gethash constructor *operation-hash*) data)) (hascategory (setf (gethash constructor |$HasCategoryTable|) data)) - (constructormodemap - (setf (|dbConstructorModemap| struct) data)) (constructorcategory (setf (|dbCategory| struct) data)) - (operationalist - (setf (|dbOperations| struct) data)) (modemaps (setf (|dbModemaps| struct) data)) (object diff --git a/src/interp/database.boot b/src/interp/database.boot index 863def62..423cf547 100644 --- a/src/interp/database.boot +++ b/src/interp/database.boot @@ -106,8 +106,10 @@ getConstructorAncestorsFromDB ctor == ++ of the constructor `form'. getConstructorModemap: %Symbol -> %Mode getConstructorModemap ctor == - mm := GETDATABASE(ctor, 'CONSTRUCTORMODEMAP) => mm - dbConstructorModemap loadDBIfNecessary constructorDB ctor + db := constructorDB ctor + if not dbBeingDefined? db and dbConstructorModemap db isnt [.,:.] then + loadDBIfNecessary db + dbConstructorModemap db getConstructorFormFromDB: %Symbol -> %Form getConstructorFormFromDB ctor == @@ -135,7 +137,10 @@ getConstructorDocumentationFromDB ctor == getConstructorOperationsFromDB: %Symbol -> %List %List %Form getConstructorOperationsFromDB ctor == - GETDATABASE(ctor,"OPERATIONALIST") + db := constructorDB ctor + if not dbBeingDefined? db and dbOperations db isnt [.,:.] then + loadDBIfNecessary db + dbOperations db getConstructorFullNameFromDB: %Symbol -> %Symbol getConstructorFullNameFromDB ctor == @@ -166,6 +171,7 @@ getConstructorParentsFromDB ctor == getSuperDomainFromDB: %Symbol -> %Form getSuperDomainFromDB ctor == + builtinConstructor? ctor => nil db := constructorDB ctor if not dbBeingDefined? db then loadDBIfNecessary db @@ -811,33 +817,51 @@ makeInitialDB [form,kind,abbrev,srcfile] == dbSourceFile(db) := srcfile setAutoLoadProperty form.op -makeDefaultPackageForm db == - [makeDefaultPackageName symbolName dbConstructor db, - :makeDefaultPackageParameters db] - -printInitdbInfo(path,dbfile) == main(path,dbfile) where - main(path,dbfile) == - for x in parseSpadFile path repeat - x is ['DEF,lhs,.,rhs] => - fn(lhs,rhs,fileNameString path,dbfile) - x is ["where",['DEF,lhs,.,rhs],:.] => - fn(lhs,rhs,fileNameString path,dbfile) - fn(lhs,rhs,path,dbfile) == - if lhs isnt [.,:.] then lhs := [lhs] - db := constructorDB lhs.op - db = nil => nil - args := [id for x in lhs.args] - where id() == (x is [":",x',:.] => x'; x) - data := [[lhs.op,:args],dbConstructorKind db,dbAbbreviation db,path] - prettyPrint(['makeInitialDB,quote data],dbfile) - writeNewline dbfile - -- If this is a category with defaults, write out the data for - -- associated package. - dbConstructorKind db isnt 'category or rhs isnt ['add,:.] => nil - data := [makeDefaultPackageForm db,'package, - makeDefaultPackageAbbreviation db,path] - prettyPrint(['makeInitialDB,quote data],dbfile) - writeNewline dbfile +defaultPackageForm lhs == + [makeDefaultPackageName symbolName lhs.op, + :completeDefaultPackageParameters lhs.args] + +++ If `decl` is a simple macro definition for `x, return +++ the definiens. Otherwise, return nil. +simpleMacro?(x,decl) == + not ident? x => nil + decl is ['MDEF,=x,=nil,body] => body + decl is ['DEF,[=x],[=nil],body] => body + nil + +++ If `x` is defined as a simple macro in `decl`, return the body +++ of that definition. +macroDefined?(x,decl) == + decl is ['SEQ,:stmts,['exit,.,val]] => + or/[body for stmt in stmts | body := simpleMacro?(x,stmt)] + or simpleMacro?(x,val) + simpleMacro?(x,decl) + +writeMinimalDB(lhs,rhs,path,dbfile) == + if lhs isnt [.,:.] then lhs := [lhs] + db := constructorDB lhs.op + db = nil => nil + args := [id for x in lhs.args] + where id() == (x is [":",x',:.] => x'; x) + data := [[lhs.op,:args],dbConstructorKind db,dbAbbreviation db,path] + prettyPrint(['makeInitialDB,quote data],dbfile) + writeNewline dbfile + -- If this is a category with defaults, write out the data for + -- associated package. + dbConstructorKind db isnt 'category or rhs isnt ['add,:.] => nil + data := [defaultPackageForm lhs,'package, + makeDefaultPackageAbbreviation db,path] + prettyPrint(['makeInitialDB,quote data],dbfile) + writeNewline dbfile + +printInitdbInfo(path,dbfile) == + for x in parseSpadFile path repeat + x is ['DEF,lhs,.,rhs] => + writeMinimalDB(lhs,rhs,fileNameString path,dbfile) + x is ["where",['DEF,lhs,.,rhs],decl] => + if ident? rhs and (body := macroDefined?(rhs,decl)) then + rhs := body + writeMinimalDB(lhs,rhs,fileNameString path,dbfile) printAllInitdbInfo(srcdir,dbfile) == paths := DIRECTORY strconc(ensureTrailingSlash srcdir,'"*.spad") diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot index 4d1675e7..7c2bf3df 100644 --- a/src/interp/i-funsel.boot +++ b/src/interp/i-funsel.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2012, Gabriel Dos Reis. +-- Copyright (C) 2007-2016, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -690,6 +690,7 @@ getFunctionFromDomain(op,dc,args) == isOpInDomain(opName,dom,nargs) == -- returns true only if there is an op in the given domain with -- the given number of arguments + builtinFunctorName? dom.op => nil -- FIXME mmList := objectAssoc(opName,getConstructorOperationsFromDB dom.op) mmList := subCopy(mmList,constructSubst dom) mmList = nil => nil @@ -720,6 +721,7 @@ findCommonSigInDomain(opName,dom,nargs) == findUniqueOpInDomain(op,opName,dom) == -- return function named op in domain dom if unique, choose one if not + builtinFunctorName? dom.op => nil -- FIXME mmList := objectAssoc(opName,getConstructorOperationsFromDB dom.op) mmList := subCopy(mmList,constructSubst dom) mmList = nil => @@ -1613,6 +1615,7 @@ hasSig(dom,foo,sig,SL) == -- under substitution SL $domPvar: local := nil fun:= getConstructorAbbreviationFromDB dom.op => + builtinFunctorName? dom.op => nil -- FIXME S0:= constructSubst dom p := objectAssoc(foo,getConstructorOperationsFromDB dom.op) => for [x,.,cond,.] in rest p until S isnt 'failed repeat diff --git a/src/interp/i-special.boot b/src/interp/i-special.boot index eb9f984d..17d3d275 100644 --- a/src/interp/i-special.boot +++ b/src/interp/i-special.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2012, Gabriel Dos Reis. +-- Copyright (C) 2007-2016, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -1331,6 +1331,7 @@ upDEF t == ++ <%Mode>: the type of the constant. ++ T: too many constants designated by `form'. constantInDomain?(form,domainForm) == + builtinFunctorName? domainForm.op => nil opAlist := getConstructorOperationsFromDB domainForm.op key := opOf form entryList := [entry for (entry := [.,.,.,k]) in LASSOC(key,opAlist) diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index 2d02af64..a47ed36c 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2015, Gabriel Dos Reis. +-- Copyright (C) 2007-2016, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -754,8 +754,9 @@ isFunctor x == getConstructorKindFromDB op in '(domain package) u := get(op,'isFunctor,$CategoryFrame) => u builtinFunctorName? op => true - kind := getConstructorKindFromDB op - kind = nil or kind = 'category => false + db := constructorDB op or return false + dbConstructorKind db = 'category => false + loadDBIfNecessary db updateCategoryFrameForConstructor op get(op,'isFunctor,$CategoryFrame) diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot index 028a30b9..7e196d10 100644 --- a/src/interp/spad-parser.boot +++ b/src/interp/spad-parser.boot @@ -1,4 +1,4 @@ --- Copyright (C) 2007-2014, Gabriel Dos Reis. +-- Copyright (C) 2007-2016, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -91,6 +91,10 @@ indentationLocation line == tabChar? line.i => loc := 8 * (loc quo 8 + 1) return loc +storeBlanks!(line,n) == + #line >= n => nil + stringChar(line,n) := char " " + skipIfBlock rs == [n,:line] := z := preparseReadLine1 rs not string? line => z diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot index 5abf11fd..010a6bab 100644 --- a/src/interp/sys-driver.boot +++ b/src/interp/sys-driver.boot @@ -1,4 +1,4 @@ --- Copyright (C) 2007-2014 Gabriel Dos Reis +-- Copyright (C) 2007-2016 Gabriel Dos Reis -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -174,10 +174,8 @@ restart() == initializeDatabases firstTime? == getOptionValue "build-initdb" => nil - --initdb := getOptionValue "initial-db" => LOAD initdb - --FIXME: Ideally we should execute the previous line. The next line is - --FIXME: a short-term stopgap until build dependencies are in place. - if initdb := getOptionValue "initial-db" then + initdb := getOptionValue "initial-db" => + CATEGORYOPEN() LOAD initdb not firstTime? => openDatabases() fillDatabasesInCore() -- cgit v1.2.3