Merge pull request #59 from philburk/build64
[pforth] / fth / private.fth
CommitLineData
8e9db35f
PB
1\ @(#) private.fth 98/01/26 1.2
2\ PRIVATIZE
3\
4\ Privatize words that are only needed within the file
5\ and do not need to be exported.
6\
7\ Usage:
8\ PRIVATE{
9\ : FOO ; \ Everything between PRIVATE{ and }PRIVATE will become private.
10\ : MOO ;
11\ }PRIVATE
12\ : GOO foo moo ; \ can use foo and moo
13\ PRIVATIZE \ smudge foo and moo
14\ ' foo \ will fail
15\
16\ Copyright 1996 Phil Burk
17\
18\ 19970701 PLB Use unsigned compares for machines with "negative" addresses.
19
20anew task-private.fth
21
22variable private-start
23variable private-stop
24$ 20 constant FLAG_SMUDGE
25
26: PRIVATE{
27 latest private-start !
28 0 private-stop !
29;
30: }PRIVATE
31 private-stop @ 0= not abort" Extra }PRIVATE"
32 latest private-stop !
33;
34: PRIVATIZE ( -- , smudge all words between PRIVATE{ and }PRIVATE )
35 private-start @ 0= abort" Missing PRIVATE{"
36 private-stop @ 0= abort" Missing }PRIVATE"
37 private-stop @
38 BEGIN
39 dup private-start @ u> \ 19970701
40 WHILE
41\ ." Smudge " dup id. cr
42 dup c@ flag_smudge or over c!
43 prevname
44 REPEAT
45 drop
46 0 private-start !
47 0 private-stop !
48;