diff options
| author | 2026-10-14 15:52:01 +0330 | |
|---|---|---|
| committer | 2026-10-14 15:52:01 +0330 | |
| commit | 7c54e48bca711a6596be4bb17fcaa4330b9928e3 (patch) | |
| tree | fd426755976847e368fe298db1c7c757f58799b9 /src/tools/automap.sh | |
| parent | todo: record each agent's state at the end of the session and the merge order (diff) | |
line tables and backtraces: port agent/line-tables onto main, op 56 on the x86-64 jit, docs, measurements, tests; default genome reservation 0x68000
Diffstat (limited to 'src/tools/automap.sh')
| -rwxr-xr-x | src/tools/automap.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/automap.sh b/src/tools/automap.sh index ff559ac..b4aceb7 100755 --- a/src/tools/automap.sh +++ b/src/tools/automap.sh @@ -35,8 +35,18 @@ lay() { # $1 = genome slot, or empty for the preset's own $CC -O1 -w -fwrapv src/tools/zc0.c -I"$O/map" -Isrc/core -o "$ZC0" $CC -O1 -w -fwrapv src/tools/mkgenome.c -I"$O/map" -o "$O/.mkgenome" } +# the files after the map's own. a run-only image gets line tables for its program (so a fault +# prints a backtrace): zc0 reads the comment //:lines NAME as "from here on, file NAME, count +# its lines from the next one". the files under src/ are the runtime's and have none. +feed() { + local f + for f in "$@"; do + if [ "$P" = run ]; then case "$f" in src/*) ;; *) printf '\n//:lines %s\n' "$f" ;; esac; fi + cat "$f" + done +} build() { - if [ -f "$O/map/compiler.zc" ]; then cat "$O/map/rt.zc" src/core/core.zc "$O/map/compiler.zc" "$@"; else cat "$O/map/rt.zc" src/core/core.zc "$@"; fi | "$ZC0" > "$O/image.bin" + if [ -f "$O/map/compiler.zc" ]; then { cat "$O/map/rt.zc" src/core/core.zc "$O/map/compiler.zc"; feed "$@"; }; else { cat "$O/map/rt.zc" src/core/core.zc; feed "$@"; }; fi | "$ZC0" > "$O/image.bin" "$O/.mkgenome" < "$O/image.bin" > "$O/genome.bin" } # with DOCS=1 the genome is made again with zc0 built for docs (ZC0DOCS), so the @@ -44,7 +54,7 @@ build() { # docofs(). the image is the same code either way; the docs are stored after it. docs() { $CC -O1 -w -fwrapv -DZC0DOCS src/tools/zc0.c -I"$O/map" -Isrc/core -o "$O/.zc0docs" - if [ -f "$O/map/compiler.zc" ]; then cat "$O/map/rt.zc" src/core/core.zc "$O/map/compiler.zc" "$@"; else cat "$O/map/rt.zc" src/core/core.zc "$@"; fi | "$O/.zc0docs" > "$O/image.bin" + if [ -f "$O/map/compiler.zc" ]; then { cat "$O/map/rt.zc" src/core/core.zc "$O/map/compiler.zc"; feed "$@"; }; else { cat "$O/map/rt.zc" src/core/core.zc; feed "$@"; }; fi | "$O/.zc0docs" > "$O/image.bin" "$O/.mkgenome" < "$O/image.bin" > "$O/genome.bin" } len() { echo $(( $(wc -c < "$1") / 8 )); } |
