Changeset 3946


Ignore:
Timestamp:
09/21/03 01:56:15 (19 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/make_condition.java

    r3926 r3946  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: make_condition.java,v 1.1 2003-09-20 16:56:33 piso Exp $
     5 * $Id: make_condition.java,v 1.2 2003-09-21 01:56:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2222package org.armedbear.lisp;
    2323
     24// ### make-condition
    2425public final class make_condition extends Primitive
    2526{
     
    2930    }
    3031
     32    // make-condition type &rest slot-initializations => condition
    3133    public LispObject execute(LispObject[] args) throws ConditionThrowable
    3234    {
    33         return new Condition();
     35        if (args.length < 1)
     36            throw new ConditionThrowable(new WrongNumberOfArgumentsException(this));
     37        LispObject type = args[0];
     38        LispObject initArgs = NIL;
     39        for (int i = args.length; i-- > 1;)
     40            initArgs = new Cons(args[i], initArgs);
     41        if (type == Symbol.CONDITION)
     42            return new Condition(initArgs);
     43        if (type == Symbol.SIMPLE_CONDITION)
     44            return new SimpleCondition(initArgs);
     45        if (type == Symbol.ERROR)
     46            return new LispError(initArgs);
     47        if (type == Symbol.SIMPLE_ERROR)
     48            return new SimpleError(initArgs);
     49        if (type == Symbol.UNBOUND_VARIABLE)
     50            return new UnboundVariable(initArgs);
     51        if (type == Symbol.UNDEFINED_FUNCTION)
     52            return new UndefinedFunction(initArgs);
     53        throw new ConditionThrowable(new LispError("MAKE-CONDITION: unsupported type " + type));
    3454    }
    3555
Note: See TracChangeset for help on using the changeset viewer.