The artifact's layout and its check (artifact.h, artifact.c), the tool (tools/f18a.c, mkf18a.c) and make -C v4 artifacts. test_mkf18a, 83 checks at both widths, failed against a stub first. Gates: test, test-32 and sanitize pass, POST 990/990. Plan section 11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
47 lines
2.4 KiB
C
47 lines
2.4 KiB
C
/* SPDX-License-Identifier: LicenseRef-Starship-1.0
|
|
* Copyright (c) 2023-2026 Robert A. James
|
|
*/
|
|
/* f18a.h -- build a train's engine, its F18 artifact, on the build machine (mkf18a).
|
|
*
|
|
* docs/v4.0.0/plans/2026-11-19-f18-artifact-build.md section 2 and section 10. Every .f18 in the train's
|
|
* directory is assembled by text.c, at 0, in name order, after the map; then:
|
|
* - every : word with a fixed stack effect (effect.c) is an export, with the flags and the capabilities
|
|
* written after its name;
|
|
* - every `import TRAIN NAME` is an import of TRAIN's export NAME: TRAIN is given as an artifact, whose
|
|
* capsule ID (the XXHash64 of its bytes, as mkcapsule gives it) names it, and whose export gives the
|
|
* effects expected;
|
|
* - every address text.c records is a relocation;
|
|
* - the provenance's four SHA-512 hashes, each over files framed as: the file's name, a NUL, its length
|
|
* in 8 bytes low first, its bytes. The source: the train's .f18, in name order. The tool: its own
|
|
* source (tools/mkf18a.c, tools/f18a.c, tools/f18a.h, src/artifact.c, src/asm.c, src/effect.c,
|
|
* src/iword.c, src/text.c, then every .h of include/v4 in name order), named from the v4 directory.
|
|
* The configuration: the text "V4_CELL_BITS=.. V4_NODE_WORDS=.. V4_DATA_RING=.. V4_RET_RING=..
|
|
* V4_ROM_WORDS=..", framed as "config", then the map. The ROM: the ROM's file as given.
|
|
* It refuses what the ABI cannot carry: a header, a store or a start in the source; an export's name
|
|
* over 31 characters; a port or a request it can see that the word does not declare, or one declared by
|
|
* a word it calls.
|
|
*/
|
|
#ifndef V4_TOOLS_F18A_H
|
|
#define V4_TOOLS_F18A_H
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef struct {
|
|
const char *name; /* as `import` names it */
|
|
const char *path; /* its .f18a */
|
|
} f18a_train;
|
|
|
|
typedef struct {
|
|
const char *map; /* the memory map's constants: map-<width>.f18 */
|
|
const char *dir; /* the train's .f18 */
|
|
const char *rom; /* the ROM it is built against */
|
|
const f18a_train *trains; /* the trains it may import from */
|
|
unsigned ntrains;
|
|
const char *tool_root; /* the v4 directory, for the tool's hash */
|
|
} f18a_args;
|
|
|
|
/* 1 and the artifact in *out (malloc'd, *len bytes), or 0 and why in err. */
|
|
int f18a_build(const f18a_args *a, unsigned char **out, size_t *len, char *err, size_t errlen);
|
|
|
|
#endif /* V4_TOOLS_F18A_H */
|