Changeset 3888


Ignore:
Timestamp:
09/19/03 12:43:59 (19 years ago)
Author:
piso
Message:

Conditions: work in progress.

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

Legend:

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

    r3580 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ArithmeticError.java,v 1.2 2003-09-04 14:55:51 piso Exp $
     5 * $Id: ArithmeticError.java,v 1.3 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2222package org.armedbear.lisp;
    2323
    24 public class ArithmeticError extends LispError
     24public class ArithmeticError extends Condition
    2525{
    2626    public ArithmeticError()
     
    3232        super(message);
    3333    }
     34
     35    public LispObject typep(LispObject type) throws ConditionThrowable
     36    {
     37        if (type == Symbol.ARITHMETIC_ERROR)
     38            return T;
     39        if (type == Symbol.ERROR)
     40            return T;
     41        return super.typep(type);
     42    }
    3443}
  • trunk/j/src/org/armedbear/lisp/Condition.java

    r3883 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Condition.java,v 1.4 2003-09-19 01:46:40 piso Exp $
     5 * $Id: Condition.java,v 1.5 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class Condition extends LispObject
    2525{
     26    private String message;
     27
     28    public Condition()
     29    {
     30    }
     31
     32    public Condition(String message)
     33    {
     34        this.message = message;
     35    }
     36
    2637    public LispObject typeOf()
    2738    {
  • trunk/j/src/org/armedbear/lisp/Fixnum.java

    r3884 r3888  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Fixnum.java,v 1.71 2003-09-19 11:50:18 piso Exp $
     5 * $Id: Fixnum.java,v 1.72 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    344344        catch (ArithmeticException e) {
    345345            if (obj.zerop())
    346                 throw new DivisionByZero();
    347             throw new ArithmeticError(e.getMessage());
     346                throw new ConditionThrowable(new DivisionByZero());
     347            throw new ConditionThrowable(new ArithmeticError(e.getMessage()));
    348348        }
    349349    }
  • trunk/j/src/org/armedbear/lisp/Lisp.java

    r3886 r3888  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.137 2003-09-19 12:20:34 piso Exp $
     5 * $Id: Lisp.java,v 1.138 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    564564    {
    565565        if (denominator.signum() == 0)
    566             throw new DivisionByZero();
     566            throw new ConditionThrowable(new DivisionByZero());
    567567        if (denominator.signum() < 0) {
    568568            numerator = numerator.negate();
  • trunk/j/src/org/armedbear/lisp/LispFloat.java

    r3884 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispFloat.java,v 1.46 2003-09-19 11:50:18 piso Exp $
     5 * $Id: LispFloat.java,v 1.47 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    223223    {
    224224        if (obj.zerop())
    225             throw new DivisionByZero();
     225            throw new ConditionThrowable(new DivisionByZero());
    226226        if (obj instanceof LispFloat)
    227227            return new LispFloat(value / ((LispFloat)obj).value);
  • trunk/j/src/org/armedbear/lisp/PackageError.java

    r3886 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: PackageError.java,v 1.2 2003-09-19 12:20:34 piso Exp $
     5 * $Id: PackageError.java,v 1.3 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class PackageError extends Condition
    2525{
    26     private String message;
    27 
    2826    public PackageError()
    2927    {
     
    3230    public PackageError(String message)
    3331    {
    34         this.message = message;
     32        super(message);
    3533    }
    3634
  • trunk/j/src/org/armedbear/lisp/ParseError.java

    r3885 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ParseError.java,v 1.3 2003-09-19 12:10:27 piso Exp $
     5 * $Id: ParseError.java,v 1.4 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class ParseError extends Condition
    2525{
    26     private String message;
    27 
    2826    public ParseError(String message)
    2927    {
    30         this.message = message;
     28        super(message);
    3129    }
    3230
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r3887 r3888  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.409 2003-09-19 12:32:13 piso Exp $
     5 * $Id: Primitives.java,v 1.410 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    11581158                    throw new ConditionThrowable(new TypeError(_format(args, 1)));
    11591159                // Default.
    1160                 throw new SimpleError(((Symbol)datum).getName());
    1161             }
    1162             throw new SimpleError(_format(args));
     1160                throw new ConditionThrowable(new SimpleError(((Symbol)datum).getName()));
     1161            }
     1162            throw new ConditionThrowable(new SimpleError(_format(args)));
    11631163        }
    11641164    };
     
    18061806            return c instanceof ControlError;
    18071807        if (type == Symbol.SIMPLE_ERROR)
    1808             return c instanceof SimpleError;
     1808            return c.getCondition() instanceof SimpleError;
    18091809        if (type == Symbol.ERROR) {
    18101810            if (c instanceof LispError)
     
    18181818            return c instanceof SimpleCondition;
    18191819        if (type == Symbol.DIVISION_BY_ZERO)
    1820             return c instanceof DivisionByZero;
     1820            return c.getCondition() instanceof DivisionByZero;
    18211821        if (type == Symbol.ARITHMETIC_ERROR)
    1822             return c instanceof ArithmeticError;
     1822            return c.getCondition() instanceof ArithmeticError;
    18231823
    18241824        return false;
  • trunk/j/src/org/armedbear/lisp/ProgramError.java

    r3885 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: ProgramError.java,v 1.5 2003-09-19 12:10:28 piso Exp $
     5 * $Id: ProgramError.java,v 1.6 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class ProgramError extends Condition
    2525{
    26     private String message;
    27 
    2826    public ProgramError()
    2927    {
     
    3230    public ProgramError(String message)
    3331    {
    34         this.message = message;
     32        super(message);
    3533    }
    3634
  • trunk/j/src/org/armedbear/lisp/Ratio.java

    r3884 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Ratio.java,v 1.34 2003-09-19 11:50:19 piso Exp $
     5 * $Id: Ratio.java,v 1.35 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    261261        if (obj instanceof LispFloat) {
    262262            if (obj.zerop())
    263                 throw new DivisionByZero();
     263                throw new ConditionThrowable(new DivisionByZero());
    264264            return new LispFloat(floatValue() / ((LispFloat)obj).getValue());
    265265        }
  • trunk/j/src/org/armedbear/lisp/SimpleError.java

    r994 r3888  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: SimpleError.java,v 1.1 2003-03-03 02:12:58 piso Exp $
     5 * $Id: SimpleError.java,v 1.2 2003-09-19 12:43:59 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 LispError
     24public class SimpleError extends Condition
    2525{
    2626    public SimpleError()
    2727    {
    28         super();
    2928    }
    3029
     
    3332        super(message);
    3433    }
     34
     35    public LispObject typep(LispObject type) throws ConditionThrowable
     36    {
     37        if (type == Symbol.SIMPLE_ERROR)
     38            return T;
     39        if (type == Symbol.ERROR)
     40            return T;
     41        return super.typep(type);
     42    }
    3543}
  • trunk/j/src/org/armedbear/lisp/StreamError.java

    r3887 r3888  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: StreamError.java,v 1.4 2003-09-19 12:32:14 piso Exp $
     5 * $Id: StreamError.java,v 1.5 2003-09-19 12:43:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class StreamError extends Condition
    2525{
    26     private String message;
    2726    private Throwable cause;
    2827
     
    3332    public StreamError(String message)
    3433    {
    35         this.message = message;
     34        super(message);
    3635    }
    3736
Note: See TracChangeset for help on using the changeset viewer.