Package gnu.expr
Class ModuleExp
-
- All Implemented Interfaces:
gnu.kawa.format.Printable
,Named
,SourceLocator
,Externalizable
,Serializable
,SourceLocator
,Locator
public class ModuleExp extends LambdaExp implements Externalizable
Class used to implement Scheme top-level environments.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gnu.expr.LambdaExp
LambdaExp.Closure
-
Nested classes/interfaces inherited from interface gnu.text.SourceLocator
SourceLocator.Simple
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
alwaysCompile
Flag to force compilation, even when not required.static boolean
compilerAvailable
Deprecated.static String
dumpZipPrefix
Used to control which .zip file dumps are generated.static int
EXPORT_SPECIFIED
static int
HAS_SUB_MODULE
static int
IMMEDIATE
True if the module is immediately evaluated.static int
INTERACTIVE
True of a read-eval-print interface where each module is only partial.static int
LAZY_DECLARATIONS
static int
NONSTATIC_SPECIFIED
static int
STATIC_RUN_SPECIFIED
static int
STATIC_SPECIFIED
static int
SUPERTYPE_SPECIFIED
static int
USE_DEFINED_CLASS
Using explicit class (e.g.-
Fields inherited from class gnu.expr.LambdaExp
ALLOW_OTHER_KEYWORDS, applyToConsumer, ATTEMPT_INLINE, body, CLOSURE_ENV_NAME, closureEnvField, firstChild, HAS_NONTRIVIAL_DEFAULT, HAS_NONTRIVIAL_PATTERN, IN_EXPWALKER, inlineHome, keywords, max_args, min_args, nameDecl, NEXT_AVAIL_FLAG, nextSibling, NO_FIELD, opt_args, OVERLOADABLE_FIELD, PASSES_TAILCALLS, PUBLIC_METHOD, returnContinuation, returnType, SEQUENCE_RESULT, staticLinkField
-
Fields inherited from class gnu.expr.Expression
applyMethodExpression, flags, noExpressions, type, VALIDATED
-
Fields inherited from class gnu.mapping.Procedure
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
-
Fields inherited from class gnu.mapping.PropertySet
nameKey
-
-
Constructor Summary
Constructors Constructor Description ModuleExp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allocChildClasses(Compilation comp)
ClassType
classFor(Compilation comp)
Return the class for this module.static boolean
compilerAvailable()
static boolean
evalModule(Environment env, CallContext ctx, Compilation comp, URL url, gnu.kawa.io.OutPort msg)
static Object
evalModule1(Environment env, Compilation comp, URL url, gnu.kawa.io.OutPort msg)
Parse and compile a module.static void
evalModule2(Environment env, CallContext ctx, Language language, ModuleExp mexp, Object inst)
static Class
evalToClass(Compilation comp, URL url)
Compile to a class for immediate evaluation.Declaration
firstDecl()
ClassType[]
getInterfaces()
ModuleInfo
getMinfo()
String
getNamespaceUri()
ClassType
getSuperType()
boolean
isStatic()
void
print(gnu.kawa.io.OutPort out)
void
readExternal(ObjectInput in)
void
setInterfaces(ClassType[] s)
void
setSuperType(ClassType s)
boolean
staticInitRun()
True if module body (i.e.boolean
subModulesOnly()
static ModuleExp
valueOf(ClassType type)
protected <R,D>
Rvisit(ExpVisitor<R,D> visitor, D d)
void
writeExternal(ObjectOutput out)
-
Methods inherited from class gnu.expr.LambdaExp
addParameter, allocFrame, apply, calculateType, capture, checkForInitCall, compile, compileBody, compileEnd, compileSetField, declareClosureEnv, declareThis, generateApplyMethods, getBodyFirstExpression, getCallConvention, getCaller, getCanRead, getClassType, getCompiledClassType, getExpClassName, getHeapFrameType, getImportsLexVars, getInlineOnly, getMainMethod, getMethod, getNeedsClosureEnv, getNeedsStaticLink, getOwningLambda, getProperty, getReturnType, incomingArgs, inlinedInCallerOrCheckMethodOnly, inlinedInCheckMethod, isAbstract, isClassMethod, isHandlingTailCalls, isModuleBody, isNative, loadHeapFrame, maybeSetReturnType, mustCompile, outerLambda, outerLambdaNotInline, outerLambdaOrCaller, pushChild, restArgType, reverseChildList, setCallConvention, setCanRead, setClassMethod, setCoercedReturnType, setCoercedReturnValue, setExceptions, setImportsLexVars, setImportsLexVars, setInlineOnly, setInlineOnly, setNeedsStaticLink, setNeedsStaticLink, setProperty, setReturnType, setType, side_effects, toString, usingCallContext, validateApply, variable_args, visitChildren, visitChildrenOnly, visitProperties
-
Methods inherited from class gnu.expr.ScopeExp
add, add, addDeclaration, addDeclaration, addDeclaration, clearCallList, countDecls, currentLambda, currentModule, duplicateDeclarationError, getDefine, getNoDefine, getOuter, getVarScope, isClassGenerated, lastDecl, lookup, lookup, nestedIn, nesting, popScope, remove, remove, replaceFollowing, setIndexes, setOuter, topLevel
-
Methods inherited from class gnu.expr.Expression
applyMethodExpression, checkLiteralKeyword, compile, compile, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getEndColumn, getEndLine, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getStartColumn, getStartLine, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, maybeSetLine, neverReturns, numArgs, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLine, setLocation, setType, valueIfConstant
-
Methods inherited from class gnu.mapping.Procedure
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
-
Methods inherited from class gnu.mapping.PropertySet
getName, getSymbol, removeProperty, setName, setProperty, setSymbol
-
-
-
-
Field Detail
-
EXPORT_SPECIFIED
public static final int EXPORT_SPECIFIED
- See Also:
- Constant Field Values
-
STATIC_SPECIFIED
public static final int STATIC_SPECIFIED
- See Also:
- Constant Field Values
-
NONSTATIC_SPECIFIED
public static final int NONSTATIC_SPECIFIED
- See Also:
- Constant Field Values
-
SUPERTYPE_SPECIFIED
public static final int SUPERTYPE_SPECIFIED
- See Also:
- Constant Field Values
-
STATIC_RUN_SPECIFIED
public static final int STATIC_RUN_SPECIFIED
- See Also:
- Constant Field Values
-
LAZY_DECLARATIONS
public static final int LAZY_DECLARATIONS
- See Also:
- Constant Field Values
-
IMMEDIATE
public static final int IMMEDIATE
True if the module is immediately evaluated.- See Also:
- Constant Field Values
-
INTERACTIVE
public static final int INTERACTIVE
True of a read-eval-print interface where each module is only partial. Conceptually, each statement is a fragment of a imagined super-module for the whole interaction, though currently there is no super-module object. IMMEDIATE is also set in this case.- See Also:
- Constant Field Values
-
USE_DEFINED_CLASS
public static final int USE_DEFINED_CLASS
Using explicit class (e.g. define-simple-class) for module class.- See Also:
- Constant Field Values
-
HAS_SUB_MODULE
public static final int HAS_SUB_MODULE
- See Also:
- Constant Field Values
-
dumpZipPrefix
public static String dumpZipPrefix
Used to control which .zip file dumps are generated.
-
compilerAvailable
@Deprecated public static boolean compilerAvailable
Deprecated.
-
alwaysCompile
public static boolean alwaysCompile
Flag to force compilation, even when not required.
-
-
Method Detail
-
subModulesOnly
public boolean subModulesOnly()
-
evalToClass
public static Class evalToClass(Compilation comp, URL url) throws SyntaxException
Compile to a class for immediate evaluation. Return null on error, if so errors go to comp.getMessages().- Throws:
SyntaxException
-
compilerAvailable
public static boolean compilerAvailable()
-
evalModule
public static final boolean evalModule(Environment env, CallContext ctx, Compilation comp, URL url, gnu.kawa.io.OutPort msg) throws Throwable
- Throws:
Throwable
-
evalModule1
public static final Object evalModule1(Environment env, Compilation comp, URL url, gnu.kawa.io.OutPort msg) throws SyntaxException
Parse and compile a module.- Returns:
- null on error; otherwise a "cookie" that can be passed to evalModule2 or CompiledModule.
- Throws:
SyntaxException
-
evalModule2
public static final void evalModule2(Environment env, CallContext ctx, Language language, ModuleExp mexp, Object inst) throws Throwable
- Throws:
Throwable
-
getMinfo
public ModuleInfo getMinfo()
-
getNamespaceUri
public String getNamespaceUri()
-
getSuperType
public final ClassType getSuperType()
-
setSuperType
public final void setSuperType(ClassType s)
-
getInterfaces
public final ClassType[] getInterfaces()
-
setInterfaces
public final void setInterfaces(ClassType[] s)
-
isStatic
public final boolean isStatic()
-
staticInitRun
public boolean staticInitRun()
True if module body (i.e. run) is called by class initializer.
-
allocChildClasses
public void allocChildClasses(Compilation comp)
- Overrides:
allocChildClasses
in classLambdaExp
-
visit
protected <R,D> R visit(ExpVisitor<R,D> visitor, D d)
-
firstDecl
public Declaration firstDecl()
-
classFor
public ClassType classFor(Compilation comp)
Return the class for this module. If not set yet, sets it now, based on the source file name.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
-