Changeset 5911


Ignore:
Timestamp:
02/24/04 00:48:16 (17 years ago)
Author:
piso
Message:

ARRAY-HAS-FILL-POINTER-P

File:
1 edited

Legend:

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

    r5909 r5911  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Primitives.java,v 1.577 2004-02-24 00:31:45 piso Exp $
     5 * $Id: Primitives.java,v 1.578 2004-02-24 00:48:16 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    199199    // ### array-has-fill-pointer-p
    200200    private static final Primitive1 ARRAY_HAS_FILL_POINTER_P =
    201         new Primitive1("array-has-fill-pointer-p","array")
    202     {
    203         public LispObject execute(LispObject arg) throws ConditionThrowable
    204         {
    205             if (arg instanceof AbstractVector)
    206                 return ((AbstractVector)arg).getFillPointer() >= 0 ? T : NIL;
    207             if (arg instanceof DisplacedArray)
    208                 return ((DisplacedArray)arg).getFillPointer() >= 0 ? T : NIL;
    209             if (arg instanceof AbstractArray)
    210                 return NIL;
    211             signal(new TypeError(arg, "array"));
    212             return NIL;
     201        new Primitive1("array-has-fill-pointer-p", "array")
     202    {
     203        public LispObject execute(LispObject arg) throws ConditionThrowable
     204        {
     205            try {
     206                return ((AbstractArray)arg).hasFillPointer() ? T : NIL;
     207            }
     208            catch (ClassCastException e) {
     209                return signal(new TypeError(arg, Symbol.ARRAY));
     210            }
    213211        }
    214212    };
    215213
    216214    // ### vectorp
    217     private static final Primitive1 VECTORP = new Primitive1("vectorp","object")
     215    private static final Primitive1 VECTORP = new Primitive1("vectorp", "object")
    218216    {
    219217        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    225223    // ### simple-vector-p
    226224    private static final Primitive1 SIMPLE_VECTOR_P =
    227         new Primitive1("simple-vector-p","object")
     225        new Primitive1("simple-vector-p", "object")
    228226    {
    229227        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    235233    // ### bit-vector-p
    236234    private static final Primitive1 BIT_VECTOR_P =
    237         new Primitive1("bit-vector-p","object")
     235        new Primitive1("bit-vector-p", "object")
    238236    {
    239237        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    245243    // ### simple-bit-vector-p
    246244    private static final Primitive1 SIMPLE_BIT_VECTOR_P =
    247         new Primitive1("simple-bit-vector-p","object")
     245        new Primitive1("simple-bit-vector-p", "object")
    248246    {
    249247        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    254252
    255253    // ### eval
    256     private static final Primitive1 EVAL = new Primitive1("eval","form")
     254    private static final Primitive1 EVAL = new Primitive1("eval", "form")
    257255    {
    258256        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    263261
    264262    // ### eq
    265     private static final Primitive2 EQ = new Primitive2("eq","x y")
     263    private static final Primitive2 EQ = new Primitive2("eq", "x y")
    266264    {
    267265        public LispObject execute(LispObject first, LispObject second)
     
    273271
    274272    // ### eql
    275     private static final Primitive2 EQL = new Primitive2("eql","x y")
     273    private static final Primitive2 EQL = new Primitive2("eql", "x y")
    276274    {
    277275        public LispObject execute(LispObject first, LispObject second)
     
    283281
    284282    // ### equal
    285     private static final Primitive2 EQUAL = new Primitive2("equal","x y")
     283    private static final Primitive2 EQUAL = new Primitive2("equal", "x y")
    286284    {
    287285        public LispObject execute(LispObject first, LispObject second)
     
    293291
    294292    // ### equalp
    295     private static final Primitive2 EQUALP = new Primitive2("equalp","x y")
     293    private static final Primitive2 EQUALP = new Primitive2("equalp", "x y")
    296294    {
    297295        public LispObject execute(LispObject first, LispObject second)
     
    303301
    304302    // ### values
    305     private static final Primitive VALUES = new Primitive("values","&rest object")
     303    private static final Primitive VALUES = new Primitive("values", "&rest object")
    306304    {
    307305        public LispObject execute()
     
    331329    // values-list list => element*
    332330    // Returns the elements of the list as multiple values.
    333     private static final Primitive1 VALUES_LIST = new Primitive1("values-list","list")
     331    private static final Primitive1 VALUES_LIST =
     332        new Primitive1("values-list", "list")
    334333    {
    335334        public LispObject execute(LispObject arg) throws ConditionThrowable
Note: See TracChangeset for help on using the changeset viewer.