1afc2ba1dSToomas Soome\ **
2afc2ba1dSToomas Soome\ ** Prefix words for ficl
3afc2ba1dSToomas Soome\ ** submitted by Larry Hastings, larry@hastings.org
4afc2ba1dSToomas Soome\ **
5afc2ba1dSToomas Soome\ (jws) To make a prefix, simply create a new definition in the <prefixes>
6afc2ba1dSToomas Soome\ wordlist. start-prefixes and end-prefixes handle the bookkeeping
7afc2ba1dSToomas Soome
8afc2ba1dSToomas Soomevariable save-current
9afc2ba1dSToomas Soome
10afc2ba1dSToomas Soome: start-prefixes   get-current save-current ! <prefixes> set-current ;
11afc2ba1dSToomas Soome: end-prefixes     save-current @ set-current ;
12afc2ba1dSToomas Soome: show-prefixes    <prefixes> >search  words  search> drop ;
13afc2ba1dSToomas Soome
14afc2ba1dSToomas Soomestart-prefixes
15afc2ba1dSToomas Soome
16afc2ba1dSToomas SoomeS" FICL_WANT_EXTENDED_PREFIX" ENVIRONMENT? drop [if]
17afc2ba1dSToomas Soome
18afc2ba1dSToomas Soome\ define " (double-quote) as an alias for s", and make it a prefix
19afc2ba1dSToomas Soome: " postpone s" ; immediate
20afc2ba1dSToomas Soome
21afc2ba1dSToomas Soome
22afc2ba1dSToomas Soome\ make .( a prefix (we just create an alias for it in the prefixes list)
23afc2ba1dSToomas Soome: .( postpone .( ; immediate
24afc2ba1dSToomas Soome
25afc2ba1dSToomas Soome
26afc2ba1dSToomas Soome\ make \ a prefix, and add // (same thing) as a prefix too
27afc2ba1dSToomas Soome: \ postpone \ ; immediate
28afc2ba1dSToomas Soome: // postpone \ ; immediate
29afc2ba1dSToomas Soome
30afc2ba1dSToomas Soome
31*152e3753SToomas Soome\ ** add 0b, 0o, 0d, 0x and $ as prefixes
32afc2ba1dSToomas Soome\ ** these temporarily shift the base to 2, 8, 10, and 16 respectively
33afc2ba1dSToomas Soome\ ** and consume the next number in the input stream, pushing/compiling
34afc2ba1dSToomas Soome\ ** as normal
35afc2ba1dSToomas Soome\ **
36afc2ba1dSToomas Soome\ ** __tempbase is precompiled, see prefix.c
37afc2ba1dSToomas Soome
38afc2ba1dSToomas Soome: 0b  2 __tempbase ; immediate
39afc2ba1dSToomas Soome: 0o  8 __tempbase ; immediate
40afc2ba1dSToomas Soome
41afc2ba1dSToomas Soome[endif]
42afc2ba1dSToomas Soome
43afc2ba1dSToomas Soome: 0d 10 __tempbase ; immediate
44afc2ba1dSToomas Soome: 0x 16 __tempbase ; immediate
45*152e3753SToomas Soome: $ 16 __tempbase ; immediate
46afc2ba1dSToomas Soome
47afc2ba1dSToomas Soomeend-prefixes