Login  Register

Re: Issue on newArray macro function

Posted by Wayne Rasband-2 on Jan 17, 2018; 10:25pm
URL: http://imagej.273.s1.nabble.com/Issue-on-newArray-macro-function-tp5019886p5019905.html

> On Jan 17, 2018, at 3:30 AM, Jan Eglinger <[hidden email]> wrote:
>
> Hi Wayne,
>
> On 16.01.2018 21:20, Wayne Rasband wrote:
>> Your proposed fix for this bug is in the latest daily build (1.51u12).
>
> This bug is not limited to expressions with +,-,* or /
>
> For example, while the following works:
>
>    a = newArray(2, acos(0.2), log(2));
>
> these other lines throw exceptions:
>
>    a = newArray(acos(0.2), log(2), 2);
>    a = newArray(log(2), 2, acos(0.2));

This bug is fixed in today’s daily build (1.51u16).

-wayne

>
>>> Which means that is there is something else than "," after the first element
>>> it interprets the code as being a newArray(size).
>>>
>>> I guess the fix for this issue would be to replace the line
>>>
>>> if (next==STRING_CONSTANT || nextNext==','
>>>
>>>        || nextNext=='[' || next=='-' || next==PI)
>>>
>>>            return initNewArray();
>>>
>>> With
>>>
>>> if (next==STRING_CONSTANT || nextNext==',' || next==PI
>>>
>>>        || nextNext=='[' || next=='+' || next=='-' || next=='*' ||
>>> next=='/')
>>>
>>>            return initNewArray();
>>>
>>> Within the "Variable[] newArray" method in the " ij.macro. Functions.java"
>>> file.
>>>
>>> My best regards,
>>>
>>> Philippe

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html