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/tests/universal/osc_probe.c # 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 / tests / universal / osc_probe.c` 48 lines ยท 1788 bytes Raw Blame History 1 /* Test-only adapter to unchanged OSC APIs. Never a production compiler. */ 2 #include 3 #include 4 #include 5 #include 6 #include "osc_front.h" 7 #include "osc_interp.h" 8 #include "osc_native.h" 9 #include "osc_cg.h" 10 int main(int argc, char **argv) { 11 if (argc != 2) return 2; 12 FILE *f = fopen(argv[1], "rb"); 13 if (!f) return 2; 14 char src[4096]; size_t n = fread(src, 1, sizeof src, f); 15 int bad = ferror(f) || !feof(f); fclose(f); 16 if (bad) return 2; 17 OscUnit *u = calloc(1, sizeof *u); 18 OscRt *rt = calloc(1, sizeof *rt); 19 if (!u || !rt) return 2; 20 OscDiag diag; 21 if (osc_compile(src, n, u, &diag, NULL)) { 22 fprintf(stderr, "OSC compile: %s\n", diag.message); return 3; 23 } 24 OscCode code = {0}; char err[256]; 25 if (osc_cg_compile(u, &code, err, sizeof err)) return 4; 26 OscNative native; 27 if (osc_native_map(&native, code.code, code.len)) { 28 fprintf(stderr, "native unavailable: requires executable AArch64 mapping\n"); return 5; 29 } 30 uint64_t args[2]; 31 while (scanf("%" SCNu64 " %" SCNu64, args, args+1) == 2) { 32 for (unsigned k = 0; k < 4; ++k) { 33 uint64_t ref = 0, got = 0; 34 osc_rt_init(rt); 35 int tr = osc_interp_run(u, (int)k, args, 2, rt, &ref); 36 osc_rt_init(rt); 37 int tn = osc_native_call(u, (int)k, &native, code.entry[k], rt, args, 2, &got); 38 if (tr || tn || ref != got) { 39 fprintf(stderr, "OSC mismatch fn=%u reftrap=%d nativetrap=%d\n", k,tr,tn); return 6; 40 } 41 printf("%s%" PRIu64, k ? " " : "", ref); 42 } 43 puts(""); 44 } 45 int status = ferror(stdin) ? 7 : 0; 46 osc_native_unmap(&native); osc_cg_free(&code); free(rt); free(u); 47 return status; 48 }