diff --git a/doc/book/glossary/glossary b/doc/book/glossary/glossary index e833c24..738cc18 100644 --- a/doc/book/glossary/glossary +++ b/doc/book/glossary/glossary @@ -168,6 +168,17 @@ Divide `n` by `m` and return the integer part of the quotient. Class: class:word | Namespace: global | Interface Layer: all ------------------------------------------------------------------------ +// + + Data: - + Addr: - + Float: - + +Ignore any tokens remaining on the current line. Works with files and the interactive "listener". + +Class: class:word | Namespace: global | Interface Layer: rre +------------------------------------------------------------------------ + /mod Data: nm-rq @@ -664,7 +675,7 @@ I Addr: - Float: - -Access the loop index for the current loop. (For loops made using `times`) +Access the loop index for the current loop. (For loops made using `indexed-times`) Class: class:word | Namespace: global | Interface Layer: all ------------------------------------------------------------------------ @@ -675,7 +686,7 @@ J Addr: - Float: - -Access the parent loop index for the current loop. (For loops made using `times`) +Access the parent loop index for the current loop. (For loops made using `indexed-times`) Class: class:word | Namespace: global | Interface Layer: all ------------------------------------------------------------------------ @@ -686,7 +697,7 @@ K Addr: - Float: - -Access the grandparent loop index for the current loop. (For loops made using `times`) +Access the grandparent loop index for the current loop. (For loops made using `indexed-times`) Class: class:word | Namespace: global | Interface Layer: all ------------------------------------------------------------------------ @@ -1735,6 +1746,17 @@ Return the current month. This will be in the range of 1-12, inclusive. Class: class:word | Namespace: clock | Interface Layer: iOS, rre ------------------------------------------------------------------------ +clock:operation + + Data: ...n- + Addr: - + Float: - + +Trigger a clock operation. This is not intended to be used directly. + +Class: class:word | Namespace: clock | Interface Layer: rre +------------------------------------------------------------------------ + clock:second Data: -n @@ -1988,7 +2010,7 @@ Return the most recent dictionary header. Class: class:word | Namespace: d | Interface Layer: all ------------------------------------------------------------------------ -d:last +d:last.class Data: -a Addr: - @@ -1999,7 +2021,7 @@ Return a pointer to the class field of the most recent dictionary header. Class: class:word | Namespace: d | Interface Layer: all ------------------------------------------------------------------------ -d:last +d:last.name Data: -s Addr: - @@ -2010,7 +2032,7 @@ Return a pointer to the name field of the most recent dictionary header. Class: class:word | Namespace: d | Interface Layer: all ------------------------------------------------------------------------ -d:last +d:last.xt Data: -a Addr: - @@ -3317,7 +3339,7 @@ Example #1: ------------------------------------------------------------------------ -file:open +file:open-for-append Data: s-nn Addr: - @@ -3328,7 +3350,7 @@ Open a file for reading & writing. Returns the size (NOS) and a file ID (TOS) Class: class:word | Namespace: file | Interface Layer: rre ------------------------------------------------------------------------ -file:open +file:open-for-reading Data: s-nn Addr: - @@ -3339,7 +3361,7 @@ Open a file for reading. Returns the size (NOS) and a file ID (TOS) Class: class:word | Namespace: file | Interface Layer: rre ------------------------------------------------------------------------ -file:open +file:open-for-writing Data: s-n Addr: - @@ -3350,6 +3372,17 @@ Open a file for writing. Returns the file ID Class: class:word | Namespace: file | Interface Layer: rre ------------------------------------------------------------------------ +file:operation + + Data: ...n- + Addr: - + Float: - + +Trigger a file I/O operation. This is not intended to be used directly. + +Class: class:word | Namespace: file | Interface Layer: rre +------------------------------------------------------------------------ + file:read Data: h-c @@ -3438,6 +3471,17 @@ Write a character to the file represented by the handle. Class: class:word | Namespace: file | Interface Layer: rre ------------------------------------------------------------------------ +float:operation + + Data: ...n- + Addr: - + Float: - + +Trigger a floating point operation. This is not intended to be used directly. + +Class: class:word | Namespace: float | Interface Layer: rre +------------------------------------------------------------------------ + gopher:get Data: asns-n @@ -3570,6 +3614,17 @@ Run the code in the specified file. Class: class:word | Namespace: global | Interface Layer: rre ------------------------------------------------------------------------ +indexed-times + + Data: nq- + Addr: - + Float: - + +Run a quote the specified number of times, tracking the loop index in `I`. This is less efficient than `times`, so if the index is not needed, this should be avoided. + +Class: class:word | Namespace: global | Interface Layer: all +------------------------------------------------------------------------ + interpret Data: s- @@ -3587,17 +3642,6 @@ Example #1: ------------------------------------------------------------------------ -io:clock-operation - - Data: ...n- - Addr: - - Float: - - -Trigger a clock operation. This is not intended to be used directly. - -Class: class:word | Namespace: io | Interface Layer: rre ------------------------------------------------------------------------- - io:enumerate Data: -n @@ -3609,28 +3653,6 @@ Return the number of I/O devices. Class: class:word | Namespace: io | Interface Layer: all ------------------------------------------------------------------------ -io:file-operation - - Data: ...n- - Addr: - - Float: - - -Trigger a file I/O operation. This is not intended to be used directly. - -Class: class:word | Namespace: io | Interface Layer: rre ------------------------------------------------------------------------- - -io:float-operation - - Data: ...n- - Addr: - - Float: - - -Trigger a floating point operation. This is not intended to be used directly. - -Class: class:word | Namespace: io | Interface Layer: rre ------------------------------------------------------------------------- - io:invoke Data: n- @@ -3675,17 +3697,6 @@ Scan the I/O devices for a device with a specified ID. Returns the device number Class: class:word | Namespace: io | Interface Layer: all ------------------------------------------------------------------------ -io:socket-operation - - Data: ...n- - Addr: - - Float: - - -Trigger a socket operation. This is not intended to be used directly. - -Class: class:word | Namespace: io | Interface Layer: rre ------------------------------------------------------------------------- - io:unix-syscall Data: ...n- @@ -5071,6 +5082,83 @@ Example #1: ------------------------------------------------------------------------ +script:abort-include + + Data: - + Addr: - + Float: - + +Discard remaining tokens on the current line being evaluated. This only works when including a file, not at the interpreter. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + +script:arguments + + Data: -n + Addr: - + Float: - + +Return the number of arguments passed to the program. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + +script:current-file + + Data: -s + Addr: - + Float: - + +Return the filename of the file being processed by the current `include`, or `/dev/stdin` if the input source is the terminal. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + +script:current-line + + Data: -n + Addr: - + Float: - + +Return the current line number of the file being processed by the current `include`, or `0` if the input source is the terminal. Line numbering starts at 1. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + +script:get-argument + + Data: n-s + Addr: - + Float: - + +Given an argument number, return the argument as a string. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + +script:ignore-to-eof + + Data: - + Addr: - + Float: - + +Discard remaining lines in the file currently being evaluated. This only works when including a file, not at the interpreter. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + +script:name + + Data: -s + Addr: - + Float: - + +Return the filename of the program being run. + +Class: class:word | Namespace: sys | Interface Layer: rre +------------------------------------------------------------------------ + set-hook Data: aa- @@ -5199,6 +5287,17 @@ Prepare a socket for accepting incoming connections. Takes a backlog count (n1) Class: class:word | Namespace: socket | Interface Layer: rre ------------------------------------------------------------------------ +socket:operation + + Data: ...n- + Addr: - + Float: - + +Trigger a socket operation. This is not intended to be used directly. + +Class: class:word | Namespace: socket | Interface Layer: rre +------------------------------------------------------------------------ + socket:recv Data: ann-nn @@ -5283,7 +5382,7 @@ sys:argc Addr: - Float: - -Return the number of arguments passed to the program. +Return the number of arguments passed to the program. Deprecated. Use script:arguments Class: class:word | Namespace: sys | Interface Layer: rre ------------------------------------------------------------------------ @@ -5294,7 +5393,7 @@ sys:argv Addr: - Float: - -Given an argument number, return the argument as a string. +Given an argument number, return the argument as a string. Deprecated. Use script:get-argument instead. Class: class:word | Namespace: sys | Interface Layer: rre ------------------------------------------------------------------------ @@ -5305,7 +5404,7 @@ sys:name Addr: - Float: - -Return the filename of the program being run. +Return the filename of the program being run. Deprecated. Use script:name instead. Class: class:word | Namespace: sys | Interface Layer: rre ------------------------------------------------------------------------ @@ -5337,17 +5436,6 @@ Example #1: ------------------------------------------------------------------------ -times - - Data: nq- - Addr: - - Float: - - -Run a quote the specified number of times, tracking the loop index in `I`. This is less efficient than `times`, so if the index is not needed, this should be avoided. - -Class: class:word | Namespace: global | Interface Layer: all ------------------------------------------------------------------------- - tri Data: xqqq-? @@ -5782,7 +5870,7 @@ Example #1: ------------------------------------------------------------------------ -var +var-n Data: ns- Addr: - @@ -5794,7 +5882,7 @@ Class: class:word | Namespace: global | Interface Layer: all Example #1: - #10 'Base var + #10 'Base var-n ------------------------------------------------------------------------ diff --git a/doc/book/techniques/dictionary b/doc/book/techniques/dictionary index 66faaba..e4747e2 100644 --- a/doc/book/techniques/dictionary +++ b/doc/book/techniques/dictionary @@ -39,9 +39,9 @@ field. RETRO provides several words for operating on the most recent header. -`d:last` returns a pointer to the latest header. `d:last` +`d:last` returns a pointer to the latest header. `d:last.xt` will give the contents of the `d:xt` field for the latest -header. There are also `d:last` and `d:last`. +header. There are also `d:last.class` and `d:last.name`. ## Adding Headers diff --git a/tests/test-core.forth b/tests/test-core.forth index 60455c4..b1024f0 100644 --- a/tests/test-core.forth +++ b/tests/test-core.forth @@ -993,21 +993,21 @@ passed -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ~~~ -'d:last Testing +'d:last.class Testing passed ~~~ -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ~~~ -'d:last Testing +'d:last.name Testing passed ~~~ -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ~~~ -'d:last Testing +'d:last.xt Testing passed ~~~ @@ -2103,9 +2103,9 @@ passed -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ~~~ -'var Testing - #30 'A var - #40 'B var +'var-n Testing + #30 'A var-n + #40 'B var-n [ ] [ &A fetch #30 eq? ] try [ ] [ &B fetch #40 eq? ] try [ #10 &A store ] [ &A fetch #10 eq? ] try @@ -2120,7 +2120,7 @@ passed ~~~ 'v:dec Testing - #199 'A var + #199 'A var-n [ &A v:dec ] [ &A fetch #198 eq? ] try [ &A v:dec ] [ &A fetch #197 eq? ] try [ &A v:dec ] [ &A fetch #196 eq? ] try @@ -2131,7 +2131,7 @@ passed ~~~ 'v:dec-by Testing - #199 'A var + #199 'A var-n [ #2 &A v:dec-by ] [ &A fetch #197 eq? ] try [ #3 &A v:dec-by ] [ &A fetch #194 eq? ] try [ #5 &A v:dec-by ] [ &A fetch #189 eq? ] try