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
8 \ $FreeBSD: src/sys/boot/ficl/softwords/prefix.fr,v 1.2 2002/04/09 17:45:28 dcs Exp $
9 \ $DragonFly: src/sys/boot/ficl/softwords/prefix.fr,v 1.1 2003/11/10 06:08:34 dillon Exp $
13 : start-prefixes get-current save-current ! <prefixes> set-current ;
14 : end-prefixes save-current @ set-current ;
15 : show-prefixes <prefixes> >search words search> drop ;
17 \ #if (FICL_EXTENDED_PREFIX)
21 \ define " (double-quote) as an alias for s", and make it a prefix
22 : " postpone s" ; immediate
25 \ make .( a prefix (we just create an alias for it in the prefixes list)
29 \ make \ a prefix, and add // (same thing) as a prefix too
30 \ (jws) "//" is precompiled to save aggravation with Perl
31 \ : // postpone \ ; immediate
34 \ ** add 0b, 0o, 0d, and 0x as prefixes
35 \ ** these temporarily shift the base to 2, 8, 10, and 16 respectively
36 \ ** and consume the next number in the input stream, pushing/compiling
39 \ (jws) __tempbase is precompiled, as are 0x and 0d - see prefix.c
41 \ : __tempbase { newbase | oldbase -- }
44 \ 0 0 parse-word >number 2drop drop
48 : 0b 2 __tempbase ; immediate
50 : 0o 8 __tempbase ; immediate
52 \ : 0d 10 __tempbase ; immediate
55 \ : 0x 16 __tempbase ; immediate