Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pass in Gforth on a Rpi

105 views
Skip to first unread message

jo...@planet.nl

unread,
May 8, 2018, 8:32:22 AM5/8/18
to
Hi,

It occurs when test2 is executed.

needs unix/pthread.fs

: Test1 ( -) \ No problem
0 here 2 stacksize4 NewTask4 pass 2drop ;

: Test2 ( -) \ In gforth-0.7.9_20180503 I got:
7 0 \ uncaught exception: Invalid memory address
do i 0 2 stacksize4 NewTask4 pass 2drop
loop ;

\s Jos

NN

unread,
May 9, 2018, 9:59:32 AM5/9/18
to
I have no idea what args NewTask4 needs, my guess is ...

In test1, here is an address passed as arg3
In test2, you are passing NIL
perhaps you could try "0 here i cells +" instead of "i 0" and see if that works.

jo...@planet.nl

unread,
May 9, 2018, 12:56:54 PM5/9/18
to
Hi,

I was a bit confused when the message was written.
Here is what I think happens:
stacksize4 and NewTask4 are needed to prepare a for new task.

The involved stack notations are:

stacksize4 ( -- dsize fsize rsize lsize )
newtask4 ( dsize rsize fsize lsize -- task )
pass ( x1 .. xn n task -- )

At pass the needed parameters are used and the
remainder of the complete word is executed in a new task
That task also executes loop so it crashes since there was no DO
in the new task.

The initial task exists at pass. Not sure if that is OK for the do...loop.
It is possible to pass an index to a secondary task by using an extra definition.

I wonder if there is a better way.

Jos

NN

unread,
May 9, 2018, 7:41:37 PM5/9/18
to
In pass what is the type of x1..xn are they integers or addresses/xts ?

jo...@planet.nl

unread,
May 10, 2018, 3:14:20 AM5/10/18
to
Op donderdag 10 mei 2018 01:41:37 UTC+2 schreef NN:
Hi,

They are just numbers. For pass it does not matter if they are integers or addresses/xts.

Jos
0 new messages