Changeset 5972


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

Zero rank arrays.

File:
1 edited

Legend:

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

    r5957 r5972  
    33 *
    44 * Copyright (C) 2004 Peter Graves
    5  * $Id: adjust_array.java,v 1.9 2004-02-25 13:50:54 piso Exp $
     5 * $Id: adjust_array.java,v 1.10 2004-02-25 18:37:26 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2323
    2424// ### %adjust-array array new-dimensions element-type initial-element
    25 // initial-element-p initial-contents fill-pointer displaced-to displaced-index-offset
    26 // => new-array
     25// initial-element-p initial-contents initial-contents-p fill-pointer
     26// displaced-to displaced-index-offset => new-array
    2727public final class adjust_array extends Primitive
    2828{
     
    3434    public LispObject execute(LispObject[] args) throws ConditionThrowable
    3535    {
    36         if (args.length != 9)
     36        if (args.length != 10)
    3737            return signal(new WrongNumberOfArgumentsException(this));
    3838        AbstractArray array = checkArray(args[0]);
     
    4242        LispObject initialElementProvided = args[4];
    4343        LispObject initialContents = args[5];
    44         LispObject fillPointer = args[6];
    45         LispObject displacedTo = args[7];
    46         LispObject displacedIndexOffset = args[8];
     44        LispObject initialContentsProvided = args[6];
     45        LispObject fillPointer = args[7];
     46        LispObject displacedTo = args[8];
     47        LispObject displacedIndexOffset = args[9];
    4748        if (initialElementProvided != NIL && initialContents != NIL) {
    4849            return signal(new LispError("ADJUST-ARRAY: cannot specify both initial element and initial contents."));
     
    5253        {
    5354            return signal(new LispError("ADJUST-ARRAY: incompatible element type."));
     55        }
     56        if (array.getRank() == 0) {
     57            if (initialContentsProvided != NIL)
     58                array.setRowMajor(0, initialContents);
     59            return array;
    5460        }
    5561        if (array.getRank() == 1) {
Note: See TracChangeset for help on using the changeset viewer.