176116Sdcs\ ** 276116Sdcs\ ** Prefix words for ficl 376116Sdcs\ ** submitted by Larry Hastings, larry@hastings.org 476116Sdcs\ ** 576116Sdcs\ (jws) To make a prefix, simply create a new definition in the <prefixes> 676116Sdcs\ wordlist. start-prefixes and end-prefixes handle the bookkeeping 794290Sdcs\ 876116Sdcs\ $FreeBSD: releng/11.0/sys/boot/ficl/softwords/prefix.fr 167850 2007-03-23 22:26:01Z jkim $ 976116Sdcs 1076116Sdcsvariable save-current 1176116Sdcs 1276116Sdcs: start-prefixes get-current save-current ! <prefixes> set-current ; 1376116Sdcs: end-prefixes save-current @ set-current ; 1476116Sdcs: show-prefixes <prefixes> >search words search> drop ; 1576116Sdcs 1676116Sdcs\ #if (FICL_EXTENDED_PREFIX) 1776116Sdcs 1876116Sdcsstart-prefixes 1976116Sdcs 2076116Sdcs\ define " (double-quote) as an alias for s", and make it a prefix 2176116Sdcs: " postpone s" ; immediate 2276116Sdcs 2376116Sdcs 2476116Sdcs\ make .( a prefix (we just create an alias for it in the prefixes list) 25167850Sjkim: .( postpone .( ; immediate 2676116Sdcs 2776116Sdcs 2876116Sdcs\ make \ a prefix, and add // (same thing) as a prefix too 2976116Sdcs\ (jws) "//" is precompiled to save aggravation with Perl 3076116Sdcs\ : // postpone \ ; immediate 3176116Sdcs 3276116Sdcs 3376116Sdcs\ ** add 0b, 0o, 0d, and 0x as prefixes 3476116Sdcs\ ** these temporarily shift the base to 2, 8, 10, and 16 respectively 3576116Sdcs\ ** and consume the next number in the input stream, pushing/compiling 3676116Sdcs\ ** as normal 3776116Sdcs 3876116Sdcs\ (jws) __tempbase is precompiled, as are 0x and 0d - see prefix.c 3976116Sdcs\ 4076116Sdcs\ : __tempbase { newbase | oldbase -- } 4176116Sdcs\ base @ to oldbase 4276116Sdcs\ newbase base ! 4376116Sdcs\ 0 0 parse-word >number 2drop drop 4476116Sdcs\ oldbase base ! 4576116Sdcs\ ; 4676116Sdcs 4776116Sdcs: 0b 2 __tempbase ; immediate 4876116Sdcs 4976116Sdcs: 0o 8 __tempbase ; immediate 5076116Sdcs 5176116Sdcs\ : 0d 10 __tempbase ; immediate 5276116Sdcs\ "0d" add-prefix 5376116Sdcs 5476116Sdcs\ : 0x 16 __tempbase ; immediate 5576116Sdcs\ "0x" add-prefix 5676116Sdcs 5776116Sdcsend-prefixes 5876116Sdcs 5976116Sdcs\ #endif 60