aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-25 13:27:11 +0100
committereunhhu <[email protected]>2026-09-25 13:27:11 +0100
commitb4ec5eeaab82ee7c876f7d02e6430997f7240899 (patch)
treefbd5918bf22b925b16aea3eb8a4b2ab060100c10
parentc61aff54852d6f2fa63949950022e7a8ede1896c (diff)
downloadaup-b4ec5eeaab82ee7c876f7d02e6430997f7240899.tar.gz
aup-b4ec5eeaab82ee7c876f7d02e6430997f7240899.zip
Emit Pure module format v4
Pure now loads only v4 modules. The new header counts records, which aup does not declare yet, so the output changes only in its magic.
-rw-r--r--Makefile2
-rw-r--r--src/aup.h2
-rw-r--r--src/compile.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 25a4b7b..d1b1dca 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ CC ?= cc
CFLAGS ?= -O2 -g
CFLAGS += -std=c17 -Wall -Wextra -Wpedantic -Werror
BUILD ?= build
-# The Pure checkout that owns module format v1; tests load every module with it.
+# The Pure checkout that owns the module format; tests load every module with it.
PURE ?= ../pure/prototypes/connections
.PHONY: all check
diff --git a/src/aup.h b/src/aup.h
index aa48daf..75047af 100644
--- a/src/aup.h
+++ b/src/aup.h
@@ -3,7 +3,7 @@
#include <stdbool.h>
#include <stddef.h>
-/* aup v0a: source text to a Pure module v1 (Pure docs/design/008). */
+/* aup: source text to a Pure module (Pure docs/design/008-module-format.md). */
enum { AUP_SOURCE_LIMIT = 32768, AUP_MESSAGE = 160 };
typedef struct {
diff --git a/src/compile.c b/src/compile.c
index e95d16c..340e623 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
-/* Limits and opcodes of Pure module format v3. */
+/* Limits and opcodes of Pure module format v4. */
enum { STATES = 32, INPUTS = 32, VIEWS = 24, HANDLERS = 64, CODE = 512, STACK = 64, NAME = 32,
DEPTH = 64, FIELDS = 32, COLLECTIONS = 1, CONSTANTS = 64, CONSTANT_BYTES = 8192 };
enum { CONST, LOAD, DT, ADD, SUB, MUL, DIV, NEG, LT, LE, GT, GE, EQ, NE, AND, OR, NOT,
@@ -1175,7 +1175,7 @@ static void generate(Compiler *c, unsigned char **module, size_t *size) {
*size = 40 + 16u * c->states + 12u * c->collections + 16u * c->input_count + 8u * fields + 8u * c->constants +
16u * c->views + 12u * c->handler_count + 16u * c->code_count + used + c->constant_used;
unsigned char *p = *module = allocate(c, *size);
- memcpy(p, "PUREMOD3", 8);
+ memcpy(p, "PUREMOD4", 8);
put16(p + 8, c->states);
put16(p + 10, c->input_count);
put16(p + 12, c->views);