feat(v4.0.0): POST's cases as a table the kernel holds

mkpost.py writes v4/system/post_cases.c where it wrote the capsule: for
each case its name, its lines, and what it must do -- end in an error, or
leave v3's stack and print v3's output, which is now held in full where
the capsule held its length and a checksum.

The same 538 cases: checked against capsules/v4/post79.4th case by case --
names, lines, stacks, and the length and checksum of each output -- with
no difference.  The capsule is still what the boot runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-07 10:34:03 -04:00
co-authored by Claude Opus 5.5
parent b04ae55ec5
commit c2f4b9808a
4 changed files with 1190 additions and 126 deletions
+32
View File
@@ -0,0 +1,32 @@
/* post.h -- POST, which is the kernel's. docs/v4.0.0/NUCLEUS.md section 6.
*
* As in v3, the kernel holds the cases and runs them on the node: nothing
* of POST is in the node's dictionary. A case is a name, its lines of
* FORTH, and what it must do. The table is generated from v3's own cases
* (v4/tools/mkpost.py -> v4/system/post_cases.c).
*/
#ifndef V4_POST_H
#define V4_POST_H
#include "v4/node.h"
#define V4_POST_STACK 0 /* its data stack and what it prints are compared */
#define V4_POST_DEPTH 1 /* only how many values it leaves; what it prints is not compared */
#define V4_POST_DEPTH_OUTPUT 2 /* how many values it leaves, and what it prints */
#define V4_POST_ERROR 3 /* it must end in an error; nothing else is compared */
typedef struct {
const char *name;
const char *const *lines; /* line_count of them, sent one at a time */
unsigned line_count;
int expect; /* V4_POST_* */
const long long *stack; /* V4_POST_STACK: depth values, the deepest first; else 0 */
unsigned depth;
const char *output; /* output_len characters */
unsigned output_len;
} v4_post_case;
extern const v4_post_case v4_post_cases[];
extern const unsigned v4_post_case_count;
#endif /* V4_POST_H */