interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / evidence / allen-omega-L694 / L758 / legacy-oracle-collection.txt

35 lines · 2915 bytes Raw Blame History
1# External collection of unmodified legacy C oracle bytes, never Omega runtime.
2from pathlib import Path
3import ctypes as C, hashlib, json, re, struct, subprocess
4h=Path.home(); w=h/'workspace/aienos-allen-omega-L694'; d=h/'handoffs/allen-omega-L694/L758'; p=w/'native/kernel/ui'
5source=(p/'allen_font.c').read_text(); data=(w/'native/omega/allen/font-data.om').read_text()
6block=source.split('glyphs[CK_AF_COUNT] = {',1)[1].split('};',1)[0]
7glyphs=re.findall(r'/\*[^\n]*?\*/\s*"([^"\n]*)"',block)
8omega=re.search(r'text Afdata "(.*)"',data).group(1).split('|')[:-1]
9if len(glyphs)!=95 or glyphs!=omega: raise RuntimeError('glyph design transcription mismatch')
10sine=source.split('sin_q[91] = {',1)[1].split('};',1)[0]
11a=[int(x) for x in re.findall(r'\d+',sine)]
12b=[int(x) for x in re.search(r'text Afsines "(.*)"',data).group(1).split()]
13if len(a)!=91 or a!=b: raise RuntimeError('sine transcription mismatch')
14lib=d/'legacy-font-reference.so'
15subprocess.run(['cc','-shared','-fPIC','-O2',str(p/'allen_font.c'),'-o',str(lib)],check=True)
16class Glyph(C.Structure):
17 _fields_=[('alpha',C.POINTER(C.c_uint8)),('w',C.c_uint16),('h',C.c_uint16),('ox',C.c_int16),('oy',C.c_int16)]
18class Face(C.Structure):
19 _fields_=[('s256',C.c_uint32),('hw256',C.c_uint32),('pool',C.POINTER(C.c_uint8)),('pool_len',C.c_size_t),('pool_used',C.c_size_t),('g',Glyph*95)]
20f=C.CDLL(str(lib)); f.ck_af_face_init.argtypes=[C.POINTER(Face),C.c_uint,C.c_uint,C.POINTER(C.c_uint8),C.c_size_t]
21f.ck_af_glyph_get.argtypes=[C.POINTER(Face),C.c_char]; f.ck_af_glyph_get.restype=C.POINTER(Glyph)
22f.ck_af_advance.argtypes=[C.POINTER(Face),C.c_char]; f.ck_af_advance.restype=C.c_uint32
23count=0
24with (d/'legacy-font.bin').open('wb') as out:
25 for cap,wt in [(14,900),(30,1250),(64,2500)]:
26 face=Face(); pool=(C.c_uint8*(4<<20))(); f.ck_af_face_init(C.byref(face),cap,wt,pool,len(pool))
27 for code in [*range(32,127),0,127,255]:
28 c=bytes([code]); g=f.ck_af_glyph_get(C.byref(face),c)
29 if not g: raise RuntimeError('reference pool unexpectedly full')
30 g=g.contents; adv=f.ck_af_advance(C.byref(face),c)
31 out.write(struct.pack('<5Q2qQ',cap,wt,code,g.w,g.h,g.ox,g.oy,adv))
32 if g.w*g.h: out.write(C.string_at(g.alpha,g.w*g.h))
33 count+=1
34manifest={'reference_only':True,'records':count,'glyph_designs':len(glyphs),'sine_samples':len(a),'source_sha256':hashlib.sha256((p/'allen_font.c').read_bytes()).hexdigest(),'reference_sha256':hashlib.sha256((d/'legacy-font.bin').read_bytes()).hexdigest(),'reference_bytes':(d/'legacy-font.bin').stat().st_size,'command':'cc -shared -fPIC -O2 native/kernel/ui/allen_font.c -o <private>/legacy-font-reference.so','scope':'Legacy external oracle only. Omega source/data handwritten; no foreign code in native construction/runtime.'}
35(d/'oracle.json').write_text(json.dumps(manifest,indent=2)+'\n'); print(json.dumps(manifest,indent=2))