1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 16:38:06 +11:00

Rename switch to ialias

The switch name was confusing.
This commit is contained in:
Virgil Dupras 2020-11-28 10:58:16 -05:00
parent b4f3fde062
commit f8b7a3ce65
4 changed files with 15 additions and 15 deletions

10
blk.fs
View File

@ -1123,7 +1123,7 @@ lblexec BSET L1 FSET ( B284 ) L2 FSET ( B286 )
A ORr, IFZ, JP(HL), THEN,
A DECr, ( compiled? ) IFNZ, ( no )
3 CPi, IFZ, ( alias ) LDDE(HL), JR, lblexec BWR THEN,
IFNC, ( switch )
IFNC, ( ialias )
LDDE(HL), EXDEHL, LDDE(HL), JR, lblexec BWR THEN,
( cell or does. push PFA ) HL PUSH,
A DECr, JRZ, lblnext BWR ( cell )
@ -1739,7 +1739,7 @@ with "390 LOAD"
( ----- 355 )
: +! TUCK @ + SWAP ! ;
: *! ( addr alias -- ) 1+ ! ;
: **! ( addr switch -- ) 1+ @ ! ;
: **! ( addr ialias -- ) 1+ @ ! ;
: / /MOD NIP ;
: MOD /MOD DROP ;
: ALLOT HERE +! ;
@ -2155,7 +2155,7 @@ XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + !
( ----- 391 )
( Now we have "as late as possible" stuff. See bootstrap doc. )
: :* ( addr -- ) (entry) 4 ( alias ) C, , ;
: :** ( addr -- ) (entry) 5 ( switch ) C, , ;
: :** ( addr -- ) (entry) 5 ( ialias ) C, , ;
( ----- 392 )
: _bchk DUP 0x7f + 0xff > IF LIT" br ovfl" (print) ABORT THEN ;
: DO COMPILE 2>R H@ ; IMMEDIATE
@ -2599,8 +2599,8 @@ lblexec BSET ( DI -> wordref )
DI PUSHx, JMPs, lblnext @ RPCs, THEN,
AL DECr, IFZ, ( does )
DI PUSHx, DI INCx, DI INCx, DI [DI] MOVx[], THEN,
( alias or switch ) DI [DI] MOVx[],
AL DECr, IFNZ, ( switch ) DI [DI] MOVx[], THEN,
( alias or ialias ) DI [DI] MOVx[],
AL DECr, IFNZ, ( ialias ) DI [DI] MOVx[], THEN,
JMPs, lblexec @ RPCs,
THEN, ( continue to compiled )
BP INCx, BP INCx, [BP] 0 DX MOV[]+x, ( pushRS )

View File

@ -66,7 +66,7 @@ WORD( a -- a Get wordref's beginning addr.
: x ... ; -- Define a new word
:* x a -- Define a new alias
:** x a -- Define a new switch
:** x a -- Define a new ialias
CREATE x -- Create cell named x. Doesn't allocate a PF.
[COMPILE] x -- *I* Compile word x and write it to HERE.
IMMEDIATE words are *not* executed.
@ -164,7 +164,7 @@ C! c a -- Store byte c in address a
C!+ c a -- a+1 Store byte c in a and inc a.
C!- c a -- a-1 Store byte c in a and dec a.
*! a al -- Change alias al's addr to a.
**! a sw -- Change switch sw's addr to a.
**! a sw -- Change ialias sw's addr to a.
CURRENT -- a Set a to wordref of last added entry.
CURRENT* -- a A pointer to active CURRENT*. Useful
when we have multiple active dicts.
@ -185,7 +185,7 @@ MOVEW notes: this word's purpose is to interface with word-
based systems. src and dst are addressed as *bytes* but u is a
*word* count. Every iteration increases src and dst by 2. This
shouldn't be used on regular memory, it will yield weird
results. Use it with A! switch pointing to a word-based target.
results. Use it with A! ialias pointing to a word-based target.
# Arithmetic / Bits

View File

@ -109,7 +109,7 @@ compiled word.
4: alias. See usage.txt. PFA is like a cell, but instead of
pushing it to PS, we execute it.
5: switch. Same as alias, but with an added indirection.
5: ialias. Same as alias, but with an added indirection.
# System variables

View File

@ -52,7 +52,7 @@ Interpreter output is unbuffered and only has EMIT. This
word can also be overriden, mostly as a companion to the
raison d'etre of your KEY override.
# Aliases and Switches
# Aliases
A common pattern in Forth is to add an indirection layer with
a pointer word. For example, if you have a word "FOO" for
@ -65,7 +65,7 @@ verbose, which make us want to avoid this pattern for words
that are often used.
For this purpose, Collapse OS has two special word types:
alias and switches.
alias and ialiases (indirect alias).
An alias is a variable that contains a pointer to another word.
When invoked, we invoke the specified pointer with minimal over-
@ -74,18 +74,18 @@ with "' _FOO :* FOO". Invoking FOO will then invoke "_FOO". You
can change the alias' pointer with "*!" like this:
"' BAR ' FOO *!". FOO now invokes BAR.
A switch is like an alias, but with a second level of indi-
A ialias is like an alias, but with a second level of indi-
rection. The variable points to a cell pointing to our word.
It works like an alias, except you have to use ":**" and "**!".
Switches are used by core code which point to hardcoded
Ialiases are used by core code which point to hardcoded
addresses in RAM (because the core code is designed to run from
ROM, we can't have regular variables). You are unlikely to
need switches in regular code.
need ialiases in regular code.
# Addressed devices
A@, A! and A, are the indirect versions of C@, C! and C,. They
are switch words and initially point to C@, C! and C,.
are ialias words and initially point to C@, C! and C,.
Addressed device words can be useful to "pipe" processing to
places outside of regular memory.