// Copyright (c) 1996-2002 Brian D. Carlstrom

package bdc.scheme.expression;

import bdc.scheme.SchemeException;
import bdc.scheme.Stack;
import bdc.scheme.Symbol;
import bdc.util.Fmt;

/**
    abstract superclass for all types of Procedures in the system
*/
abstract public class Procedure
{

    /**
        Name to print for debugging
    */
    public Symbol name;

    abstract public Object apply0 (Stack stack) throws SchemeException;

    abstract public Object apply1 (Stack stack) throws SchemeException;

    abstract public Object apply2 (Stack stack) throws SchemeException;

    abstract public Object apply3 (Stack stack) throws SchemeException;

    abstract public Object apply4 (Stack stack) throws SchemeException;

    abstract public Object applyN (int n, Stack stack) throws SchemeException;

      /**
          toString simply prints the name if it has been set by definition
          otherwise print Object.toString which will give a unique name
      */
    public String toString ()
    {
        return Fmt.S("'#{Procedure %s}",
                     ((name == null) ? super.toString() : name.toString()));
    }
}
