diff --git a/ueforth/common/forth_namespace_tests.fs b/ueforth/common/forth_namespace_tests.fs index 9b78934..198322e 100644 --- a/ueforth/common/forth_namespace_tests.fs +++ b/ueforth/common/forth_namespace_tests.fs @@ -361,6 +361,7 @@ e: check-blocks e: check-vocabulary out: internals out: sealed + out: previous out: also out: only out: transfer{ diff --git a/ueforth/common/vocabulary.fs b/ueforth/common/vocabulary.fs index ccfe07e..7a58e32 100644 --- a/ueforth/common/vocabulary.fs +++ b/ueforth/common/vocabulary.fs @@ -39,6 +39,9 @@ forth definitions : only forth 0 context cell+ ! ; : voc-stack-end ( -- a ) context begin dup @ while cell+ repeat ; : also context context cell+ voc-stack-end over - 2 cells + cmove> ; +: previous + voc-stack-end context cell+ = throw + context cell+ context voc-stack-end over - cell+ cmove ; : sealed 0 last-vocabulary @ >body ! ; ( Hide some words in an internals vocabulary ) diff --git a/ueforth/common/vocabulary_tests.fs b/ueforth/common/vocabulary_tests.fs index 06be371..7c30a0e 100644 --- a/ueforth/common/vocabulary_tests.fs +++ b/ueforth/common/vocabulary_tests.fs @@ -57,6 +57,32 @@ e: test-order only forth definitions ;e +e: test-order-previous + vocabulary foo + vocabulary bar + vocabulary baz + also foo also bar also baz + order + out: baz >> FORTH + out: bar >> FORTH + out: foo >> FORTH + out: FORTH + previous order + out: bar >> FORTH + out: foo >> FORTH + out: FORTH + previous order + out: foo >> FORTH + out: FORTH + previous order + out: FORTH +;e + +e: test-previous-throw + only forth definitions + ' previous catch 0<> assert +;e + e: test-vocab-define-order vocabulary foo foo definitions diff --git a/ueforth/posix/sockets.fs b/ueforth/posix/sockets.fs index 17435ce..ab176dd 100644 --- a/ueforth/posix/sockets.fs +++ b/ueforth/posix/sockets.fs @@ -39,4 +39,4 @@ z" setsockopt" 5 sysfunc setsockopt ( Fixup return ) : sockaccept sockaccept sign-extend ; -forth definitions +only forth definitions diff --git a/ueforth/site/common.html b/ueforth/site/common.html index ad7c5d6..59b2c84 100644 --- a/ueforth/site/common.html +++ b/ueforth/site/common.html @@ -68,6 +68,7 @@ TRANSFER ( "name" ) Move a word from its current dictionary to the current vocab Useful for "hiding" built-in words TRANSFER{ ..words.. }TRANSFER ( -- ) Transfer multiple words to the current vocabulary ALSO ( -- ) Duplicate the vocabulary at the top of the vocabulary stack +PREVIOUS ( -- ) Drop the vocabulary at the top of the vocabulary stack ONLY ( -- ) Reset context stack to one item, the FORTH dictionary Non-standard, as there's no distinct ONLY vocabulary ORDER ( -- ) Print the vocabulary search order