gnu.expr

Class ModuleBody

Implemented Interfaces:
Named
Known Direct Subclasses:
Mode, ModuleWithContext

public abstract class ModuleBody
extends Procedure0

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

Field Summary

protected boolean
runDone

Method Summary

void
apply(CallContext ctx)
Object
apply0()
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); }
Object
apply1(ModuleMethod method, Object arg1)
Object
apply2(ModuleMethod method, Object arg1, Object arg2)
Object
apply3(ModuleMethod method, Object arg1, Object arg2, Object arg3)
Object
apply4(ModuleMethod method, Object arg1, Object arg2, Object arg3, Object arg4)
Object
applyN(ModuleMethod method, 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, Object arg1, CallContext ctx)
int
match2(ModuleMethod proc, Object arg1, Object arg2, CallContext ctx)
int
match3(ModuleMethod proc, Object arg1, Object arg2, Object arg3, CallContext ctx)
int
match4(ModuleMethod proc, Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
int
matchN(ModuleMethod proc, Object[] args, CallContext ctx)
static void
processArgs(String[] args)
This is invoked by main when ModuleBody is compiled with --main.
void
run()
void
run(Consumer out)
void
run(CallContext ctx)
void
runAsMain()
This is invoked by main when ModuleBody is compiled with --main.
void
runAsMain(String[] args)
Deprecated.
static void
runCleanup(CallContext ctx, Throwable th, Consumer save)
static void
setMainPrintValues(boolean value)

Methods inherited from class gnu.mapping.Procedure0

apply0, apply1, apply2, apply3, apply4, applyN, numArgs

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getName, getProperty, getSetter, getSymbol, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, name, numArgs, removeProperty, set0, set1, setN, setName, setProperty, setProperty, setSetter, setSymbol, toString

Field Details

runDone

protected boolean runDone

Method Details

apply

public void apply(CallContext ctx)
            throws Throwable
Overrides:
apply in interface Procedure

apply0

public Object apply0()
            throws Throwable
Overrides:
apply0 in interface Procedure0

apply0

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

apply1

public Object apply1(ModuleMethod method,
                     Object arg1)
            throws Throwable

apply2

public Object apply2(ModuleMethod method,
                     Object arg1,
                     Object arg2)
            throws Throwable

apply3

public Object apply3(ModuleMethod method,
                     Object arg1,
                     Object arg2,
                     Object arg3)
            throws Throwable

apply4

public Object apply4(ModuleMethod method,
                     Object arg1,
                     Object arg2,
                     Object arg3,
                     Object arg4)
            throws Throwable

applyN

public Object applyN(ModuleMethod method,
                     Object[] args)
            throws Throwable

getMainPrintValues

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

match0

public int match0(ModuleMethod proc,
                  CallContext ctx)

match1

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

match2

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

match3

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

match4

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

matchN

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

processArgs

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

run

public void run()

run

public void run(Consumer out)

run

public void run(CallContext ctx)
            throws Throwable

runAsMain

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

runAsMain

public final void runAsMain(String[] args)

Deprecated.

This is invoked by main when ModuleBody is compiled with --main.

runCleanup

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

setMainPrintValues

public static void setMainPrintValues(boolean value)