gnu.expr
Class ModuleExp

java.lang.Object
  extended by gnu.mapping.PropertySet
      extended by gnu.mapping.Procedure
          extended by gnu.mapping.Procedure0
              extended by gnu.expr.Expression
                  extended by gnu.expr.ScopeExp
                      extended by gnu.expr.LambdaExp
                          extended by gnu.expr.ModuleExp
All Implemented Interfaces:
Named, Printable, java.io.Externalizable, java.io.Serializable, javax.xml.transform.SourceLocator, org.xml.sax.Locator

public class ModuleExp
extends LambdaExp
implements java.io.Externalizable

Class used to implement Scheme top-level environments.

See Also:
Serialized Form

Field Summary
static boolean alwaysCompile
          Flag to force compilation, even when not required.
static boolean compilerAvailable
           
static java.lang.String dumpZipPrefix
          Used to control which .zip file dumps are generated.
static int EXPORT_SPECIFIED
           
static int IMMEDIATE
           
static int interactiveCounter
          Numeric identifier for this interactive "command".
static int LAZY_DECLARATIONS
           
static int NONSTATIC_SPECIFIED
           
static int STATIC_RUN_SPECIFIED
           
static int STATIC_SPECIFIED
           
static int SUPERTYPE_SPECIFIED
           
 
Fields inherited from class gnu.expr.LambdaExp
ATTEMPT_INLINE, body, closureEnvField, defaultArgs, firstChild, inlineHome, keywords, max_args, min_args, nameDecl, NEXT_AVAIL_FLAG, nextSibling, NO_FIELD, OVERLOADABLE_FIELD, returnContinuation, returnType, SEQUENCE_RESULT, staticLinkField
 
Fields inherited from class gnu.expr.ScopeExp
frameSize, id, outer
 
Fields inherited from class gnu.expr.Expression
flags, noExpressions, VALIDATED
 
Fields inherited from class gnu.mapping.Procedure
compilerKey, validateApplyKey
 
Fields inherited from class gnu.mapping.PropertySet
nameKey
 
Constructor Summary
ModuleExp()
           
 
Method Summary
 void allocChildClasses(Compilation comp)
           
 ClassType classFor(Compilation comp)
          Return the class this module.
static boolean evalModule(Environment env, CallContext ctx, Compilation comp, java.net.URL url, OutPort msg)
           
static java.lang.Object evalModule1(Environment env, Compilation comp, java.net.URL url, OutPort msg)
          Parse and compile a module.
static void evalModule2(Environment env, CallContext ctx, Language language, ModuleExp mexp, java.lang.Object inst)
           
static java.lang.Class evalToClass(Compilation comp, java.net.URL url)
          Compile to a class for immediate evaluation.
 Declaration firstDecl()
           
 ClassType[] getInterfaces()
           
 java.lang.String getNamespaceUri()
           
 ClassType getSuperType()
           
 boolean isStatic()
           
 void print(OutPort out)
           
 void readExternal(java.io.ObjectInput in)
           
 void setInterfaces(ClassType[] s)
           
 void setSuperType(ClassType s)
           
 boolean staticInitRun()
          True if module body (i.e.
protected
<R,D> R
visit(ExpVisitor<R,D> visitor, D d)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.expr.LambdaExp
allocFrame, apply, capture, compile, compileBody, compileEnd, compileSetField, declareClosureEnv, declareThis, generateApplyMethods, getCallConvention, getCaller, getCanCall, getCanRead, getClassType, getCompiledClassType, getExpClassName, getHeapFrameType, getImportsLexVars, getInlineOnly, getMainMethod, getMethod, getNeedsClosureEnv, getNeedsStaticLink, getOwningLambda, getProperty, getReturnType, getType, incomingArgs, isAbstract, isClassGenerated, isClassMethod, isHandlingTailCalls, isModuleBody, loadHeapFrame, mustCompile, outerLambda, outerLambdaNotInline, restArgType, setCanCall, setCanRead, setClassMethod, setCoercedReturnType, setCoercedReturnValue, setExceptions, setImportsLexVars, setImportsLexVars, setInlineOnly, setNeedsStaticLink, setNeedsStaticLink, setProperty, setReturnType, setType, side_effects, toString, validateApply, variable_args, visitChildren, visitChildrenOnly, visitProperties
 
Methods inherited from class gnu.expr.ScopeExp
add, add, addDeclaration, addDeclaration, addDeclaration, countDecls, countNonDynamicDecls, currentLambda, currentModule, duplicateDeclarationError, getDefine, getNoDefine, getVarScope, lookup, lookup, nestedIn, nesting, popScope, remove, remove, replaceFollowing, setIndexes, topLevel
 
Methods inherited from class gnu.expr.Expression
apply0, compile, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getSystemId, isSingleValue, isStableSourceLocation, makeWhile, match0, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLocation, valueIfConstant
 
Methods inherited from class gnu.mapping.Procedure0
apply1, apply2, apply3, apply4, applyN, numArgs
 
Methods inherited from class gnu.mapping.Procedure
apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getReturnType, getSetter, getSourceLocation, isSideEffectFree, match1, match2, match3, match4, matchN, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
 
Methods inherited from class gnu.mapping.PropertySet
getName, getSymbol, removeProperty, setName, setProperty, setSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
See Also:
Constant Field Values

dumpZipPrefix

public static java.lang.String dumpZipPrefix
Used to control which .zip file dumps are generated.


interactiveCounter

public static int interactiveCounter
Numeric identifier for this interactive "command". Incremented by Shell.run, and used to set the module name, and maybe the name of the --debug-dump-zip output file. We increment and use this counter purely to ease debugging. (Since each module gets its own ClassLoader, they don't need to be named differently, and it doesn't matter if there is a race condition on the counter.)


compilerAvailable

public static boolean compilerAvailable

alwaysCompile

public static boolean alwaysCompile
Flag to force compilation, even when not required.

Constructor Detail

ModuleExp

public ModuleExp()
Method Detail

evalToClass

public static java.lang.Class evalToClass(Compilation comp,
                                          java.net.URL url)
                                   throws SyntaxException
Compile to a class for immediate evaluation. Return null on error, if so errors go to comp.getMessages().

Throws:
SyntaxException

evalModule

public static final boolean evalModule(Environment env,
                                       CallContext ctx,
                                       Compilation comp,
                                       java.net.URL url,
                                       OutPort msg)
                                throws java.lang.Throwable
Throws:
java.lang.Throwable

evalModule1

public static final java.lang.Object evalModule1(Environment env,
                                                 Compilation comp,
                                                 java.net.URL url,
                                                 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,
                                     java.lang.Object inst)
                              throws java.lang.Throwable
Throws:
java.lang.Throwable

getNamespaceUri

public java.lang.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 class LambdaExp

visit

protected <R,D> R visit(ExpVisitor<R,D> visitor,
                        D d)
Overrides:
visit in class LambdaExp

print

public void print(OutPort out)
Overrides:
print in class LambdaExp

firstDecl

public Declaration firstDecl()
Overrides:
firstDecl in class ScopeExp

classFor

public ClassType classFor(Compilation comp)
Return the class this module. If not set yet, sets it now, based on the source file name.


writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException