Changeset 3902


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

Conditions: work in progress.

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

Legend:

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

    r3895 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ArithmeticError.java,v 1.4 2003-09-19 14:55:06 piso Exp $
     5 * $Id: ArithmeticError.java,v 1.5 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3333    }
    3434
     35    public LispObject typeOf()
     36    {
     37        return Symbol.ARITHMETIC_ERROR;
     38    }
     39
     40    public LispClass classOf()
     41    {
     42        return LispClass.ARITHMETIC_ERROR;
     43    }
     44
    3545    public LispObject typep(LispObject type) throws ConditionThrowable
    3646    {
  • trunk/j/src/org/armedbear/lisp/Condition.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Condition.java,v 1.6 2003-09-19 14:55:06 piso Exp $
     5 * $Id: Condition.java,v 1.7 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5757        return super.typep(type);
    5858    }
     59
     60    public String toString()
     61    {
     62        if (_PRINT_ESCAPE_.symbolValueNoThrow() == NIL) {
     63            String s = getMessage();
     64            if (s != null)
     65                return s;
     66        }
     67        StringBuffer sb = new StringBuffer("#<");
     68        sb.append(typeOf());
     69        sb.append(" @ ");
     70        sb.append(Integer.toHexString(hashCode()));
     71        sb.append(">");
     72        return sb.toString();
     73    }
    5974}
  • trunk/j/src/org/armedbear/lisp/ControlError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ControlError.java,v 1.3 2003-09-19 14:55:06 piso Exp $
     5 * $Id: ControlError.java,v 1.4 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3333    }
    3434
     35    public LispObject typeOf()
     36    {
     37        return Symbol.CONTROL_ERROR;
     38    }
     39
     40    public LispClass classOf()
     41    {
     42        return LispClass.CONTROL_ERROR;
     43    }
     44
    3545    public LispObject typep(LispObject type) throws ConditionThrowable
    3646    {
  • trunk/j/src/org/armedbear/lisp/Lisp.java

    r3894 r3902  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.139 2003-09-19 14:44:10 piso Exp $
     5 * $Id: Lisp.java,v 1.140 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    275275                result = obj.getSymbolValue();
    276276                if (result == null)
    277                     throw new ConditionThrowable(new UnboundVariableException(obj.getName()));
     277                    throw new ConditionThrowable(new UnboundVariable(obj.getName()));
    278278            }
    279279            return result;
     
    283283                LispObject fun = env.lookupFunctional(first);
    284284                if (fun == null)
    285                     throw new ConditionThrowable(new UndefinedFunctionError(first));
     285                    throw new ConditionThrowable(new UndefinedFunction(first));
    286286                switch (fun.getFunctionalType()) {
    287287                    case FTYPE_SPECIAL_OPERATOR: {
     
    759759        } else if (obj instanceof Cons && obj.car() == Symbol.LAMBDA)
    760760            return new Closure(obj.cadr(), obj.cddr(), new Environment());
    761         throw new ConditionThrowable(new UndefinedFunctionError(obj));
     761        throw new ConditionThrowable(new UndefinedFunction(obj));
    762762    }
    763763
  • trunk/j/src/org/armedbear/lisp/LispClass.java

    r3884 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispClass.java,v 1.15 2003-09-19 11:50:18 piso Exp $
     5 * $Id: LispClass.java,v 1.16 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6666
    6767    // We can't call this class T!
    68     public static final LispClass CLASS_T          = addClass(T);
     68    public static final LispClass CLASS_T            = addClass(T);
    6969
    70     public static final LispClass ARRAY            = addClass(Symbol.ARRAY);
    71     public static final LispClass BIGNUM           = addClass(Symbol.BIGNUM);
    72     public static final LispClass BIT_VECTOR       = addClass(Symbol.BIT_VECTOR);
    73     public static final LispClass BUILT_IN_CLASS   = addClass(Symbol.BUILT_IN_CLASS);
    74     public static final LispClass CHARACTER        = addClass(Symbol.CHARACTER);
    75     public static final LispClass CLASS            = addClass(Symbol.CLASS);
    76     public static final LispClass COMPLEX          = addClass(Symbol.COMPLEX);
    77     public static final LispClass CONDITION        = addClass(Symbol.CONDITION);
    78     public static final LispClass CONS             = addClass(Symbol.CONS);
    79     public static final LispClass FIXNUM           = addClass(Symbol.FIXNUM);
    80     public static final LispClass FLOAT            = addClass(Symbol.FLOAT);
    81     public static final LispClass FUNCTION         = addClass(Symbol.FUNCTION);
    82     public static final LispClass HASH_TABLE       = addClass(Symbol.HASH_TABLE);
    83     public static final LispClass INTEGER          = addClass(Symbol.INTEGER);
    84     public static final LispClass LIST             = addClass(Symbol.LIST);
    85     public static final LispClass NULL             = addClass(Symbol.NULL);
    86     public static final LispClass NUMBER           = addClass(Symbol.NUMBER);
    87     public static final LispClass PACKAGE          = addClass(Symbol.PACKAGE);
    88     public static final LispClass PATHNAME         = addClass(Symbol.PATHNAME);
    89     public static final LispClass RANDOM_STATE     = addClass(Symbol.RANDOM_STATE);
    90     public static final LispClass RATIO            = addClass(Symbol.RATIO);
    91     public static final LispClass RATIONAL         = addClass(Symbol.RATIONAL);
    92     public static final LispClass REAL             = addClass(Symbol.REAL);
    93     public static final LispClass SEQUENCE         = addClass(Symbol.SEQUENCE);
    94     public static final LispClass STANDARD_CLASS   = addClass(Symbol.STANDARD_CLASS);
    95     public static final LispClass STANDARD_OBJECT  = addClass(Symbol.STANDARD_OBJECT);
    96     public static final LispClass STREAM           = addClass(Symbol.STREAM);
    97     public static final LispClass STRING           = addClass(Symbol.STRING);
    98     public static final LispClass STRING_STREAM    = addClass(Symbol.STRING_STREAM);
    99     public static final LispClass STRUCTURE_CLASS  = addClass(Symbol.STRUCTURE_CLASS);
    100     public static final LispClass STRUCTURE_OBJECT = addClass(Symbol.STRUCTURE_OBJECT);
    101     public static final LispClass SYMBOL           = addClass(Symbol.SYMBOL);
    102     public static final LispClass TWO_WAY_STREAM   = addClass(Symbol.TWO_WAY_STREAM);
    103     public static final LispClass VECTOR           = addClass(Symbol.VECTOR);
     70    public static final LispClass ARITHMETIC_ERROR   = addClass(Symbol.ARITHMETIC_ERROR);
     71    public static final LispClass ARRAY              = addClass(Symbol.ARRAY);
     72    public static final LispClass BIGNUM             = addClass(Symbol.BIGNUM);
     73    public static final LispClass BIT_VECTOR         = addClass(Symbol.BIT_VECTOR);
     74    public static final LispClass BUILT_IN_CLASS     = addClass(Symbol.BUILT_IN_CLASS);
     75    public static final LispClass CHARACTER          = addClass(Symbol.CHARACTER);
     76    public static final LispClass CLASS              = addClass(Symbol.CLASS);
     77    public static final LispClass COMPLEX            = addClass(Symbol.COMPLEX);
     78    public static final LispClass CONDITION          = addClass(Symbol.CONDITION);
     79    public static final LispClass CONS               = addClass(Symbol.CONS);
     80    public static final LispClass CONTROL_ERROR      = addClass(Symbol.CONTROL_ERROR);
     81    public static final LispClass FIXNUM             = addClass(Symbol.FIXNUM);
     82    public static final LispClass FLOAT              = addClass(Symbol.FLOAT);
     83    public static final LispClass FUNCTION           = addClass(Symbol.FUNCTION);
     84    public static final LispClass HASH_TABLE         = addClass(Symbol.HASH_TABLE);
     85    public static final LispClass INTEGER            = addClass(Symbol.INTEGER);
     86    public static final LispClass LIST               = addClass(Symbol.LIST);
     87    public static final LispClass NULL               = addClass(Symbol.NULL);
     88    public static final LispClass NUMBER             = addClass(Symbol.NUMBER);
     89    public static final LispClass PACKAGE            = addClass(Symbol.PACKAGE);
     90    public static final LispClass PACKAGE_ERROR      = addClass(Symbol.PACKAGE_ERROR);
     91    public static final LispClass PARSE_ERROR        = addClass(Symbol.PARSE_ERROR);
     92    public static final LispClass PATHNAME           = addClass(Symbol.PATHNAME);
     93    public static final LispClass PROGRAM_ERROR      = addClass(Symbol.PROGRAM_ERROR);
     94    public static final LispClass RANDOM_STATE       = addClass(Symbol.RANDOM_STATE);
     95    public static final LispClass RATIO              = addClass(Symbol.RATIO);
     96    public static final LispClass RATIONAL           = addClass(Symbol.RATIONAL);
     97    public static final LispClass REAL               = addClass(Symbol.REAL);
     98    public static final LispClass SEQUENCE           = addClass(Symbol.SEQUENCE);
     99    public static final LispClass SIMPLE_ERROR       = addClass(Symbol.SIMPLE_ERROR);
     100    public static final LispClass STANDARD_CLASS     = addClass(Symbol.STANDARD_CLASS);
     101    public static final LispClass STANDARD_OBJECT    = addClass(Symbol.STANDARD_OBJECT);
     102    public static final LispClass STREAM             = addClass(Symbol.STREAM);
     103    public static final LispClass STREAM_ERROR       = addClass(Symbol.STREAM_ERROR);
     104    public static final LispClass STRING             = addClass(Symbol.STRING);
     105    public static final LispClass STRING_STREAM      = addClass(Symbol.STRING_STREAM);
     106    public static final LispClass STRUCTURE_CLASS    = addClass(Symbol.STRUCTURE_CLASS);
     107    public static final LispClass STRUCTURE_OBJECT   = addClass(Symbol.STRUCTURE_OBJECT);
     108    public static final LispClass SYMBOL             = addClass(Symbol.SYMBOL);
     109    public static final LispClass TWO_WAY_STREAM     = addClass(Symbol.TWO_WAY_STREAM);
     110    public static final LispClass TYPE_ERROR         = addClass(Symbol.TYPE_ERROR);
     111    public static final LispClass UNBOUND_VARIABLE   = addClass(Symbol.UNBOUND_VARIABLE);
     112    public static final LispClass UNDEFINED_FUNCTION = addClass(Symbol.UNDEFINED_FUNCTION);
     113    public static final LispClass VECTOR             = addClass(Symbol.VECTOR);
    104114
    105115    public static LispClass findClass(Symbol symbol)
  • trunk/j/src/org/armedbear/lisp/LispError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispError.java,v 1.4 2003-09-19 14:55:06 piso Exp $
     5 * $Id: LispError.java,v 1.5 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3333    }
    3434
     35    public LispObject typeOf()
     36    {
     37        return Symbol.ERROR;
     38    }
     39
    3540    public LispObject typep(LispObject type) throws ConditionThrowable
    3641    {
  • trunk/j/src/org/armedbear/lisp/PackageError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: PackageError.java,v 1.4 2003-09-19 14:55:06 piso Exp $
     5 * $Id: PackageError.java,v 1.5 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3333    }
    3434
     35    public LispObject typeOf()
     36    {
     37        return Symbol.PACKAGE_ERROR;
     38    }
     39
     40    public LispClass classOf()
     41    {
     42        return LispClass.PACKAGE_ERROR;
     43    }
     44
    3545    public LispObject typep(LispObject type) throws ConditionThrowable
    3646    {
  • trunk/j/src/org/armedbear/lisp/ParseError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ParseError.java,v 1.5 2003-09-19 14:55:06 piso Exp $
     5 * $Id: ParseError.java,v 1.6 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2929    }
    3030
     31    public LispObject typeOf()
     32    {
     33        return Symbol.PARSE_ERROR;
     34    }
     35
     36    public LispClass classOf()
     37    {
     38        return LispClass.PARSE_ERROR;
     39    }
     40
    3141    public LispObject typep(LispObject type) throws ConditionThrowable
    3242    {
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r3894 r3902  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.413 2003-09-19 14:44:10 piso Exp $
     5 * $Id: Primitives.java,v 1.414 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    306306                if (function != null)
    307307                    return function;
    308                 throw new ConditionThrowable(new UndefinedFunctionError(arg));
     308                throw new ConditionThrowable(new UndefinedFunction(arg));
    309309            }
    310310            case SYMBOL_PLIST:                  // ### symbol-plist
     
    17281728                            handler = obj.getSymbolFunction();
    17291729                            if (handler == null)
    1730                                 throw new ConditionThrowable(new UndefinedFunctionError(obj));
     1730                                throw new ConditionThrowable(new UndefinedFunction(obj));
    17311731                        } else
    17321732                            handler = obj;
     
    17941794            return c.getCondition() instanceof StreamError;
    17951795        if (type == Symbol.UNDEFINED_FUNCTION)
    1796             return c.getCondition() instanceof UndefinedFunctionError;
     1796            return c.getCondition() instanceof UndefinedFunction;
    17971797        if (type == Symbol.TYPE_ERROR)
    17981798            return c.getCondition() instanceof TypeError;
     
    22262226            if (fun instanceof Function)
    22272227                return funcall0(fun, LispThread.currentThread());
    2228             throw new ConditionThrowable(new UndefinedFunctionError(arg));
     2228            throw new ConditionThrowable(new UndefinedFunction(arg));
    22292229        }
    22302230        public LispObject execute(LispObject first, LispObject second)
     
    22382238            if (fun instanceof Function)
    22392239                return funcall1(fun, second, LispThread.currentThread());
    2240             throw new ConditionThrowable(new UndefinedFunctionError(first));
     2240            throw new ConditionThrowable(new UndefinedFunction(first));
    22412241        }
    22422242        public LispObject execute(LispObject first, LispObject second,
     
    22512251            if (fun instanceof Function)
    22522252                return funcall2(fun, second, third, LispThread.currentThread());
    2253             throw new ConditionThrowable(new UndefinedFunctionError(first));
     2253            throw new ConditionThrowable(new UndefinedFunction(first));
    22542254        }
    22552255        public LispObject execute(LispObject[] args) throws ConditionThrowable
     
    22732273                }
    22742274            }
    2275             throw new ConditionThrowable(new UndefinedFunctionError(args[0]));
     2275            throw new ConditionThrowable(new UndefinedFunction(args[0]));
    22762276        }
    22772277    };
     
    23452345                fun = fun.getSymbolFunction();
    23462346            if (!(fun instanceof Function))
    2347                 throw new ConditionThrowable(new UndefinedFunctionError(first));
     2347                throw new ConditionThrowable(new UndefinedFunction(first));
    23482348            // Second argument must be a list.
    23492349            LispObject list = checkList(second);
     
    23732373                fun = fun.getSymbolFunction();
    23742374            if (!(fun instanceof Function))
    2375                 throw new ConditionThrowable(new UndefinedFunctionError(first));
     2375                throw new ConditionThrowable(new UndefinedFunction(first));
    23762376            // Remaining arguments must be lists.
    23772377            LispObject list1 = checkList(second);
     
    24062406                fun = fun.getSymbolFunction();
    24072407            if (!(fun instanceof Function))
    2408                 throw new ConditionThrowable(new UndefinedFunctionError(args[0]));
     2408                throw new ConditionThrowable(new UndefinedFunction(args[0]));
    24092409            // Remaining arguments must be lists.
    24102410            int commonLength = -1;
     
    33443344                if (functional instanceof Function)
    33453345                    return functional;
    3346                 throw new ConditionThrowable(new UndefinedFunctionError(arg));
     3346                throw new ConditionThrowable(new UndefinedFunction(arg));
    33473347            }
    33483348            if (arg instanceof Cons) {
     
    33503350                    return new Closure(arg.cadr(), arg.cddr(), env);
    33513351            }
    3352             throw new ConditionThrowable(new UndefinedFunctionError(String.valueOf(arg)));
     3352            throw new ConditionThrowable(new UndefinedFunction(String.valueOf(arg)));
    33533353        }
    33543354    };
     
    35223522                function = obj.getSymbolFunction();
    35233523                if (function == null)
    3524                     throw new ConditionThrowable(new UndefinedFunctionError(obj));
     3524                    throw new ConditionThrowable(new UndefinedFunction(obj));
    35253525            } else if (obj instanceof Function) {
    35263526                function = obj;
     
    44644464                    key = key.getSymbolFunction();
    44654465                if (!(key instanceof Function))
    4466                     throw new ConditionThrowable(new UndefinedFunctionError(args[2]));
     4466                    throw new ConditionThrowable(new UndefinedFunction(args[2]));
    44674467            }
    44684468            LispObject test = args[3];
     
    44764476                    test = test.getSymbolFunction();
    44774477                if (!(test instanceof Function))
    4478                     throw new ConditionThrowable(new UndefinedFunctionError(args[3]));
     4478                    throw new ConditionThrowable(new UndefinedFunction(args[3]));
    44794479            } else if (testNot != NIL) {
    44804480                if (testNot instanceof Symbol)
    44814481                    testNot = testNot.getSymbolFunction();
    44824482                if (!(testNot instanceof Function))
    4483                     throw new ConditionThrowable(new UndefinedFunctionError(args[3]));
     4483                    throw new ConditionThrowable(new UndefinedFunction(args[3]));
    44844484            }
    44854485            if (key == NIL && test == EQL) {
  • trunk/j/src/org/armedbear/lisp/ProgramError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ProgramError.java,v 1.7 2003-09-19 14:55:06 piso Exp $
     5 * $Id: ProgramError.java,v 1.8 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3333    }
    3434
     35    public LispObject typeOf()
     36    {
     37        return Symbol.PROGRAM_ERROR;
     38    }
     39
     40    public LispClass classOf()
     41    {
     42        return LispClass.PROGRAM_ERROR;
     43    }
     44
    3545    public LispObject typep(LispObject type) throws ConditionThrowable
    3646    {
  • trunk/j/src/org/armedbear/lisp/SimpleError.java

    r3888 r3902  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: SimpleError.java,v 1.2 2003-09-19 12:43:59 piso Exp $
     5 * $Id: SimpleError.java,v 1.3 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2222package org.armedbear.lisp;
    2323
    24 public class SimpleError extends Condition
     24public class SimpleError extends LispError
    2525{
    2626    public SimpleError()
     
    3333    }
    3434
     35    public LispObject typeOf()
     36    {
     37        return Symbol.SIMPLE_ERROR;
     38    }
     39
     40    public LispClass classOf()
     41    {
     42        return LispClass.SIMPLE_ERROR;
     43    }
     44
    3545    public LispObject typep(LispObject type) throws ConditionThrowable
    3646    {
    3747        if (type == Symbol.SIMPLE_ERROR)
    3848            return T;
    39         if (type == Symbol.ERROR)
    40             return T;
    4149        return super.typep(type);
    4250    }
  • trunk/j/src/org/armedbear/lisp/StreamError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: StreamError.java,v 1.6 2003-09-19 14:55:06 piso Exp $
     5 * $Id: StreamError.java,v 1.7 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4141    }
    4242
     43    public LispObject typeOf()
     44    {
     45        return Symbol.STREAM_ERROR;
     46    }
     47
     48    public LispClass classOf()
     49    {
     50        return LispClass.STREAM_ERROR;
     51    }
     52
    4353    public LispObject typep(LispObject type) throws ConditionThrowable
    4454    {
  • trunk/j/src/org/armedbear/lisp/Symbol.java

    r3894 r3902  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Symbol.java,v 1.79 2003-09-19 14:44:10 piso Exp $
     5 * $Id: Symbol.java,v 1.80 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    318318    {
    319319        if (function == null)
    320             throw new ConditionThrowable(new UndefinedFunctionError(this));
     320            throw new ConditionThrowable(new UndefinedFunction(this));
    321321        return function;
    322322    }
  • trunk/j/src/org/armedbear/lisp/TypeError.java

    r3895 r3902  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: TypeError.java,v 1.5 2003-09-19 14:55:06 piso Exp $
     5 * $Id: TypeError.java,v 1.6 2003-09-19 16:04:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5050    }
    5151
     52    public LispObject typeOf()
     53    {
     54        return Symbol.TYPE_ERROR;
     55    }
     56
     57    public LispClass classOf()
     58    {
     59        return LispClass.TYPE_ERROR;
     60    }
     61
    5262    public LispObject typep(LispObject type) throws ConditionThrowable
    5363    {
Note: See TracChangeset for help on using the changeset viewer.