Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra task words #33

Open
Eszartek opened this issue Nov 17, 2022 · 0 comments
Open

Extra task words #33

Eszartek opened this issue Nov 17, 2022 · 0 comments

Comments

@Eszartek
Copy link

I'm not sure of the usefullness of these words, but it was fun trying to figure them out.

stop-task will stop a running task. It's actually a suspend, as you can restart the task and then the stopped task will continue where it left off. It just takes the task out of the circular task list. ie: mytask stop-task

: stop-task ( t -- ) task-list @ begin 2dup @ = if swap @ swap ! exit then @ dup task-list @ = until ;

.ts works like .s but for a task. If your task has a pause in it to allow the webui to stay responsive, then .ts will show the stack at the pause and print the name of the next word after the pause. If I have multiple pauses, then I usually define empty marker words like : mark1 ; and place this after each pause so that .ts will indicate at which mark it is at, using a different mark word for each pause. ie: mytask .ts

: tdepth ( t -- n ) dup 4 + @ swap 8 +  - cell/ ;  ( current stack depth for a task )
: .ts ( t -- ) dup dup ." <" tdepth 1 - n. ." > " tdepth 0 max for aft dup 4 + @  r@  cells - @ r@ 0= if ."  -> " @ @  >name type else . then then next drop ;

Output example: <4> 2 66 7 1 -> mark1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant