Adding file for locals, make TO more efficient, prepare fix for interpret DOES>.
This commit is contained in:
@ -120,7 +120,7 @@ $(GEN):
|
||||
mkdir -p $@
|
||||
|
||||
POSIX_BOOT = common/boot.fs common/vocabulary.fs common/hide_calls.fs common/ansi.fs \
|
||||
posix/posix.fs posix/posix_highlevel.fs posix/termios.fs \
|
||||
posix/posix.fs posix/posix_highlevel.fs posix/termios.fs common/locals.fs \
|
||||
common/utils.fs common/highlevel.fs common/filetools.fs posix/posix_desktop.fs \
|
||||
common/tasks.fs common/streams.fs common/blocks.fs posix/args.fs
|
||||
$(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN)
|
||||
@ -128,14 +128,14 @@ $(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN)
|
||||
|
||||
WINDOWS_BOOT = common/boot.fs common/vocabulary.fs common/hide_calls.fs common/ansi.fs \
|
||||
windows/windows.fs windows/windows_highlevel.fs common/highlevel.fs \
|
||||
common/utils.fs common/tasks.fs common/streams.fs common/blocks.fs
|
||||
common/utils.fs common/tasks.fs common/streams.fs common/blocks.fs common/locals.fs
|
||||
$(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN)
|
||||
echo "ok" | cat $(WINDOWS_BOOT) - | $< boot $(VERSION) $(REVISION) >$@
|
||||
|
||||
ARDUINO_BOOT = common/boot.fs common/vocabulary.fs \
|
||||
arduino/arduino.fs arduino/arduino_highlevel.fs \
|
||||
arduino/bindings.fs common/highlevel.fs \
|
||||
common/filetools.fs common/utils.fs \
|
||||
common/filetools.fs common/utils.fs common/locals.fs \
|
||||
common/tasks.fs common/streams.fs arduino/arduino_server.fs \
|
||||
arduino/arduino_bterm.fs \
|
||||
arduino/esp_camera.fs common/blocks.fs \
|
||||
|
||||
@ -52,3 +52,17 @@ e: test-multiline
|
||||
out: There
|
||||
out: Test!
|
||||
;e
|
||||
|
||||
e: test-value-to
|
||||
123 value foo
|
||||
foo . cr
|
||||
out: 123
|
||||
55 to foo
|
||||
foo . cr
|
||||
out: 55
|
||||
: bar 99 to foo ;
|
||||
foo . cr
|
||||
out: 55
|
||||
bar foo . cr
|
||||
out: 99
|
||||
;e
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
: base ( -- a ) 'sys 4 cells + ;
|
||||
: 'heap ( -- a ) 'sys 5 cells + ;
|
||||
: current ( -- a ) 'sys 6 cells + ;
|
||||
: 'context ( -- a ) 'sys 7 cells + ; : context 'context @ ;
|
||||
: 'context ( -- a ) 'sys 7 cells + ; : context 'context @ cell+ ;
|
||||
: 'notfound ( -- a ) 'sys 8 cells + ;
|
||||
|
||||
( Dictionary )
|
||||
@ -131,8 +131,7 @@ variable handler
|
||||
|
||||
( Values )
|
||||
: value ( n -- ) create , does> @ ;
|
||||
: to ( n -- ) state @ if postpone ['] postpone >body postpone !
|
||||
else ' >body ! then ; immediate
|
||||
: to ( n -- ) ' >body state @ if aliteral postpone ! else ! then ; immediate
|
||||
|
||||
( Deferred Words )
|
||||
: defer ( "name" -- ) create 0 , does> @ dup 0= throw execute ;
|
||||
|
||||
3
ueforth/common/locals.fs
Normal file
3
ueforth/common/locals.fs
Normal file
@ -0,0 +1,3 @@
|
||||
( Local Variables )
|
||||
|
||||
|
||||
@ -22,6 +22,19 @@ current @ constant forth-wordlist
|
||||
|
||||
( Hide some words in an internals vocabulary )
|
||||
vocabulary internals internals definitions
|
||||
|
||||
( Vocabulary chain for current scope, place at the -1 position )
|
||||
variable scope scope context cell - !
|
||||
|
||||
( Make DOES> switch to compile mode when interpreted )
|
||||
(
|
||||
vocabulary partial-does partial-does definitions
|
||||
transfer does>
|
||||
only forth definitions also partial-does
|
||||
: does> postpone does> ; immediate
|
||||
only internals definitions
|
||||
)
|
||||
|
||||
transfer{
|
||||
transfer-xt voc-stack-end forth-wordlist
|
||||
last-vocabulary
|
||||
@ -36,4 +49,3 @@ transfer{
|
||||
tib-setup input-limit
|
||||
}transfer
|
||||
forth definitions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user