// Copyright (c) 1996-2002 Brian D. Carlstrom

package bdc.scheme.procedure;

import bdc.scheme.Scheme;
import bdc.scheme.SchemeException;
import bdc.scheme.Stack;
import bdc.scheme.Writer;
import bdc.scheme.expression.Procedure0;
import bdc.util.Constants;
import bdc.util.SystemUtil;

/**
    (break-point) (break-point s)
*/
public class BreakPoint extends Procedure0
{
    public Object apply0 (Stack stack) throws SchemeException
    {
        try {
            stack.addElement("default");
            return apply1(stack);
        }
        finally {
            stack.inUse -= 1;
        }
    }

    public Object apply1 (Stack stack)
    {
        Object o1 = stack.array[stack.inUse-1];
        stack.currentErrorPort.println("***BREAKPOINT***");
        stack.currentErrorPort.println(Writer.write(o1));
        stack.currentErrorPort.println();
        SystemUtil.sleep(3 * Constants.MillisPerSecond);
        return Scheme.Unspecified;
    }
}
