01: /*
02: * make_condition.java
03: *
04: * Copyright (C) 2003-2004 Peter Graves
05: * $Id: make_condition.java,v 1.15 2004/02/02 19:23:13 piso 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.ARITHMETIC_ERROR)
34: return new ArithmeticError(initArgs);
35: if (type == Symbol.CELL_ERROR)
36: return new CellError(initArgs);
37: if (type == Symbol.CONDITION)
38: return new Condition(initArgs);
39: if (type == Symbol.CONTROL_ERROR)
40: return new ControlError(initArgs);
41: if (type == Symbol.DIVISION_BY_ZERO)
42: return new DivisionByZero(initArgs);
43: if (type == Symbol.END_OF_FILE)
44: return new EndOfFile(initArgs);
45: if (type == Symbol.ERROR)
46: return new LispError(initArgs);
47: if (type == Symbol.FILE_ERROR)
48: return new FileError(initArgs);
49: if (type == Symbol.FLOATING_POINT_INEXACT)
50: return new FloatingPointInexact(initArgs);
51: if (type == Symbol.FLOATING_POINT_INVALID_OPERATION)
52: return new FloatingPointInvalidOperation(initArgs);
53: if (type == Symbol.FLOATING_POINT_OVERFLOW)
54: return new FloatingPointOverflow(initArgs);
55: if (type == Symbol.FLOATING_POINT_UNDERFLOW)
56: return new FloatingPointUnderflow(initArgs);
57: if (type == Symbol.PACKAGE_ERROR)
58: return new PackageError(initArgs);
59: if (type == Symbol.PARSE_ERROR)
60: return new ParseError(initArgs);
61: if (type == Symbol.PRINT_NOT_READABLE)
62: return new PrintNotReadable(initArgs);
63: if (type == Symbol.PROGRAM_ERROR)
64: return new ProgramError(initArgs);
65: if (type == Symbol.READER_ERROR)
66: return new ReaderError(initArgs);
67: if (type == Symbol.SERIOUS_CONDITION)
68: return new SeriousCondition(initArgs);
69: if (type == Symbol.SIMPLE_CONDITION)
70: return new SimpleCondition(initArgs);
71: if (type == Symbol.SIMPLE_ERROR)
72: return new SimpleError(initArgs);
73: if (type == Symbol.SIMPLE_TYPE_ERROR)
74: return new SimpleTypeError(initArgs);
75: if (type == Symbol.SIMPLE_WARNING)
76: return new SimpleWarning(initArgs);
77: if (type == Symbol.STORAGE_CONDITION)
78: return new StorageCondition(initArgs);
79: if (type == Symbol.STREAM_ERROR)
80: return new StreamError(initArgs);
81: if (type == Symbol.STYLE_WARNING)
82: return new StyleWarning(initArgs);
83: if (type == Symbol.TYPE_ERROR)
84: return new TypeError(initArgs);
85: if (type == Symbol.UNBOUND_SLOT)
86: return new UnboundSlot(initArgs);
87: if (type == Symbol.UNBOUND_VARIABLE)
88: return new UnboundVariable(initArgs);
89: if (type == Symbol.UNDEFINED_FUNCTION)
90: return new UndefinedFunction(initArgs);
91: if (type == Symbol.WARNING)
92: return new Warning(initArgs);
93:
94: return NIL;
95: }
96:
97: private static final Primitive2 MAKE_CONDITION = new make_condition();
98: }
|