oop sorry, I forgot to revert a change.

Should be this one.

require'gl2'

L0=: 50           NB. initial length
A0=: 1r8p1        NB. initial angle: pi divided by 8
dL=: 0.9          NB. shrink factor for length
dA=: 0.75         NB. shrink factor for angle
N=: 14            NB. number of branches

L=: L0*dL^1+i.N  NB. lengths of line segments

NB. relative angles of successive line segments
A=: A0*(dA^i.N) +/\@:*("1) _1 ^ #:i.2 ^ N

NB. end points for each line segment
P=: 0 0+/\@,"2 +.*.inv (L0,0),"2 L,"0"1 A

NB. P_C_paint=: gllines_jgl2_ bind (10 <.@+ ,/"2 P-"1<./,/P)
P_C_paint=: gllines_jgl2_@<.@(10 + ,/"2 P-"1<./,/P)
NB. P_C_paint=: gllines_jgl2_@:<.@(10 + ,/"2 P-"1<./,/P)

wd 0 : 0
pc P closeok;
setp wh 250 300;
cc C isigraph;
set C sizepolicy expanding;
pas 0 0;
pshow;
)

> On 26 Jan 2022, at 1:16 PM, Henry Rich <[email protected]> wrote:
> 
> On my system gllines is
> 
> chkgl2@:('"C:/j903/bin/jqt.dll" gllines >+ i *i i' cd (; #))"1
> 
> for which passing an atom to an argument of type *i would be a domain error.
> 
> Henry Rich
> 
> 
> On 1/26/2022 12:07 AM, bill lam wrote:
>> The issue is that
>> gllines_jgl2_ 01
>> SHOULD raise a domain because incorrect number of parameters. The dll call
>> never executed and shouldn't crash.
>> 
>> On Wed, 26 Jan 2022 at 1:04 PM Henry Rich <[email protected]> wrote:
>> 
>>> gllines_jgl2_@<. 1 2 3.3
>>> 
>>> will execute as
>>> 
>>> gllines_jgl2_ 01
>>> gllines_jgl2_ 2
>>> gllines_jgl2_ 3
>>> 
>>> which is an error.
>>> 
>>> gllines_jgl2_@:<. 1 2 3.3
>>> 
>>> will execute as
>>> 
>>> gllines_jgl2_ 1 2 3
>>> 
>>> which is what was intended.
>>> 
>>> Henry Rich
>>> 
>>> 
>>> 
>>> On 1/26/2022 12:00 AM, bill lam wrote:
>>>> gllines should already checked it received 2 parameters other 15!:0 would
>>>> raise a domain error fir incorrect number of parameters.
>>>> see the prototype of gllines in previous email.
>>>> 
>>>> On Wed, 26 Jan 2022 at 12:57 PM Henry Rich <[email protected]> wrote:
>>>> 
>>>>> gllines was being given one atom at a time, and it couldn't draw any
>>> lines.
>>>>> Henry Rich
>>>>> 
>>>>> On 1/25/2022 11:55 PM, bill lam wrote:
>>>>>> Replace @ with @: worked.
>>>>>> 
>>>>>> Any theory why it crashed with @ ?
>>>>>> 
>>>>>>> On 26 Jan 2022, at 12:19 PM, Henry Rich <[email protected]> wrote:
>>>>>>> 
>>>>>>> P_C_paint=: gllines_jgl2_@<.@(10 + ,/"2 P-"1<./,/P)
>>>>>>> 
>>>>>>> seems wrong: I suggest
>>>>>>> 
>>>>>>> P_C_paint=: gllines_jgl2_@:<.@(10 + ,/"2 P-"1<./,/P)
>>>>>>> 
>>>>>>> Henry Rich
>>>>>>> 
>>>>>>> 
>>>>>>> On 1/25/2022 9:50 PM, bill lam wrote:
>>>>>>>> prototype of gllines is
>>>>>>>> gllines=: chkgl2 @: (('"',libjqt,'" gllines >',(IFWIN#'+'),' i *i i')
>>>>> cd (;#)) "1
>>>>>>>> so that it expected integer array but a floating point data type was
>>>>> fed. JE should either signal a data type error or automatically do the
>>>>> converting, but that is another issue/bug.
>>>>>>>> I changed the line to
>>>>>>>> P_C_paint=: gllines_jgl2_ bind (10 <.@+ ,/"2 P-"1<./,/P)
>>>>>>>> then it work ok.
>>>>>>>> 
>>>>>>>> However, your line still crashed.
>>>>>>>> P_C_paint=: gllines_jgl2_@<.@(10 + ,/"2 P-"1<./,/P)
>>>>>>>> 
>>>>>>>> I suspected it couldn't coerce data to integer but I have no idea
>>>>> what's wrong.
>>>>>>>> 
>>>>>>>>> On 20 Jan 2022, at 11:15 PM, Raul Miller <[email protected]>
>>>>> wrote:
>>>>>>>>> http://www.rosettacode.org/wiki/Fractal_tree#J
>>>>>>>>> 
>>>>>>>>> The J implementation of the rosettacode fractal tree task now
>>> crashes
>>>>>>>>> (OSX Mojave 10.14.6)
>>>>>>>>> 
>>>>>>>>>     JVERSION
>>>>>>>>> Engine: j903/j64/darwin
>>>>>>>>> Release-a: commercial/2021-12-16T15:16:37
>>>>>>>>> Library: 9.03.08
>>>>>>>>> Qt IDE: 1.9.5/5.15.2(5.15.2)
>>>>>>>>> Platform: Darwin 64
>>>>>>>>> Installer: J903 install
>>>>>>>>> InstallPath: /users/rauldmiller/applications/j903
>>>>>>>>> Contact: www.jsoftware.com
>>>>>>>>> 
>>>>>>>>> The xywh wd command and the rightmove and bottommove parameters are
>>> no
>>>>>>>>> longer valid. Simply removing them from the wd command list is
>>>>>>>>> sufficient to cause the crash.
>>>>>>>>> 
>>>>>>>>> Alternatively, an updated wd command list also causes the crash:
>>>>>>>>> 
>>>>>>>>> pc P closeok;
>>>>>>>>> setp wh 250 300;
>>>>>>>>> cc C isigraph;
>>>>>>>>> set C sizepolicy expanding;
>>>>>>>>> pas 0 0;
>>>>>>>>> pshow;
>>>>>>>>> 
>>>>>>>>> The crash happens in the paint event handler (the qt window comes up
>>>>>>>>> fine with P_C_paint=: ]).
>>>>>>>>> 
>>>>>>>>> Simplifying the represented data with N=:2 still produces the crash
>>>>>>>>> 
>>>>>>>>> P_C_paint=: gllines_jgl2_@<.@(10 + ,/"2 P-"1<./,/P)
>>>>>>>>> 
>>>>>>>>> still produces the crash.
>>>>>>>>> 
>>>>>>>>> A stack backtrace looks like this:
>>>>>>>>> 
>>>>>>>>> 0   CoreFoundation                      0x00007fff4f8dfa7d
>>>>>>>>> __exceptionPreprocess + 256
>>>>>>>>> 1   libobjc.A.dylib                     0x00007fff7a10ea17
>>>>>>>>> objc_exception_throw + 48
>>>>>>>>> 2   CoreFoundation                      0x00007fff4f8df8af
>>>>>>>>> +[NSException raise:format:] + 201
>>>>>>>>> 3   AppKit                              0x00007fff4d6fc411
>>>>> _NSRunModal + 156
>>>>>>>>> 4   AppKit                              0x00007fff4d2e5bb8
>>>>>>>>> -[NSApplication runModalSession:] + 241
>>>>>>>>> 5   libqcocoa.dylib                     0x0000000114623ed6
>>>>>>>>> 
>>> _ZN21QCocoaEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE
>>>>>>>>> + 614
>>>>>>>>> 6   QtCore                              0x000000010fd6facf
>>>>>>>>> _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE + 431
>>>>>>>>> 7   QtWidgets                           0x0000000111ddae9e
>>>>>>>>> _ZN7QDialog4execEv + 526
>>>>>>>>> 8   QtWidgets                           0x0000000111e18a72
>>>>>>>>> 
>>> _ZL17showNewMessageBoxP7QWidgetN11QMessageBox4IconERK7QStringS5_6QFlagsINS1_14StandardButtonEES7_
>>>>>>>>> + 354
>>>>>>>>> 9   libjqt.dylib                        0x000000011150247a
>>>>>>>>> 
>>> _Z2mbNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES5_
>>>>>>>>> + 12026
>>>>>>>>> 10  libjqt.dylib                        0x0000000111544c35 _ZL3wd1v
>>> +
>>>>> 10821
>>>>>>>>> 11  libjqt.dylib                        0x000000011154219b wd + 91
>>>>>>>>> 12  libj.dylib                          0x00000001166452b8 stdcalli
>>> +
>>>>> 280
>>>>>>>>> 13  libj.dylib                          0x0000000116636f85 jtcdexec1
>>>>> + 4965
>>>>>>>>> 14  libj.dylib                          0x0000000116634ddc jtcd +
>>> 1164
>>>>>>>>> On a tangentially related note, the links to doc.qt.io embedded in
>>>>>>>>> 
>>> https://code.jsoftware.com/wiki/Guides/Window_Driver/ChildClasses#Styles_and_set_commands_common_to_all_controls
>>>>>>>>> are now invalid.
>>>>>>>>> 
>>>>>>>>> FYI,
>>>>>>>>> 
>>>>>>>>> --
>>>>>>>>> Raul
>>>>>>>>> 
>>> ----------------------------------------------------------------------
>>>>>>>>> For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>>>>>>> For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>>>>>>> --
>>>>>>> This email has been checked for viruses by AVG.
>>>>>>> https://www.avg.com
>>>>>>> 
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>> 
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> 
>>> --
>>> This email has been checked for viruses by AVG.
>>> https://www.avg.com
>>> 
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> 
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> 
> -- 
> This email has been checked for viruses by AVG.
> https://www.avg.com
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to