diff options
| author | 2026-10-14 09:09:21 +0330 | |
|---|---|---|
| committer | 2026-10-14 09:09:21 +0330 | |
| commit | dc7f7407e08f54e4a2a3c1d1723b2a7d6959532d (patch) | |
| tree | d1de9f471a99951c57896f85b5e5523eeb96cee1 /docs/history/07-zygote/code/mkgenome.c | |
| parent | todo: sync docs, examples and fixtures with the include format, and test acto... (diff) | |
docs: archive the frozen stage code as one compressed tarball
docs/history kept six stages with a full copy of the project under code/,
3.8 mb of sources duplicated from stage to stage and already superseded. store
them as docs/history/code-snapshots.tar.gz, 0.66 mb, and extract one in place
to read it. every stage's notes.md stays browsable, and the index says where the
code went and how to get it back.
the top-level README points at the archive too. its other two links into
docs/history, 21-micro and 35-bench, were notes that were never kept and do not
resolve; the index now records that.
Diffstat (limited to 'docs/history/07-zygote/code/mkgenome.c')
| -rw-r--r-- | docs/history/07-zygote/code/mkgenome.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/docs/history/07-zygote/code/mkgenome.c b/docs/history/07-zygote/code/mkgenome.c deleted file mode 100644 index 7d9f0bc..0000000 --- a/docs/history/07-zygote/code/mkgenome.c +++ /dev/null @@ -1,35 +0,0 @@ -/* assembles the genome at a fixed origin and writes it as a c header */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#define ORG 48000 -static char tok[30000][99]; -static int lab[30000], nt, img[17536], n; -static char *ops = "q@!$_~cjzr,?.+-*&|^><"; -static int val(char *s) -{ - int j; char *e; long v; - for (j = nt; j--;) if (tok[j][0] == ':' && !strcmp(tok[j] + 1, s)) return lab[j]; - v = strtol(s, &e, 0); - if (!*s || *e) { fprintf(stderr, "unknown label %s\n", s); exit(1); } - return (int)v; -} -static void put(int w) { if (n >= 17536) exit(1); img[n++] = w; } -int main(void) -{ - int pass, i; char *q, *c; - while (nt < 30000 && scanf("%98s", tok[nt]) == 1) nt++; - for (pass = 0; pass < 2; pass++) - for (n = i = 0; i < nt; i++) { - q = tok[i]; - if (*q == '"') while (*++q) put(*q); - else if (*q == ':') lab[i] = ORG + n; - else if (!q[1] && (c = strchr(ops, *q))) put((c - ops) * 2); - else if (*q == '#') put(pass ? val(q + 1) : 0); - else put(pass ? val(q) * 2 + 1 : 1); - } - printf("#define GORG %d\n#define GLEN %d\nstatic const int genome[] = {", ORG, n); - for (i = 0; i < n; i++) printf("%s%d", !i ? "\n" : i % 16 ? "," : ",\n", img[i]); - printf("\n};\n"); - return 0; -} |
