Changeset 3884


Ignore:
Timestamp:
09/19/03 11:50:19 (19 years ago)
Author:
piso
Message:

Conditions: work in progress.

Location:
trunk/j/src/org/armedbear/lisp
Files:
50 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/AbstractVector.java

    r3883 r3884  
    7474    {
    7575        if (n != 0)
    76             throw new TypeError("bad dimension for vector");
     76            throw new ConditionThrowable(new TypeError("bad dimension for vector"));
    7777        return capacity();
    7878    }
     
    123123            sb.append(')');
    124124        }
    125         throw new TypeError(sb.toString());
     125        throw new ConditionThrowable(new TypeError(sb.toString()));
    126126    }
    127127
  • trunk/j/src/org/armedbear/lisp/Array.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Array.java,v 1.12 2003-09-19 01:46:39 piso Exp $
     5 * $Id: Array.java,v 1.13 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    155155        }
    156156        catch (ArrayIndexOutOfBoundsException e) {
    157             throw new TypeError("bad array dimension");
     157            throw new ConditionThrowable(new TypeError("bad array dimension"));
    158158        }
    159159    }
     
    175175        }
    176176        catch (ArrayIndexOutOfBoundsException e) {
    177             throw new TypeError("bad row major index " + index);
     177            throw new ConditionThrowable(new TypeError("bad row major index " + index));
    178178        }
    179179    }
     
    185185        }
    186186        catch (ArrayIndexOutOfBoundsException e) {
    187             throw new TypeError("bad row major index " + index);
     187            throw new ConditionThrowable(new TypeError("bad row major index " + index));
    188188        }
    189189    }
  • trunk/j/src/org/armedbear/lisp/Autoload.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Autoload.java,v 1.68 2003-09-19 01:46:39 piso Exp $
     5 * $Id: Autoload.java,v 1.69 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    132132                return T;
    133133            }
    134             throw new TypeError(first);
     134            throw new ConditionThrowable(new TypeError(first));
    135135        }
    136136        public LispObject execute(LispObject first, LispObject second)
     
    150150                return T;
    151151            }
    152             throw new TypeError(first);
     152            throw new ConditionThrowable(new TypeError(first));
    153153        }
    154154    };
  • trunk/j/src/org/armedbear/lisp/AutoloadMacro.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: AutoloadMacro.java,v 1.3 2003-09-19 01:46:39 piso Exp $
     5 * $Id: AutoloadMacro.java,v 1.4 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6666                return T;
    6767            }
    68             throw new TypeError(first);
     68            throw new ConditionThrowable(new TypeError(first));
    6969        }
    7070        public LispObject execute(LispObject first, LispObject second)
     
    8484                return T;
    8585            }
    86             throw new TypeError(first);
     86            throw new ConditionThrowable(new TypeError(first));
    8787        }
    8888    };
  • trunk/j/src/org/armedbear/lisp/Bignum.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Bignum.java,v 1.43 2003-09-19 01:46:39 piso Exp $
     5 * $Id: Bignum.java,v 1.44 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    148148    }
    149149
    150     public boolean evenp() throws TypeError
     150    public boolean evenp() throws ConditionThrowable
    151151    {
    152152        return !value.testBit(0);
    153153    }
    154154
    155     public boolean oddp() throws TypeError
     155    public boolean oddp() throws ConditionThrowable
    156156    {
    157157        return value.testBit(0);
     
    173173    }
    174174
    175     public double floatValue() throws TypeError
     175    public double floatValue() throws ConditionThrowable
    176176    {
    177177        double d = value.doubleValue();
    178178        if (Double.isInfinite(d))
    179             throw new TypeError(toString() +
     179            throw new ConditionThrowable(new TypeError(toString()) +
    180180                                " is too large to be converted to a float");
    181181        return d;
     
    188188        }
    189189        catch (ClassCastException e) {
    190             throw new TypeError(obj, "bignum");
     190            throw new ConditionThrowable(new TypeError(obj, "bignum"));
    191191        }
    192192    }
     
    225225            return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart());
    226226        }
    227         throw new TypeError(obj, "number");
     227        throw new ConditionThrowable(new TypeError(obj, "number"));
    228228    }
    229229
     
    247247                                       Fixnum.ZERO.subtract(c.getImaginaryPart()));
    248248        }
    249         throw new TypeError(obj, "number");
     249        throw new ConditionThrowable(new TypeError(obj, "number"));
    250250    }
    251251
     
    268268        if (obj instanceof LispFloat)
    269269            return new LispFloat(floatValue() * ((LispFloat)obj).getValue());
    270         throw new TypeError(obj, "number");
     270        throw new ConditionThrowable(new TypeError(obj, "number"));
    271271    }
    272272
     
    283283        if (obj instanceof LispFloat)
    284284            return new LispFloat(floatValue() / ((LispFloat)obj).getValue());
    285         throw new TypeError(obj, "number");
     285        throw new ConditionThrowable(new TypeError(obj, "number"));
    286286    }
    287287
     
    294294        if (obj.numberp())
    295295            return false;
    296         throw new TypeError(obj, "number");
     296        throw new ConditionThrowable(new TypeError(obj, "number"));
    297297    }
    298298
     
    305305        if (obj.numberp())
    306306            return true;
    307         throw new TypeError(obj, "number");
     307        throw new ConditionThrowable(new TypeError(obj, "number"));
    308308    }
    309309
     
    320320        if (obj instanceof LispFloat)
    321321            return floatValue() < ((LispFloat)obj).getValue();
    322         throw new TypeError(obj, "real");
     322        throw new ConditionThrowable(new TypeError(obj, "real"));
    323323    }
    324324
     
    335335        if (obj instanceof LispFloat)
    336336            return floatValue() > ((LispFloat)obj).getValue();
    337         throw new TypeError(obj, "real");
     337        throw new ConditionThrowable(new TypeError(obj, "real"));
    338338    }
    339339
     
    350350        if (obj instanceof LispFloat)
    351351            return floatValue() <= ((LispFloat)obj).getValue();
    352         throw new TypeError(obj, "real");
     352        throw new ConditionThrowable(new TypeError(obj, "real"));
    353353    }
    354354
     
    365365        if (obj instanceof LispFloat)
    366366            return floatValue() >= ((LispFloat)obj).getValue();
    367         throw new TypeError(obj, "real");
     367        throw new ConditionThrowable(new TypeError(obj, "real"));
    368368    }
    369369
  • trunk/j/src/org/armedbear/lisp/BitVector.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: BitVector.java,v 1.23 2003-09-19 01:46:40 piso Exp $
     5 * $Id: BitVector.java,v 1.24 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    187187            // None of the above...
    188188        }
    189         catch (TypeError e) {}
    190         throw new TypeError(newValue, "bit");
     189        catch (ConditionThrowable t) {}
     190        throw new ConditionThrowable(new TypeError(newValue, "bit"));
    191191    }
    192192
     
    232232            // None of the above...
    233233        }
    234         catch (TypeError e) {}
    235         throw new TypeError(obj, "bit");
     234        catch (ConditionThrowable t) {}
     235        throw new ConditionThrowable(new TypeError(obj, "bit"));
    236236    }
    237237
  • trunk/j/src/org/armedbear/lisp/CompiledFunction.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: CompiledFunction.java,v 1.11 2003-09-19 01:46:40 piso Exp $
     5 * $Id: CompiledFunction.java,v 1.12 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    135135            if (arg instanceof CompiledFunction)
    136136                return ((CompiledFunction)arg).getVariableList();
    137             throw new TypeError(arg, "compiled function");
     137            throw new ConditionThrowable(new TypeError(arg, "compiled function"));
    138138        }
    139139    };
  • trunk/j/src/org/armedbear/lisp/Complex.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Complex.java,v 1.22 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Complex.java,v 1.23 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3535    public static LispObject getInstance(LispObject realpart,
    3636                                         LispObject imagpart)
    37         throws TypeError
     37        throws ConditionThrowable
    3838    {
    3939        if (!realpart.realp())
    40             throw new TypeError(realpart, "real number");
     40            throw new ConditionThrowable(new TypeError(realpart, "real number"));
    4141        if (!imagpart.realp())
    42             throw new TypeError(imagpart, "real number");
     42            throw new ConditionThrowable(new TypeError(imagpart, "real number"));
    4343        if (realpart instanceof LispFloat)
    4444            imagpart = LispFloat.coerceToFloat(imagpart);
     
    201201            return false;
    202202        }
    203         throw new TypeError(obj, "number");
     203        throw new ConditionThrowable(new TypeError(obj, "number"));
    204204    }
    205205
     
    209209    }
    210210
    211     public LispObject ABS() throws TypeError
     211    public LispObject ABS() throws ConditionThrowable
    212212    {
    213213        double real = LispFloat.coerceToFloat(realpart).getValue();
     
    216216    }
    217217
    218     public boolean zerop() throws TypeError
     218    public boolean zerop() throws ConditionThrowable
    219219    {
    220220        return realpart.zerop() && imagpart.zerop();
  • trunk/j/src/org/armedbear/lisp/Cons.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Cons.java,v 1.27 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Cons.java,v 1.28 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    153153        }
    154154        catch (ClassCastException e) {
    155             throw new TypeError(obj, "list");
     155            throw new ConditionThrowable(new TypeError(obj, "list"));
    156156        }
    157157        return length;
     
    161161    {
    162162        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));
    165165        }
    166166        int i = 0;
     
    176176        catch (ClassCastException e) {
    177177            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));
    180180            else
    181                 throw new TypeError(this, "proper sequence");
     181                throw new ConditionThrowable(new TypeError(this, "proper sequence"));
    182182        }
    183183    }
  • trunk/j/src/org/armedbear/lisp/DisplacedArray.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: DisplacedArray.java,v 1.11 2003-09-19 01:46:40 piso Exp $
     5 * $Id: DisplacedArray.java,v 1.12 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    9191        if (dimv.length == 1)
    9292            return size;
    93         throw new TypeError(this, "sequence");
     93        throw new ConditionThrowable(new TypeError(this, "sequence"));
    9494    }
    9595
     
    9898        if (dimv.length == 1)
    9999            return getRowMajor(index);
    100         throw new TypeError(this, "sequence");
     100        throw new ConditionThrowable(new TypeError(this, "sequence"));
    101101    }
    102102
     
    130130        }
    131131        catch (ArrayIndexOutOfBoundsException e) {
    132             throw new TypeError("bad array dimension");
     132            throw new ConditionThrowable(new TypeError("bad array dimension"));
    133133        }
    134134    }
     
    148148        if (index >= 0 && index < size)
    149149            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));
    151151    }
    152152
     
    155155        if (index >= 0 && index < size)
    156156            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));
    158158    }
    159159
  • trunk/j/src/org/armedbear/lisp/Extensions.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Extensions.java,v 1.9 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Extensions.java,v 1.10 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4242            if (arg instanceof CharacterOutputStream)
    4343                return new Fixnum(((CharacterOutputStream)arg).getCharPos());
    44             throw new TypeError(arg, "character output stream");
     44            throw new ConditionThrowable(new TypeError(arg, "character output stream"));
    4545        }
    4646    };
  • trunk/j/src/org/armedbear/lisp/FillPointerOutputStream.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: FillPointerOutputStream.java,v 1.2 2003-09-19 01:46:40 piso Exp $
     5 * $Id: FillPointerOutputStream.java,v 1.3 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4040            LispString string = checkString(arg);
    4141            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"));
    4343            return new FillPointerOutputStream(string);
    4444        }
  • trunk/j/src/org/armedbear/lisp/Fixnum.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Fixnum.java,v 1.70 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Fixnum.java,v 1.71 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    154154    }
    155155
    156     public boolean evenp() throws TypeError
     156    public boolean evenp() throws ConditionThrowable
    157157    {
    158158        return (value & 0x01) == 0;
    159159    }
    160160
    161     public boolean oddp() throws TypeError
     161    public boolean oddp() throws ConditionThrowable
    162162    {
    163163        return (value & 0x01) != 0;
     
    185185        }
    186186        catch (ClassCastException e) {
    187             throw new TypeError(obj, "fixnum");
     187            throw new ConditionThrowable(new TypeError(obj, "fixnum"));
    188188        }
    189189    }
     
    195195        }
    196196        catch (ClassCastException e) {
    197             throw new TypeError(obj, "fixnum");
     197            throw new ConditionThrowable(new TypeError(obj, "fixnum"));
    198198        }
    199199    }
     
    205205        }
    206206        catch (ClassCastException e) {
    207             throw new TypeError(obj, "fixnum");
     207            throw new ConditionThrowable(new TypeError(obj, "fixnum"));
    208208        }
    209209    }
     
    215215        }
    216216        catch (ClassCastException e) {
    217             throw new TypeError(obj, "fixnum");
     217            throw new ConditionThrowable(new TypeError(obj, "fixnum"));
    218218        }
    219219    }
     
    262262            return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart());
    263263        }
    264         throw new TypeError(obj, "number");
     264        throw new ConditionThrowable(new TypeError(obj, "number"));
    265265    }
    266266
     
    285285                                       ZERO.subtract(c.getImaginaryPart()));
    286286        }
    287         throw new TypeError(obj, "number");
     287        throw new ConditionThrowable(new TypeError(obj, "number"));
    288288    }
    289289
     
    308308                                       multiplyBy(c.getImaginaryPart()));
    309309        }
    310         throw new TypeError(obj, "number");
     310        throw new ConditionThrowable(new TypeError(obj, "number"));
    311311    }
    312312
     
    340340                                           Fixnum.ZERO.subtract(multiplyBy(imagPart).divideBy(denominator)));
    341341            }
    342             throw new TypeError(obj, "number");
     342            throw new ConditionThrowable(new TypeError(obj, "number"));
    343343        }
    344344        catch (ArithmeticException e) {
     
    359359        if (obj.numberp())
    360360            return false;
    361         throw new TypeError(obj, "number");
     361        throw new ConditionThrowable(new TypeError(obj, "number"));
    362362    }
    363363
     
    373373        if (obj.numberp())
    374374            return true;
    375         throw new TypeError(obj, "number");
     375        throw new ConditionThrowable(new TypeError(obj, "number"));
    376376    }
    377377
     
    389389        if (obj instanceof LispFloat)
    390390            return (float) value < LispFloat.getValue(obj);
    391         throw new TypeError(obj, "number");
     391        throw new ConditionThrowable(new TypeError(obj, "number"));
    392392    }
    393393
     
    405405        if (obj instanceof LispFloat)
    406406            return (float) value > LispFloat.getValue(obj);
    407         throw new TypeError(obj, "number");
     407        throw new ConditionThrowable(new TypeError(obj, "number"));
    408408    }
    409409
     
    421421        if (obj instanceof LispFloat)
    422422            return (float) value <= LispFloat.getValue(obj);
    423         throw new TypeError(obj, "number");
     423        throw new ConditionThrowable(new TypeError(obj, "number"));
    424424    }
    425425
     
    437437        if (obj instanceof LispFloat)
    438438            return (float) value >= LispFloat.getValue(obj);
    439         throw new TypeError(obj, "number");
     439        throw new ConditionThrowable(new TypeError(obj, "number"));
    440440    }
    441441
  • trunk/j/src/org/armedbear/lisp/HashTable.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: HashTable.java,v 1.18 2003-09-19 01:46:40 piso Exp $
     5 * $Id: HashTable.java,v 1.19 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    304304                return ht.gethash(key, defaultValue);
    305305            }
    306             throw new TypeError(args[1], "hash-table");
     306            throw new ConditionThrowable(new TypeError(args[1], "hash-table"));
    307307        }
    308308    };
     
    329329                return ht.puthash(key, value);
    330330            }
    331             throw new TypeError(args[1], "hash-table");
     331            throw new ConditionThrowable(new TypeError(args[1], "hash-table"));
    332332        }
    333333    };
     
    343343                return ht.remhash(key);
    344344            }
    345             throw new TypeError(second, "hash-table");
     345            throw new ConditionThrowable(new TypeError(second, "hash-table"));
    346346        }
    347347    };
     
    372372            if (arg instanceof HashTable)
    373373                return ((HashTable)arg).ENTRIES();
    374             throw new TypeError(arg, "hash-table");
     374            throw new ConditionThrowable(new TypeError(arg, "hash-table"));
    375375        }
    376376    };
  • trunk/j/src/org/armedbear/lisp/Java.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Java.java,v 1.8 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Java.java,v 1.9 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    168168                    }
    169169                } else
    170                     throw new TypeError(methodRef);
     170                    throw new ConditionThrowable(new TypeError(methodRef));
    171171                Object[] methodArgs = new Object[args.length-2];
    172172                for (int i = 2; i < args.length; i++) {
  • trunk/j/src/org/armedbear/lisp/JavaObject.java

    r3871 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: JavaObject.java,v 1.7 2003-09-19 00:05:10 piso Exp $
     5 * $Id: JavaObject.java,v 1.8 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3737    }
    3838
    39     public static final Object getObject(LispObject o) throws TypeError
     39    public static final Object getObject(LispObject o) throws ConditionThrowable
    4040    {
    4141        try {
     
    4343        }
    4444        catch (ClassCastException e) {
    45             throw new TypeError(o, "Java object");
     45            throw new ConditionThrowable(new TypeError(o, "Java object"));
    4646        }
    4747    }
  • trunk/j/src/org/armedbear/lisp/Lisp.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.134 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Lisp.java,v 1.135 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    340340                LispObject args = obj.cdr();
    341341                if (!args.listp())
    342                     throw new TypeError(args, "list");
     342                    throw new ConditionThrowable(new TypeError(args, "list"));
    343343                LispObject funcar = first.car();
    344344                LispObject rest = first.cdr();
     
    460460        }
    461461        catch (ClassCastException e) {
    462             throw new TypeError(obj, "symbol");
     462            throw new ConditionThrowable(new TypeError(obj, "symbol"));
    463463        }
    464464    }
     
    472472        }
    473473        catch (ClassCastException e) {
    474             throw new TypeError(obj, "cons");
     474            throw new ConditionThrowable(new TypeError(obj, "cons"));
    475475        }
    476476    }
     
    483483        if (obj.listp())
    484484            return obj;
    485         throw new TypeError(obj, "list");
     485        throw new ConditionThrowable(new TypeError(obj, "list"));
    486486    }
    487487
     
    495495        }
    496496        catch (ClassCastException e) {
    497             throw new TypeError(obj, "array");
     497            throw new ConditionThrowable(new TypeError(obj, "array"));
    498498        }
    499499    }
     
    508508        }
    509509        catch (ClassCastException e) {
    510             throw new TypeError(obj, "vector");
     510            throw new ConditionThrowable(new TypeError(obj, "vector"));
    511511        }
    512512    }
     
    521521        }
    522522        catch (ClassCastException e) {
    523             throw new TypeError(obj, "string");
     523            throw new ConditionThrowable(new TypeError(obj, "string"));
    524524        }
    525525    }
     
    533533        if (arg instanceof LispCharacter)
    534534            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"));
    537537    }
    538538
     
    545545        if (arg instanceof LispCharacter)
    546546            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"));
    549549    }
    550550
     
    655655        }
    656656        catch (ClassCastException e) {
    657             throw new TypeError(obj, "character");
     657            throw new ConditionThrowable(new TypeError(obj, "character"));
    658658        }
    659659    }
     
    668668        }
    669669        catch (ClassCastException e) {
    670             throw new TypeError(obj, "package");
     670            throw new ConditionThrowable(new TypeError(obj, "package"));
    671671        }
    672672    }
     
    681681        }
    682682        catch (ClassCastException e) {
    683             throw new TypeError(obj, "function");
     683            throw new ConditionThrowable(new TypeError(obj, "function"));
    684684        }
    685685    }
     
    694694        }
    695695        catch (ClassCastException e) {
    696             throw new TypeError(obj, "stream");
     696            throw new ConditionThrowable(new TypeError(obj, "stream"));
    697697        }
    698698    }
     
    707707        if (obj instanceof TwoWayStream)
    708708            return ((TwoWayStream)obj).getInputStream();
    709         throw new TypeError(obj, "input stream");
     709        throw new ConditionThrowable(new TypeError(obj, "input stream"));
    710710    }
    711711
     
    719719        if (obj instanceof TwoWayStream)
    720720            return ((TwoWayStream)obj).getOutputStream();
    721         throw new TypeError(obj, "output stream");
     721        throw new ConditionThrowable(new TypeError(obj, "output stream"));
    722722    }
    723723
     
    731731        }
    732732        catch (ClassCastException e) {
    733             throw new TypeError(obj, "readtable");
     733            throw new ConditionThrowable(new TypeError(obj, "readtable"));
    734734        }
    735735    }
     
    744744        }
    745745        catch (ClassCastException e) {
    746             throw new TypeError(obj, "environment");
     746            throw new ConditionThrowable(new TypeError(obj, "environment"));
    747747        }
    748748    }
  • trunk/j/src/org/armedbear/lisp/LispCharacter.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispCharacter.java,v 1.25 2003-09-19 01:46:41 piso Exp $
     5 * $Id: LispCharacter.java,v 1.26 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    120120        }
    121121        catch (ClassCastException e) {
    122             throw new TypeError(obj, "character");
     122            throw new ConditionThrowable(new TypeError(obj, "character"));
    123123        }
    124124    }
     
    181181                    return new LispCharacter(name.charAt(0));
    182182            }
    183             throw new TypeError();
     183            throw new ConditionThrowable(new TypeError());
    184184        }
    185185    };
  • trunk/j/src/org/armedbear/lisp/LispClass.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispClass.java,v 1.14 2003-09-19 01:46:41 piso Exp $
     5 * $Id: LispClass.java,v 1.15 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    127127            }
    128128            catch (ClassCastException e) {
    129                 throw new TypeError(arg, "class");
     129                throw new ConditionThrowable(new TypeError(arg, "class"));
    130130            }
    131131        }
  • trunk/j/src/org/armedbear/lisp/LispFloat.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispFloat.java,v 1.45 2003-09-19 01:46:41 piso Exp $
     5 * $Id: LispFloat.java,v 1.46 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    153153        }
    154154        catch (ClassCastException e) {
    155             throw new TypeError(obj, "float");
     155            throw new ConditionThrowable(new TypeError(obj, "float"));
    156156        }
    157157    }
     
    186186            return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart());
    187187        }
    188         throw new TypeError(obj, "number");
     188        throw new ConditionThrowable(new TypeError(obj, "number"));
    189189    }
    190190
     
    204204                                       ZERO.subtract(c.getImaginaryPart()));
    205205        }
    206         throw new TypeError(obj, "number");
     206        throw new ConditionThrowable(new TypeError(obj, "number"));
    207207    }
    208208
     
    217217        if (obj instanceof Ratio)
    218218            return new LispFloat(value * ((Ratio)obj).floatValue());
    219         throw new TypeError(obj, "number");
     219        throw new ConditionThrowable(new TypeError(obj, "number"));
    220220    }
    221221
     
    232232        if (obj instanceof Ratio)
    233233            return new LispFloat(value / ((Ratio)obj).floatValue());
    234         throw new TypeError(obj, "number");
     234        throw new ConditionThrowable(new TypeError(obj, "number"));
    235235    }
    236236
     
    247247        if (obj instanceof Complex)
    248248            return obj.isEqualTo(this);
    249         throw new TypeError(obj, "number");
     249        throw new ConditionThrowable(new TypeError(obj, "number"));
    250250    }
    251251
     
    265265        if (obj instanceof Ratio)
    266266            return value < ((Ratio)obj).floatValue();
    267         throw new TypeError(obj, "real");
     267        throw new ConditionThrowable(new TypeError(obj, "real"));
    268268    }
    269269
     
    278278        if (obj instanceof Ratio)
    279279            return value > ((Ratio)obj).floatValue();
    280         throw new TypeError(obj, "real");
     280        throw new ConditionThrowable(new TypeError(obj, "real"));
    281281    }
    282282
     
    291291        if (obj instanceof Ratio)
    292292            return value <= ((Ratio)obj).floatValue();
    293         throw new TypeError(obj, "real");
     293        throw new ConditionThrowable(new TypeError(obj, "real"));
    294294    }
    295295
     
    304304        if (obj instanceof Ratio)
    305305            return value >= ((Ratio)obj).floatValue();
    306         throw new TypeError(obj, "real");
     306        throw new ConditionThrowable(new TypeError(obj, "real"));
    307307    }
    308308
     
    396396                return values[0];
    397397            }
    398             throw new TypeError(arg, "float");
     398            throw new ConditionThrowable(new TypeError(arg, "float"));
    399399        }
    400400    };
     
    408408            if (arg instanceof LispFloat)
    409409                return Fixnum.TWO;
    410             throw new TypeError(arg, "float");
     410            throw new ConditionThrowable(new TypeError(arg, "float"));
    411411        }
    412412    };
     
    420420            if (arg instanceof LispFloat)
    421421                return new Fixnum(52);
    422             throw new TypeError(arg, "float");
     422            throw new ConditionThrowable(new TypeError(arg, "float"));
    423423        }
    424424    };
    425425
    426     public static LispFloat coerceToFloat(LispObject obj) throws TypeError
     426    public static LispFloat coerceToFloat(LispObject obj) throws ConditionThrowable
    427427    {
    428428        if (obj instanceof LispFloat)
     
    434434        if (obj instanceof Ratio)
    435435            return new LispFloat(((Ratio)obj).floatValue());
    436         throw new TypeError(obj, "real number");
     436        throw new ConditionThrowable(new TypeError(obj, "real number"));
    437437    }
    438438
  • trunk/j/src/org/armedbear/lisp/LispObject.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispObject.java,v 1.57 2003-09-19 01:46:41 piso Exp $
     5 * $Id: LispObject.java,v 1.58 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7272    public LispObject car() throws ConditionThrowable
    7373    {
    74         throw new TypeError(this, "list");
     74        throw new ConditionThrowable(new TypeError(this, "list"));
    7575    }
    7676
    7777    public void setCar(LispObject obj) throws ConditionThrowable
    7878    {
    79         throw new TypeError(this, "cons");
     79        throw new ConditionThrowable(new TypeError(this, "cons"));
    8080    }
    8181
    8282    public LispObject cdr() throws ConditionThrowable
    8383    {
    84         throw new TypeError(this, "list");
     84        throw new ConditionThrowable(new TypeError(this, "list"));
    8585    }
    8686
    8787    public void setCdr(LispObject obj) throws ConditionThrowable
    8888    {
    89         throw new TypeError(this, "cons");
     89        throw new ConditionThrowable(new TypeError(this, "cons"));
    9090    }
    9191
    9292    public LispObject cadr() throws ConditionThrowable
    9393    {
    94         throw new TypeError(this, "list");
     94        throw new ConditionThrowable(new TypeError(this, "list"));
    9595    }
    9696
    9797    public LispObject cddr() throws ConditionThrowable
    9898    {
    99         throw new TypeError(this, "list");
     99        throw new ConditionThrowable(new TypeError(this, "list"));
    100100    }
    101101
     
    125125    }
    126126
    127     public LispObject ABS() throws TypeError
    128     {
    129         throw new TypeError(this, "number");
    130     }
    131 
    132     public LispObject NUMERATOR() throws TypeError
    133     {
    134         throw new TypeError(this, "rational number");
    135     }
    136 
    137     public LispObject DENOMINATOR() throws TypeError
    138     {
    139         throw new TypeError(this, "rational number");
    140     }
    141 
    142     public LispObject EVENP() throws TypeError
     127    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
    143143    {
    144144        return evenp() ? T : NIL;
    145145    }
    146146
    147     public boolean evenp() throws TypeError
    148     {
    149         throw new TypeError(this, "integer");
    150     }
    151 
    152     public LispObject ODDP() throws TypeError
     147    public boolean evenp() throws ConditionThrowable
     148    {
     149        throw new ConditionThrowable(new TypeError(this, "integer"));
     150    }
     151
     152    public LispObject ODDP() throws ConditionThrowable
    153153    {
    154154        return oddp() ? T : NIL;
    155155    }
    156156
    157     public boolean oddp() throws TypeError
    158     {
    159         throw new TypeError(this, "integer");
    160     }
    161 
    162     public LispObject PLUSP() throws TypeError
     157    public boolean oddp() throws ConditionThrowable
     158    {
     159        throw new ConditionThrowable(new TypeError(this, "integer"));
     160    }
     161
     162    public LispObject PLUSP() throws ConditionThrowable
    163163    {
    164164        return plusp() ? T : NIL;
    165165    }
    166166
    167     public boolean plusp() throws TypeError
    168     {
    169         throw new TypeError(this, "real number");
    170     }
    171 
    172     public LispObject MINUSP() throws TypeError
     167    public boolean plusp() throws ConditionThrowable
     168    {
     169        throw new ConditionThrowable(new TypeError(this, "real number"));
     170    }
     171
     172    public LispObject MINUSP() throws ConditionThrowable
    173173    {
    174174        return minusp() ? T : NIL;
    175175    }
    176176
    177     public boolean minusp() throws TypeError
    178     {
    179         throw new TypeError(this, "real number");
     177    public boolean minusp() throws ConditionThrowable
     178    {
     179        throw new ConditionThrowable(new TypeError(this, "real number"));
    180180    }
    181181
     
    190190    }
    191191
    192     public LispObject ZEROP() throws TypeError
     192    public LispObject ZEROP() throws ConditionThrowable
    193193    {
    194194        return zerop() ? T : NIL;
    195195    }
    196196
    197     public boolean zerop() throws TypeError
    198     {
    199         throw new TypeError(this, "number");
     197    public boolean zerop() throws ConditionThrowable
     198    {
     199        throw new ConditionThrowable(new TypeError(this, "number"));
    200200    }
    201201
     
    272272    public int length() throws ConditionThrowable
    273273    {
    274         throw new TypeError(this, "sequence");
     274        throw new ConditionThrowable(new TypeError(this, "sequence"));
    275275    }
    276276
     
    282282    public LispObject elt(int index) throws ConditionThrowable
    283283    {
    284         throw new TypeError(this, "sequence");
     284        throw new ConditionThrowable(new TypeError(this, "sequence"));
    285285    }
    286286
    287287    public LispObject AREF(LispObject index) throws ConditionThrowable
    288288    {
    289         throw new TypeError(this, "array");
     289        throw new ConditionThrowable(new TypeError(this, "array"));
    290290    }
    291291
    292292    public LispObject[] copyToArray() throws ConditionThrowable
    293293    {
    294         throw new TypeError(this, "list");
     294        throw new ConditionThrowable(new TypeError(this, "list"));
    295295    }
    296296
     
    310310    }
    311311
    312     public LispObject ENDP() throws TypeError
    313     {
    314         throw new TypeError(this, "list");
     312    public LispObject ENDP() throws ConditionThrowable
     313    {
     314        throw new ConditionThrowable(new TypeError(this, "list"));
    315315    }
    316316
     
    327327    public LispObject getSymbolValue() throws ConditionThrowable
    328328    {
    329         throw new TypeError(this, "symbol");
     329        throw new ConditionThrowable(new TypeError(this, "symbol"));
    330330    }
    331331
    332332    public LispObject getSymbolFunction() throws ConditionThrowable
    333333    {
    334         throw new TypeError(this, "symbol");
     334        throw new ConditionThrowable(new TypeError(this, "symbol"));
    335335    }
    336336
    337337    public LispObject getSymbolFunctionOrDie() throws ConditionThrowable
    338338    {
    339         throw new TypeError(this, "symbol");
     339        throw new ConditionThrowable(new TypeError(this, "symbol"));
    340340    }
    341341
     
    386386    public LispObject incr() throws ConditionThrowable
    387387    {
    388         throw new TypeError(this, "number");
     388        throw new ConditionThrowable(new TypeError(this, "number"));
    389389    }
    390390
    391391    public LispObject decr() throws ConditionThrowable
    392392    {
    393         throw new TypeError(this, "number");
     393        throw new ConditionThrowable(new TypeError(this, "number"));
    394394    }
    395395
    396396    public LispObject add(LispObject obj) throws ConditionThrowable
    397397    {
    398         throw new TypeError(this, "number");
     398        throw new ConditionThrowable(new TypeError(this, "number"));
    399399    }
    400400
    401401    public LispObject subtract(LispObject obj) throws ConditionThrowable
    402402    {
    403         throw new TypeError(this, "number");
     403        throw new ConditionThrowable(new TypeError(this, "number"));
    404404    }
    405405
    406406    public LispObject multiplyBy(LispObject obj) throws ConditionThrowable
    407407    {
    408         throw new TypeError(this, "number");
     408        throw new ConditionThrowable(new TypeError(this, "number"));
    409409    }
    410410
    411411    public LispObject divideBy(LispObject obj) throws ConditionThrowable
    412412    {
    413         throw new TypeError(this, "number");
     413        throw new ConditionThrowable(new TypeError(this, "number"));
    414414    }
    415415
    416416    public boolean isEqualTo(LispObject obj) throws ConditionThrowable
    417417    {
    418         throw new TypeError(this, "number");
     418        throw new ConditionThrowable(new TypeError(this, "number"));
    419419    }
    420420
     
    426426    public boolean isNotEqualTo(LispObject obj) throws ConditionThrowable
    427427    {
    428         throw new TypeError(this, "number");
     428        throw new ConditionThrowable(new TypeError(this, "number"));
    429429    }
    430430
     
    436436    public boolean isLessThan(LispObject obj) throws ConditionThrowable
    437437    {
    438         throw new TypeError(this, "number");
     438        throw new ConditionThrowable(new TypeError(this, "number"));
    439439    }
    440440
     
    446446    public boolean isGreaterThan(LispObject obj) throws ConditionThrowable
    447447    {
    448         throw new TypeError(this, "number");
     448        throw new ConditionThrowable(new TypeError(this, "number"));
    449449    }
    450450
     
    456456    public boolean isLessThanOrEqualTo(LispObject obj) throws ConditionThrowable
    457457    {
    458         throw new TypeError(this, "number");
     458        throw new ConditionThrowable(new TypeError(this, "number"));
    459459    }
    460460
     
    466466    public boolean isGreaterThanOrEqualTo(LispObject obj) throws ConditionThrowable
    467467    {
    468         throw new TypeError(this, "number");
     468        throw new ConditionThrowable(new TypeError(this, "number"));
    469469    }
    470470
     
    476476    public LispObject truncate(LispObject obj) throws ConditionThrowable
    477477    {
    478         throw new TypeError(this, "real number");
     478        throw new ConditionThrowable(new TypeError(this, "real number"));
    479479    }
    480480
  • trunk/j/src/org/armedbear/lisp/LispString.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispString.java,v 1.58 2003-09-19 01:46:41 piso Exp $
     5 * $Id: LispString.java,v 1.59 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    244244        }
    245245        catch (ClassCastException e) {
    246             throw new TypeError(obj, "string");
     246            throw new ConditionThrowable(new TypeError(obj, "string"));
    247247        }
    248248    }
  • trunk/j/src/org/armedbear/lisp/LispThread.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispThread.java,v 1.11 2003-09-19 01:46:41 piso Exp $
     5 * $Id: LispThread.java,v 1.12 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    340340                ((LispFloat)arg.multiplyBy(new LispFloat(1000))).getValue();
    341341            if (d < 0)
    342                 throw new TypeError(arg, "non-negative real");
     342                throw new ConditionThrowable(new TypeError(arg, "non-negative real"));
    343343            long millis = d < Long.MAX_VALUE ? (long) d : Long.MAX_VALUE;
    344344            try {
     
    380380                return T;
    381381            } else
    382                 throw new TypeError(arg, "Lisp thread");
     382                throw new ConditionThrowable(new TypeError(arg, "Lisp thread"));
    383383        }
    384384    };
  • trunk/j/src/org/armedbear/lisp/Nil.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Nil.java,v 1.23 2003-09-19 01:46:41 piso Exp $
     5 * $Id: Nil.java,v 1.24 2003-09-19 11:50:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8787    public LispObject elt(int index) throws ConditionThrowable
    8888    {
    89         throw new TypeError("ELT: invalid index " + index + " for " + this);
     89        throw new ConditionThrowable(new TypeError("ELT: invalid index " + index + " for " + this));
    9090    }
    9191
  • trunk/j/src/org/armedbear/lisp/Pathname.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Pathname.java,v 1.12 2003-09-19 01:46:42 piso Exp $
     5 * $Id: Pathname.java,v 1.13 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    9696            if (arg instanceof Pathname)
    9797                return new LispString(((Pathname)arg).getNamestring());
    98             throw new TypeError(arg, "pathname designator");
     98            throw new ConditionThrowable(new TypeError(arg, "pathname designator"));
    9999        }
    100100    };
     
    114114                namestring = ((Pathname)arg).getNamestring();
    115115            else
    116                 throw new TypeError(arg, "pathname designator");
     116                throw new ConditionThrowable(new TypeError(arg, "pathname designator"));
    117117            if (namestring != null) {
    118118                for (int i = namestring.length(); i-- > 0;) {
     
    136136            if (arg instanceof LispString)
    137137                return new Pathname(((LispString)arg).getValue());
    138             throw new TypeError(arg, "pathname designator");
     138            throw new ConditionThrowable(new TypeError(arg, "pathname designator"));
    139139        }
    140140    };
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.405 2003-09-19 01:46:42 piso Exp $
     5 * $Id: Primitives.java,v 1.406 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    213213                LispObject result = args[0];
    214214                if (!result.realp())
    215                     throw new TypeError(result, "real");
     215                    throw new ConditionThrowable(new TypeError(result, "real"));
    216216                for (int i = 1; i < args.length; i++) {
    217217                    if (args[i].isLessThan(result))
     
    225225                LispObject result = args[0];
    226226                if (!result.realp())
    227                     throw new TypeError(result, "real");
     227                    throw new ConditionThrowable(new TypeError(result, "real"));
    228228                for (int i = 1; i < args.length; i++) {
    229229                    if (args[i].isGreaterThan(result))
     
    293293                if (arg.typep(Symbol.SYMBOL) != NIL)
    294294                    return new LispString(arg.getName());
    295                 throw new TypeError(arg, "symbol");
     295                throw new ConditionThrowable(new TypeError(arg, "symbol"));
    296296            case SYMBOL_PACKAGE:                // ### symbol-package
    297297                return checkSymbol(arg).getPackage();
     
    313313                }
    314314                catch (ClassCastException e) {
    315                     throw new TypeError(arg, "symbol");
     315                    throw new ConditionThrowable(new TypeError(arg, "symbol"));
    316316                }
    317317            case ABS:                           // ### abs
     
    324324                if (arg instanceof AbstractArray)
    325325                    return NIL;
    326                 throw new TypeError(arg, "array");
     326                throw new ConditionThrowable(new TypeError(arg, "array"));
    327327            case VECTORP:                       // ### vectorp
    328328                return arg.VECTORP();
     
    527527    // ### plusp
    528528    private static final Primitive1 PLUSP = new Primitive1("plusp") {
    529         public LispObject execute(LispObject arg) throws TypeError
     529        public LispObject execute(LispObject arg) throws ConditionThrowable
    530530        {
    531531            return arg.PLUSP();
     
    535535    // ### minusp
    536536    private static final Primitive1 MINUSP = new Primitive1("minusp") {
    537         public LispObject execute(LispObject arg) throws TypeError
     537        public LispObject execute(LispObject arg) throws ConditionThrowable
    538538        {
    539539            return arg.MINUSP();
     
    543543    // ### zerop
    544544    private static final Primitive1 ZEROP = new Primitive1("zerop") {
    545         public LispObject execute(LispObject arg) throws TypeError
     545        public LispObject execute(LispObject arg) throws ConditionThrowable
    546546        {
    547547            return arg.ZEROP();
     
    677677                    out = (CharacterOutputStream) args[1];
    678678                else
    679                     throw new TypeError(args[0], "output stream");
     679                    throw new ConditionThrowable(new TypeError(args[0], "output stream"));
    680680            }
    681681            if (out == null)
     
    722722                out = getStandardOutput();
    723723            else
    724                 throw new TypeError(second, "output stream");
     724                throw new ConditionThrowable(new TypeError(second, "output stream"));
    725725            out.prin1(first);
    726726            return first;
     
    764764                    out = (CharacterOutputStream) args[0];
    765765                else
    766                     throw new TypeError(args[0], "output stream");
     766                    throw new ConditionThrowable(new TypeError(args[0], "output stream"));
    767767            }
    768768            if (out == null)
     
    898898                            }
    899899                        } else
    900                             throw new TypeError(list, "list");
     900                            throw new ConditionThrowable(new TypeError(list, "list"));
    901901                    }
    902902                    if (result == null)
     
    10711071                        return cons;
    10721072                } else if (cons != NIL)
    1073                     throw new TypeError(cons, "list");
     1073                    throw new ConditionThrowable(new TypeError(cons, "list"));
    10741074                alist = alist.cdr();
    10751075            }
     
    11311131            final int index = Fixnum.getValue(first);
    11321132            if (index < 0)
    1133                 throw new TypeError("bad index to NTHCDR: " + index);
     1133                throw new ConditionThrowable(new TypeError("bad index to NTHCDR: " + index));
    11341134            for (int i = 0; i < index; i++) {
    11351135                second = second.cdr();
     
    11561156                    throw new ConditionThrowable(new ProgramError(_format(args, 1)));
    11571157                if (datum == Symbol.TYPE_ERROR)
    1158                     throw new TypeError(_format(args, 1));
     1158                    throw new ConditionThrowable(new TypeError(_format(args, 1)));
    11591159                // Default.
    11601160                throw new SimpleError(((Symbol)datum).getName());
     
    13981398                symbol.setVariableDocumentation(third);
    13991399            else if (third != NIL)
    1400                 throw new TypeError(third, "string");
     1400                throw new ConditionThrowable(new TypeError(third, "string"));
    14011401            symbol.setSymbolValue(second);
    14021402            symbol.setSpecial(true);
     
    14271427                symbol.setVariableDocumentation(third);
    14281428            else if (third != NIL)
    1429                 throw new TypeError(third, "string");
     1429                throw new ConditionThrowable(new TypeError(third, "string"));
    14301430            symbol.setSymbolValue(second);
    14311431            symbol.setConstant(true);
     
    15271527                args = args.cdr();
    15281528            }
    1529             throw new TypeError("ECASE: no match for " + key);
     1529            throw new ConditionThrowable(new TypeError("ECASE: no match for " + key));
    15301530        }
    15311531    };
     
    17951795            return c instanceof UndefinedFunctionError;
    17961796        if (type == Symbol.TYPE_ERROR)
    1797             return c instanceof TypeError;
     1797            return c.getCondition() instanceof TypeError;
    17981798        if (type == Symbol.PACKAGE_ERROR)
    17991799            return c instanceof PackageError;
     
    18141814            if (condition instanceof ProgramError)
    18151815                return true;
     1816            if (condition instanceof TypeError)
     1817                return true;
    18161818            return false;
    18171819        }
     
    19231925                    return NIL;
    19241926                } else
    1925                     throw new TypeError(arg, "integer");
     1927                    throw new ConditionThrowable(new TypeError(arg, "integer"));
    19261928            }
    19271929            return T;
     
    20022004                throw new ConditionThrowable(new ProgramError());
    20032005            } else
    2004                 throw new TypeError(subscript, "integer");
     2006                throw new ConditionThrowable(new TypeError(subscript, "integer"));
    20052007        }
    20062008        return sum;
     
    20462048            AbstractVector v = checkVector(first);
    20472049            if (!v.isSimpleVector())
    2048                 throw new TypeError(first, "simple vector");
     2050                throw new ConditionThrowable(new TypeError(first, "simple vector"));
    20492051            int index = v.checkIndex(second);
    20502052            return v.get(index);
     
    20622064            AbstractVector v = checkVector(first);
    20632065            if (!v.isSimpleVector())
    2064                 throw new TypeError(first, "simple vector");
     2066                throw new ConditionThrowable(new TypeError(first, "simple vector"));
    20652067            int i = v.checkIndex(second);
    20662068            v.set(i, third);
     
    20772079            int fillPointer = checkVector(arg).getFillPointer();
    20782080            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"));
    20802082            return new Fixnum(fillPointer);
    20812083        }
     
    20912093            int fillPointer = v.getFillPointer();
    20922094            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"));
    20942096            v.setFillPointer(second);
    20952097            return second;
     
    21072109            int fillPointer = v.getFillPointer();
    21082110            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"));
    21102112            if (fillPointer >= v.capacity())
    21112113                return NIL;
     
    21322134            int fillPointer = v.getFillPointer();
    21332135            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"));
    21352137            if (fillPointer >= v.capacity()) {
    21362138                // Need to extend vector.
     
    21522154            int fillPointer = v.getFillPointer();
    21532155            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"));
    21552157            if (fillPointer == 0)
    21562158                throw new LispError("nothing left to pop");
     
    23112313                }
    23122314            }
    2313             throw new TypeError(fun, "function");
     2315            throw new ConditionThrowable(new TypeError(fun, "function"));
    23142316        }
    23152317        public LispObject execute(final LispObject[] args) throws ConditionThrowable
     
    23342336                return funcall(fun, funArgs, LispThread.currentThread());
    23352337            }
    2336             throw new TypeError(fun, "function");
     2338            throw new ConditionThrowable(new TypeError(fun, "function"));
    23372339        }
    23382340    };
     
    24142416            for (int i = 1; i < numArgs; i++) {
    24152417                if (!args[i].listp())
    2416                     throw new TypeError(args[i], "list");
     2418                    throw new ConditionThrowable(new TypeError(args[i], "list"));
    24172419                int len = args[i].length();
    24182420                if (commonLength < 0)
     
    24882490                    int n = ((Fixnum)arg).getValue();
    24892491                    if (n < 0)
    2490                         throw new TypeError(arg,
    2491                             "non-negative integer");
     2492                        throw new ConditionThrowable(new TypeError(arg,
     2493                                                                   "non-negative integer"));
    24922494                    StringBuffer sb = new StringBuffer(prefix);
    24932495                    sb.append(n);
     
    24972499                    BigInteger n = ((Bignum)arg).getValue();
    24982500                    if (n.signum() < 0)
    2499                         throw new TypeError(arg,
    2500                             "non-negative integer");
     2501                        throw new ConditionThrowable(new TypeError(arg,
     2502                                                                   "non-negative integer"));
    25012503                    StringBuffer sb = new StringBuffer(prefix);
    25022504                    sb.append(n.toString());
     
    25062508                    prefix = ((LispString)arg).getValue();
    25072509                else
    2508                     throw new TypeError(arg, "string or non-negative integer");
     2510                    throw new ConditionThrowable(new TypeError(arg, "string or non-negative integer"));
    25092511            }
    25102512            return gensym(prefix);
     
    36283630                    out = getStandardOutput();
    36293631                else
    3630                     throw new TypeError(args[1],
    3631                                         "character output stream");
     3632                    throw new ConditionThrowable(new TypeError(args[1],
     3633                                                               "character output stream"));
    36323634            }
    36333635            out.writeChar(c);
     
    36553657                    out = getStandardOutput();
    36563658                else
    3657                     throw new TypeError(args[1],
    3658                         "character output stream");
     3659                    throw new ConditionThrowable(new TypeError(args[1],
     3660                                                               "character output stream"));
    36593661            }
    36603662            out.writeString(string);
     
    36833685                    out = getStandardOutput();
    36843686                else
    3685                     throw new TypeError(args[1], "character output stream");
     3687                    throw new ConditionThrowable(new TypeError(args[1], "character output stream"));
    36863688            }
    36873689            out.finishOutput();
     
    37773779            int n = Fixnum.getValue(first);
    37783780            if (n < 0 || n > 255)
    3779                 throw new TypeError(first, "unsigned byte");
     3781                throw new ConditionThrowable(new TypeError(first, "unsigned byte"));
    37803782            if (second instanceof BinaryOutputStream) {
    37813783                ((BinaryOutputStream)second).writeByte(n);
    37823784                return first;
    37833785            }
    3784             throw new TypeError(second, "binary output stream");
     3786            throw new ConditionThrowable(new TypeError(second, "binary output stream"));
    37853787        }
    37863788    };
     
    37993801                stream = (BinaryInputStream) args[0];
    38003802            else
    3801                 throw new TypeError(args[0], "binary input stream");
     3803                throw new ConditionThrowable(new TypeError(args[0], "binary input stream"));
    38023804            boolean eofError = length > 1 ? (args[1] != NIL) : true;
    38033805            LispObject eofValue = length > 2 ? args[2] : NIL;
     
    38243826                stream = ((TwoWayStream)args[0]).getInputStream();
    38253827            else
    3826                 throw new TypeError(args[0], "input stream");
     3828                throw new ConditionThrowable(new TypeError(args[0], "input stream"));
    38273829            boolean eofError = length > 1 ? (args[1] != NIL) : true;
    38283830            LispObject eofValue = length > 2 ? args[2] : NIL;
     
    40424044                return second;
    40434045            } else
    4044                 throw new TypeError(first, "function");
     4046                throw new ConditionThrowable(new TypeError(first, "function"));
    40454047        }
    40464048    };
     
    41044106                }
    41054107            }
    4106             throw new TypeError(args[0], "positive integer or positive float");
     4108            throw new ConditionThrowable(new TypeError(args[0], "positive integer or positive float"));
    41074109        }
    41084110    };
     
    41354137            if (n instanceof LispFloat)
    41364138                return ((LispFloat)n).truncate(d);
    4137             throw new TypeError(n, "number");
     4139            throw new ConditionThrowable(new TypeError(n, "number"));
    41384140        }
    41394141    };
     
    41514153                n = ((Bignum)first).getValue();
    41524154            else
    4153                 throw new TypeError(first, "integer");
     4155                throw new ConditionThrowable(new TypeError(first, "integer"));
    41544156            if (second instanceof Fixnum) {
    41554157                int count = Fixnum.getInt(second);
     
    41704172                Debug.bug(); // Shouldn't happen.
    41714173            }
    4172             throw new TypeError(second, "integer");
     4174            throw new ConditionThrowable(new TypeError(second, "integer"));
    41734175        }
    41744176    };
     
    43604362            if (arg == NIL)
    43614363                return NIL;
    4362             throw new TypeError(arg, "proper sequence");
     4364            throw new ConditionThrowable(new TypeError(arg, "proper sequence"));
    43634365        }
    43644366    };
     
    43734375                int index = Fixnum.getValue(second);
    43744376                if (index < 0)
    4375                     throw new TypeError();
     4377                    throw new ConditionThrowable(new TypeError());
    43764378                LispObject list = first;
    43774379                int i = 0;
     
    43834385                    list = list.cdr();
    43844386                    if (list == NIL)
    4385                         throw new TypeError();
     4387                        throw new ConditionThrowable(new TypeError());
    43864388                    ++i;
    43874389                }
     
    43904392                return third;
    43914393            } else
    4392                 throw new TypeError(first, "sequence");
     4394                throw new ConditionThrowable(new TypeError(first, "sequence"));
    43934395        }
    43944396    };
     
    44294431            int size = Fixnum.getValue(first);
    44304432            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"));
    44334435            LispObject result = NIL;
    44344436            for (int i = size; i-- > 0;)
     
    46034605            if (arg.realp())
    46044606                return arg;
    4605             throw new TypeError(arg, "real number");
     4607            throw new ConditionThrowable(new TypeError(arg, "real number"));
    46064608        }
    46074609        public LispObject execute(LispObject first, LispObject second)
     
    46444646            if (arg.numberp())
    46454647                return arg;
    4646             throw new TypeError(arg, "number");
     4648            throw new ConditionThrowable(new TypeError(arg, "number"));
    46474649        }
    46484650    };
     
    46614663    private static final Primitive1 INTEGER_LENGTH =
    46624664        new Primitive1("integer-length") {
    4663         public LispObject execute(LispObject arg) throws TypeError
     4665        public LispObject execute(LispObject arg) throws ConditionThrowable
    46644666        {
    46654667            BigInteger value;
     
    46694671                value = ((Bignum)arg).getValue();
    46704672            else
    4671                 throw new TypeError(arg, "integer");
     4673                throw new ConditionThrowable(new TypeError(arg, "integer"));
    46724674            return new Fixnum(value.bitLength());
    46734675        }
     
    46884690    };
    46894691
    4690     private static final LispFloat sqrt(LispObject obj) throws TypeError
     4692    private static final LispFloat sqrt(LispObject obj) throws ConditionThrowable
    46914693    {
    46924694        if (obj instanceof Fixnum)
     
    46984700        if (obj instanceof LispFloat)
    46994701            return new LispFloat(Math.sqrt(((LispFloat)obj).getValue()));
    4700         throw new TypeError(obj, "number");
     4702        throw new ConditionThrowable(new TypeError(obj, "number"));
    47014703    }
    47024704
     
    47134715    };
    47144716
    4715     private static final LispFloat log(LispObject obj) throws TypeError
     4717    private static final LispFloat log(LispObject obj) throws ConditionThrowable
    47164718    {
    47174719        if (obj instanceof Fixnum)
     
    47234725        if (obj instanceof LispFloat)
    47244726            return new LispFloat(Math.log(((LispFloat)obj).getValue()));
    4725         throw new TypeError(obj, "number");
     4727        throw new ConditionThrowable(new TypeError(obj, "number"));
    47264728    }
    47274729
     
    47394741                n1 = ((Bignum)first).getValue();
    47404742            else
    4741                 throw new TypeError(first, "integer");
     4743                throw new ConditionThrowable(new TypeError(first, "integer"));
    47424744            if (second instanceof Fixnum)
    47434745                n2 = BigInteger.valueOf(((Fixnum)second).getValue());
     
    47454747                n2 = ((Bignum)second).getValue();
    47464748            else
    4747                 throw new TypeError(second, "integer");
     4749                throw new ConditionThrowable(new TypeError(second, "integer"));
    47484750            return number(n1.gcd(n2));
    47494751        }
  • trunk/j/src/org/armedbear/lisp/Ratio.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Ratio.java,v 1.33 2003-09-19 01:46:42 piso Exp $
     5 * $Id: Ratio.java,v 1.34 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    188188            return Complex.getInstance(add(c.getRealPart()), c.getImaginaryPart());
    189189        }
    190         throw new TypeError(obj, "number");
     190        throw new ConditionThrowable(new TypeError(obj, "number"));
    191191    }
    192192
     
    220220                                       Fixnum.ZERO.subtract(c.getImaginaryPart()));
    221221        }
    222         throw new TypeError(obj, "number");
     222        throw new ConditionThrowable(new TypeError(obj, "number"));
    223223    }
    224224
     
    241241            return new LispFloat(floatValue() * ((LispFloat)obj).getValue());
    242242        }
    243         throw new TypeError(obj, "number");
     243        throw new ConditionThrowable(new TypeError(obj, "number"));
    244244    }
    245245
     
    264264            return new LispFloat(floatValue() / ((LispFloat)obj).getValue());
    265265        }
    266         throw new TypeError(obj, "number");
     266        throw new ConditionThrowable(new TypeError(obj, "number"));
    267267    }
    268268
     
    276276        if (obj.numberp())
    277277            return false;
    278         throw new TypeError(obj, "number");
     278        throw new ConditionThrowable(new TypeError(obj, "number"));
    279279    }
    280280
     
    302302            return floatValue() < ((LispFloat)obj).getValue();
    303303        }
    304         throw new TypeError(obj, "real");
     304        throw new ConditionThrowable(new TypeError(obj, "real"));
    305305    }
    306306
     
    323323            return floatValue() > ((LispFloat)obj).getValue();
    324324        }
    325         throw new TypeError(obj, "real");
     325        throw new ConditionThrowable(new TypeError(obj, "real"));
    326326    }
    327327
     
    344344            return floatValue() <= ((LispFloat)obj).getValue();
    345345        }
    346         throw new TypeError(obj, "real");
     346        throw new ConditionThrowable(new TypeError(obj, "real"));
    347347    }
    348348
     
    365365            return floatValue() >= ((LispFloat)obj).getValue();
    366366        }
    367         throw new TypeError(obj, "real");
     367        throw new ConditionThrowable(new TypeError(obj, "real"));
    368368    }
    369369
     
    382382        } else {
    383383            Thread.dumpStack();
    384             throw new TypeError(obj, "number");
     384            throw new ConditionThrowable(new TypeError(obj, "number"));
    385385        }
    386386
  • trunk/j/src/org/armedbear/lisp/StringFunctions.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StringFunctions.java,v 1.4 2003-09-19 01:46:42 piso Exp $
     5 * $Id: StringFunctions.java,v 1.5 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    388388            int start = (int) Fixnum.getValue(second);
    389389            if (start < 0 || start > length)
    390                 throw new TypeError("invalid start position " + start);
     390                throw new ConditionThrowable(new TypeError("invalid start position " + start));
    391391            int end;
    392392            if (third == NIL)
     
    395395                end = (int) Fixnum.getValue(third);
    396396            if (end < 0 || end > length)
    397                 throw new TypeError("invalid end position " + start);
     397                throw new ConditionThrowable(new TypeError("invalid end position " + start));
    398398            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 + ")"));
    400400            StringBuffer sb = new StringBuffer(length);
    401401            char[] array = s.chars();
     
    421421            int start = (int) Fixnum.getValue(second);
    422422            if (start < 0 || start > length)
    423                 throw new TypeError("invalid start position " + start);
     423                throw new ConditionThrowable(new TypeError("invalid start position " + start));
    424424            int end;
    425425            if (third == NIL)
     
    428428                end = (int) Fixnum.getValue(third);
    429429            if (end < 0 || end > length)
    430                 throw new TypeError("invalid end position " + start);
     430                throw new ConditionThrowable(new TypeError("invalid end position " + start));
    431431            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 + ")"));
    433433            StringBuffer sb = new StringBuffer(length);
    434434            char[] array = s.chars();
     
    454454            int start = (int) Fixnum.getValue(second);
    455455            if (start < 0 || start > length)
    456                 throw new TypeError("invalid start position " + start);
     456                throw new ConditionThrowable(new TypeError("invalid start position " + start));
    457457            int end;
    458458            if (third == NIL)
     
    461461                end = (int) Fixnum.getValue(third);
    462462            if (end < 0 || end > length)
    463                 throw new TypeError("invalid end position " + start);
     463                throw new ConditionThrowable(new TypeError("invalid end position " + start));
    464464            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 + ")"));
    466466            StringBuffer sb = new StringBuffer(length);
    467467            char[] array = s.chars();
     
    499499            int start = (int) Fixnum.getValue(second);
    500500            if (start < 0 || start > length)
    501                 throw new TypeError("invalid start position " + start);
     501                throw new ConditionThrowable(new TypeError("invalid start position " + start));
    502502            int end;
    503503            if (third == NIL)
     
    506506                end = (int) Fixnum.getValue(third);
    507507            if (end < 0 || end > length)
    508                 throw new TypeError("invalid end position " + start);
     508                throw new ConditionThrowable(new TypeError("invalid end position " + start));
    509509            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 + ")"));
    511511            char[] array = s.chars();
    512512            for (int i = start; i < end; i++)
     
    526526            int start = (int) Fixnum.getValue(second);
    527527            if (start < 0 || start > length)
    528                 throw new TypeError("invalid start position " + start);
     528                throw new ConditionThrowable(new TypeError("invalid start position " + start));
    529529            int end;
    530530            if (third == NIL)
     
    533533                end = (int) Fixnum.getValue(third);
    534534            if (end < 0 || end > length)
    535                 throw new TypeError("invalid end position " + start);
     535                throw new ConditionThrowable(new TypeError("invalid end position " + start));
    536536            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 + ")"));
    538538            char[] array = s.chars();
    539539            for (int i = start; i < end; i++)
     
    553553            int start = (int) Fixnum.getValue(second);
    554554            if (start < 0 || start > length)
    555                 throw new TypeError("invalid start position " + start);
     555                throw new ConditionThrowable(new TypeError("invalid start position " + start));
    556556            int end;
    557557            if (third == NIL)
     
    560560                end = (int) Fixnum.getValue(third);
    561561            if (end < 0 || end > length)
    562                 throw new TypeError("invalid end position " + start);
     562                throw new ConditionThrowable(new TypeError("invalid end position " + start));
    563563            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 + ")"));
    565565            char[] array = s.chars();
    566566            boolean lastCharWasAlphanumeric = false;
  • trunk/j/src/org/armedbear/lisp/StringOutputStream.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: StringOutputStream.java,v 1.3 2003-09-19 01:46:42 piso Exp $
     5 * $Id: StringOutputStream.java,v 1.4 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7070            if (arg instanceof StringOutputStream)
    7171                return ((StringOutputStream)arg).getString();
    72             throw new TypeError(this, "string output stream");
     72            throw new ConditionThrowable(new TypeError(this, "string output stream"));
    7373        }
    7474    };
  • trunk/j/src/org/armedbear/lisp/StructureObject.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StructureObject.java,v 1.10 2003-09-19 01:46:42 piso Exp $
     5 * $Id: StructureObject.java,v 1.11 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8484            }
    8585            catch (ClassCastException e) {
    86                 throw new TypeError();
     86                throw new ConditionThrowable(new TypeError());
    8787            }
    8888            catch (ArrayIndexOutOfBoundsException e) {
     
    101101            }
    102102            catch (ClassCastException e) {
    103                 throw new TypeError();
     103                throw new ConditionThrowable(new TypeError());
    104104            }
    105105            catch (ArrayIndexOutOfBoundsException e) {
     
    118118            }
    119119            catch (ClassCastException e) {
    120                 throw new TypeError();
     120                throw new ConditionThrowable(new TypeError());
    121121            }
    122122            catch (ArrayIndexOutOfBoundsException e) {
     
    135135            }
    136136            catch (ClassCastException e) {
    137                 throw new TypeError();
     137                throw new ConditionThrowable(new TypeError());
    138138            }
    139139            catch (ArrayIndexOutOfBoundsException e) {
     
    157157            }
    158158            catch (ClassCastException e) {
    159                 throw new TypeError();
     159                throw new ConditionThrowable(new TypeError());
    160160            }
    161161            catch (ArrayIndexOutOfBoundsException e) {
     
    176176            }
    177177            catch (ClassCastException e) {
    178                 throw new TypeError();
     178                throw new ConditionThrowable(new TypeError());
    179179            }
    180180            catch (ArrayIndexOutOfBoundsException e) {
     
    195195            }
    196196            catch (ClassCastException e) {
    197                 throw new TypeError();
     197                throw new ConditionThrowable(new TypeError());
    198198            }
    199199            catch (ArrayIndexOutOfBoundsException e) {
     
    214214            }
    215215            catch (ClassCastException e) {
    216                 throw new TypeError();
     216                throw new ConditionThrowable(new TypeError());
    217217            }
    218218            catch (ArrayIndexOutOfBoundsException e) {
     
    244244            }
    245245            catch (ClassCastException e) {
    246                 throw new TypeError(arg, "STRUCTURE-OBJECT");
     246                throw new ConditionThrowable(new TypeError(arg, "STRUCTURE-OBJECT"));
    247247            }
    248248        }
  • trunk/j/src/org/armedbear/lisp/Time.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Time.java,v 1.5 2003-09-19 01:46:42 piso Exp $
     5 * $Id: Time.java,v 1.6 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8282                namestring = ((Pathname)arg).getNamestring();
    8383            else
    84                 throw new TypeError(arg, "pathname designator");
     84                throw new ConditionThrowable(new TypeError(arg, "pathname designator"));
    8585            File file = new File(namestring);
    8686            long lastModified = file.lastModified();
  • trunk/j/src/org/armedbear/lisp/TwoWayStream.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: TwoWayStream.java,v 1.3 2003-09-19 01:46:42 piso Exp $
     5 * $Id: TwoWayStream.java,v 1.4 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7070        {
    7171            if (!(first instanceof CharacterInputStream))
    72                 throw new TypeError(first, "input stream");
     72                throw new ConditionThrowable(new TypeError(first, "input stream"));
    7373            if (!(second instanceof CharacterOutputStream))
    74                 throw new TypeError(second, "output stream");
     74                throw new ConditionThrowable(new TypeError(second, "output stream"));
    7575            return new TwoWayStream((CharacterInputStream) first,
    7676                (CharacterOutputStream) second);
     
    8686            if (arg instanceof TwoWayStream)
    8787                return ((TwoWayStream)arg).getInputStream();
    88             throw new TypeError(arg, "two-way-stream");
     88            throw new ConditionThrowable(new TypeError(arg, "two-way-stream"));
    8989        }
    9090    };
     
    9898            if (arg instanceof TwoWayStream)
    9999                return ((TwoWayStream)arg).getOutputStream();
    100             throw new TypeError(arg, "two-way-stream");
     100            throw new ConditionThrowable(new TypeError(arg, "two-way-stream"));
    101101        }
    102102    };
  • trunk/j/src/org/armedbear/lisp/TypeError.java

    r751 r3884  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: TypeError.java,v 1.2 2003-02-15 19:44:01 piso Exp $
     5 * $Id: TypeError.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2222package org.armedbear.lisp;
    2323
    24 public final class TypeError extends LispError
     24public final class TypeError extends Condition
    2525{
     26    private final String message;
    2627    private final LispObject object;
    2728    private final String expectedType;
     
    3435    public TypeError(String message)
    3536    {
    36         super(message);
    37         this.object = null;
    38         this.expectedType = null;
     37        this.message = message;
     38        object = null;
     39        expectedType = null;
    3940    }
    4041
     
    4647    public TypeError(LispObject object, String expectedType)
    4748    {
     49        message = null;
    4850        this.object = object;
    4951        this.expectedType = expectedType;
     
    5254    public String getMessage()
    5355    {
    54         String s = super.getMessage();
    55         if (s != null)
    56             return s;
    57 
     56        if (message != null)
     57            return message;
    5858        StringBuffer sb = new StringBuffer("wrong type");
    5959        String name = object != null ? String.valueOf(object) : null;
  • trunk/j/src/org/armedbear/lisp/coerce.java

    r3871 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: coerce.java,v 1.7 2003-09-19 00:05:11 piso Exp $
     5 * $Id: coerce.java,v 1.8 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4343                        return LispCharacter.getInstance(name.charAt(0));
    4444                }
    45                 throw new TypeError();
     45                throw new ConditionThrowable(new TypeError());
    4646            }
    4747            if (second == Symbol.FLOAT || second == Symbol.SINGLE_FLOAT ||
     
    5656                    return first;
    5757                }
    58                 throw new TypeError(first, "number");
     58                throw new ConditionThrowable(new TypeError(first, "number"));
    5959            }
    6060            if (first instanceof AbstractVector) {
     
    126126                    if (obj instanceof Function) {
    127127                        if (obj instanceof SpecialOperator)
    128                             throw new TypeError();
     128                            throw new ConditionThrowable(new TypeError());
    129129                        return obj;
    130130                    }
    131131                }
    132132            }
    133             throw new TypeError();
     133            throw new ConditionThrowable(new TypeError());
    134134        }
    135135    };
  • trunk/j/src/org/armedbear/lisp/last.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: last.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: last.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7575            return result;
    7676        }
    77         throw new TypeError(second, "non-negative integer");
     77        throw new ConditionThrowable(new TypeError(second, "non-negative integer"));
    7878    }
    7979
  • trunk/j/src/org/armedbear/lisp/logand.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logand.java,v 1.3 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logand.java,v 1.4 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5151                n1 = ((Bignum)first).getValue();
    5252            else
    53                 throw new TypeError(first, "integer");
     53                throw new ConditionThrowable(new TypeError(first, "integer"));
    5454            if (second instanceof Fixnum)
    5555                n2 = ((Fixnum)second).getBigInteger();
     
    5757                n2 = ((Bignum)second).getValue();
    5858            else
    59                 throw new TypeError(second, "integer");
     59                throw new ConditionThrowable(new TypeError(second, "integer"));
    6060            return number(n1.and(n2));
    6161        }
     
    7171                n = ((Bignum)args[i]).getValue();
    7272            else
    73                 throw new TypeError(args[i], "integer");
     73                throw new ConditionThrowable(new TypeError(args[i], "integer"));
    7474            result = result.and(n);
    7575        }
  • trunk/j/src/org/armedbear/lisp/logandc1.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logandc1.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logandc1.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4343                return number(n1.not().and(n2));
    4444            }
    45             throw new TypeError(second, "integer");
     45            throw new ConditionThrowable(new TypeError(second, "integer"));
    4646        }
    4747        if (first instanceof Bignum) {
     
    5555                return number(n1.not().and(n2));
    5656            }
    57             throw new TypeError(second, "integer");
     57            throw new ConditionThrowable(new TypeError(second, "integer"));
    5858        }
    59         throw new TypeError(first, "integer");
     59        throw new ConditionThrowable(new TypeError(first, "integer"));
    6060    }
    6161
  • trunk/j/src/org/armedbear/lisp/logandc2.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logandc2.java,v 1.3 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logandc2.java,v 1.4 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4646                return number(n1.and(n2.not()));
    4747            }
    48             throw new TypeError(second, "integer");
     48            throw new ConditionThrowable(new TypeError(second, "integer"));
    4949        }
    5050        if (first instanceof Bignum) {
     
    5858                return number(n1.and(n2.not()));
    5959            }
    60             throw new TypeError(second, "integer");
     60            throw new ConditionThrowable(new TypeError(second, "integer"));
    6161        }
    62         throw new TypeError(first, "integer");
     62        throw new ConditionThrowable(new TypeError(first, "integer"));
    6363    }
    6464
  • trunk/j/src/org/armedbear/lisp/logbitp.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logbitp.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logbitp.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4646        }
    4747        if (index < 0)
    48             throw new TypeError(first, "non-negative integer");
     48            throw new ConditionThrowable(new TypeError(first, "non-negative integer"));
    4949        BigInteger n;
    5050        if (second instanceof Fixnum)
     
    5353            n = ((Bignum)second).getValue();
    5454        else
    55             throw new TypeError(second, "integer");
     55            throw new ConditionThrowable(new TypeError(second, "integer"));
    5656        // FIXME See above.
    5757        if (index == Integer.MAX_VALUE)
  • trunk/j/src/org/armedbear/lisp/logeqv.java

    r3657 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logeqv.java,v 1.1 2003-09-10 16:10:32 piso Exp $
     5 * $Id: logeqv.java,v 1.2 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3939    }
    4040
    41     public LispObject execute(LispObject arg) throws TypeError
     41    public LispObject execute(LispObject arg) throws ConditionThrowable
    4242    {
    4343        if (arg instanceof Fixnum)
     
    4545        if (arg instanceof Bignum)
    4646            return arg;
    47         throw new TypeError(arg, "integer");
     47        throw new ConditionThrowable(new TypeError(arg, "integer"));
    4848    }
    4949
    50     public LispObject execute(LispObject[] args) throws TypeError
     50    public LispObject execute(LispObject[] args) throws ConditionThrowable
    5151    {
    5252        BigInteger result = null;
     
    5959                n = ((Bignum)arg).getValue();
    6060            else
    61                 throw new TypeError(arg, "integer");
     61                throw new ConditionThrowable(new TypeError(arg, "integer"));
    6262            if (result == null)
    6363                result = n;
  • trunk/j/src/org/armedbear/lisp/logior.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logior.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logior.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5151                n1 = ((Bignum)first).getValue();
    5252            else
    53                 throw new TypeError(first, "integer");
     53                throw new ConditionThrowable(new TypeError(first, "integer"));
    5454            if (second instanceof Fixnum)
    5555                n2 = ((Fixnum)second).getBigInteger();
     
    5757                n2 = ((Bignum)second).getValue();
    5858            else
    59                 throw new TypeError(second, "integer");
     59                throw new ConditionThrowable(new TypeError(second, "integer"));
    6060            return number(n1.or(n2));
    6161        }
     
    7171                n = ((Bignum)args[i]).getValue();
    7272            else
    73                 throw new TypeError(args[i], "integer");
     73                throw new ConditionThrowable(new TypeError(args[i], "integer"));
    7474            result = result.or(n);
    7575        }
  • trunk/j/src/org/armedbear/lisp/lognand.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: lognand.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: lognand.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4343                return number(n1.and(n2).not());
    4444            }
    45             throw new TypeError(second, "integer");
     45            throw new ConditionThrowable(new TypeError(second, "integer"));
    4646        }
    4747        if (first instanceof Bignum) {
     
    5555                return number(n1.and(n2).not());
    5656            }
    57             throw new TypeError(second, "integer");
     57            throw new ConditionThrowable(new TypeError(second, "integer"));
    5858        }
    59         throw new TypeError(first, "integer");
     59        throw new ConditionThrowable(new TypeError(first, "integer"));
    6060    }
    6161
  • trunk/j/src/org/armedbear/lisp/lognor.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: lognor.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: lognor.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4343                return number(n1.or(n2).not());
    4444            }
    45             throw new TypeError(second, "integer");
     45            throw new ConditionThrowable(new TypeError(second, "integer"));
    4646        }
    4747        if (first instanceof Bignum) {
     
    5555                return number(n1.or(n2).not());
    5656            }
    57             throw new TypeError(second, "integer");
     57            throw new ConditionThrowable(new TypeError(second, "integer"));
    5858        }
    59         throw new TypeError(first, "integer");
     59        throw new ConditionThrowable(new TypeError(first, "integer"));
    6060    }
    6161
  • trunk/j/src/org/armedbear/lisp/lognot.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: lognot.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: lognot.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3838        if (arg instanceof Bignum)
    3939            return number(((Bignum)arg).getValue().not());
    40         throw new TypeError(arg, "integer");
     40        throw new ConditionThrowable(new TypeError(arg, "integer"));
    4141    }
    4242
  • trunk/j/src/org/armedbear/lisp/logorc1.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logorc1.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logorc1.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4646                return number(n1.not().or(n2));
    4747            }
    48             throw new TypeError(second, "integer");
     48            throw new ConditionThrowable(new TypeError(second, "integer"));
    4949        }
    5050        if (first instanceof Bignum) {
     
    5858                return number(n1.not().or(n2));
    5959            }
    60             throw new TypeError(second, "integer");
     60            throw new ConditionThrowable(new TypeError(second, "integer"));
    6161        }
    62         throw new TypeError(first, "integer");
     62        throw new ConditionThrowable(new TypeError(first, "integer"));
    6363    }
    6464
  • trunk/j/src/org/armedbear/lisp/logorc2.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logorc2.java,v 1.2 2003-09-19 01:46:42 piso Exp $
     5 * $Id: logorc2.java,v 1.3 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4646                return number(n1.or(n2.not()));
    4747            }
    48             throw new TypeError(second, "integer");
     48            throw new ConditionThrowable(new TypeError(second, "integer"));
    4949        }
    5050        if (first instanceof Bignum) {
     
    5858                return number(n1.or(n2.not()));
    5959            }
    60             throw new TypeError(second, "integer");
     60            throw new ConditionThrowable(new TypeError(second, "integer"));
    6161        }
    62         throw new TypeError(first, "integer");
     62        throw new ConditionThrowable(new TypeError(first, "integer"));
    6363    }
    6464
  • trunk/j/src/org/armedbear/lisp/logxor.java

    r3669 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: logxor.java,v 1.1 2003-09-10 16:49:01 piso Exp $
     5 * $Id: logxor.java,v 1.2 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3939    }
    4040
    41     public LispObject execute(LispObject arg) throws TypeError
     41    public LispObject execute(LispObject arg) throws ConditionThrowable
    4242    {
    4343        if (arg instanceof Fixnum)
     
    4545        if (arg instanceof Bignum)
    4646            return arg;
    47         throw new TypeError(arg, "integer");
     47        throw new ConditionThrowable(new TypeError(arg, "integer"));
    4848    }
    4949
    50     public LispObject execute(LispObject[] args) throws TypeError
     50    public LispObject execute(LispObject[] args) throws ConditionThrowable
    5151    {
    5252        BigInteger result = null;
     
    5959                n = ((Bignum)arg).getValue();
    6060            else
    61                 throw new TypeError(arg, "integer");
     61                throw new ConditionThrowable(new TypeError(arg, "integer"));
    6262            if (result == null)
    6363                result = n;
  • trunk/j/src/org/armedbear/lisp/make_array.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: make_array.java,v 1.4 2003-09-19 01:46:42 piso Exp $
     5 * $Id: make_array.java,v 1.5 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    110110                        v.set(i, initialContents.elt(i));
    111111                } else
    112                     throw new TypeError(initialContents, "sequence");
     112                    throw new ConditionThrowable(new TypeError(initialContents, "sequence"));
    113113            }
    114114            if (fillPointer != NIL)
  • trunk/j/src/org/armedbear/lisp/open.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: open.java,v 1.3 2003-09-19 01:46:43 piso Exp $
     5 * $Id: open.java,v 1.4 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4242                namestring = ((Pathname)first).getNamestring();
    4343            else
    44                 throw new TypeError(first, "pathname designator");
     44                throw new ConditionThrowable(new TypeError(first, "pathname designator"));
    4545            boolean binary;
    4646            LispObject elementType = second;
     
    9191                namestring = ((Pathname)first).getNamestring();
    9292            else
    93                 throw new TypeError(first, "pathname designator");
     93                throw new ConditionThrowable(new TypeError(first, "pathname designator"));
    9494            boolean binary;
    9595            LispObject elementType = second;
  • trunk/j/src/org/armedbear/lisp/probe_file.java

    r3883 r3884  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: probe_file.java,v 1.3 2003-09-19 01:46:43 piso Exp $
     5 * $Id: probe_file.java,v 1.4 2003-09-19 11:50:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3737                namestring = ((Pathname)arg).getNamestring();
    3838            else
    39                 throw new TypeError(arg, "pathname designator");
     39                throw new ConditionThrowable(new TypeError(arg, "pathname designator"));
    4040            boolean absolute = false;
    4141            if (System.getProperty("os.name").startsWith("Windows")) {
Note: See TracChangeset for help on using the changeset viewer.