Changeset 5971


Ignore:
Timestamp:
02/25/04 18:36:12 (17 years ago)
Author:
piso
Message:

Added support for zero rank arrays.

File:
1 edited

Legend:

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

    r5956 r5971  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: make_array.java,v 1.19 2004-02-25 03:10:51 piso Exp $
     5 * $Id: make_array.java,v 1.20 2004-02-25 18:36:12 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4747        if (initialElementProvided != NIL && initialContents != NIL) {
    4848            return signal(new LispError("MAKE-ARRAY: cannot specify both " +
    49                                         ":INITIAL-ELEMENT AND :INITIAL-CONTENTS"));
     49                                        "initial element and initial contents."));
    5050        }
    5151        final int rank = dimensions.listp() ? dimensions.length() : 1;
     
    6464            final AbstractArray array = checkArray(displacedTo);
    6565            if (initialElementProvided != NIL)
    66                 return signal(new LispError(":INITIAL-ELEMENT must not be specified with :DISPLACED-TO"));
     66                return signal(new LispError("Initial element must not be specified for a displaced array."));
    6767            if (initialContents != NIL)
    68                 return signal(new LispError(":INITIAL-CONTENTS must not be specified with :DISPLACED-TO"));
     68                return signal(new LispError("Initial contents must not be specified for a displaced array."));
    6969            final int displacement;
    7070            if (displacedIndexOffset != NIL)
     
    9494                displacedArray.setFillPointer(fillPointer);
    9595            return displacedArray;
     96        }
     97        if (rank == 0) {
     98            LispObject data;
     99            if (initialElementProvided != NIL)
     100                data = initialElement;
     101            else
     102                data = initialContents;
     103            return new ZeroRankArray(getUpgradedArrayElementType(elementType),
     104                                     data, adjustable != NIL);
    96105        }
    97106        if (rank == 1) {
Note: See TracChangeset for help on using the changeset viewer.