File: private.fth

package info (click to toggle)
pforth 21-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 820 kB
  • ctags: 873
  • sloc: ansic: 5,050; makefile: 102
file content (48 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download | duplicates (5)
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
37
38
39
40
41
42
43
44
45
46
47
48
\ @(#) private.fth 98/01/26 1.2
\ PRIVATIZE
\
\ Privatize words that are only needed within the file
\ and do not need to be exported.
\
\ Usage:
\    PRIVATE{
\    : FOO ;  \ Everything between PRIVATE{ and }PRIVATE will become private.
\    : MOO ;
\    }PRIVATE
\    : GOO   foo moo ;  \ can use foo and moo
\    PRIVATIZE          \ smudge foo and moo
\    ' foo              \ will fail
\
\ Copyright 1996 Phil Burk
\
\ 19970701 PLB Use unsigned compares for machines with "negative" addresses.

anew task-private.fth

variable private-start
variable private-stop
$ 20 constant FLAG_SMUDGE

: PRIVATE{
	latest private-start !
	0 private-stop !
;
: }PRIVATE
	private-stop @ 0= not abort" Extra }PRIVATE"
	latest private-stop !
;
: PRIVATIZE  ( -- , smudge all words between PRIVATE{ and }PRIVATE )
	private-start @ 0= abort" Missing PRIVATE{"
	private-stop @ 0= abort" Missing }PRIVATE"
	private-stop @
	BEGIN
		dup private-start @ u>    \ 19970701
	WHILE
\		." Smudge " dup id. cr
		dup c@ flag_smudge or over c!
		prevname
	REPEAT
	drop
	0 private-start !
	0 private-stop !
;