gnu.expr
Class ModuleBody

java.lang.Object
  extended by gnu.mapping.PropertySet
      extended by gnu.mapping.Procedure
          extended by gnu.mapping.Procedure0
              extended by gnu.expr.ModuleBody
All Implemented Interfaces:
Named
Direct Known Subclasses:
Mode, ModuleWithContext

public abstract class ModuleBody
extends Procedure0

Class for the dummy top-level function of a module.


Field Summary
protected  boolean runDone
           
 
Constructor Summary
ModuleBody()
           
 
Method Summary
 void apply(CallContext ctx)
          Call this Procedure using the explicit-CallContext-convention.
 java.lang.Object apply0()
           
 java.lang.Object apply0(ModuleMethod method)
          A subclass will typically override this like: switch (method.selector) { case 3: return function3(); case 5: return function5(); default: super.apply0(method); }
 java.lang.Object apply1(ModuleMethod method, java.lang.Object arg1)
           
 java.lang.Object apply2(ModuleMethod method, java.lang.Object arg1, java.lang.Object arg2)
           
 java.lang.Object apply3(ModuleMethod method, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
           
 java.lang.Object apply4(ModuleMethod method, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
           
 java.lang.Object applyN(ModuleMethod method, java.lang.Object[] args)
           
static boolean getMainPrintValues()
          True if runAsMain should print values (in top-level expressions).
 int match0(ModuleMethod proc, CallContext ctx)
           
 int match1(ModuleMethod proc, java.lang.Object arg1, CallContext ctx)
           
 int match2(ModuleMethod proc, java.lang.Object arg1, java.lang.Object arg2, CallContext ctx)
           
 int match3(ModuleMethod proc, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, CallContext ctx)
           
 int match4(ModuleMethod proc, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, CallContext ctx)
           
 int matchN(ModuleMethod proc, java.lang.Object[] args, CallContext ctx)
           
static void processArgs(java.lang.String[] args)
          This is invoked by main when ModuleBody is compiled with --main.
 void run()
           
 void run(CallContext ctx)
           
 void run(Consumer out)
           
 void runAsMain()
          This is invoked by main when ModuleBody is compiled with --main.
static void runCleanup(CallContext ctx, java.lang.Throwable th, Consumer save)
           
static void setMainPrintValues(boolean value)
           
 
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, getSetter, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, 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

runDone

protected boolean runDone
Constructor Detail

ModuleBody

public ModuleBody()
Method Detail

apply

public void apply(CallContext ctx)
           throws java.lang.Throwable
Description copied from class: Procedure
Call this Procedure using the explicit-CallContext-convention. The input arguments are (by default) in stack.args; the result is written to ctx.consumer.

Overrides:
apply in class Procedure
Throws:
java.lang.Throwable

run

public void run(CallContext ctx)
         throws java.lang.Throwable
Throws:
java.lang.Throwable

run

public void run()

run

public void run(Consumer out)

runCleanup

public static void runCleanup(CallContext ctx,
                              java.lang.Throwable th,
                              Consumer save)

apply0

public java.lang.Object apply0()
                        throws java.lang.Throwable
Specified by:
apply0 in class Procedure0
Throws:
java.lang.Throwable

getMainPrintValues

public static boolean getMainPrintValues()
True if runAsMain should print values (in top-level expressions).


setMainPrintValues

public static void setMainPrintValues(boolean value)

processArgs

public static void processArgs(java.lang.String[] args)
This is invoked by main when ModuleBody is compiled with --main.


runAsMain

public final void runAsMain()
This is invoked by main when ModuleBody is compiled with --main.


apply0

public java.lang.Object apply0(ModuleMethod method)
                        throws java.lang.Throwable
A subclass will typically override this like: switch (method.selector) { case 3: return function3(); case 5: return function5(); default: super.apply0(method); }

Throws:
java.lang.Throwable

apply1

public java.lang.Object apply1(ModuleMethod method,
                               java.lang.Object arg1)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

apply2

public java.lang.Object apply2(ModuleMethod method,
                               java.lang.Object arg1,
                               java.lang.Object arg2)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

apply3

public java.lang.Object apply3(ModuleMethod method,
                               java.lang.Object arg1,
                               java.lang.Object arg2,
                               java.lang.Object arg3)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

apply4

public java.lang.Object apply4(ModuleMethod method,
                               java.lang.Object arg1,
                               java.lang.Object arg2,
                               java.lang.Object arg3,
                               java.lang.Object arg4)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

applyN

public java.lang.Object applyN(ModuleMethod method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

match0

public int match0(ModuleMethod proc,
                  CallContext ctx)

match1

public int match1(ModuleMethod proc,
                  java.lang.Object arg1,
                  CallContext ctx)

match2

public int match2(ModuleMethod proc,
                  java.lang.Object arg1,
                  java.lang.Object arg2,
                  CallContext ctx)

match3

public int match3(ModuleMethod proc,
                  java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.Object arg3,
                  CallContext ctx)

match4

public int match4(ModuleMethod proc,
                  java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.Object arg3,
                  java.lang.Object arg4,
                  CallContext ctx)

matchN

public int matchN(ModuleMethod proc,
                  java.lang.Object[] args,
                  CallContext ctx)