Deleted Added
full compact
jhlocal.fr (76116) jhlocal.fr (167850)
1\ #if FICL_WANT_LOCALS
2\ ** ficl/softwords/jhlocal.fr
3\ ** stack comment style local syntax...
4\ { a b c | cleared -- d e }
5\ variables before the "|" are initialized in reverse order
6\ from the stack. Those after the "|" are zero initialized.
7\ Anything between "--" and "}" is treated as comment
8\ Uses locals...
9\ locstate: 0 = looking for | or -- or }}
10\ 1 = found |
11\ 2 = found --
12\ 3 = found }
13\ 4 = end of line
14\
15\ revised 2 June 2000 - { | a -- } now works correctly
16\
1\ #if FICL_WANT_LOCALS
2\ ** ficl/softwords/jhlocal.fr
3\ ** stack comment style local syntax...
4\ { a b c | cleared -- d e }
5\ variables before the "|" are initialized in reverse order
6\ from the stack. Those after the "|" are zero initialized.
7\ Anything between "--" and "}" is treated as comment
8\ Uses locals...
9\ locstate: 0 = looking for | or -- or }}
10\ 1 = found |
11\ 2 = found --
12\ 3 = found }
13\ 4 = end of line
14\
15\ revised 2 June 2000 - { | a -- } now works correctly
16\
17\ $FreeBSD: head/sys/boot/ficl/softwords/jhlocal.fr 76116 2001-04-29 02:36:36Z dcs $
17\ $FreeBSD: head/sys/boot/ficl/softwords/jhlocal.fr 167850 2007-03-23 22:26:01Z jkim $
18
19hide
18
19hide
20
200 constant zero
21
210 constant zero
22
23
22: ?-- ( c-addr u -- c-addr u flag )
23 2dup s" --" compare 0= ;
24: ?} ( c-addr u -- c-addr u flag )
25 2dup s" }" compare 0= ;
26: ?| ( c-addr u -- c-addr u flag )
27 2dup s" |" compare 0= ;
28
29\ examine name - if it's a 2local (starts with "2:"),

--- 39 unchanged lines hidden (view full) ---

69 loop \ ( )
70
71 \ zero locals until -- or }
72 locstate 1 = if
73 begin
74 parse-word
75 ?delim dup to locstate
76 0= while
24: ?-- ( c-addr u -- c-addr u flag )
25 2dup s" --" compare 0= ;
26: ?} ( c-addr u -- c-addr u flag )
27 2dup s" }" compare 0= ;
28: ?| ( c-addr u -- c-addr u flag )
29 2dup s" |" compare 0= ;
30
31\ examine name - if it's a 2local (starts with "2:"),

--- 39 unchanged lines hidden (view full) ---

71 loop \ ( )
72
73 \ zero locals until -- or }
74 locstate 1 = if
75 begin
76 parse-word
77 ?delim dup to locstate
78 0= while
77 ?2loc if
78 postpone zero postpone zero (2local)
79 else
80 postpone zero (local)
81 endif
79 ?2loc if
80 postpone zero postpone zero (2local)
81 else
82 postpone zero (local)
83 endif
82 repeat
83 endif
84
85 0 0 (local)
86
87 \ toss words until }
84 repeat
85 endif
86
87 0 0 (local)
88
89 \ toss words until }
90 \ (explicitly allow | and -- in the comment)
88 locstate 2 = if
89 begin
90 parse-word
91 locstate 2 = if
92 begin
93 parse-word
91 ?delim dup to locstate
92 0= while
93 2drop
94 ?delim dup to locstate
95 3 < while
96 locstate 0= if 2drop endif
94 repeat
95 endif
96
97 locstate 3 <> abort" syntax error in { } local line"
98; immediate compile-only
99
100previous
101\ #endif
102
97 repeat
98 endif
99
100 locstate 3 <> abort" syntax error in { } local line"
101; immediate compile-only
102
103previous
104\ #endif
105