Updated README with better build info
[debian/pforth] / fth / private.fth
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
20 anew task-private.fth
21
22 variable private-start
23 variable private-stop
24
25 : PRIVATE{
26     private-start @ 0= not abort" ERROR: Missing PRIVATIZE"
27     private-stop @ 0= not abort" ERROR: Missing PRIVATIZE"
28     latest private-start !
29     0 private-stop !
30 ;
31
32 : }PRIVATE
33     private-stop @ 0= not abort" ERROR: Extra }PRIVATE"
34     latest private-stop !
35 ;
36
37 : PRIVATIZE  ( -- , smudge all words between PRIVATE{ and }PRIVATE )
38     private-start @ 0= abort" ERROR: Missing PRIVATE{"
39     private-stop @ 0= abort" ERROR: Missing }PRIVATE"
40     private-stop @
41     BEGIN
42         dup private-start @ u>    \ 19970701
43     WHILE
44 \       ." Smudge " dup id. cr
45         dup c@ flag_smudge or over c!
46         prevname
47     REPEAT
48     drop
49     0 private-start !
50     0 private-stop !
51 ;