KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > armedbear > lisp > make_condition


1 /*
2  * make_condition.java
3  *
4  * Copyright (C) 2003-2004 Peter Graves
5  * $Id: make_condition.java,v 1.15 2004/02/02 19:23:13 piso Exp $
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * 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 {
26     private make_condition()
27     {
28         super("%make-condition", PACKAGE_SYS, false);
29     }
30
31     // ### %make-condition
32
// %make-condition type slot-initializations => condition
33
public LispObject execute(LispObject type, LispObject initArgs)
34         throws ConditionThrowable
35     {
36         if (type == Symbol.ARITHMETIC_ERROR)
37             return new ArithmeticError(initArgs);
38         if (type == Symbol.CELL_ERROR)
39             return new CellError(initArgs);
40         if (type == Symbol.CONDITION)
41             return new Condition(initArgs);
42         if (type == Symbol.CONTROL_ERROR)
43             return new ControlError(initArgs);
44         if (type == Symbol.DIVISION_BY_ZERO)
45             return new DivisionByZero(initArgs);
46         if (type == Symbol.END_OF_FILE)
47             return new EndOfFile(initArgs);
48         if (type == Symbol.ERROR)
49             return new LispError(initArgs);
50         if (type == Symbol.FILE_ERROR)
51             return new FileError(initArgs);
52         if (type == Symbol.FLOATING_POINT_INEXACT)
53             return new FloatingPointInexact(initArgs);
54         if (type == Symbol.FLOATING_POINT_INVALID_OPERATION)
55             return new FloatingPointInvalidOperation(initArgs);
56         if (type == Symbol.FLOATING_POINT_OVERFLOW)
57             return new FloatingPointOverflow(initArgs);
58         if (type == Symbol.FLOATING_POINT_UNDERFLOW)
59             return new FloatingPointUnderflow(initArgs);
60         if (type == Symbol.PACKAGE_ERROR)
61             return new PackageError(initArgs);
62         if (type == Symbol.PARSE_ERROR)
63             return new ParseError(initArgs);
64         if (type == Symbol.PRINT_NOT_READABLE)
65             return new PrintNotReadable(initArgs);
66         if (type == Symbol.PROGRAM_ERROR)
67             return new ProgramError(initArgs);
68         if (type == Symbol.READER_ERROR)
69             return new ReaderError(initArgs);
70         if (type == Symbol.SERIOUS_CONDITION)
71             return new SeriousCondition(initArgs);
72         if (type == Symbol.SIMPLE_CONDITION)
73             return new SimpleCondition(initArgs);
74         if (type == Symbol.SIMPLE_ERROR)
75             return new SimpleError(initArgs);
76         if (type == Symbol.SIMPLE_TYPE_ERROR)
77             return new SimpleTypeError(initArgs);
78         if (type == Symbol.SIMPLE_WARNING)
79             return new SimpleWarning(initArgs);
80         if (type == Symbol.STORAGE_CONDITION)
81             return new StorageCondition(initArgs);
82         if (type == Symbol.STREAM_ERROR)
83             return new StreamError(initArgs);
84         if (type == Symbol.STYLE_WARNING)
85             return new StyleWarning(initArgs);
86         if (type == Symbol.TYPE_ERROR)
87             return new TypeError(initArgs);
88         if (type == Symbol.UNBOUND_SLOT)
89             return new UnboundSlot(initArgs);
90         if (type == Symbol.UNBOUND_VARIABLE)
91             return new UnboundVariable(initArgs);
92         if (type == Symbol.UNDEFINED_FUNCTION)
93             return new UndefinedFunction(initArgs);
94         if (type == Symbol.WARNING)
95             return new Warning(initArgs);
96
97         return NIL;
98     }
99
100     private static final Primitive2 MAKE_CONDITION = new make_condition();
101 }
102
Popular Tags