Login  Register

Re: Issue on newArray macro function

Posted by Jan Eglinger on Jan 17, 2018; 8:30am
URL: http://imagej.273.s1.nabble.com/Issue-on-newArray-macro-function-tp5019886p5019895.html

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));

Jan



>
>> 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
>

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