1 \ ** ficl/softwords/softcore.fr
2 \ ** FICL soft extensions
3 \ ** John Sadler (john_sadler@alum.mit.edu)
6 S" FICL_WANT_USER" ENVIRONMENT? drop [if]
7 \ ** Ficl USER variables
8 \ ** See words.c for primitive def'n of USER
9 variable nUser 0 nUser !
11 nUser dup @ user 1 swap +! ;
17 S" FICL_WANT_LOCALS" ENVIRONMENT? drop [if]
19 \ ** LOCAL EXT word set
21 : locals| ( name...name | -- )
24 dup 0= abort" where's the delimiter??"
29 repeat 2drop 0 0 (local)
32 : local ( name -- ) bl word count (local) ; immediate
34 : 2local ( name -- ) bl word count (2local) ; immediate
36 : end-locals ( -- ) 0 0 (local) ; immediate
40 : strdup ( c-addr length -- c-addr2 length2 ior )
41 0 locals| addr2 length c-addr | end-locals
45 c-addr addr2 length move
52 : strcat ( 2:a 2:b -- 2:new-a )
53 0 locals| b-length b-u b-addr a-u a-addr | end-locals
55 b-addr a-addr a-u + b-length move
59 : strcpy ( 2:a 2:b -- 2:new-a )
60 locals| b-u b-addr a-u a-addr | end-locals
61 a-addr 0 b-addr b-u strcat
67 dup $80 u< if emit exit then \ special case ASCII
70 2/ >r dup $3F and $80 or swap 6 rshift r>
72 begin dup $80 u< 0= while emit repeat drop