diff options
| author | kitty <nepeta@canaglie.net> | 2026-03-30 16:26:38 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-03-30 16:26:38 +1100 |
| commit | 070162cb446fe379d97ccca9fa177d24a052d957 (patch) | |
| tree | 8cab7159c7a83f872d202fd45014f8682465cf4f /readme.md | |
| parent | a059eda0ecd73cbb6277da3bf64a550097bc346d (diff) | |
errno stuff and defer words wheeeee
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -149,7 +149,6 @@ fetch the 64 bit value at memory address a. ### `= ( n1 n2 -- ? )` return true if n1 and n2 are equal. - ### `< ( n1 n2 -- ? )` return true if n1 is less than n2. @@ -177,6 +176,9 @@ return true if n1 is greater than or equal to n2. ### `>body ( ht -- xt )` yield the code field of header token. +### `>defer ( xt -- a )` +get the xt storage address of the deferred execution token. + ### `>errno ( u -- val err )` transform the result of a system call into a value/error pair. if no error occured, err is zero and val is the result, @@ -337,6 +339,17 @@ store the 32 bit value u into the memory address a. ### `decimal ( -- )` set current base to decimal. +### `defer ( "name" -- )` +create a new word, the behaviour of which can be controlled with +`defer!`, `defer@`, `is` and `action-of`. +initially it is set to yield an error. + +### `defer! ( xt1 xt2 -- )` +set the deferred word xt2's behaviour to xt1. + +### `defer@ ( xt -- xt' )` +retrieve the xt' which the deferred word xt is set to execute. + ### `does> ( -- )` modify the behaviour of the most recent `create`d word. (non-`create`d words will be corrupted.) @@ -426,6 +439,9 @@ until it runs out. ### `invert ( u -- u' )` invert all bytes in u. +### `is ( xt "name" -- ) IMMEDIATE` +set the deferred word name to execute xt. + ### `latest ( -- a )` a variable containing the execution token of the most recently created word. @@ -707,3 +723,5 @@ but it diverges in a few notable places: - PNO words (`<# # #>` etc.) work with single cell numbers. this is because this forth has no double number support. (128 bit integer arithmetic does not seem all that useful to me) +- the dynamic allocation `free` word requires a length. + this is because munmap requires a length. |
