xref: /illumos-gate/usr/src/common/ficl/softcore/ficllocal.fr (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
1\ ** ficl/softwords/ficllocal.fr
2\ ** stack comment style local syntax...
3\ {{ a b c -- d e }}
4\ variables before the "--" are initialized in reverse order
5\ from the stack. Those after the "--" are zero initialized
6\ Uses locals...
7\ locstate: 0 = looking for -- or }}
8\           1 = found --
9hide
100 constant zero
11
12: ?--   s" --" compare 0= ;
13: ?}}   s" }}" compare 0= ;
14
15set-current
16
17: {{
18    0 dup  locals| nLocs locstate |
19    begin
20        parse-word
21        ?dup 0= abort" Error: out of text without seeing }}"
22        2dup 2dup  ?-- -rot ?}} or 0=
23    while
24        nLocs 1+ to nLocs
25    repeat
26
27    ?-- if 1 to locstate endif
28
29    nLocs 0 do
30        (local)
31    loop
32
33    locstate 1 = if
34        begin
35            parse-word
36            2dup ?}} 0=
37        while
38            postpone zero  (local)
39        repeat
40        2drop
41    endif
42
43    0 0 (local)
44; immediate compile-only
45
46previous
47