Fix Racket R6RS support

This commit is contained in:
retropikzel 2025-04-19 16:12:45 +03:00
parent 3e6d37c746
commit 8fb6592aa4
2 changed files with 7 additions and 4 deletions

View File

@ -36,8 +36,8 @@ test-r6rs:
mkdir -p test
mkdir -p test/snow
mkdir -p test/snow/foo
echo "(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > test/snow/foo/bar.sls
echo "(import (rnrs) (foo bar)) (baz)" > test/main.sps
printf "#!r6rs\n(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > test/snow/foo/bar.sls
printf "#!r6rs\n(import (rnrs) (foo bar)) (baz)" > test/main.sps
cd test && COMPILE_R7RS=${COMPILE_R7RS} compile-r7rs -I ./snow -o main main.sps
-cd test && ./main > /tmp/compile-r7rs-test-result.txt 2>&1
@grep "Test successfull" /tmp/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat /tmp/compile-r7rs-test-result.txt && exit 1)

View File

@ -417,6 +417,8 @@
(let ((rkt-input-file (if (string=? input-file "")
""
(change-file-suffix input-file ".rkt"))))
(if r6rs?
#t
(when (not (string=? rkt-input-file ""))
(when (file-exists? rkt-input-file)
(delete-file rkt-input-file))
@ -430,7 +432,7 @@
(display "(include \"")
(display (path->filename input-file))
(display "\")")
(newline))))
(newline)))))
(apply string-append
`("racket"
" "
@ -447,7 +449,8 @@
(string-append "-S " item " "))
append-directories)
" "
,(if r6rs? input-file rkt-input-file)))))))
,(if r6rs? input-file rkt-input-file)
))))))
(sagittarius
(type . interpreter)
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)