Changeset ff980cb6d9294b1f1ade981ddeed99c34c534c41
Commiter: Charles Childers
Author: Charles Childers
Parent: fb05358b51
(2010/04/03 21:10) About 2 years ago
start using prefixes in the libraries
Commiter: Charles Childers
Author: Charles Childers
Parent: fb05358b51
(2010/04/03 21:10) About 2 years ago
start using prefixes in the libraries
{{: :create ( $- ): keep-here ( $- )here @last , !last ( field: link )( $-$a$ ) here over&.data , ( field: class )( $a$-$an ) getLengthhere push 0 , ( field: xt )( $an-$an ) dup allothere over getLength ( field: name )( $an- ) copy 0 , ;dup zallot copy 0 ,---reveal---here pop ! ( patch xt field ) ;: :create ( $- )( $-$a - ) here( $-$ - ) last dup @ , !( $-$ - ) ['] .data ,( $-$ -$) here push 0 ,( $- $-$) keep-here( - $- ) here pop ! ;}}: seal ( "- ) ' drop 0 which @ ! ;: seal ( "- ) ' 0; drop 0 @which ! ;{{{{: esc: ( $- ) create 32 accept tib keepString last @ d->xt ! ['] .esc reclass ;: esc: ( $- ) create 32 accept tib keepString @last d->xt ! &.esc reclass ;{{{{: save ( -n ) blk @ 0 blk ! ;: save ( -n ) @blk 0 !blk ;: restore ( n- ) blk ! ;: restore ( n- ) !blk ;: list ( - ) cr #-blocks @ fori .line blk ++ nexti ;: list ( - ) cr @#-blocks fori .line blk ++ nexti ;: load ( n- ) blk @ push s e pop blk ! v ;: load ( n- ) @blk push s e pop !blk v ;{{{{: range ( h-ahn ) #-blocks @ 512 * ;: range ( h-ahn ) @#-blocks 512 * ;: saveBlocks ( - ) offset @ s" blocks.txt" :w fopen range for write next fclose 2drop ;: saveBlocks ( - ) @offset s" blocks.txt" :w fopen range for write next fclose 2drop ;: readBlocks ( - ) s" blocks.txt" :r fopen offset @ range for read next drop fclose drop ;: readBlocks ( - ) s" blocks.txt" :r fopen @offset range for read next drop fclose drop ;: uncycle? n @ 1 <if 6 ;then n @ 1- ;: uncycle? @n 1 <if 6 ;then @n 1- ;: cycle? n @ 6 >if 0 n ! then n @ dup 1+ n ! ;: cycle? @n 6 >if 0 !n then @n n ++ ;: >task ( a- ) n @ task-addr ! 1 n +! n @ 6 =if 0 n ! then ;: >task ( a- ) @n task-addr ! n ++ @n 6 =if 0 !n then ;{{0 n ! last repeat @ 0; dup d->name type 32 emit n ++ again ;0 !n last repeat @ 0; dup d->name type 32 emit n ++ again ;here is words ] w cr n @ . cr ;here is words ] w cr @n . cr ;{{{{: handle dup d->name over d->class @ myclass @ =if type space else drop then ;: handle dup d->name over d->class @ @myclass =if type space else drop then ;: (words) last swap myclass ! repeat @ handle 0; again ;: (words) last swap !myclass repeat @ handle 0; again ;: .vocabs ( - ) words-of .vocab ;: .words ( - ) words-of .word ;: .macros ( - ) words-of .macro ;: .primitives ( - ) words-of .primitive ;: .datas ( - ) words-of .data ;{{{{: begin ' op ! ;: begin ' !op ;: end? last @ d->name s" |" compare ;: end? @last d->name s" |" compare ;: update dup last @ d->xt ! op @ execute ;: update dup @last d->xt ! @op execute ;: cleanup last @ heap ! drop last @ @ last ! ;: cleanup @last heap ! drop @last @ !last ;