Changeset 3885
- Timestamp:
- 09/19/03 12:10:28 (20 years ago)
- Location:
- trunk/j/src/org/armedbear/lisp
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/Lisp.java
r3884 r3885 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Lisp.java,v 1.13 5 2003-09-19 11:50:18piso Exp $5 * $Id: Lisp.java,v 1.136 2003-09-19 12:10:27 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 275 275 result = obj.getSymbolValue(); 276 276 if (result == null) 277 throw new UnboundVariableException(obj.getName());277 throw new ConditionThrowable(new UnboundVariableException(obj.getName())); 278 278 } 279 279 return result; … … 283 283 LispObject fun = env.lookupFunctional(first); 284 284 if (fun == null) 285 throw new UndefinedFunctionError(first);285 throw new ConditionThrowable(new UndefinedFunctionError(first)); 286 286 switch (fun.getFunctionalType()) { 287 287 case FTYPE_SPECIAL_OPERATOR: { … … 759 759 } else if (obj instanceof Cons && obj.car() == Symbol.LAMBDA) 760 760 return new Closure(obj.cadr(), obj.cddr(), new Environment()); 761 throw new UndefinedFunctionError(obj);761 throw new ConditionThrowable(new UndefinedFunctionError(obj)); 762 762 } 763 763 -
trunk/j/src/org/armedbear/lisp/ParseError.java
r3880 r3885 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: ParseError.java,v 1. 2 2003-09-19 01:07:46piso Exp $5 * $Id: ParseError.java,v 1.3 2003-09-19 12:10:27 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 30 30 this.message = message; 31 31 } 32 33 public LispObject typep(LispObject type) throws ConditionThrowable 34 { 35 if (type == Symbol.PARSE_ERROR) 36 return T; 37 if (type == Symbol.ERROR) 38 return T; 39 return super.typep(type); 40 } 32 41 } -
trunk/j/src/org/armedbear/lisp/Primitives.java
r3884 r3885 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Primitives.java,v 1.40 6 2003-09-19 11:50:19piso Exp $5 * $Id: Primitives.java,v 1.407 2003-09-19 12:10:27 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 306 306 if (function != null) 307 307 return function; 308 throw new UndefinedFunctionError(arg);308 throw new ConditionThrowable(new UndefinedFunctionError(arg)); 309 309 } 310 310 case SYMBOL_PLIST: // ### symbol-plist … … 1728 1728 handler = obj.getSymbolFunction(); 1729 1729 if (handler == null) 1730 throw new UndefinedFunctionError(obj);1730 throw new ConditionThrowable(new UndefinedFunctionError(obj)); 1731 1731 } else 1732 1732 handler = obj; … … 1787 1787 1788 1788 private static boolean isConditionOfType(ConditionThrowable c, LispObject type) 1789 throws ConditionThrowable 1789 1790 { 1790 1791 if (type == Symbol.END_OF_FILE) … … 1793 1794 return c instanceof StreamError; 1794 1795 if (type == Symbol.UNDEFINED_FUNCTION) 1795 return c instanceof UndefinedFunctionError;1796 return c.getCondition() instanceof UndefinedFunctionError; 1796 1797 if (type == Symbol.TYPE_ERROR) 1797 1798 return c.getCondition() instanceof TypeError; … … 1810 1811 return true; 1811 1812 Condition condition = c.getCondition(); 1812 if (condition instanceof ParseError) 1813 return true; 1814 if (condition instanceof ProgramError) 1815 return true; 1816 if (condition instanceof TypeError) 1813 if (condition.typep(Symbol.ERROR) == T) 1817 1814 return true; 1818 1815 return false; … … 2231 2228 if (fun instanceof Function) 2232 2229 return funcall0(fun, LispThread.currentThread()); 2233 throw new UndefinedFunctionError(arg);2230 throw new ConditionThrowable(new UndefinedFunctionError(arg)); 2234 2231 } 2235 2232 public LispObject execute(LispObject first, LispObject second) … … 2243 2240 if (fun instanceof Function) 2244 2241 return funcall1(fun, second, LispThread.currentThread()); 2245 throw new UndefinedFunctionError(first);2242 throw new ConditionThrowable(new UndefinedFunctionError(first)); 2246 2243 } 2247 2244 public LispObject execute(LispObject first, LispObject second, … … 2256 2253 if (fun instanceof Function) 2257 2254 return funcall2(fun, second, third, LispThread.currentThread()); 2258 throw new UndefinedFunctionError(first);2255 throw new ConditionThrowable(new UndefinedFunctionError(first)); 2259 2256 } 2260 2257 public LispObject execute(LispObject[] args) throws ConditionThrowable … … 2278 2275 } 2279 2276 } 2280 throw new UndefinedFunctionError(args[0]);2277 throw new ConditionThrowable(new UndefinedFunctionError(args[0])); 2281 2278 } 2282 2279 }; … … 2350 2347 fun = fun.getSymbolFunction(); 2351 2348 if (!(fun instanceof Function)) 2352 throw new UndefinedFunctionError(first);2349 throw new ConditionThrowable(new UndefinedFunctionError(first)); 2353 2350 // Second argument must be a list. 2354 2351 LispObject list = checkList(second); … … 2378 2375 fun = fun.getSymbolFunction(); 2379 2376 if (!(fun instanceof Function)) 2380 throw new UndefinedFunctionError(first);2377 throw new ConditionThrowable(new UndefinedFunctionError(first)); 2381 2378 // Remaining arguments must be lists. 2382 2379 LispObject list1 = checkList(second); … … 2411 2408 fun = fun.getSymbolFunction(); 2412 2409 if (!(fun instanceof Function)) 2413 throw new UndefinedFunctionError(args[0]);2410 throw new ConditionThrowable(new UndefinedFunctionError(args[0])); 2414 2411 // Remaining arguments must be lists. 2415 2412 int commonLength = -1; … … 3349 3346 if (functional instanceof Function) 3350 3347 return functional; 3351 throw new UndefinedFunctionError(arg);3348 throw new ConditionThrowable(new UndefinedFunctionError(arg)); 3352 3349 } 3353 3350 if (arg instanceof Cons) { … … 3355 3352 return new Closure(arg.cadr(), arg.cddr(), env); 3356 3353 } 3357 throw new UndefinedFunctionError(String.valueOf(arg));3354 throw new ConditionThrowable(new UndefinedFunctionError(String.valueOf(arg))); 3358 3355 } 3359 3356 }; … … 3527 3524 function = obj.getSymbolFunction(); 3528 3525 if (function == null) 3529 throw new UndefinedFunctionError(obj);3526 throw new ConditionThrowable(new UndefinedFunctionError(obj)); 3530 3527 } else if (obj instanceof Function) { 3531 3528 function = obj; … … 4469 4466 key = key.getSymbolFunction(); 4470 4467 if (!(key instanceof Function)) 4471 throw new UndefinedFunctionError(args[2]);4468 throw new ConditionThrowable(new UndefinedFunctionError(args[2])); 4472 4469 } 4473 4470 LispObject test = args[3]; … … 4481 4478 test = test.getSymbolFunction(); 4482 4479 if (!(test instanceof Function)) 4483 throw new UndefinedFunctionError(args[3]);4480 throw new ConditionThrowable(new UndefinedFunctionError(args[3])); 4484 4481 } else if (testNot != NIL) { 4485 4482 if (testNot instanceof Symbol) 4486 4483 testNot = testNot.getSymbolFunction(); 4487 4484 if (!(testNot instanceof Function)) 4488 throw new UndefinedFunctionError(args[3]);4485 throw new ConditionThrowable(new UndefinedFunctionError(args[3])); 4489 4486 } 4490 4487 if (key == NIL && test == EQL) { -
trunk/j/src/org/armedbear/lisp/ProgramError.java
r3883 r3885 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: ProgramError.java,v 1. 4 2003-09-19 01:46:42piso Exp $5 * $Id: ProgramError.java,v 1.5 2003-09-19 12:10:28 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 34 34 this.message = message; 35 35 } 36 37 public LispObject typep(LispObject type) throws ConditionThrowable 38 { 39 if (type == Symbol.PROGRAM_ERROR) 40 return T; 41 if (type == Symbol.ERROR) 42 return T; 43 return super.typep(type); 44 } 36 45 } -
trunk/j/src/org/armedbear/lisp/Symbol.java
r3883 r3885 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Symbol.java,v 1.7 7 2003-09-19 01:46:42piso Exp $5 * $Id: Symbol.java,v 1.78 2003-09-19 12:10:28 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 124 124 public static final Symbol STREAM_ERROR = PACKAGE_CL.addExternalSymbol("STREAM-ERROR"); 125 125 public static final Symbol TYPE_ERROR = PACKAGE_CL.addExternalSymbol("TYPE-ERROR"); 126 public static final Symbol UNBOUND_VARIABLE = PACKAGE_CL.addExternalSymbol("UNBOUND-VARIABLE"); 126 127 public static final Symbol UNDEFINED_FUNCTION = PACKAGE_CL.addExternalSymbol("UNDEFINED-FUNCTION"); 127 128 … … 317 318 { 318 319 if (function == null) 319 throw new UndefinedFunctionError(this);320 throw new ConditionThrowable(new UndefinedFunctionError(this)); 320 321 return function; 321 322 } -
trunk/j/src/org/armedbear/lisp/TypeError.java
r3884 r3885 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: TypeError.java,v 1. 3 2003-09-19 11:50:19piso Exp $5 * $Id: TypeError.java,v 1.4 2003-09-19 12:10:28 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 52 52 } 53 53 54 public LispObject typep(LispObject type) throws ConditionThrowable 55 { 56 if (type == Symbol.TYPE_ERROR) 57 return T; 58 if (type == Symbol.ERROR) 59 return T; 60 return super.typep(type); 61 } 62 54 63 public String getMessage() 55 64 { -
trunk/j/src/org/armedbear/lisp/UnboundVariableException.java
r743 r3885 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: UnboundVariableException.java,v 1. 2 2003-02-15 16:48:17piso Exp $5 * $Id: UnboundVariableException.java,v 1.3 2003-09-19 12:10:28 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 22 22 package org.armedbear.lisp; 23 23 24 public final class UnboundVariableException extends LispError24 public final class UnboundVariableException extends Condition 25 25 { 26 26 private final String name; … … 37 37 return "the variable " + name + " has no value"; 38 38 } 39 40 public LispObject typep(LispObject type) throws ConditionThrowable 41 { 42 if (type == Symbol.UNBOUND_VARIABLE) 43 return T; 44 if (type == Symbol.ERROR) 45 return T; 46 return super.typep(type); 47 } 39 48 } -
trunk/j/src/org/armedbear/lisp/UndefinedFunctionError.java
r2572 r3885 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: UndefinedFunctionError.java,v 1. 2 2003-06-24 18:21:40piso Exp $5 * $Id: UndefinedFunctionError.java,v 1.3 2003-09-19 12:10:28 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 22 22 package org.armedbear.lisp; 23 23 24 public final class UndefinedFunctionError extends LispError24 public final class UndefinedFunctionError extends Condition 25 25 { 26 26 private final LispObject object; … … 45 45 } 46 46 47 public LispObject typep(LispObject type) throws ConditionThrowable 48 { 49 if (type == Symbol.UNDEFINED_FUNCTION) 50 return T; 51 if (type == Symbol.ERROR) 52 return T; 53 return super.typep(type); 54 } 55 47 56 public String getMessage() 48 57 {
Note: See TracChangeset
for help on using the changeset viewer.