Changeset 5270


Ignore:
Timestamp:
12/27/03 17:01:38 (17 years ago)
Author:
piso
Message:

ARRAY-HAS-FILL-POINTER-P
FILL-POINTER

File:
1 edited

Legend:

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

    r5268 r5270  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.545 2003-12-27 15:53:55 piso Exp $
     5 * $Id: Primitives.java,v 1.546 2003-12-27 17:01:38 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    204204            if (arg instanceof AbstractVector)
    205205                return ((AbstractVector)arg).getFillPointer() >= 0 ? T : NIL;
     206            if (arg instanceof DisplacedArray)
     207                return ((DisplacedArray)arg).getFillPointer() >= 0 ? T : NIL;
    206208            if (arg instanceof AbstractArray)
    207209                return NIL;
     
    18851887    // ### fill-pointer
    18861888    private static final Primitive1 FILL_POINTER =
    1887         new Primitive1("fill-pointer","vector") {
     1889        new Primitive1("fill-pointer", "vector")
     1890    {
    18881891        public LispObject execute(LispObject arg)
    18891892            throws ConditionThrowable
    18901893        {
    1891             int fillPointer = checkVector(arg).getFillPointer();
    1892             if (fillPointer < 0)
    1893                 signal(new TypeError("array does not have a fill pointer"));
    1894             return new Fixnum(fillPointer);
     1894            int fillPointer = -1;
     1895            if (arg instanceof AbstractVector)
     1896                fillPointer = ((AbstractVector)arg).getFillPointer();
     1897            else if (arg instanceof DisplacedArray)
     1898                fillPointer = ((DisplacedArray)arg).getFillPointer();
     1899            if (fillPointer >= 0)
     1900                return new Fixnum(fillPointer);
     1901            if (arg instanceof AbstractArray)
     1902                return signal(new TypeError("Array does not have a fill pointer."));
     1903            else
     1904                return signal(new TypeError(arg, Symbol.ARRAY));
    18951905        }
    18961906    };
Note: See TracChangeset for help on using the changeset viewer.