v4 mkf18a: import nucleus NAME -- hash 0, the effect from the nucleus (task 4, part 1)

mkf18a takes nucleus=SYSDIR, assembles the nucleus as the ROM does and
looks NAME up by its dictionary name; a word in line there, or one with
no fixed effect, is refused (plan section 12, rulings 3 and 4).
test_mkf18a: 5 new checks failed first, 93 pass at both widths. Its
build now has the host node's size, as the tool's has: the nucleus did
not fit a mesh node's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 03:53:57 +00:00
parent 7cfcbf2b68
commit 0684cd8362
8 changed files with 128 additions and 6 deletions
+6 -3
View File
@@ -3,10 +3,11 @@
*/
/* mkf18a.c -- build a train's engine, its F18 artifact, off the node (f18a.h).
*
* mkf18a OUT.f18a MAP.f18 ROM DIR [TRAIN=PATH.f18a ...]
* mkf18a OUT.f18a MAP.f18 ROM DIR [TRAIN=PATH.f18a ...] [nucleus=SYSDIR]
*
* docs/v4.0.0/plans/2026-11-19-f18-artifact-build.md section 2. Built as mkrom is, one per cell width,
* with the node's size. DIR holds the train's .f18; each TRAIN=PATH is a train it may import from.
* with the node's size. DIR holds the train's .f18; each TRAIN=PATH is a train it may import from;
* nucleus=SYSDIR is the nucleus's source, for `import nucleus NAME` (plan section 12).
*/
#include "f18a.h"
#include <stdio.h>
@@ -27,15 +28,17 @@ int main(int argc, char **argv)
int i;
FILE *f;
if (argc < 5) { fprintf(stderr, "usage: mkf18a OUT.f18a MAP.f18 ROM DIR [TRAIN=PATH.f18a ...]\n"); return 2; }
if (argc < 5) { fprintf(stderr, "usage: mkf18a OUT.f18a MAP.f18 ROM DIR [TRAIN=PATH.f18a ...] [nucleus=SYSDIR]\n"); return 2; }
a.map = argv[2];
a.rom = argv[3];
a.dir = argv[4];
a.ntrains = 0;
a.nucleus = NULL;
for (i = 5; i < argc; i++) {
char *eq = strchr(argv[i], '=');
if (!eq || a.ntrains == 64) { fprintf(stderr, "mkf18a: not TRAIN=PATH: %s\n", argv[i]); return 2; }
*eq = 0;
if (strcmp(argv[i], "nucleus") == 0) { a.nucleus = eq + 1; continue; }
trains[a.ntrains].name = argv[i];
trains[a.ntrains].path = eq + 1;
a.ntrains++;