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/aienux/blob/main/native/omega/allen/base.om # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. 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 `aienux / native / omega / allen / base.om` 102 lines ยท 1495 bytes Raw Blame History 1 note L694 fixed-buffer utilities. No platform effects in product functions. 2 global In uchar 8192 3 global Inlen ulong 1 4 global Outb uchar 8192 5 global Outlen ulong 1 6 global Err ulong 1 7 text Digits "`0123456789abcdef`" 8 fn emitb c uchar to void 9 n = get Outlen 0 10 if ge n len Outb 11 put Err 0 1 12 else 13 put Outb n c 14 put Outlen 0 add n 1 15 end 16 end 17 fn emitn v ulong to void 18 d = new uchar 20 0 19 n = ulong 0 20 x = v 21 put d n uchar add rem x 10 48 22 n = add n 1 23 x = div x 10 24 while gt x 0 25 put d n uchar add rem x 10 48 26 n = add n 1 27 x = div x 10 28 end 29 while gt n 0 30 n = sub n 1 31 emitb get d n 32 end 33 end 34 fn outreset to void 35 put Outlen 0 0 36 put Err 0 0 37 end 38 fn ineq at ulong c uchar to bool 39 if ge at get Inlen 0 40 ret false 41 end 42 ret eq get In at c 43 end 44 fn isdigit c uchar to bool 45 ret and ge c 48 le c 57 46 end 47 note Parser cursor P0, number P1, error P2. Never wraps a u32. 48 global P ulong 3 49 fn number to void 50 v = ulong 0 51 n = ulong 0 52 p = get P 0 53 while lt p get Inlen 0 54 c = get In p 55 if not isdigit c 56 put P 0 p 57 put P 1 v 58 if eq n 0 59 put P 2 1 60 end 61 ret 62 end 63 if or ge n 10 gt v `429496729` 64 put P 2 1 65 ret 66 end 67 v = add mul v 10 sub ulong c 48 68 if gt v `4294967295` 69 put P 2 1 70 ret 71 end 72 n = add n 1 73 p = add p 1 74 end 75 put P 0 p 76 put P 1 v 77 if eq n 0 78 put P 2 1 79 end 80 end 81 fn expect c uchar to void 82 p = get P 0 83 if not ineq p c 84 put P 2 1 85 else 86 put P 0 add p 1 87 end 88 end 89 fn crc off ulong count ulong to uint 90 c = uint `4294967295` 91 for i ulong count 92 c = xor c uint get In add off i 93 for k ulong 8 94 if ne and c 1 0 95 c = xor shr c 1 `3988292384` 96 else 97 c = shr c 1 98 end 99 end 100 end 101 ret not c 102 end