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/aien-train/blob/main/native/omegese45/translate/otio.om # aien-train AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / native / omegese45 / translate / otio.om` 85 lines ยท 1649 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note otio: byte I/O helpers shared by the #45 translator units (prefix ot). 3 note Output is collected in otob and written once by otflush, so a refusal 4 note never leaves a partial success line on stdout. Fixed texts are emitted 5 note by otfrag.om (concatenated after the tool file that defines otfr). 6 global otob uchar 8192 7 global otol ulong 1 8 global otin uchar 1024 9 global otinl ulong 1 10 global otdb uchar 24 11 12 note Read all of fd 0 into otin. Returns the byte count, -1 when the input 13 note does not fit (1024 bytes or more), -2 on a read error. Every pass adds 14 note at least one byte, so 1024 passes bound the loop. 15 fn otrdin to long 16 put otinl 0 0 17 n = ulong 0 18 while true bound 1025 19 if ge n 1024 20 ret neg long 1 21 end 22 k = read 0 otin n sub 1024 n 23 if lt k 0 24 ret neg long 2 25 end 26 if eq k 0 27 put otinl 0 n 28 ret long n 29 end 30 n = add n ulong k 31 end 32 ret neg long 2 33 end 34 35 fn otpb c uchar to void 36 o = get otol 0 37 put otob o c 38 put otol 0 add o 1 39 end 40 41 note Append decimal v. 42 fn otpdec v ulong to void 43 if eq v 0 44 otpb 48 45 ret 46 end 47 p = ulong 24 48 while gt v 0 bound 24 49 p = sub p 1 50 put otdb p uchar add 48 rem v 10 51 v = div v 10 52 end 53 while lt p 24 bound 24 54 otpb get otdb p 55 p = add p 1 56 end 57 end 58 59 note Append v as exactly nd lowercase hex digits (nd 1..16). 60 fn otphex v ulong nd ulong to void 61 i = nd 62 while gt i 0 bound 16 63 i = sub i 1 64 d = and shr v mul i 4 15 65 if lt d 10 66 otpb uchar add d 48 67 else 68 otpb uchar add d 87 69 end 70 end 71 end 72 73 note Write otob to fd 1. A short or failed write exits 2. 74 fn otflush to void 75 n = get otol 0 76 o = ulong 0 77 while lt o n bound 8193 78 w = write 1 otob o sub n o 79 if le w 0 80 exit 2 81 end 82 o = add o ulong w 83 end 84 put otol 0 0 85 end