2 \ ** Prefix words for ficl
3 \ ** submitted by Larry Hastings, larry@hastings.org
5 \ (jws) To make a prefix, simply create a new definition in the <prefixes>
6 \ wordlist. start-prefixes and end-prefixes handle the bookkeeping
11 : start-prefixes get-current save-current ! <prefixes> set-current ;
12 : end-prefixes save-current @ set-current ;
13 : show-prefixes <prefixes> >search words search> drop ;
15 \ #if (FICL_EXTENDED_PREFIX)
19 \ define " (double-quote) as an alias for s", and make it a prefix
20 : " postpone s" ; immediate
23 \ make .( a prefix (we just create an alias for it in the prefixes list)
24 : .( postpone .( ; immediate
27 \ make \ a prefix, and add // (same thing) as a prefix too
28 \ (jws) "//" is precompiled to save aggravation with Perl
29 \ : // postpone \ ; immediate
32 \ ** add 0b, 0o, 0d, and 0x as prefixes
33 \ ** these temporarily shift the base to 2, 8, 10, and 16 respectively
34 \ ** and consume the next number in the input stream, pushing/compiling
37 \ (jws) __tempbase is precompiled, as are 0x and 0d - see prefix.c
39 \ : __tempbase { newbase | oldbase -- }
42 \ 0 0 parse-word >number 2drop drop
46 : 0b 2 __tempbase ; immediate
48 : 0o 8 __tempbase ; immediate
50 \ : 0d 10 __tempbase ; immediate
53 \ : 0x 16 __tempbase ; immediate