add sub-stack comments for a couple of words

FossilOrigin-Name: d47690614c26e3515ab85f5d66ab3afd8da9ec6fa5debe1652d1cd6ae4a4c2e9
This commit is contained in:
crc 2021-06-22 12:35:19 +00:00
parent 84ef7119e8
commit 67855948b9
6 changed files with 27 additions and 27 deletions

View file

@ -34,13 +34,13 @@ Execute the quotation if the flag is `FALSE`.
-if; D: fq- A: - F: -
Execute the quotation if the flag is `FALSE`. If false, also exit the word.
/ D: nm-q A: - F: -
/ D: nm-v A: - F: -
Divide `n` by `m` and return the integer part of the quotient.
// D: - A: - F: -
"Ignore any tokens remaining on the current line. Works with files and the interactive ""listener""."
/mod D: nm-rq A: - F: -
/mod D: nm-rv A: - F: -
Divide `n` by `m` and return the integer part of the quotient and remainder.
0; D: n-n || n- A: - F: -
@ -1366,7 +1366,7 @@ Process token as a bytecode.
sigil:| D: s- A: - F: -
POSTPONE equivalent.
sip D: nq-n A: - F: -
sip D: nq(?n-?)-n A: - F: -
Run quote. After execution completes, put a copy of n back on top of the stack.
socket:accept D: n-nn A: - F: -
@ -1546,7 +1546,7 @@ Runs another application using the system shell and returns after execution is c
unix:wait D: -n A: - F: -
Waits for a child process to complete. This maps to the wait() system call.
until D: q- A: - F: -
until D: q(-f)- A: - F: -
Execute quote repeatedly while the quote returns a value of `FALSE`. The quote should return a flag of either `TRUE` or `FALSE`, though `until` will treat any non-zero value as `TRUE`.
v:dec D: a- A: - F: -
@ -1582,7 +1582,7 @@ Create a variable. The variable is initialized to 0.
var-n D: ns- A: - F: -
Create a variable with the specified initial value.
while D: q- A: - F: -
while D: q(-f)- A: - F: -
Execute quote repeatedly while the quote returns a `TRUE` value. The quote should return a flag of either `TRUE` or `FALSE`, though `while` will treat any non-zero value as `TRUE`.
xor D: mn-o A: - F: -

View file

@ -10,9 +10,9 @@ $ D: -c A: - F: -
-eq? D: nn-f A: - F: -
-if D: fq- A: - F: -
-if; D: fq- A: - F: -
/ D: nm-q A: - F: -
/ D: nm-v A: - F: -
// D: - A: - F: -
/mod D: nm-rq A: - F: -
/mod D: nm-rv A: - F: -
0; D: n-n || n- A: - F: -
; D: - A: - F: -
?dup D: n-nn || n-n A: - F: -
@ -454,7 +454,7 @@ sigil:\ D: s- A: - F: -
sigil:^ D: s- A: - F: -
sigil:` D: s- A: - F: -
sigil:| D: s- A: - F: -
sip D: nq-n A: - F: -
sip D: nq(?n-?)-n A: - F: -
socket:accept D: n-nn A: - F: -
socket:bind D: sn-nn A: - F: -
socket:close D: n- A: - F: -
@ -514,7 +514,7 @@ unix:sleep D: n- A: - F: -
unix:slurp-pipe D: as-n A: - F: -
unix:system D: s- A: - F: -
unix:wait D: -n A: - F: -
until D: q- A: - F: -
until D: q(-f)- A: - F: -
v:dec D: a- A: - F: -
v:dec-by D: na- A: - F: -
v:inc D: a- A: - F: -
@ -526,7 +526,7 @@ v:preserve D: aq- A: - F: -
v:update D: aq- A: - F: -
var D: s- A: - F: -
var-n D: ns- A: - F: -
while D: q- A: - F: -
while D: q(-f)- A: - F: -
xor D: mn-o A: - F: -
{ D: - A: - F: -
{{ D: - A: - F: -

View file

@ -105,7 +105,7 @@
<p>Execute the quotation if the flag is `FALSE`. If false, also exit the word.</p>
<table><tr><td><b>Class:</b> </td><td>class:word</td></tr><tr><td><b>Namespace:</b> </td><td>global</td></tr><tr><td><b>Interface Layer:</b> </td><td>all</td></tr></table><hr/>
<h2>/</h2>
<div style='margin-left: 1em;'><p><b>Data:</b> nm-q<br>
<div style='margin-left: 1em;'><p><b>Data:</b> nm-v<br>
<b>Addr:</b> -<br>
<b>Float:</b> -</p>
</div>
@ -119,7 +119,7 @@
<p>"Ignore any tokens remaining on the current line. Works with files and the interactive ""listener""."</p>
<table><tr><td><b>Class:</b> </td><td>class:word</td></tr><tr><td><b>Namespace:</b> </td><td>global</td></tr><tr><td><b>Interface Layer:</b> </td><td>rre</td></tr></table><hr/>
<h2>/mod</h2>
<div style='margin-left: 1em;'><p><b>Data:</b> nm-rq<br>
<div style='margin-left: 1em;'><p><b>Data:</b> nm-rv<br>
<b>Addr:</b> -<br>
<b>Float:</b> -</p>
</div>
@ -3498,7 +3498,7 @@
<table><tr><td><b>Class:</b> </td><td>class:macro</td></tr><tr><td><b>Namespace:</b> </td><td>sigil</td></tr><tr><td><b>Interface Layer:</b> </td><td>all</td></tr></table><hr/>
<h2>sip</h2>
<div style='margin-left: 1em;'><p><b>Data:</b> nq-n<br>
<div style='margin-left: 1em;'><p><b>Data:</b> nq(?n-?)-n<br>
<b>Addr:</b> -<br>
<b>Float:</b> -</p>
</div>
@ -3963,7 +3963,7 @@
<p>Waits for a child process to complete. This maps to the wait() system call.</p>
<table><tr><td><b>Class:</b> </td><td>class:word</td></tr><tr><td><b>Namespace:</b> </td><td>unix</td></tr><tr><td><b>Interface Layer:</b> </td><td>rre</td></tr></table><hr/>
<h2>until</h2>
<div style='margin-left: 1em;'><p><b>Data:</b> q-<br>
<div style='margin-left: 1em;'><p><b>Data:</b> q(-f)-<br>
<b>Addr:</b> -<br>
<b>Float:</b> -</p>
</div>
@ -4060,7 +4060,7 @@
</p>
<hr/>
<h2>while</h2>
<div style='margin-left: 1em;'><p><b>Data:</b> q-<br>
<div style='margin-left: 1em;'><p><b>Data:</b> q(-f)-<br>
<b>Addr:</b> -<br>
<b>Float:</b> -</p>
</div>

View file

@ -159,7 +159,7 @@ Class: class:word | Namespace: global | Interface Layer: all
/
Data: nm-q
Data: nm-v
Addr: -
Float: -
@ -181,7 +181,7 @@ Class: class:word | Namespace: global | Interface Layer: rre
/mod
Data: nm-rq
Data: nm-rv
Addr: -
Float: -
@ -5371,7 +5371,7 @@ Class: class:macro | Namespace: sigil | Interface Layer: all
sip
Data: nq-n
Data: nq(?n-?)-n
Addr: -
Float: -
@ -6086,7 +6086,7 @@ Class: class:word | Namespace: unix | Interface Layer: rre
until
Data: q-
Data: q(-f)-
Addr: -
Float: -
@ -6234,7 +6234,7 @@ Example #1:
while
Data: q-
Data: q(-f)-
Addr: -
Float: -

View file

@ -10,9 +10,9 @@ $ -c - - Return ASCII:NUL (0). class:macro {n/a} {n/a} global all
-eq? nn-f - - Compare two values for inequality. Returns `TRUE` if they are not equal or `FALSE` otherwise. class:primitive #1 #2 -eq?\n $a $b -eq? {n/a} global all
-if fq- - - Execute the quotation if the flag is `FALSE`. class:word {n/a} {n/a} global all
-if; fq- - - Execute the quotation if the flag is `FALSE`. If false, also exit the word. class:word {n/a} {n/a} global all
/ nm-q - - Divide `n` by `m` and return the integer part of the quotient. class:word {n/a} {n/a} global all
/ nm-v - - Divide `n` by `m` and return the integer part of the quotient. class:word {n/a} {n/a} global all
// - - - "Ignore any tokens remaining on the current line. Works with files and the interactive ""listener""." class:word {n/a} {n/a} global rre
/mod nm-rq - - Divide `n` by `m` and return the integer part of the quotient and remainder. class:primitive {n/a} {n/a} global all
/mod nm-rv - - Divide `n` by `m` and return the integer part of the quotient and remainder. class:primitive {n/a} {n/a} global all
0; n-n || n- - - If `n` is zero, drop `n` and exit the current word. If non-zero, leave `n` alone and allow execution to continue. class:macro {n/a} {n/a} global all
; - - - End the current definition. class:macro {n/a} {n/a} global all
?dup n-nn || n-n - - Duplicate top value on stack if not zero. If zero, do nothing. class:word #1 ?dup\n #0 ?dup {n/a} global all
@ -454,7 +454,7 @@ sigil:\ s- - - Process token as an instruction bundle. Discard the string. Assem
sigil:^ s- - - Process token as a function reference. Discard the string. Comma the XT of the word into the current definition. class:macro {n/a} {n/a} sigil all
sigil:` s- - - Process token as a bytecode. Discard the string. Convert the string to a number and use `,` to inline it into the current definition. class:macro {n/a} {n/a} sigil all
sigil:| s- - - POSTPONE equivalent. Discard the string. Convert the string to a number and use `,` to inline it into the current definition. class:macro {n/a} {n/a} sigil all
sip nq-n - - Run quote. After execution completes, put a copy of n back on top of the stack. class:word {n/a} {n/a} global all
sip nq(?n-?)-n - - Run quote. After execution completes, put a copy of n back on top of the stack. class:word {n/a} {n/a} global all
socket:accept n-nn - - Begin accepting connections. Returns a new socket and an error code. class:word {n/a} {n/a} socket rre
socket:bind sn-nn - - Bind a socket to a port. The port should be a string. Returns 0 if successful or -1 otherwise and an error code. class:word {n/a} {n/a} socket rre
socket:close n- - - Close a socket. class:word {n/a} {n/a} socket rre
@ -514,7 +514,7 @@ unix:sleep n- - - Sleep for the specified number of seconds. class:word {n/a}
unix:slurp-pipe as-n - - Open a pipe. Read all output from the pipe (until ASCII:NULL) and store in the specified buffer. Return the number of bytes read. class:word {n/a} {n/a} unix rre
unix:system s- - - Runs another application using the system shell and returns after execution is completed. class:word 'ls_-lh_/etc unix:system {n/a} unix rre
unix:wait -n - - Waits for a child process to complete. This maps to the wait() system call. class:word {n/a} {n/a} unix rre
until q- - - Execute quote repeatedly while the quote returns a value of `FALSE`. The quote should return a flag of either `TRUE` or `FALSE`, though `until` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:zero? ] until {n/a} global all
until q(-f)- - - Execute quote repeatedly while the quote returns a value of `FALSE`. The quote should return a flag of either `TRUE` or `FALSE`, though `until` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:zero? ] until {n/a} global all
v:dec a- - - Decrement the value stored at the specified address by 1. class:word {n/a} {n/a} v all
v:dec-by na- - - Decrement the value stored at the specified address by the specified value. class:word {n/a} {n/a} v all
v:inc a- - - Increment the value stored at the specified address by 1. class:word {n/a} {n/a} v all
@ -526,7 +526,7 @@ v:preserve aq- - - Make a copy of the value at the address, then run the quote.
v:update aq- - - Fetch a value from the specified address, then run the quotation with this value on the stack. Afterwards, store the returned value at the original address. class:word {n/a} {n/a} v all
var s- - - Create a variable. The variable is initialized to 0. class:word 'Base var {n/a} global all
var-n ns- - - Create a variable with the specified initial value. class:word #10 'Base var-n\n {n/a} global all
while q- - - Execute quote repeatedly while the quote returns a `TRUE` value. The quote should return a flag of either `TRUE` or `FALSE`, though `while` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:-zero? ] while {n/a} global all
while q(-f)- - - Execute quote repeatedly while the quote returns a `TRUE` value. The quote should return a flag of either `TRUE` or `FALSE`, though `while` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:-zero? ] while {n/a} global all
xor mn-o - - Perform a bitwise XOR operation. class:primitive {n/a} {n/a} global all
{ - - - Begin an array. This is intended to make creating arrays a bit cleaner than using a quotation and `a:counted-results`. class:word {n/a} {n/a} global all
{{ - - - Begin a lexically scoped area. class:word {n/a} {n/a} global all

1 $ -c - - Return ASCII:NUL (0). class:macro {n/a} {n/a} global all
10 -eq? nn-f - - Compare two values for inequality. Returns `TRUE` if they are not equal or `FALSE` otherwise. class:primitive #1 #2 -eq?\n $a $b -eq? {n/a} global all
11 -if fq- - - Execute the quotation if the flag is `FALSE`. class:word {n/a} {n/a} global all
12 -if; fq- - - Execute the quotation if the flag is `FALSE`. If false, also exit the word. class:word {n/a} {n/a} global all
13 / nm-q nm-v - - Divide `n` by `m` and return the integer part of the quotient. class:word {n/a} {n/a} global all
14 // - - - Ignore any tokens remaining on the current line. Works with files and the interactive "listener". class:word {n/a} {n/a} global rre
15 /mod nm-rq nm-rv - - Divide `n` by `m` and return the integer part of the quotient and remainder. class:primitive {n/a} {n/a} global all
16 0; n-n || n- - - If `n` is zero, drop `n` and exit the current word. If non-zero, leave `n` alone and allow execution to continue. class:macro {n/a} {n/a} global all
17 ; - - - End the current definition. class:macro {n/a} {n/a} global all
18 ?dup n-nn || n-n - - Duplicate top value on stack if not zero. If zero, do nothing. class:word #1 ?dup\n #0 ?dup {n/a} global all
454 sigil:^ s- - - Process token as a function reference. Discard the string. Comma the XT of the word into the current definition. class:macro {n/a} {n/a} sigil all
455 sigil:` s- - - Process token as a bytecode. Discard the string. Convert the string to a number and use `,` to inline it into the current definition. class:macro {n/a} {n/a} sigil all
456 sigil:| s- - - POSTPONE equivalent. Discard the string. Convert the string to a number and use `,` to inline it into the current definition. class:macro {n/a} {n/a} sigil all
457 sip nq-n nq(?n-?)-n - - Run quote. After execution completes, put a copy of n back on top of the stack. class:word {n/a} {n/a} global all
458 socket:accept n-nn - - Begin accepting connections. Returns a new socket and an error code. class:word {n/a} {n/a} socket rre
459 socket:bind sn-nn - - Bind a socket to a port. The port should be a string. Returns 0 if successful or -1 otherwise and an error code. class:word {n/a} {n/a} socket rre
460 socket:close n- - - Close a socket. class:word {n/a} {n/a} socket rre
514 unix:slurp-pipe as-n - - Open a pipe. Read all output from the pipe (until ASCII:NULL) and store in the specified buffer. Return the number of bytes read. class:word {n/a} {n/a} unix rre
515 unix:system s- - - Runs another application using the system shell and returns after execution is completed. class:word 'ls_-lh_/etc unix:system {n/a} unix rre
516 unix:wait -n - - Waits for a child process to complete. This maps to the wait() system call. class:word {n/a} {n/a} unix rre
517 until q- q(-f)- - - Execute quote repeatedly while the quote returns a value of `FALSE`. The quote should return a flag of either `TRUE` or `FALSE`, though `until` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:zero? ] until {n/a} global all
518 v:dec a- - - Decrement the value stored at the specified address by 1. class:word {n/a} {n/a} v all
519 v:dec-by na- - - Decrement the value stored at the specified address by the specified value. class:word {n/a} {n/a} v all
520 v:inc a- - - Increment the value stored at the specified address by 1. class:word {n/a} {n/a} v all
526 v:update aq- - - Fetch a value from the specified address, then run the quotation with this value on the stack. Afterwards, store the returned value at the original address. class:word {n/a} {n/a} v all
527 var s- - - Create a variable. The variable is initialized to 0. class:word 'Base var {n/a} global all
528 var-n ns- - - Create a variable with the specified initial value. class:word #10 'Base var-n\n {n/a} global all
529 while q- q(-f)- - - Execute quote repeatedly while the quote returns a `TRUE` value. The quote should return a flag of either `TRUE` or `FALSE`, though `while` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:-zero? ] while {n/a} global all
530 xor mn-o - - Perform a bitwise XOR operation. class:primitive {n/a} {n/a} global all
531 { - - - Begin an array. This is intended to make creating arrays a bit cleaner than using a quotation and `a:counted-results`. class:word {n/a} {n/a} global all
532 {{ - - - Begin a lexically scoped area. class:word {n/a} {n/a} global all

View file

@ -445,13 +445,13 @@ Apply q to x, y, and z.
Execute quote until quote returns a flag of 0. In high level code:
:while (q-)
:while (q(-f)-)
[ repeat dup push call pop swap 0; drop again ] call drop ;
This is manually translated to assembly and inlined for performance.
~~~
:while (q-) [ repeat \dupuca.. \poswzr.. drop again ] call drop ;
:while (q(-f)-) [ repeat \dupuca.. \poswzr.. drop again ] call drop ;
~~~
Execute quote until quote returns a non-zero flag. As with `while`