Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/host/tests/trunc.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / host / tests / trunc.om` 43 lines ยท 563 bytes Raw Blame History 1 note ftrunc: write 8 bytes, shorten to 4, rewind, read 4 then EOF; a closed descriptor is refused. 2 text p "trunc.tmp" 3 text body "abcdefgh" 4 fn main to int 5 fd = int fopen p 0 len p 578 420 6 if lt fd 0 7 ret 1 8 end 9 n = write fd body 0 len body 10 if ne n long len body 11 ret 2 12 end 13 r = ftrunc fd 4 14 if ne r 0 15 ret 3 16 end 17 r = fseek fd 0 0 18 if ne r 0 19 ret 4 20 end 21 buf = new uchar 8 0 22 n = read fd buf 0 8 23 if ne n 4 24 ret 5 25 end 26 m = read fd buf 0 8 27 if ne m 0 28 ret 6 29 end 30 r = fclose fd 31 if ne r 0 32 ret 7 33 end 34 r = ftrunc fd 0 35 if ge r 0 36 ret 8 37 end 38 r = unlink p 0 len p 39 if ne r 0 40 ret 9 41 end 42 ret 0 43 end