Changeset 5852


Ignore:
Timestamp:
02/16/04 12:41:20 (17 years ago)
Author:
piso
Message:

CODE-CHAR

File:
1 edited

Legend:

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

    r5568 r5852  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: LispCharacter.java,v 1.35 2004-01-26 20:01:41 piso Exp $
     5 * $Id: LispCharacter.java,v 1.36 2004-02-16 12:41:20 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public final class LispCharacter extends LispObject
    2525{
    26     private static final LispCharacter[] characters = new LispCharacter[128];
     26    private static final LispCharacter[] characters = new LispCharacter[CHAR_MAX];
    2727
    2828    static {
     
    234234        public LispObject execute(LispObject arg) throws ConditionThrowable
    235235        {
    236             if (arg instanceof Fixnum) {
    237                 int n = Fixnum.getValue(arg);
    238                 if (n < 128)
     236            try {
     237                int n = ((Fixnum)arg).getValue();
     238                if (n < CHAR_MAX)
    239239                    return characters[n];
    240240            }
     241            catch (ClassCastException e) {
     242                ; // SBCL signals a type error here: "not of type (UNSIGNED-BYTE 8)".
     243            }
    241244            return NIL;
    242245        }
     
    244247
    245248    // ### characterp
    246     private static final Primitive1 CHARACTERP = new Primitive1("characterp", "object")
     249    private static final Primitive1 CHARACTERP =
     250        new Primitive1("characterp", "object")
    247251    {
    248252        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    253257
    254258    // ### both-case-p
    255     private static final Primitive1 BOTH_CASE_P = new Primitive1("both-case-p", "character")
     259    private static final Primitive1 BOTH_CASE_P =
     260        new Primitive1("both-case-p", "character")
    256261    {
    257262        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    265270
    266271    // ### lower-case-p
    267     private static final Primitive1 LOWER_CASE_P = new Primitive1("lower-case-p", "character")
     272    private static final Primitive1 LOWER_CASE_P =
     273        new Primitive1("lower-case-p", "character")
    268274    {
    269275        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    274280
    275281    // ### upper-case-p
    276     private static final Primitive1 UPPER_CASE_P = new Primitive1("upper-case-p", "character")
     282    private static final Primitive1 UPPER_CASE_P =
     283        new Primitive1("upper-case-p", "character")
    277284    {
    278285        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    283290
    284291    // ### char-downcase
    285     private static final Primitive1 CHAR_DOWNCASE = new Primitive1("char-downcase","character")
     292    private static final Primitive1 CHAR_DOWNCASE =
     293        new Primitive1("char-downcase", "character")
    286294    {
    287295        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    292300
    293301    // ### char-upcase
    294     private static final Primitive1 CHAR_UPCASE = new Primitive1("char-upcase","character")
     302    private static final Primitive1 CHAR_UPCASE =
     303        new Primitive1("char-upcase", "character")
    295304    {
    296305        public LispObject execute(LispObject arg) throws ConditionThrowable
Note: See TracChangeset for help on using the changeset viewer.