Changeset 10352


Ignore:
Timestamp:
11/04/05 13:42:07 (16 years ago)
Author:
piso
Message:

Cleanup.

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

Legend:

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

    r10342 r10352  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: SimpleCondition.java,v 1.15 2005-11-04 10:59:22 piso Exp $
     5 * $Id: SimpleCondition.java,v 1.16 2005-11-04 13:42:07 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6868    // ### simple-condition-format-control
    6969    private static final Primitive SIMPLE_CONDITION_FORMAT_CONTROL =
    70         new Primitive("simple-condition-format-control", "condition")
     70        new Primitive(Symbol.SIMPLE_CONDITION_FORMAT_CONTROL, "condition")
    7171    {
    7272        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    8585    // ### simple-condition-format-arguments
    8686    private static final Primitive SIMPLE_CONDITION_FORMAT_ARGUMENTS =
    87         new Primitive("simple-condition-format-arguments", "condition")
     87        new Primitive(Symbol.SIMPLE_CONDITION_FORMAT_ARGUMENTS, "condition")
    8888    {
    8989        public LispObject execute(LispObject arg) throws ConditionThrowable
  • trunk/j/src/org/armedbear/lisp/TypeError.java

    r10308 r10352  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: TypeError.java,v 1.34 2005-11-01 09:44:19 piso Exp $
     5 * $Id: TypeError.java,v 1.35 2005-11-04 13:40:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class TypeError extends LispError
    2525{
    26     private String typeString;
    27 
    2826    public TypeError() throws ConditionThrowable
    2927    {
     
    7169        if (datum != null)
    7270            setDatum(datum);
    73         if (expectedType != null) {
     71        if (expectedType != null)
    7472            setExpectedType(expectedType);
    75             this.typeString = expectedType.writeToString();
    76         }
    7773    }
    7874
     
    9288        setDatum(datum);
    9389        setExpectedType(expectedType);
    94     }
    95 
    96     public TypeError(LispObject datum, String typeString)
    97         throws ConditionThrowable
    98     {
    99         super(StandardClass.TYPE_ERROR);
    100         setDatum(datum);
    101         setExpectedType(NIL);
    102         this.typeString = typeString;
    10390    }
    10491
     
    138125                String name = datum != null ? datum.writeToString() : null;
    139126                String type = null;
    140                 if (typeString != null)
    141                     type = typeString;
    142                 else if (expectedType != null)
     127                if (expectedType != null)
    143128                    type = expectedType.writeToString();
    144129                if (type != null) {
  • trunk/j/src/org/armedbear/lisp/assql.java

    r8084 r10352  
    22 * assql.java
    33 *
    4  * Copyright (C) 2003 Peter Graves
    5  * $Id: assql.java,v 1.3 2004-11-03 15:27:24 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: assql.java,v 1.4 2005-11-04 13:38:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3939                    return cons;
    4040            } else if (cons != NIL)
    41                 return signal(new TypeError(cons, "list"));
     41                return signalTypeError(cons, Symbol.LIST);
    4242            alist = alist.cdr();
    4343        }
     
    4545    }
    4646
    47     private static final assql ASSQL = new assql();
     47    private static final Primitive ASSQL = new assql();
    4848}
  • trunk/j/src/org/armedbear/lisp/last.java

    r5114 r10352  
    22 * last.java
    33 *
    4  * Copyright (C) 2003 Peter Graves
    5  * $Id: last.java,v 1.5 2003-12-13 00:58:51 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: last.java,v 1.6 2005-11-04 13:38:40 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2222package org.armedbear.lisp;
    2323
    24 // ### last
    25 // last list &optional n => tail
    26 public final class last extends Primitive {
    27     public last(String name, String arglist)
     24// ### last list &optional n => tail
     25public final class last extends Primitive
     26{
     27    public last()
    2828    {
    29         super(name,arglist);
     29        super("last", "list &optional n");
    3030    }
    3131
     
    7575            return result;
    7676        }
    77         return signal(new TypeError(second, "non-negative integer"));
     77        return signalTypeError(second, Symbol.UNSIGNED_BYTE);
    7878    }
    7979
    80     private static final last LAST = new last("last","list &optional n");
     80    private static final Primitive LAST = new last();
    8181}
  • trunk/j/src/org/armedbear/lisp/logbitp.java

    r8084 r10352  
    22 * logbitp.java
    33 *
    4  * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: logbitp.java,v 1.7 2004-11-03 15:27:24 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: logbitp.java,v 1.8 2005-11-04 13:38:59 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424import java.math.BigInteger;
    2525
    26 // ### logbitp
    27 // logbitp index integer => generalized-boolean
     26// ### logbitp index integer => generalized-boolean
    2827public final class logbitp extends Primitive
    2928{
     
    3837        int index = -1;
    3938        if (first instanceof Fixnum) {
    40             index = ((Fixnum)first).getValue();
     39            index = ((Fixnum)first).value;
    4140        } else if (first instanceof Bignum) {
    4241            // FIXME If the number is really big, we're not checking the right
    4342            // bit...
    44             if (((Bignum)first).getValue().signum() > 0)
     43            if (((Bignum)first).value.signum() > 0)
    4544                index = Integer.MAX_VALUE;
    4645        }
    4746        if (index < 0)
    48             return signal(new TypeError(first, "non-negative integer"));
     47            return signalTypeError(first, Symbol.UNSIGNED_BYTE);
    4948        BigInteger n;
    5049        if (second instanceof Fixnum)
    5150            n = ((Fixnum)second).getBigInteger();
    5251        else if (second instanceof Bignum)
    53             n = ((Bignum)second).getValue();
     52            n = ((Bignum)second).value;
    5453        else
    55             return signal(new TypeError(second, Symbol.INTEGER));
     54            return signalTypeError(second, Symbol.INTEGER);
    5655        // FIXME See above.
    5756        if (index == Integer.MAX_VALUE)
  • trunk/j/src/org/armedbear/lisp/logcount.java

    r8087 r10352  
    22 * logcount.java
    33 *
    4  * Copyright (C) 2003 Peter Graves
    5  * $Id: logcount.java,v 1.4 2004-11-03 15:39:02 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: logcount.java,v 1.5 2005-11-04 13:35:56 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424import java.math.BigInteger;
    2525
    26 // ### logcount
    27 // logcount integer => number-of-on-bits
     26// ### logcount integer => number-of-on-bits
    2827public final class logcount extends Primitive
    2928{
     
    4039            n = ((Fixnum)arg).getBigInteger();
    4140        else if (arg instanceof Bignum)
    42             n = ((Bignum)arg).getValue();
     41            n = ((Bignum)arg).value;
    4342        else
    44             return signal(new TypeError(arg, "integer"));
     43            return signalTypeError(arg, Symbol.INTEGER);
    4544        return new Fixnum(n.bitCount());
    4645    }
    4746
    48     private static final logcount LOGCOUNT = new logcount();
     47    private static final Primitive LOGCOUNT = new logcount();
    4948}
  • trunk/j/src/org/armedbear/lisp/lognor.java

    r8084 r10352  
    22 * lognor.java
    33 *
    4  * Copyright (C) 2003 Peter Graves
    5  * $Id: lognor.java,v 1.6 2004-11-03 15:27:24 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: lognor.java,v 1.7 2005-11-04 13:35:12 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2626public final class lognor extends Primitive
    2727{
    28     private lognor(String name, String arglist)
     28    private lognor()
    2929    {
    30         super(name,arglist);
     30        super("lognor", "integer-1 integer-2");
    3131    }
    3232
     
    4343                return number(n1.or(n2).not());
    4444            }
    45             return signal(new TypeError(second, "integer"));
     45            return signalTypeError(second, Symbol.INTEGER);
    4646        }
    4747        if (first instanceof Bignum) {
     
    5555                return number(n1.or(n2).not());
    5656            }
    57             return signal(new TypeError(second, "integer"));
     57            return signalTypeError(second, Symbol.INTEGER);
    5858        }
    59         return signal(new TypeError(first, "integer"));
     59        return signalTypeError(first, Symbol.INTEGER);
    6060    }
    6161
    62     private static final lognor LOGNOR = new lognor("lognor","integer-1 integer-2");
     62    private static final Primitive LOGNOR = new lognor();
    6363}
  • trunk/j/src/org/armedbear/lisp/logtest.java

    r8084 r10352  
    22 * logtest.java
    33 *
    4  * Copyright (C) 2003 Peter Graves
    5  * $Id: logtest.java,v 1.4 2004-11-03 15:27:24 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: logtest.java,v 1.5 2005-11-04 13:35:47 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424import java.math.BigInteger;
    2525
    26 // ### logtest
    27 // logtest integer-1 integer-2 => generalized-boolean
    28 // (logtest x y) ==  (not (zerop (logand x y)))
     26// ### logtest integer-1 integer-2 => generalized-boolean
     27// (logtest x y) == (not (zerop (logand x y)))
    2928public final class logtest extends Primitive
    3029{
    3130    private logtest()
    3231    {
    33         super("logtest","integer-1 integer-2");
     32        super("logtest", "integer-1 integer-2");
    3433    }
    3534
     
    3837    {
    3938        if (first instanceof Fixnum && second instanceof Fixnum) {
    40             return (((Fixnum)first).getValue() & ((Fixnum)second).getValue()) == 0 ? NIL : T;
     39            return (((Fixnum)first).value & ((Fixnum)second).value) == 0 ? NIL : T;
    4140        } else {
    4241            BigInteger n1, n2;
     
    4645                n1 = ((Bignum)first).getValue();
    4746            else
    48                 return signal(new TypeError(first, "integer"));
     47                return signalTypeError(first, Symbol.INTEGER);
    4948            if (second instanceof Fixnum)
    5049                n2 = ((Fixnum)second).getBigInteger();
     
    5251                n2 = ((Bignum)second).getValue();
    5352            else
    54                 return signal(new TypeError(second, "integer"));
     53                return signalTypeError(second, Symbol.INTEGER);
    5554            return n1.and(n2).signum() == 0 ? NIL : T;
    5655        }
    5756    }
    5857
    59     private static final logtest LOGTEST = new logtest();
     58    private static final Primitive LOGTEST = new logtest();
    6059}
Note: See TracChangeset for help on using the changeset viewer.