nx_xfile_struct_writer.nx source
↩ module page · 28 lines · 899 B
1// nx_safety_envelope:
2// intended_use: AUTO_APPLIED -- primitive-specific tuning queued
3// sil_target: SIL1
4// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail]
5// verdict: NOT_YET_EVALUATED
6
7import "nx_xfile_struct_types.nx"
8
9// Mirror of ir.nx's ir_add_global_string pattern: cast a raw byte
10// region to *G, then write fields by name. If the C anchor assigns
11// G's fields the same offsets here as in main, the reader sees what
12// we wrote.
13func xfile_writer_fill(base: i64, n: i64) -> i64 {
14 var i: i64 = 0
15 while i < n {
16 let g: *G = (base + i * 80) as *G
17 g.id = i
18 g.name_bytes = 0 as *u8
19 g.name_len = 100 + i
20 g.bytes = 0 as *u8
21 g.len = 200 + i
22 g.is_string = 0
23 g.zero_init = 0
24 g.writable = 0
25 i = i + 1
26 }
27 return 0
28}