Files
LithosAnanke/v4/include/v4/capsule.h
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 04:12:49 +00:00

41 lines
1.6 KiB
C

/* SPDX-License-Identifier: LicenseRef-Starship-1.0
* Copyright (c) 2023-2026 Robert A. James
*/
/* capsule.h -- a capsule of F18 code: what a neighbour writes to a node's
* port to put a programme into it and start it. docs/v4.0.0/MESH.md
* section 5.
*
* A node newly born has nothing in it and executes what arrives at its port
* (node.h). So a capsule of F18 code is not a format a node has to
* understand: it is the words themselves, in the order they are sent. For
* each stretch of memory that is not zero,
*
* @p a! @p push the node executes this from its port,
* address takes these two as its literals,
* count - 1
* @p !+ unext and then this: each word that follows is fetched
* the words ... from the port and stored
*
* and at the end
*
* jump start
*
* This is the F18's own way of loading a node through a port. Nothing here
* knows what the programme is: StarForth's system, as the machine's ROM
* assembled it, is one such capsule (what a node that is born is sent:
* tests/test_host_unit.c), and anything written for the node is another.
*/
#ifndef V4_CAPSULE_H
#define V4_CAPSULE_H
#include "v4/node.h"
/* Write the capsule that makes a node's memory what `n`'s is, and starts it
* at `start`: `out` is called with each word in turn. Words of `n` that
* are zero are not sent -- a node is born with its memory zero. Returns
* how many words were written. */
unsigned v4_capsule_write(const v4_node *n, v4_cell start,
void (*out)(void *self, v4_cell word), void *self);
#endif /* V4_CAPSULE_H */