Asm gains the file I/O surface Python and C already had, unlocking 9/9 cells of the portal producer×consumer matrix (previously 6/9). asm: - (load "path") — mmaps file, swaps input source, loops scheme_read+eval, restores on exit. Nestable. Uses SYS_LSEEK + SYS_MUNMAP. - Output ports: (open-output-file), (close-port), (port?). Encoded as SPECIAL values ≥ 1000 (fd = (val>>3) − PORT_SPECIAL_BASE), no tag-bit expansion needed. - (display), (write), (newline) accept optional port arg; printer writes via output_fd global, swapped by port-aware builtins. - (write-file path content) / (file->string path) — bytes in/out. c, py: (write-file) / (file->string) added for parity. tests: 131 asm (up 23), 189 functional (up 8, shared py+c), tests/portal-cross-test.sh exercises 3×3 save×load matrix.
11 lines
550 B
Text
11 lines
550 B
Text
;;; portal-cross-load.lsp — load state written by another implementation
|
|
|
|
(load "/tmp/cross.sexp")
|
|
(display "loaded cross-int=") (display cross-int) (newline)
|
|
(display "loaded cross-list=") (display cross-list) (newline)
|
|
(display "loaded cross-str=") (display cross-str) (newline)
|
|
(display "loaded cross-fib=") (display cross-fib) (newline)
|
|
|
|
(if (and (= cross-int 777) (= cross-fib 6765) (= (length cross-list) 6))
|
|
(display "PASS: cross-impl S-expression portal round-trip\n")
|
|
(display "FAIL: cross-impl S-expression portal round-trip\n"))
|