From 67d25d837ac55f28a366c0a3b262e439a6e75fc3 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 19 Aug 2017 12:15:28 +0200 Subject: Add AmForth --- amforth-6.5/common/lib/in.frt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 amforth-6.5/common/lib/in.frt (limited to 'amforth-6.5/common/lib/in.frt') diff --git a/amforth-6.5/common/lib/in.frt b/amforth-6.5/common/lib/in.frt new file mode 100644 index 0000000..b2af5f3 --- /dev/null +++ b/amforth-6.5/common/lib/in.frt @@ -0,0 +1,36 @@ +\ invented at the Euro Forth 2016 to +\ define a word in a vocabulary different +\ to CURRENT + +\ #require also.frt +\ #require previous.frt +\ #require definitions.frt + + +: in ( "voc" "defining-word" -- ) + get-current >r also ' execute + definitions previous ' execute r> set-current +; + +\ use as follows, require vocabulary.frt first +\ vocabulary gui +\ in gui : foo ( .. -- .. ) ... ; +\ in gui variable bar +\ in gui defer baz +\ show what's in gui +\ also gui words previous +\ remeber: gui is a vocabulary, not a wordlist +\ +\ Alternative implementation uses wordlist id's +\ instead of vocabularies. All the #require +\ lines can be omitted. +\ +\ : IN ( wid "action" -- ) +\ get-current >r set-current ' execute r> set-current ; +\ +\ use it like +\ wordlist constant gui +\ ... same as above +\ show the content of gui +\ gui show-wordlist +\ -- cgit v1.2.3