01: /*
02: * make_condition.java
03: *
04: * Copyright (C) 2003 Peter Graves
05: * $Id: make_condition.java,v 1.7 2003/11/15 11:03:32 beedlem Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: package org.armedbear.lisp;
23:
24: public final class make_condition extends Primitive2 {
25: private make_condition() {
26: super ("%make-condition", PACKAGE_SYS, false);
27: }
28:
29: // ### %make-condition
30: // %make-condition type slot-initializations => condition
31: public LispObject execute(LispObject type, LispObject initArgs)
32: throws ConditionThrowable {
33: if (type == Symbol.CONDITION)
34: return new Condition(initArgs);
35: if (type == Symbol.SIMPLE_CONDITION)
36: return new SimpleCondition(initArgs);
37: if (type == Symbol.ERROR)
38: return new LispError(initArgs);
39: if (type == Symbol.ARITHMETIC_ERROR)
40: return new ArithmeticError(initArgs);
41: if (type == Symbol.CELL_ERROR)
42: return new CellError(initArgs);
43: if (type == Symbol.CONTROL_ERROR)
44: return new ControlError(initArgs);
45: if (type == Symbol.DIVISION_BY_ZERO)
46: return new DivisionByZero(initArgs);
47: if (type == Symbol.END_OF_FILE)
48: return new EndOfFile(initArgs);
49: if (type == Symbol.PACKAGE_ERROR)
50: return new PackageError(initArgs);
51: if (type == Symbol.SIMPLE_ERROR)
52: return new SimpleError(initArgs);
53: if (type == Symbol.STREAM_ERROR)
54: return new StreamError(initArgs);
55: if (type == Symbol.TYPE_ERROR)
56: return new TypeError(initArgs);
57: if (type == Symbol.SIMPLE_TYPE_ERROR)
58: return new SimpleTypeError(initArgs);
59: if (type == Symbol.UNBOUND_SLOT)
60: return new UnboundSlot(initArgs);
61: if (type == Symbol.UNBOUND_VARIABLE)
62: return new UnboundVariable(initArgs);
63: if (type == Symbol.UNDEFINED_FUNCTION)
64: return new UndefinedFunction(initArgs);
65:
66: return NIL;
67: }
68:
69: private static final make_condition MAKE_CONDITION = new make_condition();
70: }
|