/** * Sets the maximum stack size. * @param stackSizeMax the maximum stack size in element units. */ public static void setStackSizeMax(final int stackSizeMax) { UserFunction.stackSizeMax = stackSizeMax; createStack(); }
public double evalD(final EvalEnv env, final Term[] args) { final int si0 = stackIndex; prepareCall(env, args, si0); final double ret = body.evalD(env); finishCall(env, si0); return ret; }
public boolean evalB(final EvalEnv env, final Term[] args) throws EvalException { if (body.isB()) { final int si0 = stackIndex; prepareCall(env, args, si0); final boolean ret = body.evalB(env); finishCall(env, si0); return ret; } return Term.toB(evalD(env, args)); }
/** * Construcs a new user function with the given name, parameter list and body. * @param name the function's name, must not be <code>null</code> * @param params the parameter list, must not be <code>null</code> * @param body the function's body, must not be <code>null</code> */ public UserFunction(final String name, final Variable[] params, final Term body) { super(name, body.getRetType(), params.length, getArgTypes(params)); this.params = params; this.body = body; }
public int evalI(final EvalEnv env, final Term[] args) throws EvalException { if (body.isI()) { final int si0 = stackIndex; prepareCall(env, args, si0); final int ret = body.evalI(env); finishCall(env, si0); return ret; } return Term.toI(evalD(env, args)); }