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/aienux/allen/look-chat.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 / aienux / allen / look-chat.om` 142 lines ยท 2976 bytes Raw Blame History 1 note SPDX-License-Identifier: MIT 2 note COURIER lane: Allen's courier to the Spark relay over UDP 47033, the Omega 3 note build's x86/courier_udp_x86.c. application.om (appinit, appask, apppoll, 4 note appsent, appreceive) already speaks the courier wire; this module binds its 5 note datagrams to net.om's netudpsend/Chrx hooks and the typed line to appask. 6 note Needs base, runtime, code, courier, scheduler, memory, intent, reply, 7 note context, application (gate.sh core list) and net.om before it in the unit. 8 note Ch: 0 initialized, 1 last event, 2 datagrams out, 3 datagrams in, 9 note 4 refused sends, 5 answers taken, 6 run id, 7 dropped-at-receive seen. 10 note Chevent after chstep: 0 nothing, 1 answer visible in Chsay, 2 asked AGAIN, 11 note 3 gave up, 4 refused, 5 slow notice, 6 silence (application.om A2). 12 global Ch ulong 8 13 global Chsay uchar 320 14 global Chsayn ulong 1 15 global Chevent ulong 1 16 note Run id like the C kernel: the clock at start mixed with the MAC, never 0. 17 fn chrun now ulong to ulong 18 run = now 19 for i ulong 6 20 run = xor run shl ulong get Nmac i mul 8 add i 2 21 end 22 if eq run 0 23 run = 1 24 end 25 ret run 26 end 27 note Refused (false, nothing touched) while application.om is still active. 28 fn chinit now ulong run ulong to bool 29 if eq run 0 30 run = chrun now 31 end 32 if not appinit run now 33 ret false 34 end 35 for i ulong 8 36 put Ch i 0 37 end 38 put Chsayn 0 0 39 put Chevent 0 0 40 put Chrxn 0 0 41 put Chdrop 0 0 42 put Ch 0 1 43 put Ch 6 run 44 ret true 45 end 46 note The typed request is platform.om's Dprm[0..Dprmn); appask copies and 47 note validates it (1..159 printable bytes). Dprmn is left for the caller. 48 fn chask now ulong to bool 49 if eq get Ch 0 0 50 ret false 51 end 52 n = get Dprmn 0 53 if gt n len Dprm 54 ret false 55 end 56 for i ulong n 57 put In i get Dprm i 58 end 59 put Inlen 0 n 60 ret appask now 61 end 62 fn chbusy to bool 63 if eq get Ch 0 0 64 ret false 65 end 66 ret or ne get R 1 0 ne get A 1 0 67 end 68 fn chcancel to void 69 if eq get Ch 0 0 70 ret 71 end 72 appcancel 73 put Chevent 0 0 74 end 75 fn chsay to void 76 n = get R 8 77 if gt n len Chsay 78 n = len Chsay 79 end 80 for i ulong n 81 put Chsay i get Answer i 82 end 83 put Chsayn 0 n 84 put Ch 5 add get Ch 5 1 85 end 86 fn chevent to void 87 e = get A 2 88 if eq e 0 89 ret 90 end 91 put Chevent 0 e 92 put Ch 1 e 93 if eq e 1 94 chsay 95 end 96 end 97 fn chtake now ulong to void 98 n = get Chrxn 0 99 put Chrxn 0 0 100 put Ch 3 add get Ch 3 1 101 put Ch 7 get Chdrop 0 102 for i ulong n 103 put In i get Chrx i 104 end 105 put Inlen 0 n 106 if appreceive now 107 chevent 108 end 109 end 110 fn chsend now ulong to void 111 n = get Outlen 0 112 ok = false 113 if and ne n 0 le n len Chtx 114 for i ulong n 115 put Chtx i get Outb i 116 end 117 ok = netudpsend n 118 end 119 if ok 120 put Ch 2 add get Ch 2 1 121 else 122 put Ch 4 add get Ch 4 1 123 end 124 ok = appsent now ok 125 end 126 note One step of the courier, like the C pump: take the datagram waiting in 127 note Chrx, then let the scheduler offer HELLO/JOB/GOT and send it. up is the 128 note firmware's network-up flag (Es 6). Chevent reports this step's event. 129 fn chstep now ulong up bool to void 130 put Chevent 0 0 131 if eq get Ch 0 0 132 ret 133 end 134 if ne get Chrxn 0 0 135 chtake now 136 end 137 off = apppoll now up 138 chevent 139 if off 140 chsend now 141 end 142 end