gnu.mapping

Class Procedure

public abstract class Procedure extends PropertySet

The abstract parent for all Scheme functions.
Constructor Summary
Procedure()
Procedure(String n)
Method Summary
voidapply(CallContext ctx)
Call this Procedure using the explicit-CallContext-convention.
static voidapply(Procedure proc, CallContext ctx)
abstract Objectapply0()
abstract Objectapply1(Object arg1)
abstract Objectapply2(Object arg1, Object arg2)
abstract Objectapply3(Object arg1, Object arg2, Object arg3)
abstract Objectapply4(Object arg1, Object arg2, Object arg3, Object arg4)
abstract ObjectapplyN(Object[] args)
voidcheck0(CallContext ctx)
Does match0, plus throws exception on argument mismatch.
voidcheck1(Object arg1, CallContext ctx)
Does match1, plus throws exception on argument mismatch.
voidcheck2(Object arg1, Object arg2, CallContext ctx)
Does match, plus throws exception on argument mismatch.
voidcheck3(Object arg1, Object arg2, Object arg3, CallContext ctx)
Does match3, plus throws exception on argument mismatch.
voidcheck4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
Does match4, plus throws exception on argument mismatch.
static voidcheckArgCount(Procedure proc, int argCount)
Check that the number of arguments in a call is valid.
voidcheckN(Object[] args, CallContext ctx)
Does matchN, plus throws exception on argument mismatch.
ProceduregetSetter()
StringgetSourceLocation()
intmatch0(CallContext ctx)
Pass zero arguments.
intmatch1(Object arg1, CallContext ctx)
Pass one argument.
intmatch2(Object arg1, Object arg2, CallContext ctx)
Pass two arguments.
intmatch3(Object arg1, Object arg2, Object arg3, CallContext ctx)
Pass three arguments.
intmatch4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
Pass four arguments.
intmatchN(Object[] args, CallContext ctx)
intmaxArgs()
Maximum number of arguments allowed, or -1 for unlimited.
intminArgs()
Minimum number of arguments required.
intnumArgs()
Return minArgs()|(maxArgs<<12).
voidset0(Object result)
If HasSetter, the Procedure is called in the LHS of an assignment.
voidset1(Object arg1, Object value)
voidsetN(Object[] args)
voidsetSetter(Procedure setter)
voidsetSourceLocation(String file, int line)
StringtoString()

Constructor Detail

Procedure

public Procedure()

Procedure

public Procedure(String n)

Method Detail

apply

public void apply(CallContext ctx)
Call this Procedure using the explicit-CallContext-convention. The input arguments are (by default) in stack.args; the result is written to ctx.consumer.

apply

public static void apply(Procedure proc, CallContext ctx)

apply0

public abstract Object apply0()

apply1

public abstract Object apply1(Object arg1)

apply2

public abstract Object apply2(Object arg1, Object arg2)

apply3

public abstract Object apply3(Object arg1, Object arg2, Object arg3)

apply4

public abstract Object apply4(Object arg1, Object arg2, Object arg3, Object arg4)

applyN

public abstract Object applyN(Object[] args)

check0

public void check0(CallContext ctx)
Does match0, plus throws exception on argument mismatch.

check1

public void check1(Object arg1, CallContext ctx)
Does match1, plus throws exception on argument mismatch.

check2

public void check2(Object arg1, Object arg2, CallContext ctx)
Does match, plus throws exception on argument mismatch.

check3

public void check3(Object arg1, Object arg2, Object arg3, CallContext ctx)
Does match3, plus throws exception on argument mismatch.

check4

public void check4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
Does match4, plus throws exception on argument mismatch.

checkArgCount

public static void checkArgCount(Procedure proc, int argCount)
Check that the number of arguments in a call is valid.

Parameters: proc the Procedure being called argCount the number of arguments in the call

Throws: WrongArguments there are too many or too few actual arguments

checkN

public void checkN(Object[] args, CallContext ctx)
Does matchN, plus throws exception on argument mismatch.

getSetter

public Procedure getSetter()

getSourceLocation

public String getSourceLocation()

match0

public int match0(CallContext ctx)
Pass zero arguments.

Returns: non-negative if the match succeeded, else negative.

match1

public int match1(Object arg1, CallContext ctx)
Pass one argument.

Returns: non-negative if the match succeeded, else negative.

match2

public int match2(Object arg1, Object arg2, CallContext ctx)
Pass two arguments.

Returns: non-negative if the match succeeded, else negative.

match3

public int match3(Object arg1, Object arg2, Object arg3, CallContext ctx)
Pass three arguments.

Returns: non-negative if the match succeeded, else negative.

match4

public int match4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
Pass four arguments.

Returns: non-negative if the match succeeded, else negative.

matchN

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

maxArgs

public final int maxArgs()
Maximum number of arguments allowed, or -1 for unlimited. (May also return -1 if there are keyword arguments, for implementation reasons.)

minArgs

public final int minArgs()
Minimum number of arguments required.

numArgs

public int numArgs()
Return minArgs()|(maxArgs<<12).

set0

public void set0(Object result)
If HasSetter, the Procedure is called in the LHS of an assignment.

set1

public void set1(Object arg1, Object value)

setN

public void setN(Object[] args)

setSetter

public void setSetter(Procedure setter)

setSourceLocation

public void setSourceLocation(String file, int line)

toString

public String toString()