gnu.kawa.functions
Class GetModuleClass

java.lang.Object
  extended by gnu.mapping.PropertySet
      extended by gnu.mapping.Procedure
          extended by gnu.mapping.ProcedureN
              extended by gnu.kawa.functions.GetModuleClass
All Implemented Interfaces:
Inlineable, Named

public class GetModuleClass
extends ProcedureN
implements Inlineable

Special procedure to get the Class of the current module. Since "current module" is defined by lexical scope, this isn't a first-class procedure - it has to be inlined.


Field Summary
static GetModuleClass getModuleClass
          A function that returns the class of the current module.
static GetModuleClass getModuleUri
          A function that returns the URLPath of the current module.
static GetModuleClass getModuleUriDummy
          A dummy 1-argument functions used in implementing getModuleUri.
 
Fields inherited from class gnu.mapping.ProcedureN
noArgs
 
Fields inherited from class gnu.mapping.Procedure
compilerKey, validateApplyKey
 
Fields inherited from class gnu.mapping.PropertySet
nameKey
 
Constructor Summary
GetModuleClass()
           
 
Method Summary
 java.lang.Object applyN(java.lang.Object[] args)
           
 void compile(ApplyExp exp, Compilation comp, Target target)
           
static Expression getModuleClassURI(Compilation comp)
          Return an expression that evaluates to a module-relative URL.
 Type getReturnType(Expression[] args)
          Semi-deprecated - instead should be set at Inline time.
 int numArgs()
          Return minArgs()|(maxArgs<<12).
 
Methods inherited from class gnu.mapping.ProcedureN
apply0, apply1, apply2, apply3, apply4
 
Methods inherited from class gnu.mapping.Procedure
apply, apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, isSideEffectFree, match0, match1, match2, match3, match4, matchN, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation, toString
 
Methods inherited from class gnu.mapping.PropertySet
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

getModuleClass

public static final GetModuleClass getModuleClass
A function that returns the class of the current module.


getModuleUri

public static final GetModuleClass getModuleUri
A function that returns the URLPath of the current module. This is "class-resource:" URL (see ResourceStreamHandler), though in immediate mode it gets optimized to a "file:" URL.


getModuleUriDummy

public static final GetModuleClass getModuleUriDummy
A dummy 1-argument functions used in implementing getModuleUri. It takes one argument - a reference to a declaration containing the intended result, with a value to initialize it. The compile method sets up the needed static initialization.

Constructor Detail

GetModuleClass

public GetModuleClass()
Method Detail

applyN

public java.lang.Object applyN(java.lang.Object[] args)
Specified by:
applyN in class ProcedureN

numArgs

public int numArgs()
Description copied from class: Procedure
Return minArgs()|(maxArgs<<12). We use a single virtual function to reduce the number of methods in the system, as well as the number of virtual method table entries. We shift by 12 so the number can normally be represented using a sipush instruction, without requiring a constant pool entry.

Overrides:
numArgs in class Procedure

compile

public void compile(ApplyExp exp,
                    Compilation comp,
                    Target target)
Specified by:
compile in interface Inlineable

getReturnType

public Type getReturnType(Expression[] args)
Description copied from class: Procedure
Semi-deprecated - instead should be set at Inline time. FIXME

Overrides:
getReturnType in class Procedure

getModuleClassURI

public static Expression getModuleClassURI(Compilation comp)
Return an expression that evaluates to a module-relative URL. This has the Kawa-specific URL scheme "class-resource:" and an associated ClassLoader (using a WeakHashMap). It's used to reference resources located using the compiled class's ClassLoader.