aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/in.frt
blob: b2af5f34349c82d070a68c0056686bd85553d28f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
\