01: /*
02: * FileError.java
03: *
04: * Copyright (C) 2004 Peter Graves
05: * $Id: FileError.java,v 1.3 2004/01/16 15:16:40 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 FileError extends LispError {
25: private LispObject pathname = NIL;
26:
27: // initArgs is either a normal initArgs list or a pathname.
28: public FileError(LispObject initArgs) throws ConditionThrowable {
29: super (initArgs);
30: if (initArgs instanceof Cons) {
31: LispObject pathname = NIL;
32: LispObject first, second;
33: while (initArgs != NIL) {
34: first = initArgs.car();
35: initArgs = initArgs.cdr();
36: second = initArgs.car();
37: initArgs = initArgs.cdr();
38: if (first == Keyword.PATHNAME) {
39: pathname = second;
40: break;
41: }
42: }
43: this .pathname = pathname;
44: } else
45: pathname = initArgs;
46: }
47:
48: public FileError(String message) {
49: super (message);
50: }
51:
52: public FileError(String message, LispObject pathname) {
53: super (message);
54: this .pathname = pathname;
55: }
56:
57: public LispObject getPathname() {
58: return pathname;
59: }
60:
61: public LispObject typeOf() {
62: return Symbol.FILE_ERROR;
63: }
64:
65: public LispClass classOf() {
66: return BuiltInClass.FILE_ERROR;
67: }
68:
69: public LispObject typep(LispObject type) throws ConditionThrowable {
70: if (type == Symbol.FILE_ERROR)
71: return T;
72: if (type == BuiltInClass.FILE_ERROR)
73: return T;
74: return super.typep(type);
75: }
76: }
|