-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathblock-051.fth
More file actions
32 lines (19 loc) · 915 Bytes
/
block-051.fth
File metadata and controls
32 lines (19 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
( Block 51 - More Blocks )
find blk-init loaded?
blk-read(blk--)blk-norm >t t@ blk-fn fopen-rb
?dupif0t> blk-clear exitthen( fn ." %n-r/%S-" )
>a t> blk-buf block-sz a@ fread drop a> fclose ;
blk-read-all(--)num-blocks for i blk-read next ;
blk-write(blk--)blk-norm >a a@ blk-dirty?if0adrop exitthen
a@ blk-buf >t a@ blk-fn fopen-wb ?dup fn ." %n-w/%S-"
if>r t@ block-sz r@ fwrite . r> fclosethenatdrop ;
blk-flush(--)num-blocks for i blk-write next ;
blk-rm(blk--)dup blk-fn fdelete blk-clear ;
blk-cp-buf(buf blk--)dup blk-dirty! blk-buf block-sz cmove ;
blk-cp(from to--)>t blk-buf t> blk-cp-buf blk-flush ;
blk-mv(from to--)over swap blk-cp blk-rm blk-flush ;
blk-ins(n to--)1+ >t >a
begint@- t@ swap blk-mv t@ a@ >whiletdrop a> blk-rm blk-flush ;
blk-load(blk--)blk-buf outer ;
blk-init(--)blk-clear-all blk-read-all ;
blk-init