1 21 22 package org.armedbear.lisp; 23 24 public class PrintNotReadable extends LispError 25 { 26 public final LispObject object; 27 28 public PrintNotReadable(LispObject initArgs) throws ConditionThrowable 29 { 30 super(initArgs); 31 LispObject object = 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.OBJECT) { 39 object = second; 40 break; 41 } 42 } 43 this.object = object; 44 } 45 46 public LispObject typeOf() 47 { 48 return Symbol.PRINT_NOT_READABLE; 49 } 50 51 public LispClass classOf() 52 { 53 return BuiltInClass.PRINT_NOT_READABLE; 54 } 55 56 public LispObject typep(LispObject type) throws ConditionThrowable 57 { 58 if (type == Symbol.PRINT_NOT_READABLE) 59 return T; 60 if (type == BuiltInClass.PRINT_NOT_READABLE) 61 return T; 62 return super.typep(type); 63 } 64 65 private static final Primitive1 PRINT_NOT_READABLE_OBJECT = 67 new Primitive1("print-not-readable-object", "condition") 68 { 69 public LispObject execute(LispObject arg) throws ConditionThrowable 70 { 71 try { 72 return ((PrintNotReadable)arg).object; 73 } 74 catch (ClassCastException e) { 75 return signal(new TypeError(arg, Symbol.PRINT_NOT_READABLE)); 76 } 77 } 78 }; 79 } 80 | Popular Tags |