nx_archive.nx
buildroot/runtime/nx_archive.nx
about
nx_archive.nx -- BSD-format ar(1) static library builder.
Replaces `ar rcs libfoo.a *.o`. Useful for shipping reusable
NishiLang code as a single linkable artifact.
AR format (System V variant; also BSD-compatible):
"!<arch>\n" 8 bytes -- magic
one or more entries:
[name (16 bytes, space-padded, ends with '/')]
[date (12 bytes ASCII decimal seconds-since-epoch)]
[uid (6 bytes ASCII decimal)]
[gid (6 bytes ASCII decimal)]
[mode (8 bytes ASCII octal)]
[size (10 bytes ASCII decimal)]
[magic (2 bytes "`\n")]
[data (size bytes)]
[pad (1 byte if size is odd -- "\n")]
Total per entry: 60-byte header + data + optional pad. Names
longer than 15 chars use the "//" extended-name table (BSD/SysV
convention), which we DEFER to v0.0.2 -- v0.0.1 names must be
≤ 15 chars + a single trailing '/'.
Pairs with nx_elf_writer (produces objects), nx_elf_read +
nx_objdump (inspect), nxld (linker that consumes archives).
dependencies 1 imports · 0 importers
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 47 | struct NxAr |
consts
| 35 | const NX_MAGIC_4096: i64 = 4096 |
| 39 | const NX_AR_HEADER_BYTES: i64 = 60 |
| 40 | const NX_AR_NAME_BYTES: i64 = 16 |
| 41 | const NX_AR_DATE_BYTES: i64 = 12 |
| 42 | const NX_AR_UID_BYTES: i64 = 6 |
| 43 | const NX_AR_GID_BYTES: i64 = 6 |
| 44 | const NX_AR_MODE_BYTES: i64 = 8 |
| 45 | const NX_AR_SIZE_BYTES: i64 = 10 |
| 54 | const NX_AR_BYTES: i64 = 32 |
functions
| 60 | func nx_ar_pad_dec(dst: *u8, off: i64, width: i64, v: i64) -> i64 called by 1: nx_ar_add |
| 89 | func nx_ar_pad_name(dst: *u8, off: i64, name: *u8) -> i64 called by 1: nx_ar_add |
| 116 | func nx_ar_new(cap: i64) -> *NxAr called by 1: main |
| 137 | func nx_ar_add(a: *NxAr, name: *u8, data: *u8, size: i64) -> i64 |
| 173 | func nx_ar_size(a: *NxAr) -> i64 { return a.used } called by 1: main |
| 174 | func nx_ar_count(a: *NxAr) -> i64 { return a.n } called by 1: main |
| 175 | func nx_ar_bytes(a: *NxAr) -> *u8 { return a.buf } |
| 179 | func main() -> i64 |