Changeset 3884
- Timestamp:
- 09/19/03 11:50:19 (20 years ago)
- Location:
- trunk/j/src/org/armedbear/lisp
- Files:
-
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/AbstractVector.java
r3883 r3884 74 74 { 75 75 if (n != 0) 76 throw new TypeError("bad dimension for vector");76 throw new ConditionThrowable(new TypeError("bad dimension for vector")); 77 77 return capacity(); 78 78 } … … 123 123 sb.append(')'); 124 124 } 125 throw new TypeError(sb.toString());125 throw new ConditionThrowable(new TypeError(sb.toString())); 126 126 } 127 127 -
trunk/j/src/org/armedbear/lisp/Array.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Array.java,v 1.1 2 2003-09-19 01:46:39piso Exp $5 * $Id: Array.java,v 1.13 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 155 155 } 156 156 catch (ArrayIndexOutOfBoundsException e) { 157 throw new TypeError("bad array dimension");157 throw new ConditionThrowable(new TypeError("bad array dimension")); 158 158 } 159 159 } … … 175 175 } 176 176 catch (ArrayIndexOutOfBoundsException e) { 177 throw new TypeError("bad row major index " + index);177 throw new ConditionThrowable(new TypeError("bad row major index " + index)); 178 178 } 179 179 } … … 185 185 } 186 186 catch (ArrayIndexOutOfBoundsException e) { 187 throw new TypeError("bad row major index " + index);187 throw new ConditionThrowable(new TypeError("bad row major index " + index)); 188 188 } 189 189 } -
trunk/j/src/org/armedbear/lisp/Autoload.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Autoload.java,v 1.6 8 2003-09-19 01:46:39piso Exp $5 * $Id: Autoload.java,v 1.69 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 132 132 return T; 133 133 } 134 throw new TypeError(first);134 throw new ConditionThrowable(new TypeError(first)); 135 135 } 136 136 public LispObject execute(LispObject first, LispObject second) … … 150 150 return T; 151 151 } 152 throw new TypeError(first);152 throw new ConditionThrowable(new TypeError(first)); 153 153 } 154 154 }; -
trunk/j/src/org/armedbear/lisp/AutoloadMacro.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: AutoloadMacro.java,v 1. 3 2003-09-19 01:46:39piso Exp $5 * $Id: AutoloadMacro.java,v 1.4 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 66 66 return T; 67 67 } 68 throw new TypeError(first);68 throw new ConditionThrowable(new TypeError(first)); 69 69 } 70 70 public LispObject execute(LispObject first, LispObject second) … … 84 84 return T; 85 85 } 86 throw new TypeError(first);86 throw new ConditionThrowable(new TypeError(first)); 87 87 } 88 88 }; -
trunk/j/src/org/armedbear/lisp/Bignum.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Bignum.java,v 1.4 3 2003-09-19 01:46:39piso Exp $5 * $Id: Bignum.java,v 1.44 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 148 148 } 149 149 150 public boolean evenp() throws TypeError150 public boolean evenp() throws ConditionThrowable 151 151 { 152 152 return !value.testBit(0); 153 153 } 154 154 155 public boolean oddp() throws TypeError155 public boolean oddp() throws ConditionThrowable 156 156 { 157 157 return value.testBit(0); … … 173 173 } 174 174 175 public double floatValue() throws TypeError175 public double floatValue() throws ConditionThrowable 176 176 { 177 177 double d = value.doubleValue(); 178 178 if (Double.isInfinite(d)) 179 throw new TypeError(toString() +179 throw new ConditionThrowable(new TypeError(toString()) + 180 180 " is too large to be converted to a float"); 181 181 return d; … … 188 188 } 189 189 catch (ClassCastException e) { 190 throw new TypeError(obj, "bignum");190 throw new ConditionThrowable(new TypeError(obj, "bignum")); 191 191 } 192 192 } … … 225 225 return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart()); 226 226 } 227 throw new TypeError(obj, "number");227 throw new ConditionThrowable(new TypeError(obj, "number")); 228 228 } 229 229 … … 247 247 Fixnum.ZERO.subtract(c.getImaginaryPart())); 248 248 } 249 throw new TypeError(obj, "number");249 throw new ConditionThrowable(new TypeError(obj, "number")); 250 250 } 251 251 … … 268 268 if (obj instanceof LispFloat) 269 269 return new LispFloat(floatValue() * ((LispFloat)obj).getValue()); 270 throw new TypeError(obj, "number");270 throw new ConditionThrowable(new TypeError(obj, "number")); 271 271 } 272 272 … … 283 283 if (obj instanceof LispFloat) 284 284 return new LispFloat(floatValue() / ((LispFloat)obj).getValue()); 285 throw new TypeError(obj, "number");285 throw new ConditionThrowable(new TypeError(obj, "number")); 286 286 } 287 287 … … 294 294 if (obj.numberp()) 295 295 return false; 296 throw new TypeError(obj, "number");296 throw new ConditionThrowable(new TypeError(obj, "number")); 297 297 } 298 298 … … 305 305 if (obj.numberp()) 306 306 return true; 307 throw new TypeError(obj, "number");307 throw new ConditionThrowable(new TypeError(obj, "number")); 308 308 } 309 309 … … 320 320 if (obj instanceof LispFloat) 321 321 return floatValue() < ((LispFloat)obj).getValue(); 322 throw new TypeError(obj, "real");322 throw new ConditionThrowable(new TypeError(obj, "real")); 323 323 } 324 324 … … 335 335 if (obj instanceof LispFloat) 336 336 return floatValue() > ((LispFloat)obj).getValue(); 337 throw new TypeError(obj, "real");337 throw new ConditionThrowable(new TypeError(obj, "real")); 338 338 } 339 339 … … 350 350 if (obj instanceof LispFloat) 351 351 return floatValue() <= ((LispFloat)obj).getValue(); 352 throw new TypeError(obj, "real");352 throw new ConditionThrowable(new TypeError(obj, "real")); 353 353 } 354 354 … … 365 365 if (obj instanceof LispFloat) 366 366 return floatValue() >= ((LispFloat)obj).getValue(); 367 throw new TypeError(obj, "real");367 throw new ConditionThrowable(new TypeError(obj, "real")); 368 368 } 369 369 -
trunk/j/src/org/armedbear/lisp/BitVector.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: BitVector.java,v 1.2 3 2003-09-19 01:46:40piso Exp $5 * $Id: BitVector.java,v 1.24 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 187 187 // None of the above... 188 188 } 189 catch ( TypeError e) {}190 throw new TypeError(newValue, "bit");189 catch (ConditionThrowable t) {} 190 throw new ConditionThrowable(new TypeError(newValue, "bit")); 191 191 } 192 192 … … 232 232 // None of the above... 233 233 } 234 catch ( TypeError e) {}235 throw new TypeError(obj, "bit");234 catch (ConditionThrowable t) {} 235 throw new ConditionThrowable(new TypeError(obj, "bit")); 236 236 } 237 237 -
trunk/j/src/org/armedbear/lisp/CompiledFunction.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: CompiledFunction.java,v 1.1 1 2003-09-19 01:46:40piso Exp $5 * $Id: CompiledFunction.java,v 1.12 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 135 135 if (arg instanceof CompiledFunction) 136 136 return ((CompiledFunction)arg).getVariableList(); 137 throw new TypeError(arg, "compiled function");137 throw new ConditionThrowable(new TypeError(arg, "compiled function")); 138 138 } 139 139 }; -
trunk/j/src/org/armedbear/lisp/Complex.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Complex.java,v 1.2 2 2003-09-19 01:46:40piso Exp $5 * $Id: Complex.java,v 1.23 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 35 35 public static LispObject getInstance(LispObject realpart, 36 36 LispObject imagpart) 37 throws TypeError37 throws ConditionThrowable 38 38 { 39 39 if (!realpart.realp()) 40 throw new TypeError(realpart, "real number");40 throw new ConditionThrowable(new TypeError(realpart, "real number")); 41 41 if (!imagpart.realp()) 42 throw new TypeError(imagpart, "real number");42 throw new ConditionThrowable(new TypeError(imagpart, "real number")); 43 43 if (realpart instanceof LispFloat) 44 44 imagpart = LispFloat.coerceToFloat(imagpart); … … 201 201 return false; 202 202 } 203 throw new TypeError(obj, "number");203 throw new ConditionThrowable(new TypeError(obj, "number")); 204 204 } 205 205 … … 209 209 } 210 210 211 public LispObject ABS() throws TypeError211 public LispObject ABS() throws ConditionThrowable 212 212 { 213 213 double real = LispFloat.coerceToFloat(realpart).getValue(); … … 216 216 } 217 217 218 public boolean zerop() throws TypeError218 public boolean zerop() throws ConditionThrowable 219 219 { 220 220 return realpart.zerop() && imagpart.zerop(); -
trunk/j/src/org/armedbear/lisp/Cons.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Cons.java,v 1.2 7 2003-09-19 01:46:40piso Exp $5 * $Id: Cons.java,v 1.28 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 153 153 } 154 154 catch (ClassCastException e) { 155 throw new TypeError(obj, "list");155 throw new ConditionThrowable(new TypeError(obj, "list")); 156 156 } 157 157 return length; … … 161 161 { 162 162 if (index < 0) { 163 throw new TypeError("ELT: invalid index " + index + " for " +164 this);163 throw new ConditionThrowable(new TypeError("ELT: invalid index " + index + " for " + 164 this)); 165 165 } 166 166 int i = 0; … … 176 176 catch (ClassCastException e) { 177 177 if (cons.cdr == NIL) 178 throw new TypeError("ELT: invalid index " + index + " for " +179 this);178 throw new ConditionThrowable(new TypeError("ELT: invalid index " + index + " for " + 179 this)); 180 180 else 181 throw new TypeError(this, "proper sequence");181 throw new ConditionThrowable(new TypeError(this, "proper sequence")); 182 182 } 183 183 } -
trunk/j/src/org/armedbear/lisp/DisplacedArray.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: DisplacedArray.java,v 1.1 1 2003-09-19 01:46:40piso Exp $5 * $Id: DisplacedArray.java,v 1.12 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 91 91 if (dimv.length == 1) 92 92 return size; 93 throw new TypeError(this, "sequence");93 throw new ConditionThrowable(new TypeError(this, "sequence")); 94 94 } 95 95 … … 98 98 if (dimv.length == 1) 99 99 return getRowMajor(index); 100 throw new TypeError(this, "sequence");100 throw new ConditionThrowable(new TypeError(this, "sequence")); 101 101 } 102 102 … … 130 130 } 131 131 catch (ArrayIndexOutOfBoundsException e) { 132 throw new TypeError("bad array dimension");132 throw new ConditionThrowable(new TypeError("bad array dimension")); 133 133 } 134 134 } … … 148 148 if (index >= 0 && index < size) 149 149 return array.getRowMajor(index + offset); 150 throw new TypeError("bad row major index " + index);150 throw new ConditionThrowable(new TypeError("bad row major index " + index)); 151 151 } 152 152 … … 155 155 if (index >= 0 && index < size) 156 156 array.setRowMajor(index + offset, newValue); 157 throw new TypeError("bad row major index " + index);157 throw new ConditionThrowable(new TypeError("bad row major index " + index)); 158 158 } 159 159 -
trunk/j/src/org/armedbear/lisp/Extensions.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Extensions.java,v 1. 9 2003-09-19 01:46:40piso Exp $5 * $Id: Extensions.java,v 1.10 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 42 42 if (arg instanceof CharacterOutputStream) 43 43 return new Fixnum(((CharacterOutputStream)arg).getCharPos()); 44 throw new TypeError(arg, "character output stream");44 throw new ConditionThrowable(new TypeError(arg, "character output stream")); 45 45 } 46 46 }; -
trunk/j/src/org/armedbear/lisp/FillPointerOutputStream.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: FillPointerOutputStream.java,v 1. 2 2003-09-19 01:46:40piso Exp $5 * $Id: FillPointerOutputStream.java,v 1.3 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 40 40 LispString string = checkString(arg); 41 41 if (string.getFillPointer() < 0) 42 throw new TypeError(arg, "string with a fill pointer");42 throw new ConditionThrowable(new TypeError(arg, "string with a fill pointer")); 43 43 return new FillPointerOutputStream(string); 44 44 } -
trunk/j/src/org/armedbear/lisp/Fixnum.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Fixnum.java,v 1.7 0 2003-09-19 01:46:40piso Exp $5 * $Id: Fixnum.java,v 1.71 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 154 154 } 155 155 156 public boolean evenp() throws TypeError156 public boolean evenp() throws ConditionThrowable 157 157 { 158 158 return (value & 0x01) == 0; 159 159 } 160 160 161 public boolean oddp() throws TypeError161 public boolean oddp() throws ConditionThrowable 162 162 { 163 163 return (value & 0x01) != 0; … … 185 185 } 186 186 catch (ClassCastException e) { 187 throw new TypeError(obj, "fixnum");187 throw new ConditionThrowable(new TypeError(obj, "fixnum")); 188 188 } 189 189 } … … 195 195 } 196 196 catch (ClassCastException e) { 197 throw new TypeError(obj, "fixnum");197 throw new ConditionThrowable(new TypeError(obj, "fixnum")); 198 198 } 199 199 } … … 205 205 } 206 206 catch (ClassCastException e) { 207 throw new TypeError(obj, "fixnum");207 throw new ConditionThrowable(new TypeError(obj, "fixnum")); 208 208 } 209 209 } … … 215 215 } 216 216 catch (ClassCastException e) { 217 throw new TypeError(obj, "fixnum");217 throw new ConditionThrowable(new TypeError(obj, "fixnum")); 218 218 } 219 219 } … … 262 262 return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart()); 263 263 } 264 throw new TypeError(obj, "number");264 throw new ConditionThrowable(new TypeError(obj, "number")); 265 265 } 266 266 … … 285 285 ZERO.subtract(c.getImaginaryPart())); 286 286 } 287 throw new TypeError(obj, "number");287 throw new ConditionThrowable(new TypeError(obj, "number")); 288 288 } 289 289 … … 308 308 multiplyBy(c.getImaginaryPart())); 309 309 } 310 throw new TypeError(obj, "number");310 throw new ConditionThrowable(new TypeError(obj, "number")); 311 311 } 312 312 … … 340 340 Fixnum.ZERO.subtract(multiplyBy(imagPart).divideBy(denominator))); 341 341 } 342 throw new TypeError(obj, "number");342 throw new ConditionThrowable(new TypeError(obj, "number")); 343 343 } 344 344 catch (ArithmeticException e) { … … 359 359 if (obj.numberp()) 360 360 return false; 361 throw new TypeError(obj, "number");361 throw new ConditionThrowable(new TypeError(obj, "number")); 362 362 } 363 363 … … 373 373 if (obj.numberp()) 374 374 return true; 375 throw new TypeError(obj, "number");375 throw new ConditionThrowable(new TypeError(obj, "number")); 376 376 } 377 377 … … 389 389 if (obj instanceof LispFloat) 390 390 return (float) value < LispFloat.getValue(obj); 391 throw new TypeError(obj, "number");391 throw new ConditionThrowable(new TypeError(obj, "number")); 392 392 } 393 393 … … 405 405 if (obj instanceof LispFloat) 406 406 return (float) value > LispFloat.getValue(obj); 407 throw new TypeError(obj, "number");407 throw new ConditionThrowable(new TypeError(obj, "number")); 408 408 } 409 409 … … 421 421 if (obj instanceof LispFloat) 422 422 return (float) value <= LispFloat.getValue(obj); 423 throw new TypeError(obj, "number");423 throw new ConditionThrowable(new TypeError(obj, "number")); 424 424 } 425 425 … … 437 437 if (obj instanceof LispFloat) 438 438 return (float) value >= LispFloat.getValue(obj); 439 throw new TypeError(obj, "number");439 throw new ConditionThrowable(new TypeError(obj, "number")); 440 440 } 441 441 -
trunk/j/src/org/armedbear/lisp/HashTable.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: HashTable.java,v 1.1 8 2003-09-19 01:46:40piso Exp $5 * $Id: HashTable.java,v 1.19 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 304 304 return ht.gethash(key, defaultValue); 305 305 } 306 throw new TypeError(args[1], "hash-table");306 throw new ConditionThrowable(new TypeError(args[1], "hash-table")); 307 307 } 308 308 }; … … 329 329 return ht.puthash(key, value); 330 330 } 331 throw new TypeError(args[1], "hash-table");331 throw new ConditionThrowable(new TypeError(args[1], "hash-table")); 332 332 } 333 333 }; … … 343 343 return ht.remhash(key); 344 344 } 345 throw new TypeError(second, "hash-table");345 throw new ConditionThrowable(new TypeError(second, "hash-table")); 346 346 } 347 347 }; … … 372 372 if (arg instanceof HashTable) 373 373 return ((HashTable)arg).ENTRIES(); 374 throw new TypeError(arg, "hash-table");374 throw new ConditionThrowable(new TypeError(arg, "hash-table")); 375 375 } 376 376 }; -
trunk/j/src/org/armedbear/lisp/Java.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Java.java,v 1. 8 2003-09-19 01:46:40piso Exp $5 * $Id: Java.java,v 1.9 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 168 168 } 169 169 } else 170 throw new TypeError(methodRef);170 throw new ConditionThrowable(new TypeError(methodRef)); 171 171 Object[] methodArgs = new Object[args.length-2]; 172 172 for (int i = 2; i < args.length; i++) { -
trunk/j/src/org/armedbear/lisp/JavaObject.java
r3871 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: JavaObject.java,v 1. 7 2003-09-19 00:05:10piso Exp $5 * $Id: JavaObject.java,v 1.8 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 37 37 } 38 38 39 public static final Object getObject(LispObject o) throws TypeError39 public static final Object getObject(LispObject o) throws ConditionThrowable 40 40 { 41 41 try { … … 43 43 } 44 44 catch (ClassCastException e) { 45 throw new TypeError(o, "Java object");45 throw new ConditionThrowable(new TypeError(o, "Java object")); 46 46 } 47 47 } -
trunk/j/src/org/armedbear/lisp/Lisp.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Lisp.java,v 1.13 4 2003-09-19 01:46:40piso Exp $5 * $Id: Lisp.java,v 1.135 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 340 340 LispObject args = obj.cdr(); 341 341 if (!args.listp()) 342 throw new TypeError(args, "list");342 throw new ConditionThrowable(new TypeError(args, "list")); 343 343 LispObject funcar = first.car(); 344 344 LispObject rest = first.cdr(); … … 460 460 } 461 461 catch (ClassCastException e) { 462 throw new TypeError(obj, "symbol");462 throw new ConditionThrowable(new TypeError(obj, "symbol")); 463 463 } 464 464 } … … 472 472 } 473 473 catch (ClassCastException e) { 474 throw new TypeError(obj, "cons");474 throw new ConditionThrowable(new TypeError(obj, "cons")); 475 475 } 476 476 } … … 483 483 if (obj.listp()) 484 484 return obj; 485 throw new TypeError(obj, "list");485 throw new ConditionThrowable(new TypeError(obj, "list")); 486 486 } 487 487 … … 495 495 } 496 496 catch (ClassCastException e) { 497 throw new TypeError(obj, "array");497 throw new ConditionThrowable(new TypeError(obj, "array")); 498 498 } 499 499 } … … 508 508 } 509 509 catch (ClassCastException e) { 510 throw new TypeError(obj, "vector");510 throw new ConditionThrowable(new TypeError(obj, "vector")); 511 511 } 512 512 } … … 521 521 } 522 522 catch (ClassCastException e) { 523 throw new TypeError(obj, "string");523 throw new ConditionThrowable(new TypeError(obj, "string")); 524 524 } 525 525 } … … 533 533 if (arg instanceof LispCharacter) 534 534 return new LispString(((LispCharacter)arg).getValue()); 535 throw new TypeError(String.valueOf(arg) +536 " cannot be coerced to a string");535 throw new ConditionThrowable(new TypeError(String.valueOf(arg) + 536 " cannot be coerced to a string")); 537 537 } 538 538 … … 545 545 if (arg instanceof LispCharacter) 546 546 return String.valueOf(new char[] {((LispCharacter)arg).getValue()}); 547 throw new TypeError(String.valueOf(arg) +548 " cannot be coerced to a string");547 throw new ConditionThrowable(new TypeError(String.valueOf(arg) + 548 " cannot be coerced to a string")); 549 549 } 550 550 … … 655 655 } 656 656 catch (ClassCastException e) { 657 throw new TypeError(obj, "character");657 throw new ConditionThrowable(new TypeError(obj, "character")); 658 658 } 659 659 } … … 668 668 } 669 669 catch (ClassCastException e) { 670 throw new TypeError(obj, "package");670 throw new ConditionThrowable(new TypeError(obj, "package")); 671 671 } 672 672 } … … 681 681 } 682 682 catch (ClassCastException e) { 683 throw new TypeError(obj, "function");683 throw new ConditionThrowable(new TypeError(obj, "function")); 684 684 } 685 685 } … … 694 694 } 695 695 catch (ClassCastException e) { 696 throw new TypeError(obj, "stream");696 throw new ConditionThrowable(new TypeError(obj, "stream")); 697 697 } 698 698 } … … 707 707 if (obj instanceof TwoWayStream) 708 708 return ((TwoWayStream)obj).getInputStream(); 709 throw new TypeError(obj, "input stream");709 throw new ConditionThrowable(new TypeError(obj, "input stream")); 710 710 } 711 711 … … 719 719 if (obj instanceof TwoWayStream) 720 720 return ((TwoWayStream)obj).getOutputStream(); 721 throw new TypeError(obj, "output stream");721 throw new ConditionThrowable(new TypeError(obj, "output stream")); 722 722 } 723 723 … … 731 731 } 732 732 catch (ClassCastException e) { 733 throw new TypeError(obj, "readtable");733 throw new ConditionThrowable(new TypeError(obj, "readtable")); 734 734 } 735 735 } … … 744 744 } 745 745 catch (ClassCastException e) { 746 throw new TypeError(obj, "environment");746 throw new ConditionThrowable(new TypeError(obj, "environment")); 747 747 } 748 748 } -
trunk/j/src/org/armedbear/lisp/LispCharacter.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: LispCharacter.java,v 1.2 5 2003-09-19 01:46:41piso Exp $5 * $Id: LispCharacter.java,v 1.26 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 120 120 } 121 121 catch (ClassCastException e) { 122 throw new TypeError(obj, "character");122 throw new ConditionThrowable(new TypeError(obj, "character")); 123 123 } 124 124 } … … 181 181 return new LispCharacter(name.charAt(0)); 182 182 } 183 throw new TypeError();183 throw new ConditionThrowable(new TypeError()); 184 184 } 185 185 }; -
trunk/j/src/org/armedbear/lisp/LispClass.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: LispClass.java,v 1.1 4 2003-09-19 01:46:41piso Exp $5 * $Id: LispClass.java,v 1.15 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 127 127 } 128 128 catch (ClassCastException e) { 129 throw new TypeError(arg, "class");129 throw new ConditionThrowable(new TypeError(arg, "class")); 130 130 } 131 131 } -
trunk/j/src/org/armedbear/lisp/LispFloat.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: LispFloat.java,v 1.4 5 2003-09-19 01:46:41piso Exp $5 * $Id: LispFloat.java,v 1.46 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 153 153 } 154 154 catch (ClassCastException e) { 155 throw new TypeError(obj, "float");155 throw new ConditionThrowable(new TypeError(obj, "float")); 156 156 } 157 157 } … … 186 186 return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart()); 187 187 } 188 throw new TypeError(obj, "number");188 throw new ConditionThrowable(new TypeError(obj, "number")); 189 189 } 190 190 … … 204 204 ZERO.subtract(c.getImaginaryPart())); 205 205 } 206 throw new TypeError(obj, "number");206 throw new ConditionThrowable(new TypeError(obj, "number")); 207 207 } 208 208 … … 217 217 if (obj instanceof Ratio) 218 218 return new LispFloat(value * ((Ratio)obj).floatValue()); 219 throw new TypeError(obj, "number");219 throw new ConditionThrowable(new TypeError(obj, "number")); 220 220 } 221 221 … … 232 232 if (obj instanceof Ratio) 233 233 return new LispFloat(value / ((Ratio)obj).floatValue()); 234 throw new TypeError(obj, "number");234 throw new ConditionThrowable(new TypeError(obj, "number")); 235 235 } 236 236 … … 247 247 if (obj instanceof Complex) 248 248 return obj.isEqualTo(this); 249 throw new TypeError(obj, "number");249 throw new ConditionThrowable(new TypeError(obj, "number")); 250 250 } 251 251 … … 265 265 if (obj instanceof Ratio) 266 266 return value < ((Ratio)obj).floatValue(); 267 throw new TypeError(obj, "real");267 throw new ConditionThrowable(new TypeError(obj, "real")); 268 268 } 269 269 … … 278 278 if (obj instanceof Ratio) 279 279 return value > ((Ratio)obj).floatValue(); 280 throw new TypeError(obj, "real");280 throw new ConditionThrowable(new TypeError(obj, "real")); 281 281 } 282 282 … … 291 291 if (obj instanceof Ratio) 292 292 return value <= ((Ratio)obj).floatValue(); 293 throw new TypeError(obj, "real");293 throw new ConditionThrowable(new TypeError(obj, "real")); 294 294 } 295 295 … … 304 304 if (obj instanceof Ratio) 305 305 return value >= ((Ratio)obj).floatValue(); 306 throw new TypeError(obj, "real");306 throw new ConditionThrowable(new TypeError(obj, "real")); 307 307 } 308 308 … … 396 396 return values[0]; 397 397 } 398 throw new TypeError(arg, "float");398 throw new ConditionThrowable(new TypeError(arg, "float")); 399 399 } 400 400 }; … … 408 408 if (arg instanceof LispFloat) 409 409 return Fixnum.TWO; 410 throw new TypeError(arg, "float");410 throw new ConditionThrowable(new TypeError(arg, "float")); 411 411 } 412 412 }; … … 420 420 if (arg instanceof LispFloat) 421 421 return new Fixnum(52); 422 throw new TypeError(arg, "float");422 throw new ConditionThrowable(new TypeError(arg, "float")); 423 423 } 424 424 }; 425 425 426 public static LispFloat coerceToFloat(LispObject obj) throws TypeError426 public static LispFloat coerceToFloat(LispObject obj) throws ConditionThrowable 427 427 { 428 428 if (obj instanceof LispFloat) … … 434 434 if (obj instanceof Ratio) 435 435 return new LispFloat(((Ratio)obj).floatValue()); 436 throw new TypeError(obj, "real number");436 throw new ConditionThrowable(new TypeError(obj, "real number")); 437 437 } 438 438 -
trunk/j/src/org/armedbear/lisp/LispObject.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: LispObject.java,v 1.5 7 2003-09-19 01:46:41piso Exp $5 * $Id: LispObject.java,v 1.58 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 72 72 public LispObject car() throws ConditionThrowable 73 73 { 74 throw new TypeError(this, "list");74 throw new ConditionThrowable(new TypeError(this, "list")); 75 75 } 76 76 77 77 public void setCar(LispObject obj) throws ConditionThrowable 78 78 { 79 throw new TypeError(this, "cons");79 throw new ConditionThrowable(new TypeError(this, "cons")); 80 80 } 81 81 82 82 public LispObject cdr() throws ConditionThrowable 83 83 { 84 throw new TypeError(this, "list");84 throw new ConditionThrowable(new TypeError(this, "list")); 85 85 } 86 86 87 87 public void setCdr(LispObject obj) throws ConditionThrowable 88 88 { 89 throw new TypeError(this, "cons");89 throw new ConditionThrowable(new TypeError(this, "cons")); 90 90 } 91 91 92 92 public LispObject cadr() throws ConditionThrowable 93 93 { 94 throw new TypeError(this, "list");94 throw new ConditionThrowable(new TypeError(this, "list")); 95 95 } 96 96 97 97 public LispObject cddr() throws ConditionThrowable 98 98 { 99 throw new TypeError(this, "list");99 throw new ConditionThrowable(new TypeError(this, "list")); 100 100 } 101 101 … … 125 125 } 126 126 127 public LispObject ABS() throws TypeError128 { 129 throw new TypeError(this, "number");130 } 131 132 public LispObject NUMERATOR() throws TypeError133 { 134 throw new TypeError(this, "rational number");135 } 136 137 public LispObject DENOMINATOR() throws TypeError138 { 139 throw new TypeError(this, "rational number");140 } 141 142 public LispObject EVENP() throws TypeError127 public LispObject ABS() throws ConditionThrowable 128 { 129 throw new ConditionThrowable(new TypeError(this, "number")); 130 } 131 132 public LispObject NUMERATOR() throws ConditionThrowable 133 { 134 throw new ConditionThrowable(new TypeError(this, "rational number")); 135 } 136 137 public LispObject DENOMINATOR() throws ConditionThrowable 138 { 139 throw new ConditionThrowable(new TypeError(this, "rational number")); 140 } 141 142 public LispObject EVENP() throws ConditionThrowable 143 143 { 144 144 return evenp() ? T : NIL; 145 145 } 146 146 147 public boolean evenp() throws TypeError148 { 149 throw new TypeError(this, "integer");150 } 151 152 public LispObject ODDP() throws TypeError147 public boolean evenp() throws ConditionThrowable 148 { 149 throw new ConditionThrowable(new TypeError(this, "integer")); 150 } 151 152 public LispObject ODDP() throws ConditionThrowable 153 153 { 154 154 return oddp() ? T : NIL; 155 155 } 156 156 157 public boolean oddp() throws TypeError158 { 159 throw new TypeError(this, "integer");160 } 161 162 public LispObject PLUSP() throws TypeError157 public boolean oddp() throws ConditionThrowable 158 { 159 throw new ConditionThrowable(new TypeError(this, "integer")); 160 } 161 162 public LispObject PLUSP() throws ConditionThrowable 163 163 { 164 164 return plusp() ? T : NIL; 165 165 } 166 166 167 public boolean plusp() throws TypeError168 { 169 throw new TypeError(this, "real number");170 } 171 172 public LispObject MINUSP() throws TypeError167 public boolean plusp() throws ConditionThrowable 168 { 169 throw new ConditionThrowable(new TypeError(this, "real number")); 170 } 171 172 public LispObject MINUSP() throws ConditionThrowable 173 173 { 174 174 return minusp() ? T : NIL; 175 175 } 176 176 177 public boolean minusp() throws TypeError178 { 179 throw new TypeError(this, "real number");177 public boolean minusp() throws ConditionThrowable 178 { 179 throw new ConditionThrowable(new TypeError(this, "real number")); 180 180 } 181 181 … … 190 190 } 191 191 192 public LispObject ZEROP() throws TypeError192 public LispObject ZEROP() throws ConditionThrowable 193 193 { 194 194 return zerop() ? T : NIL; 195 195 } 196 196 197 public boolean zerop() throws TypeError198 { 199 throw new TypeError(this, "number");197 public boolean zerop() throws ConditionThrowable 198 { 199 throw new ConditionThrowable(new TypeError(this, "number")); 200 200 } 201 201 … … 272 272 public int length() throws ConditionThrowable 273 273 { 274 throw new TypeError(this, "sequence");274 throw new ConditionThrowable(new TypeError(this, "sequence")); 275 275 } 276 276 … … 282 282 public LispObject elt(int index) throws ConditionThrowable 283 283 { 284 throw new TypeError(this, "sequence");284 throw new ConditionThrowable(new TypeError(this, "sequence")); 285 285 } 286 286 287 287 public LispObject AREF(LispObject index) throws ConditionThrowable 288 288 { 289 throw new TypeError(this, "array");289 throw new ConditionThrowable(new TypeError(this, "array")); 290 290 } 291 291 292 292 public LispObject[] copyToArray() throws ConditionThrowable 293 293 { 294 throw new TypeError(this, "list");294 throw new ConditionThrowable(new TypeError(this, "list")); 295 295 } 296 296 … … 310 310 } 311 311 312 public LispObject ENDP() throws TypeError313 { 314 throw new TypeError(this, "list");312 public LispObject ENDP() throws ConditionThrowable 313 { 314 throw new ConditionThrowable(new TypeError(this, "list")); 315 315 } 316 316 … … 327 327 public LispObject getSymbolValue() throws ConditionThrowable 328 328 { 329 throw new TypeError(this, "symbol");329 throw new ConditionThrowable(new TypeError(this, "symbol")); 330 330 } 331 331 332 332 public LispObject getSymbolFunction() throws ConditionThrowable 333 333 { 334 throw new TypeError(this, "symbol");334 throw new ConditionThrowable(new TypeError(this, "symbol")); 335 335 } 336 336 337 337 public LispObject getSymbolFunctionOrDie() throws ConditionThrowable 338 338 { 339 throw new TypeError(this, "symbol");339 throw new ConditionThrowable(new TypeError(this, "symbol")); 340 340 } 341 341 … … 386 386 public LispObject incr() throws ConditionThrowable 387 387 { 388 throw new TypeError(this, "number");388 throw new ConditionThrowable(new TypeError(this, "number")); 389 389 } 390 390 391 391 public LispObject decr() throws ConditionThrowable 392 392 { 393 throw new TypeError(this, "number");393 throw new ConditionThrowable(new TypeError(this, "number")); 394 394 } 395 395 396 396 public LispObject add(LispObject obj) throws ConditionThrowable 397 397 { 398 throw new TypeError(this, "number");398 throw new ConditionThrowable(new TypeError(this, "number")); 399 399 } 400 400 401 401 public LispObject subtract(LispObject obj) throws ConditionThrowable 402 402 { 403 throw new TypeError(this, "number");403 throw new ConditionThrowable(new TypeError(this, "number")); 404 404 } 405 405 406 406 public LispObject multiplyBy(LispObject obj) throws ConditionThrowable 407 407 { 408 throw new TypeError(this, "number");408 throw new ConditionThrowable(new TypeError(this, "number")); 409 409 } 410 410 411 411 public LispObject divideBy(LispObject obj) throws ConditionThrowable 412 412 { 413 throw new TypeError(this, "number");413 throw new ConditionThrowable(new TypeError(this, "number")); 414 414 } 415 415 416 416 public boolean isEqualTo(LispObject obj) throws ConditionThrowable 417 417 { 418 throw new TypeError(this, "number");418 throw new ConditionThrowable(new TypeError(this, "number")); 419 419 } 420 420 … … 426 426 public boolean isNotEqualTo(LispObject obj) throws ConditionThrowable 427 427 { 428 throw new TypeError(this, "number");428 throw new ConditionThrowable(new TypeError(this, "number")); 429 429 } 430 430 … … 436 436 public boolean isLessThan(LispObject obj) throws ConditionThrowable 437 437 { 438 throw new TypeError(this, "number");438 throw new ConditionThrowable(new TypeError(this, "number")); 439 439 } 440 440 … … 446 446 public boolean isGreaterThan(LispObject obj) throws ConditionThrowable 447 447 { 448 throw new TypeError(this, "number");448 throw new ConditionThrowable(new TypeError(this, "number")); 449 449 } 450 450 … … 456 456 public boolean isLessThanOrEqualTo(LispObject obj) throws ConditionThrowable 457 457 { 458 throw new TypeError(this, "number");458 throw new ConditionThrowable(new TypeError(this, "number")); 459 459 } 460 460 … … 466 466 public boolean isGreaterThanOrEqualTo(LispObject obj) throws ConditionThrowable 467 467 { 468 throw new TypeError(this, "number");468 throw new ConditionThrowable(new TypeError(this, "number")); 469 469 } 470 470 … … 476 476 public LispObject truncate(LispObject obj) throws ConditionThrowable 477 477 { 478 throw new TypeError(this, "real number");478 throw new ConditionThrowable(new TypeError(this, "real number")); 479 479 } 480 480 -
trunk/j/src/org/armedbear/lisp/LispString.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: LispString.java,v 1.5 8 2003-09-19 01:46:41piso Exp $5 * $Id: LispString.java,v 1.59 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 244 244 } 245 245 catch (ClassCastException e) { 246 throw new TypeError(obj, "string");246 throw new ConditionThrowable(new TypeError(obj, "string")); 247 247 } 248 248 } -
trunk/j/src/org/armedbear/lisp/LispThread.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: LispThread.java,v 1.1 1 2003-09-19 01:46:41piso Exp $5 * $Id: LispThread.java,v 1.12 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 340 340 ((LispFloat)arg.multiplyBy(new LispFloat(1000))).getValue(); 341 341 if (d < 0) 342 throw new TypeError(arg, "non-negative real");342 throw new ConditionThrowable(new TypeError(arg, "non-negative real")); 343 343 long millis = d < Long.MAX_VALUE ? (long) d : Long.MAX_VALUE; 344 344 try { … … 380 380 return T; 381 381 } else 382 throw new TypeError(arg, "Lisp thread");382 throw new ConditionThrowable(new TypeError(arg, "Lisp thread")); 383 383 } 384 384 }; -
trunk/j/src/org/armedbear/lisp/Nil.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Nil.java,v 1.2 3 2003-09-19 01:46:41piso Exp $5 * $Id: Nil.java,v 1.24 2003-09-19 11:50:18 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 87 87 public LispObject elt(int index) throws ConditionThrowable 88 88 { 89 throw new TypeError("ELT: invalid index " + index + " for " + this);89 throw new ConditionThrowable(new TypeError("ELT: invalid index " + index + " for " + this)); 90 90 } 91 91 -
trunk/j/src/org/armedbear/lisp/Pathname.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Pathname.java,v 1.1 2 2003-09-19 01:46:42piso Exp $5 * $Id: Pathname.java,v 1.13 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 96 96 if (arg instanceof Pathname) 97 97 return new LispString(((Pathname)arg).getNamestring()); 98 throw new TypeError(arg, "pathname designator");98 throw new ConditionThrowable(new TypeError(arg, "pathname designator")); 99 99 } 100 100 }; … … 114 114 namestring = ((Pathname)arg).getNamestring(); 115 115 else 116 throw new TypeError(arg, "pathname designator");116 throw new ConditionThrowable(new TypeError(arg, "pathname designator")); 117 117 if (namestring != null) { 118 118 for (int i = namestring.length(); i-- > 0;) { … … 136 136 if (arg instanceof LispString) 137 137 return new Pathname(((LispString)arg).getValue()); 138 throw new TypeError(arg, "pathname designator");138 throw new ConditionThrowable(new TypeError(arg, "pathname designator")); 139 139 } 140 140 }; -
trunk/j/src/org/armedbear/lisp/Primitives.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Primitives.java,v 1.40 5 2003-09-19 01:46:42piso Exp $5 * $Id: Primitives.java,v 1.406 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 213 213 LispObject result = args[0]; 214 214 if (!result.realp()) 215 throw new TypeError(result, "real");215 throw new ConditionThrowable(new TypeError(result, "real")); 216 216 for (int i = 1; i < args.length; i++) { 217 217 if (args[i].isLessThan(result)) … … 225 225 LispObject result = args[0]; 226 226 if (!result.realp()) 227 throw new TypeError(result, "real");227 throw new ConditionThrowable(new TypeError(result, "real")); 228 228 for (int i = 1; i < args.length; i++) { 229 229 if (args[i].isGreaterThan(result)) … … 293 293 if (arg.typep(Symbol.SYMBOL) != NIL) 294 294 return new LispString(arg.getName()); 295 throw new TypeError(arg, "symbol");295 throw new ConditionThrowable(new TypeError(arg, "symbol")); 296 296 case SYMBOL_PACKAGE: // ### symbol-package 297 297 return checkSymbol(arg).getPackage(); … … 313 313 } 314 314 catch (ClassCastException e) { 315 throw new TypeError(arg, "symbol");315 throw new ConditionThrowable(new TypeError(arg, "symbol")); 316 316 } 317 317 case ABS: // ### abs … … 324 324 if (arg instanceof AbstractArray) 325 325 return NIL; 326 throw new TypeError(arg, "array");326 throw new ConditionThrowable(new TypeError(arg, "array")); 327 327 case VECTORP: // ### vectorp 328 328 return arg.VECTORP(); … … 527 527 // ### plusp 528 528 private static final Primitive1 PLUSP = new Primitive1("plusp") { 529 public LispObject execute(LispObject arg) throws TypeError529 public LispObject execute(LispObject arg) throws ConditionThrowable 530 530 { 531 531 return arg.PLUSP(); … … 535 535 // ### minusp 536 536 private static final Primitive1 MINUSP = new Primitive1("minusp") { 537 public LispObject execute(LispObject arg) throws TypeError537 public LispObject execute(LispObject arg) throws ConditionThrowable 538 538 { 539 539 return arg.MINUSP(); … … 543 543 // ### zerop 544 544 private static final Primitive1 ZEROP = new Primitive1("zerop") { 545 public LispObject execute(LispObject arg) throws TypeError545 public LispObject execute(LispObject arg) throws ConditionThrowable 546 546 { 547 547 return arg.ZEROP(); … … 677 677 out = (CharacterOutputStream) args[1]; 678 678 else 679 throw new TypeError(args[0], "output stream");679 throw new ConditionThrowable(new TypeError(args[0], "output stream")); 680 680 } 681 681 if (out == null) … … 722 722 out = getStandardOutput(); 723 723 else 724 throw new TypeError(second, "output stream");724 throw new ConditionThrowable(new TypeError(second, "output stream")); 725 725 out.prin1(first); 726 726 return first; … … 764 764 out = (CharacterOutputStream) args[0]; 765 765 else 766 throw new TypeError(args[0], "output stream");766 throw new ConditionThrowable(new TypeError(args[0], "output stream")); 767 767 } 768 768 if (out == null) … … 898 898 } 899 899 } else 900 throw new TypeError(list, "list");900 throw new ConditionThrowable(new TypeError(list, "list")); 901 901 } 902 902 if (result == null) … … 1071 1071 return cons; 1072 1072 } else if (cons != NIL) 1073 throw new TypeError(cons, "list");1073 throw new ConditionThrowable(new TypeError(cons, "list")); 1074 1074 alist = alist.cdr(); 1075 1075 } … … 1131 1131 final int index = Fixnum.getValue(first); 1132 1132 if (index < 0) 1133 throw new TypeError("bad index to NTHCDR: " + index);1133 throw new ConditionThrowable(new TypeError("bad index to NTHCDR: " + index)); 1134 1134 for (int i = 0; i < index; i++) { 1135 1135 second = second.cdr(); … … 1156 1156 throw new ConditionThrowable(new ProgramError(_format(args, 1))); 1157 1157 if (datum == Symbol.TYPE_ERROR) 1158 throw new TypeError(_format(args, 1));1158 throw new ConditionThrowable(new TypeError(_format(args, 1))); 1159 1159 // Default. 1160 1160 throw new SimpleError(((Symbol)datum).getName()); … … 1398 1398 symbol.setVariableDocumentation(third); 1399 1399 else if (third != NIL) 1400 throw new TypeError(third, "string");1400 throw new ConditionThrowable(new TypeError(third, "string")); 1401 1401 symbol.setSymbolValue(second); 1402 1402 symbol.setSpecial(true); … … 1427 1427 symbol.setVariableDocumentation(third); 1428 1428 else if (third != NIL) 1429 throw new TypeError(third, "string");1429 throw new ConditionThrowable(new TypeError(third, "string")); 1430 1430 symbol.setSymbolValue(second); 1431 1431 symbol.setConstant(true); … … 1527 1527 args = args.cdr(); 1528 1528 } 1529 throw new TypeError("ECASE: no match for " + key);1529 throw new ConditionThrowable(new TypeError("ECASE: no match for " + key)); 1530 1530 } 1531 1531 }; … … 1795 1795 return c instanceof UndefinedFunctionError; 1796 1796 if (type == Symbol.TYPE_ERROR) 1797 return c instanceof TypeError;1797 return c.getCondition() instanceof TypeError; 1798 1798 if (type == Symbol.PACKAGE_ERROR) 1799 1799 return c instanceof PackageError; … … 1814 1814 if (condition instanceof ProgramError) 1815 1815 return true; 1816 if (condition instanceof TypeError) 1817 return true; 1816 1818 return false; 1817 1819 } … … 1923 1925 return NIL; 1924 1926 } else 1925 throw new TypeError(arg, "integer");1927 throw new ConditionThrowable(new TypeError(arg, "integer")); 1926 1928 } 1927 1929 return T; … … 2002 2004 throw new ConditionThrowable(new ProgramError()); 2003 2005 } else 2004 throw new TypeError(subscript, "integer");2006 throw new ConditionThrowable(new TypeError(subscript, "integer")); 2005 2007 } 2006 2008 return sum; … … 2046 2048 AbstractVector v = checkVector(first); 2047 2049 if (!v.isSimpleVector()) 2048 throw new TypeError(first, "simple vector");2050 throw new ConditionThrowable(new TypeError(first, "simple vector")); 2049 2051 int index = v.checkIndex(second); 2050 2052 return v.get(index); … … 2062 2064 AbstractVector v = checkVector(first); 2063 2065 if (!v.isSimpleVector()) 2064 throw new TypeError(first, "simple vector");2066 throw new ConditionThrowable(new TypeError(first, "simple vector")); 2065 2067 int i = v.checkIndex(second); 2066 2068 v.set(i, third); … … 2077 2079 int fillPointer = checkVector(arg).getFillPointer(); 2078 2080 if (fillPointer < 0) 2079 throw new TypeError("array does not have a fill pointer");2081 throw new ConditionThrowable(new TypeError("array does not have a fill pointer")); 2080 2082 return new Fixnum(fillPointer); 2081 2083 } … … 2091 2093 int fillPointer = v.getFillPointer(); 2092 2094 if (fillPointer < 0) 2093 throw new TypeError("array does not have a fill pointer");2095 throw new ConditionThrowable(new TypeError("array does not have a fill pointer")); 2094 2096 v.setFillPointer(second); 2095 2097 return second; … … 2107 2109 int fillPointer = v.getFillPointer(); 2108 2110 if (fillPointer < 0) 2109 throw new TypeError("array does not have a fill pointer");2111 throw new ConditionThrowable(new TypeError("array does not have a fill pointer")); 2110 2112 if (fillPointer >= v.capacity()) 2111 2113 return NIL; … … 2132 2134 int fillPointer = v.getFillPointer(); 2133 2135 if (fillPointer < 0) 2134 throw new TypeError("array does not have a fill pointer");2136 throw new ConditionThrowable(new TypeError("array does not have a fill pointer")); 2135 2137 if (fillPointer >= v.capacity()) { 2136 2138 // Need to extend vector. … … 2152 2154 int fillPointer = v.getFillPointer(); 2153 2155 if (fillPointer < 0) 2154 throw new TypeError("array does not have a fill pointer");2156 throw new ConditionThrowable(new TypeError("array does not have a fill pointer")); 2155 2157 if (fillPointer == 0) 2156 2158 throw new LispError("nothing left to pop"); … … 2311 2313 } 2312 2314 } 2313 throw new TypeError(fun, "function");2315 throw new ConditionThrowable(new TypeError(fun, "function")); 2314 2316 } 2315 2317 public LispObject execute(final LispObject[] args) throws ConditionThrowable … … 2334 2336 return funcall(fun, funArgs, LispThread.currentThread()); 2335 2337 } 2336 throw new TypeError(fun, "function");2338 throw new ConditionThrowable(new TypeError(fun, "function")); 2337 2339 } 2338 2340 }; … … 2414 2416 for (int i = 1; i < numArgs; i++) { 2415 2417 if (!args[i].listp()) 2416 throw new TypeError(args[i], "list");2418 throw new ConditionThrowable(new TypeError(args[i], "list")); 2417 2419 int len = args[i].length(); 2418 2420 if (commonLength < 0) … … 2488 2490 int n = ((Fixnum)arg).getValue(); 2489 2491 if (n < 0) 2490 throw new TypeError(arg,2491 "non-negative integer");2492 throw new ConditionThrowable(new TypeError(arg, 2493 "non-negative integer")); 2492 2494 StringBuffer sb = new StringBuffer(prefix); 2493 2495 sb.append(n); … … 2497 2499 BigInteger n = ((Bignum)arg).getValue(); 2498 2500 if (n.signum() < 0) 2499 throw new TypeError(arg,2500 "non-negative integer");2501 throw new ConditionThrowable(new TypeError(arg, 2502 "non-negative integer")); 2501 2503 StringBuffer sb = new StringBuffer(prefix); 2502 2504 sb.append(n.toString()); … … 2506 2508 prefix = ((LispString)arg).getValue(); 2507 2509 else 2508 throw new TypeError(arg, "string or non-negative integer");2510 throw new ConditionThrowable(new TypeError(arg, "string or non-negative integer")); 2509 2511 } 2510 2512 return gensym(prefix); … … 3628 3630 out = getStandardOutput(); 3629 3631 else 3630 throw new TypeError(args[1],3631 "character output stream");3632 throw new ConditionThrowable(new TypeError(args[1], 3633 "character output stream")); 3632 3634 } 3633 3635 out.writeChar(c); … … 3655 3657 out = getStandardOutput(); 3656 3658 else 3657 throw new TypeError(args[1],3658 "character output stream");3659 throw new ConditionThrowable(new TypeError(args[1], 3660 "character output stream")); 3659 3661 } 3660 3662 out.writeString(string); … … 3683 3685 out = getStandardOutput(); 3684 3686 else 3685 throw new TypeError(args[1], "character output stream");3687 throw new ConditionThrowable(new TypeError(args[1], "character output stream")); 3686 3688 } 3687 3689 out.finishOutput(); … … 3777 3779 int n = Fixnum.getValue(first); 3778 3780 if (n < 0 || n > 255) 3779 throw new TypeError(first, "unsigned byte");3781 throw new ConditionThrowable(new TypeError(first, "unsigned byte")); 3780 3782 if (second instanceof BinaryOutputStream) { 3781 3783 ((BinaryOutputStream)second).writeByte(n); 3782 3784 return first; 3783 3785 } 3784 throw new TypeError(second, "binary output stream");3786 throw new ConditionThrowable(new TypeError(second, "binary output stream")); 3785 3787 } 3786 3788 }; … … 3799 3801 stream = (BinaryInputStream) args[0]; 3800 3802 else 3801 throw new TypeError(args[0], "binary input stream");3803 throw new ConditionThrowable(new TypeError(args[0], "binary input stream")); 3802 3804 boolean eofError = length > 1 ? (args[1] != NIL) : true; 3803 3805 LispObject eofValue = length > 2 ? args[2] : NIL; … … 3824 3826 stream = ((TwoWayStream)args[0]).getInputStream(); 3825 3827 else 3826 throw new TypeError(args[0], "input stream");3828 throw new ConditionThrowable(new TypeError(args[0], "input stream")); 3827 3829 boolean eofError = length > 1 ? (args[1] != NIL) : true; 3828 3830 LispObject eofValue = length > 2 ? args[2] : NIL; … … 4042 4044 return second; 4043 4045 } else 4044 throw new TypeError(first, "function");4046 throw new ConditionThrowable(new TypeError(first, "function")); 4045 4047 } 4046 4048 }; … … 4104 4106 } 4105 4107 } 4106 throw new TypeError(args[0], "positive integer or positive float");4108 throw new ConditionThrowable(new TypeError(args[0], "positive integer or positive float")); 4107 4109 } 4108 4110 }; … … 4135 4137 if (n instanceof LispFloat) 4136 4138 return ((LispFloat)n).truncate(d); 4137 throw new TypeError(n, "number");4139 throw new ConditionThrowable(new TypeError(n, "number")); 4138 4140 } 4139 4141 }; … … 4151 4153 n = ((Bignum)first).getValue(); 4152 4154 else 4153 throw new TypeError(first, "integer");4155 throw new ConditionThrowable(new TypeError(first, "integer")); 4154 4156 if (second instanceof Fixnum) { 4155 4157 int count = Fixnum.getInt(second); … … 4170 4172 Debug.bug(); // Shouldn't happen. 4171 4173 } 4172 throw new TypeError(second, "integer");4174 throw new ConditionThrowable(new TypeError(second, "integer")); 4173 4175 } 4174 4176 }; … … 4360 4362 if (arg == NIL) 4361 4363 return NIL; 4362 throw new TypeError(arg, "proper sequence");4364 throw new ConditionThrowable(new TypeError(arg, "proper sequence")); 4363 4365 } 4364 4366 }; … … 4373 4375 int index = Fixnum.getValue(second); 4374 4376 if (index < 0) 4375 throw new TypeError();4377 throw new ConditionThrowable(new TypeError()); 4376 4378 LispObject list = first; 4377 4379 int i = 0; … … 4383 4385 list = list.cdr(); 4384 4386 if (list == NIL) 4385 throw new TypeError();4387 throw new ConditionThrowable(new TypeError()); 4386 4388 ++i; 4387 4389 } … … 4390 4392 return third; 4391 4393 } else 4392 throw new TypeError(first, "sequence");4394 throw new ConditionThrowable(new TypeError(first, "sequence")); 4393 4395 } 4394 4396 }; … … 4429 4431 int size = Fixnum.getValue(first); 4430 4432 if (size < 0) 4431 throw new TypeError("MAKE-LIST: " + size +4432 " is not a valid list length");4433 throw new ConditionThrowable(new TypeError("MAKE-LIST: " + size + 4434 " is not a valid list length")); 4433 4435 LispObject result = NIL; 4434 4436 for (int i = size; i-- > 0;) … … 4603 4605 if (arg.realp()) 4604 4606 return arg; 4605 throw new TypeError(arg, "real number");4607 throw new ConditionThrowable(new TypeError(arg, "real number")); 4606 4608 } 4607 4609 public LispObject execute(LispObject first, LispObject second) … … 4644 4646 if (arg.numberp()) 4645 4647 return arg; 4646 throw new TypeError(arg, "number");4648 throw new ConditionThrowable(new TypeError(arg, "number")); 4647 4649 } 4648 4650 }; … … 4661 4663 private static final Primitive1 INTEGER_LENGTH = 4662 4664 new Primitive1("integer-length") { 4663 public LispObject execute(LispObject arg) throws TypeError4665 public LispObject execute(LispObject arg) throws ConditionThrowable 4664 4666 { 4665 4667 BigInteger value; … … 4669 4671 value = ((Bignum)arg).getValue(); 4670 4672 else 4671 throw new TypeError(arg, "integer");4673 throw new ConditionThrowable(new TypeError(arg, "integer")); 4672 4674 return new Fixnum(value.bitLength()); 4673 4675 } … … 4688 4690 }; 4689 4691 4690 private static final LispFloat sqrt(LispObject obj) throws TypeError4692 private static final LispFloat sqrt(LispObject obj) throws ConditionThrowable 4691 4693 { 4692 4694 if (obj instanceof Fixnum) … … 4698 4700 if (obj instanceof LispFloat) 4699 4701 return new LispFloat(Math.sqrt(((LispFloat)obj).getValue())); 4700 throw new TypeError(obj, "number");4702 throw new ConditionThrowable(new TypeError(obj, "number")); 4701 4703 } 4702 4704 … … 4713 4715 }; 4714 4716 4715 private static final LispFloat log(LispObject obj) throws TypeError4717 private static final LispFloat log(LispObject obj) throws ConditionThrowable 4716 4718 { 4717 4719 if (obj instanceof Fixnum) … … 4723 4725 if (obj instanceof LispFloat) 4724 4726 return new LispFloat(Math.log(((LispFloat)obj).getValue())); 4725 throw new TypeError(obj, "number");4727 throw new ConditionThrowable(new TypeError(obj, "number")); 4726 4728 } 4727 4729 … … 4739 4741 n1 = ((Bignum)first).getValue(); 4740 4742 else 4741 throw new TypeError(first, "integer");4743 throw new ConditionThrowable(new TypeError(first, "integer")); 4742 4744 if (second instanceof Fixnum) 4743 4745 n2 = BigInteger.valueOf(((Fixnum)second).getValue()); … … 4745 4747 n2 = ((Bignum)second).getValue(); 4746 4748 else 4747 throw new TypeError(second, "integer");4749 throw new ConditionThrowable(new TypeError(second, "integer")); 4748 4750 return number(n1.gcd(n2)); 4749 4751 } -
trunk/j/src/org/armedbear/lisp/Ratio.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Ratio.java,v 1.3 3 2003-09-19 01:46:42piso Exp $5 * $Id: Ratio.java,v 1.34 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 188 188 return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart()); 189 189 } 190 throw new TypeError(obj, "number");190 throw new ConditionThrowable(new TypeError(obj, "number")); 191 191 } 192 192 … … 220 220 Fixnum.ZERO.subtract(c.getImaginaryPart())); 221 221 } 222 throw new TypeError(obj, "number");222 throw new ConditionThrowable(new TypeError(obj, "number")); 223 223 } 224 224 … … 241 241 return new LispFloat(floatValue() * ((LispFloat)obj).getValue()); 242 242 } 243 throw new TypeError(obj, "number");243 throw new ConditionThrowable(new TypeError(obj, "number")); 244 244 } 245 245 … … 264 264 return new LispFloat(floatValue() / ((LispFloat)obj).getValue()); 265 265 } 266 throw new TypeError(obj, "number");266 throw new ConditionThrowable(new TypeError(obj, "number")); 267 267 } 268 268 … … 276 276 if (obj.numberp()) 277 277 return false; 278 throw new TypeError(obj, "number");278 throw new ConditionThrowable(new TypeError(obj, "number")); 279 279 } 280 280 … … 302 302 return floatValue() < ((LispFloat)obj).getValue(); 303 303 } 304 throw new TypeError(obj, "real");304 throw new ConditionThrowable(new TypeError(obj, "real")); 305 305 } 306 306 … … 323 323 return floatValue() > ((LispFloat)obj).getValue(); 324 324 } 325 throw new TypeError(obj, "real");325 throw new ConditionThrowable(new TypeError(obj, "real")); 326 326 } 327 327 … … 344 344 return floatValue() <= ((LispFloat)obj).getValue(); 345 345 } 346 throw new TypeError(obj, "real");346 throw new ConditionThrowable(new TypeError(obj, "real")); 347 347 } 348 348 … … 365 365 return floatValue() >= ((LispFloat)obj).getValue(); 366 366 } 367 throw new TypeError(obj, "real");367 throw new ConditionThrowable(new TypeError(obj, "real")); 368 368 } 369 369 … … 382 382 } else { 383 383 Thread.dumpStack(); 384 throw new TypeError(obj, "number");384 throw new ConditionThrowable(new TypeError(obj, "number")); 385 385 } 386 386 -
trunk/j/src/org/armedbear/lisp/StringFunctions.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: StringFunctions.java,v 1. 4 2003-09-19 01:46:42piso Exp $5 * $Id: StringFunctions.java,v 1.5 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 388 388 int start = (int) Fixnum.getValue(second); 389 389 if (start < 0 || start > length) 390 throw new TypeError("invalid start position " + start);390 throw new ConditionThrowable(new TypeError("invalid start position " + start)); 391 391 int end; 392 392 if (third == NIL) … … 395 395 end = (int) Fixnum.getValue(third); 396 396 if (end < 0 || end > length) 397 throw new TypeError("invalid end position " + start);397 throw new ConditionThrowable(new TypeError("invalid end position " + start)); 398 398 if (start > end) 399 throw new TypeError("start (" + start + ") is greater than end (" + end + ")");399 throw new ConditionThrowable(new TypeError("start (" + start + ") is greater than end (" + end + ")")); 400 400 StringBuffer sb = new StringBuffer(length); 401 401 char[] array = s.chars(); … … 421 421 int start = (int) Fixnum.getValue(second); 422 422 if (start < 0 || start > length) 423 throw new TypeError("invalid start position " + start);423 throw new ConditionThrowable(new TypeError("invalid start position " + start)); 424 424 int end; 425 425 if (third == NIL) … … 428 428 end = (int) Fixnum.getValue(third); 429 429 if (end < 0 || end > length) 430 throw new TypeError("invalid end position " + start);430 throw new ConditionThrowable(new TypeError("invalid end position " + start)); 431 431 if (start > end) 432 throw new TypeError("start (" + start + ") is greater than end (" + end + ")");432 throw new ConditionThrowable(new TypeError("start (" + start + ") is greater than end (" + end + ")")); 433 433 StringBuffer sb = new StringBuffer(length); 434 434 char[] array = s.chars(); … … 454 454 int start = (int) Fixnum.getValue(second); 455 455 if (start < 0 || start > length) 456 throw new TypeError("invalid start position " + start);456 throw new ConditionThrowable(new TypeError("invalid start position " + start)); 457 457 int end; 458 458 if (third == NIL) … … 461 461 end = (int) Fixnum.getValue(third); 462 462 if (end < 0 || end > length) 463 throw new TypeError("invalid end position " + start);463 throw new ConditionThrowable(new TypeError("invalid end position " + start)); 464 464 if (start > end) 465 throw new TypeError("start (" + start + ") is greater than end (" + end + ")");465 throw new ConditionThrowable(new TypeError("start (" + start + ") is greater than end (" + end + ")")); 466 466 StringBuffer sb = new StringBuffer(length); 467 467 char[] array = s.chars(); … … 499 499 int start = (int) Fixnum.getValue(second); 500 500 if (start < 0 || start > length) 501 throw new TypeError("invalid start position " + start);501 throw new ConditionThrowable(new TypeError("invalid start position " + start)); 502 502 int end; 503 503 if (third == NIL) … … 506 506 end = (int) Fixnum.getValue(third); 507 507 if (end < 0 || end > length) 508 throw new TypeError("invalid end position " + start);508 throw new ConditionThrowable(new TypeError("invalid end position " + start)); 509 509 if (start > end) 510 throw new TypeError("start (" + start + ") is greater than end (" + end + ")");510 throw new ConditionThrowable(new TypeError("start (" + start + ") is greater than end (" + end + ")")); 511 511 char[] array = s.chars(); 512 512 for (int i = start; i < end; i++) … … 526 526 int start = (int) Fixnum.getValue(second); 527 527 if (start < 0 || start > length) 528 throw new TypeError("invalid start position " + start);528 throw new ConditionThrowable(new TypeError("invalid start position " + start)); 529 529 int end; 530 530 if (third == NIL) … … 533 533 end = (int) Fixnum.getValue(third); 534 534 if (end < 0 || end > length) 535 throw new TypeError("invalid end position " + start);535 throw new ConditionThrowable(new TypeError("invalid end position " + start)); 536 536 if (start > end) 537 throw new TypeError("start (" + start + ") is greater than end (" + end + ")");537 throw new ConditionThrowable(new TypeError("start (" + start + ") is greater than end (" + end + ")")); 538 538 char[] array = s.chars(); 539 539 for (int i = start; i < end; i++) … … 553 553 int start = (int) Fixnum.getValue(second); 554 554 if (start < 0 || start > length) 555 throw new TypeError("invalid start position " + start);555 throw new ConditionThrowable(new TypeError("invalid start position " + start)); 556 556 int end; 557 557 if (third == NIL) … … 560 560 end = (int) Fixnum.getValue(third); 561 561 if (end < 0 || end > length) 562 throw new TypeError("invalid end position " + start);562 throw new ConditionThrowable(new TypeError("invalid end position " + start)); 563 563 if (start > end) 564 throw new TypeError("start (" + start + ") is greater than end (" + end + ")");564 throw new ConditionThrowable(new TypeError("start (" + start + ") is greater than end (" + end + ")")); 565 565 char[] array = s.chars(); 566 566 boolean lastCharWasAlphanumeric = false; -
trunk/j/src/org/armedbear/lisp/StringOutputStream.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: StringOutputStream.java,v 1. 3 2003-09-19 01:46:42piso Exp $5 * $Id: StringOutputStream.java,v 1.4 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 70 70 if (arg instanceof StringOutputStream) 71 71 return ((StringOutputStream)arg).getString(); 72 throw new TypeError(this, "string output stream");72 throw new ConditionThrowable(new TypeError(this, "string output stream")); 73 73 } 74 74 }; -
trunk/j/src/org/armedbear/lisp/StructureObject.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: StructureObject.java,v 1.1 0 2003-09-19 01:46:42piso Exp $5 * $Id: StructureObject.java,v 1.11 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 84 84 } 85 85 catch (ClassCastException e) { 86 throw new TypeError();86 throw new ConditionThrowable(new TypeError()); 87 87 } 88 88 catch (ArrayIndexOutOfBoundsException e) { … … 101 101 } 102 102 catch (ClassCastException e) { 103 throw new TypeError();103 throw new ConditionThrowable(new TypeError()); 104 104 } 105 105 catch (ArrayIndexOutOfBoundsException e) { … … 118 118 } 119 119 catch (ClassCastException e) { 120 throw new TypeError();120 throw new ConditionThrowable(new TypeError()); 121 121 } 122 122 catch (ArrayIndexOutOfBoundsException e) { … … 135 135 } 136 136 catch (ClassCastException e) { 137 throw new TypeError();137 throw new ConditionThrowable(new TypeError()); 138 138 } 139 139 catch (ArrayIndexOutOfBoundsException e) { … … 157 157 } 158 158 catch (ClassCastException e) { 159 throw new TypeError();159 throw new ConditionThrowable(new TypeError()); 160 160 } 161 161 catch (ArrayIndexOutOfBoundsException e) { … … 176 176 } 177 177 catch (ClassCastException e) { 178 throw new TypeError();178 throw new ConditionThrowable(new TypeError()); 179 179 } 180 180 catch (ArrayIndexOutOfBoundsException e) { … … 195 195 } 196 196 catch (ClassCastException e) { 197 throw new TypeError();197 throw new ConditionThrowable(new TypeError()); 198 198 } 199 199 catch (ArrayIndexOutOfBoundsException e) { … … 214 214 } 215 215 catch (ClassCastException e) { 216 throw new TypeError();216 throw new ConditionThrowable(new TypeError()); 217 217 } 218 218 catch (ArrayIndexOutOfBoundsException e) { … … 244 244 } 245 245 catch (ClassCastException e) { 246 throw new TypeError(arg, "STRUCTURE-OBJECT");246 throw new ConditionThrowable(new TypeError(arg, "STRUCTURE-OBJECT")); 247 247 } 248 248 } -
trunk/j/src/org/armedbear/lisp/Time.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Time.java,v 1. 5 2003-09-19 01:46:42piso Exp $5 * $Id: Time.java,v 1.6 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 82 82 namestring = ((Pathname)arg).getNamestring(); 83 83 else 84 throw new TypeError(arg, "pathname designator");84 throw new ConditionThrowable(new TypeError(arg, "pathname designator")); 85 85 File file = new File(namestring); 86 86 long lastModified = file.lastModified(); -
trunk/j/src/org/armedbear/lisp/TwoWayStream.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: TwoWayStream.java,v 1. 3 2003-09-19 01:46:42piso Exp $5 * $Id: TwoWayStream.java,v 1.4 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 70 70 { 71 71 if (!(first instanceof CharacterInputStream)) 72 throw new TypeError(first, "input stream");72 throw new ConditionThrowable(new TypeError(first, "input stream")); 73 73 if (!(second instanceof CharacterOutputStream)) 74 throw new TypeError(second, "output stream");74 throw new ConditionThrowable(new TypeError(second, "output stream")); 75 75 return new TwoWayStream((CharacterInputStream) first, 76 76 (CharacterOutputStream) second); … … 86 86 if (arg instanceof TwoWayStream) 87 87 return ((TwoWayStream)arg).getInputStream(); 88 throw new TypeError(arg, "two-way-stream");88 throw new ConditionThrowable(new TypeError(arg, "two-way-stream")); 89 89 } 90 90 }; … … 98 98 if (arg instanceof TwoWayStream) 99 99 return ((TwoWayStream)arg).getOutputStream(); 100 throw new TypeError(arg, "two-way-stream");100 throw new ConditionThrowable(new TypeError(arg, "two-way-stream")); 101 101 } 102 102 }; -
trunk/j/src/org/armedbear/lisp/TypeError.java
r751 r3884 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: TypeError.java,v 1. 2 2003-02-15 19:44:01piso Exp $5 * $Id: TypeError.java,v 1.3 2003-09-19 11:50:19 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 TypeError extends LispError24 public final class TypeError extends Condition 25 25 { 26 private final String message; 26 27 private final LispObject object; 27 28 private final String expectedType; … … 34 35 public TypeError(String message) 35 36 { 36 super(message);37 this.object = null;38 this.expectedType = null;37 this.message = message; 38 object = null; 39 expectedType = null; 39 40 } 40 41 … … 46 47 public TypeError(LispObject object, String expectedType) 47 48 { 49 message = null; 48 50 this.object = object; 49 51 this.expectedType = expectedType; … … 52 54 public String getMessage() 53 55 { 54 String s = super.getMessage(); 55 if (s != null) 56 return s; 57 56 if (message != null) 57 return message; 58 58 StringBuffer sb = new StringBuffer("wrong type"); 59 59 String name = object != null ? String.valueOf(object) : null; -
trunk/j/src/org/armedbear/lisp/coerce.java
r3871 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: coerce.java,v 1. 7 2003-09-19 00:05:11piso Exp $5 * $Id: coerce.java,v 1.8 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 43 43 return LispCharacter.getInstance(name.charAt(0)); 44 44 } 45 throw new TypeError();45 throw new ConditionThrowable(new TypeError()); 46 46 } 47 47 if (second == Symbol.FLOAT || second == Symbol.SINGLE_FLOAT || … … 56 56 return first; 57 57 } 58 throw new TypeError(first, "number");58 throw new ConditionThrowable(new TypeError(first, "number")); 59 59 } 60 60 if (first instanceof AbstractVector) { … … 126 126 if (obj instanceof Function) { 127 127 if (obj instanceof SpecialOperator) 128 throw new TypeError();128 throw new ConditionThrowable(new TypeError()); 129 129 return obj; 130 130 } 131 131 } 132 132 } 133 throw new TypeError();133 throw new ConditionThrowable(new TypeError()); 134 134 } 135 135 }; -
trunk/j/src/org/armedbear/lisp/last.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: last.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: last.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 75 75 return result; 76 76 } 77 throw new TypeError(second, "non-negative integer");77 throw new ConditionThrowable(new TypeError(second, "non-negative integer")); 78 78 } 79 79 -
trunk/j/src/org/armedbear/lisp/logand.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logand.java,v 1. 3 2003-09-19 01:46:42piso Exp $5 * $Id: logand.java,v 1.4 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 51 51 n1 = ((Bignum)first).getValue(); 52 52 else 53 throw new TypeError(first, "integer");53 throw new ConditionThrowable(new TypeError(first, "integer")); 54 54 if (second instanceof Fixnum) 55 55 n2 = ((Fixnum)second).getBigInteger(); … … 57 57 n2 = ((Bignum)second).getValue(); 58 58 else 59 throw new TypeError(second, "integer");59 throw new ConditionThrowable(new TypeError(second, "integer")); 60 60 return number(n1.and(n2)); 61 61 } … … 71 71 n = ((Bignum)args[i]).getValue(); 72 72 else 73 throw new TypeError(args[i], "integer");73 throw new ConditionThrowable(new TypeError(args[i], "integer")); 74 74 result = result.and(n); 75 75 } -
trunk/j/src/org/armedbear/lisp/logandc1.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logandc1.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: logandc1.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 43 43 return number(n1.not().and(n2)); 44 44 } 45 throw new TypeError(second, "integer");45 throw new ConditionThrowable(new TypeError(second, "integer")); 46 46 } 47 47 if (first instanceof Bignum) { … … 55 55 return number(n1.not().and(n2)); 56 56 } 57 throw new TypeError(second, "integer");57 throw new ConditionThrowable(new TypeError(second, "integer")); 58 58 } 59 throw new TypeError(first, "integer");59 throw new ConditionThrowable(new TypeError(first, "integer")); 60 60 } 61 61 -
trunk/j/src/org/armedbear/lisp/logandc2.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logandc2.java,v 1. 3 2003-09-19 01:46:42piso Exp $5 * $Id: logandc2.java,v 1.4 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 46 46 return number(n1.and(n2.not())); 47 47 } 48 throw new TypeError(second, "integer");48 throw new ConditionThrowable(new TypeError(second, "integer")); 49 49 } 50 50 if (first instanceof Bignum) { … … 58 58 return number(n1.and(n2.not())); 59 59 } 60 throw new TypeError(second, "integer");60 throw new ConditionThrowable(new TypeError(second, "integer")); 61 61 } 62 throw new TypeError(first, "integer");62 throw new ConditionThrowable(new TypeError(first, "integer")); 63 63 } 64 64 -
trunk/j/src/org/armedbear/lisp/logbitp.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logbitp.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: logbitp.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 46 46 } 47 47 if (index < 0) 48 throw new TypeError(first, "non-negative integer");48 throw new ConditionThrowable(new TypeError(first, "non-negative integer")); 49 49 BigInteger n; 50 50 if (second instanceof Fixnum) … … 53 53 n = ((Bignum)second).getValue(); 54 54 else 55 throw new TypeError(second, "integer");55 throw new ConditionThrowable(new TypeError(second, "integer")); 56 56 // FIXME See above. 57 57 if (index == Integer.MAX_VALUE) -
trunk/j/src/org/armedbear/lisp/logeqv.java
r3657 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logeqv.java,v 1. 1 2003-09-10 16:10:32piso Exp $5 * $Id: logeqv.java,v 1.2 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 39 39 } 40 40 41 public LispObject execute(LispObject arg) throws TypeError41 public LispObject execute(LispObject arg) throws ConditionThrowable 42 42 { 43 43 if (arg instanceof Fixnum) … … 45 45 if (arg instanceof Bignum) 46 46 return arg; 47 throw new TypeError(arg, "integer");47 throw new ConditionThrowable(new TypeError(arg, "integer")); 48 48 } 49 49 50 public LispObject execute(LispObject[] args) throws TypeError50 public LispObject execute(LispObject[] args) throws ConditionThrowable 51 51 { 52 52 BigInteger result = null; … … 59 59 n = ((Bignum)arg).getValue(); 60 60 else 61 throw new TypeError(arg, "integer");61 throw new ConditionThrowable(new TypeError(arg, "integer")); 62 62 if (result == null) 63 63 result = n; -
trunk/j/src/org/armedbear/lisp/logior.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logior.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: logior.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 51 51 n1 = ((Bignum)first).getValue(); 52 52 else 53 throw new TypeError(first, "integer");53 throw new ConditionThrowable(new TypeError(first, "integer")); 54 54 if (second instanceof Fixnum) 55 55 n2 = ((Fixnum)second).getBigInteger(); … … 57 57 n2 = ((Bignum)second).getValue(); 58 58 else 59 throw new TypeError(second, "integer");59 throw new ConditionThrowable(new TypeError(second, "integer")); 60 60 return number(n1.or(n2)); 61 61 } … … 71 71 n = ((Bignum)args[i]).getValue(); 72 72 else 73 throw new TypeError(args[i], "integer");73 throw new ConditionThrowable(new TypeError(args[i], "integer")); 74 74 result = result.or(n); 75 75 } -
trunk/j/src/org/armedbear/lisp/lognand.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: lognand.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: lognand.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 43 43 return number(n1.and(n2).not()); 44 44 } 45 throw new TypeError(second, "integer");45 throw new ConditionThrowable(new TypeError(second, "integer")); 46 46 } 47 47 if (first instanceof Bignum) { … … 55 55 return number(n1.and(n2).not()); 56 56 } 57 throw new TypeError(second, "integer");57 throw new ConditionThrowable(new TypeError(second, "integer")); 58 58 } 59 throw new TypeError(first, "integer");59 throw new ConditionThrowable(new TypeError(first, "integer")); 60 60 } 61 61 -
trunk/j/src/org/armedbear/lisp/lognor.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: lognor.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: lognor.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 43 43 return number(n1.or(n2).not()); 44 44 } 45 throw new TypeError(second, "integer");45 throw new ConditionThrowable(new TypeError(second, "integer")); 46 46 } 47 47 if (first instanceof Bignum) { … … 55 55 return number(n1.or(n2).not()); 56 56 } 57 throw new TypeError(second, "integer");57 throw new ConditionThrowable(new TypeError(second, "integer")); 58 58 } 59 throw new TypeError(first, "integer");59 throw new ConditionThrowable(new TypeError(first, "integer")); 60 60 } 61 61 -
trunk/j/src/org/armedbear/lisp/lognot.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: lognot.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: lognot.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 38 38 if (arg instanceof Bignum) 39 39 return number(((Bignum)arg).getValue().not()); 40 throw new TypeError(arg, "integer");40 throw new ConditionThrowable(new TypeError(arg, "integer")); 41 41 } 42 42 -
trunk/j/src/org/armedbear/lisp/logorc1.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logorc1.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: logorc1.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 46 46 return number(n1.not().or(n2)); 47 47 } 48 throw new TypeError(second, "integer");48 throw new ConditionThrowable(new TypeError(second, "integer")); 49 49 } 50 50 if (first instanceof Bignum) { … … 58 58 return number(n1.not().or(n2)); 59 59 } 60 throw new TypeError(second, "integer");60 throw new ConditionThrowable(new TypeError(second, "integer")); 61 61 } 62 throw new TypeError(first, "integer");62 throw new ConditionThrowable(new TypeError(first, "integer")); 63 63 } 64 64 -
trunk/j/src/org/armedbear/lisp/logorc2.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logorc2.java,v 1. 2 2003-09-19 01:46:42piso Exp $5 * $Id: logorc2.java,v 1.3 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 46 46 return number(n1.or(n2.not())); 47 47 } 48 throw new TypeError(second, "integer");48 throw new ConditionThrowable(new TypeError(second, "integer")); 49 49 } 50 50 if (first instanceof Bignum) { … … 58 58 return number(n1.or(n2.not())); 59 59 } 60 throw new TypeError(second, "integer");60 throw new ConditionThrowable(new TypeError(second, "integer")); 61 61 } 62 throw new TypeError(first, "integer");62 throw new ConditionThrowable(new TypeError(first, "integer")); 63 63 } 64 64 -
trunk/j/src/org/armedbear/lisp/logxor.java
r3669 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: logxor.java,v 1. 1 2003-09-10 16:49:01piso Exp $5 * $Id: logxor.java,v 1.2 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 39 39 } 40 40 41 public LispObject execute(LispObject arg) throws TypeError41 public LispObject execute(LispObject arg) throws ConditionThrowable 42 42 { 43 43 if (arg instanceof Fixnum) … … 45 45 if (arg instanceof Bignum) 46 46 return arg; 47 throw new TypeError(arg, "integer");47 throw new ConditionThrowable(new TypeError(arg, "integer")); 48 48 } 49 49 50 public LispObject execute(LispObject[] args) throws TypeError50 public LispObject execute(LispObject[] args) throws ConditionThrowable 51 51 { 52 52 BigInteger result = null; … … 59 59 n = ((Bignum)arg).getValue(); 60 60 else 61 throw new TypeError(arg, "integer");61 throw new ConditionThrowable(new TypeError(arg, "integer")); 62 62 if (result == null) 63 63 result = n; -
trunk/j/src/org/armedbear/lisp/make_array.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: make_array.java,v 1. 4 2003-09-19 01:46:42piso Exp $5 * $Id: make_array.java,v 1.5 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 110 110 v.set(i, initialContents.elt(i)); 111 111 } else 112 throw new TypeError(initialContents, "sequence");112 throw new ConditionThrowable(new TypeError(initialContents, "sequence")); 113 113 } 114 114 if (fillPointer != NIL) -
trunk/j/src/org/armedbear/lisp/open.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: open.java,v 1. 3 2003-09-19 01:46:43piso Exp $5 * $Id: open.java,v 1.4 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 42 42 namestring = ((Pathname)first).getNamestring(); 43 43 else 44 throw new TypeError(first, "pathname designator");44 throw new ConditionThrowable(new TypeError(first, "pathname designator")); 45 45 boolean binary; 46 46 LispObject elementType = second; … … 91 91 namestring = ((Pathname)first).getNamestring(); 92 92 else 93 throw new TypeError(first, "pathname designator");93 throw new ConditionThrowable(new TypeError(first, "pathname designator")); 94 94 boolean binary; 95 95 LispObject elementType = second; -
trunk/j/src/org/armedbear/lisp/probe_file.java
r3883 r3884 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: probe_file.java,v 1. 3 2003-09-19 01:46:43piso Exp $5 * $Id: probe_file.java,v 1.4 2003-09-19 11:50:19 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 37 37 namestring = ((Pathname)arg).getNamestring(); 38 38 else 39 throw new TypeError(arg, "pathname designator");39 throw new ConditionThrowable(new TypeError(arg, "pathname designator")); 40 40 boolean absolute = false; 41 41 if (System.getProperty("os.name").startsWith("Windows")) {
Note: See TracChangeset
for help on using the changeset viewer.