R6RS Fixes

This commit is contained in:
retropikzel 2026-01-26 19:25:32 +02:00
parent c7dddc4a44
commit a12b46315f
5 changed files with 20 additions and 20 deletions

View File

@ -25,5 +25,4 @@ COPY test.sps .
COPY compile-test.scm . COPY compile-test.scm .
COPY compile-test.sps . COPY compile-test.sps .
COPY scheme-venv . COPY scheme-venv .
ENV SCHEME_VENV_DEBUG=true

View File

@ -10,17 +10,15 @@ test-r6rs-script:
@echo "Starting test Scheme: ${SCHEME}, RNRS: R6RS" @echo "Starting test Scheme: ${SCHEME}, RNRS: R6RS"
@rm -rf testvenv/ \ @rm -rf testvenv/ \
&& ./scheme-venv ${SCHEME} r6rs testvenv \ && ./scheme-venv ${SCHEME} r6rs testvenv \
&& ./testvenv/bin/snow-chibi install --always-yes retropikzel.hello \
&& ./testvenv/bin/akku install chez-srfi \ && ./testvenv/bin/akku install chez-srfi \
&& SCHEME_VENV_DEBUG=1 ./testvenv/bin/scheme-script test.sps && ./testvenv/bin/scheme-script test.sps
test-r6rs-compile: test-r6rs-compile:
@echo "Starting test Scheme: ${SCHEME}, RNRS: R6RS" @echo "Starting test Scheme: ${SCHEME}, RNRS: R6RS"
@rm -rf testvenv/ \ @rm -rf testvenv/ \
&& ./scheme-venv ${SCHEME} r6rs testvenv \ && ./scheme-venv ${SCHEME} r6rs testvenv \
&& ./testvenv/bin/snow-chibi install --always-yes retropikzel.hello \
&& ./testvenv/bin/akku install chez-srfi \ && ./testvenv/bin/akku install chez-srfi \
&& SCHEME_VENV_DEBUG=1 ./testvenv/bin/scheme-compile compile-test.sps \ && ./testvenv/bin/scheme-compile compile-test.sps srfi.64 \
&& ./compile-test && ./compile-test
test-r7rs-script: test-r7rs-script:
@ -28,14 +26,14 @@ test-r7rs-script:
@rm -rf testvenv/ \ @rm -rf testvenv/ \
&& ./scheme-venv ${SCHEME} r7rs testvenv \ && ./scheme-venv ${SCHEME} r7rs testvenv \
&& ./testvenv/bin/snow-chibi install --always-yes retropikzel.hello srfi.64 \ && ./testvenv/bin/snow-chibi install --always-yes retropikzel.hello srfi.64 \
&& SCHEME_VENV_DEBUG=1 ./testvenv/bin/scheme-script test.scm && ./testvenv/bin/scheme-script test.scm
test-r7rs-compile: test-r7rs-compile:
@echo "Starting test Scheme: ${SCHEME}, RNRS: R7RS" @echo "Starting test Scheme: ${SCHEME}, RNRS: R7RS"
@rm -rf testvenv/ \ @rm -rf testvenv/ \
&& ./scheme-venv ${SCHEME} r7rs testvenv \ && ./scheme-venv ${SCHEME} r7rs testvenv \
&& ./testvenv/bin/snow-chibi install --always-yes retropikzel.hello srfi.64 \ && ./testvenv/bin/snow-chibi install --always-yes retropikzel.hello \
&& SCHEME_VENV_DEBUG=1 ./testvenv/bin/scheme-compile compile-test.scm \ && ./testvenv/bin/scheme-compile compile-test.scm \
&& ./compile-test && ./compile-test
build-test-docker-image: build-test-docker-image:

View File

@ -1,8 +1,7 @@
(import (scheme base) (import (scheme base)
(scheme write) (scheme write)
(scheme process-context) (scheme process-context)
(retropikzel hello) (retropikzel hello))
(srfi 64))
(display "scheme-venv-compile-test-success-") (display "scheme-venv-compile-test-success-")
(hello) (hello)

View File

@ -74,6 +74,7 @@ if [ "${rnrs}" = "r6rs" ]; then
{ {
cat << EOF cat << EOF
#!/bin/sh #!/bin/sh
echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
if [ "\${1}" = "install" ]; then if [ "\${1}" = "install" ]; then
shift shift
PATH="${PATH}" $(which snow-chibi) install \ PATH="${PATH}" $(which snow-chibi) install \
@ -93,6 +94,7 @@ else
{ {
cat << EOF cat << EOF
#!/bin/sh #!/bin/sh
echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
if [ "\${1}" = "install" ]; then if [ "\${1}" = "install" ]; then
shift shift
PATH="${PATH}" $(which snow-chibi) install \ PATH="${PATH}" $(which snow-chibi) install \
@ -113,6 +115,7 @@ fi
{ {
cat << EOF cat << EOF
#!/bin/sh #!/bin/sh
echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
cd "${venvpath}/lib" cd "${venvpath}/lib"
$(which akku) update $(which akku) update
$(which akku) "\$@" $(which akku) "\$@"
@ -123,6 +126,7 @@ chmod +x "${venvpath}/bin/akku"
## bin/activate ## bin/activate
{ {
cat << EOF cat << EOF
echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
deactivate () { deactivate () {
unset SCHEME unset SCHEME
unset COMPILE_R7RS unset COMPILE_R7RS
@ -172,7 +176,7 @@ if [ "${rnrs}" = "r6rs" ]; then
fi fi
;; ;;
"guile") "guile")
scheme_cmd="guile --r6rs -L \"${venvpath}/lib/.akku/lib\" \"\${IF}\"" scheme_cmd="guile --r6rs -x .sls -L \"${venvpath}/lib/.akku/lib\" -s \"\${IF}\""
;; ;;
"ikarus") "ikarus")
scheme_cmd="IKARUS_LIBRARY_PATH=\"${venvpath}/lib/.akku/lib\" ikarus --r6rs-script \"\${IF}\"" scheme_cmd="IKARUS_LIBRARY_PATH=\"${venvpath}/lib/.akku/lib\" ikarus --r6rs-script \"\${IF}\""
@ -219,8 +223,8 @@ else
scheme_compile_cmd="csc -static -X r7rs -R r7rs -o \"\${OF}\" \"\${IF}\"" scheme_compile_cmd="csc -static -X r7rs -R r7rs -o \"\${OF}\" \"\${IF}\""
;; ;;
"cyclone") "cyclone")
scheme_cmd="icyc -I \"${venvpath}/lib\" \"\${IF}\"" scheme_cmd="CYCLONE_LIBRARY_PATH=\"${venvpath}/lib\" icyc -I \"${venvpath}/lib\" \"\${IF}\""
scheme_compile_cmd="cyclone -I \"${venvpath}/lib\" \"\${IF}\"" scheme_compile_cmd="CYCLONE_LIBRARY_PATH=\"${venvpath}/lib\" cyclone -I \"${venvpath}/lib\" \"\${IF}\""
;; ;;
"foment") "foment")
scheme_cmd="foment -I \"${venvpath}/lib\" \"\${IF}\"" scheme_cmd="foment -I \"${venvpath}/lib\" \"\${IF}\""
@ -234,7 +238,7 @@ else
scheme_cmd="gosh -r7 -I \"${venvpath}/lib\" \"\${IF}\"" scheme_cmd="gosh -r7 -I \"${venvpath}/lib\" \"\${IF}\""
;; ;;
"guile") "guile")
scheme_cmd="guile --r7rs -C \"${venvpath}/lib\" -L \"${venvpath}/lib\" \"\${IF}\"" scheme_cmd="guile --r7rs -x .sld -C \"${venvpath}/lib\" -L \"${venvpath}/lib\" -s \"\${IF}\""
;; ;;
"kawa") "kawa")
scheme_cmd="kawa --r7rs --full-tailcalls -Dkawa.import.path=\"${venvpath}/lib/*.sld\" \"\${IF}\"" scheme_cmd="kawa --r7rs --full-tailcalls -Dkawa.import.path=\"${venvpath}/lib/*.sld\" \"\${IF}\""
@ -250,7 +254,7 @@ else
scheme_cmd="meevax -I \"${venvpath}/lib\" \"\${IF}\"" scheme_cmd="meevax -I \"${venvpath}/lib\" \"\${IF}\""
;; ;;
"mit-scheme") "mit-scheme")
scheme_cmd="mit-scheme --prepend-library ${venvpath}/lib --batch-mode --load \"\${IF}\" --eval \"(exit 0)\" --args" scheme_cmd="mit-scheme --prepend-library \"${venvpath}/lib\" --batch-mode --load \"\${IF}\" --eval \"(exit 0)\" --args"
;; ;;
"mosh") "mosh")
scheme_cmd="mosh --loadpath=\"${venvpath}/lib\" \"\${IF}\"" scheme_cmd="mosh --loadpath=\"${venvpath}/lib\" \"\${IF}\""
@ -284,6 +288,7 @@ fi
## bin/scheme-script ## bin/scheme-script
{ {
echo "#!/bin/sh" echo "#!/bin/sh"
echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
echo "if [ \"\${1}\" = \"\" ]; then echo 'scheme-venv (${implementation} ${rnrs}) Give script file as argument' && exit 1; fi" echo "if [ \"\${1}\" = \"\" ]; then echo 'scheme-venv (${implementation} ${rnrs}) Give script file as argument' && exit 1; fi"
echo "if [ \"\${1}\" = \"--help\" ]; then echo 'scheme-venv (${implementation} ${rnrs}) Give script file as argument' && exit 1; fi" echo "if [ \"\${1}\" = \"--help\" ]; then echo 'scheme-venv (${implementation} ${rnrs}) Give script file as argument' && exit 1; fi"
echo "IF=\"\${1}\"" echo "IF=\"\${1}\""
@ -296,7 +301,7 @@ chmod +x "${venvpath}/bin/scheme-script"
if [ "${scheme_type}" = "interpreter" ]; then if [ "${scheme_type}" = "interpreter" ]; then
{ {
echo "#!/bin/sh" echo "#!/bin/sh"
echo "if [ \"\${SCHEME_VENV_DEBUG}\" = "1" ]; then set -x; fi" echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
echo "IF=\"\$(realpath \"\${1}\")\"" echo "IF=\"\$(realpath \"\${1}\")\""
echo "if [ "${rnrs}" = "r6rs" ]; then OF=\"\${IF%.sps}\"; else OF=\"\${IF%.scm}\"; fi" echo "if [ "${rnrs}" = "r6rs" ]; then OF=\"\${IF%.sps}\"; else OF=\"\${IF%.scm}\"; fi"
echo "printf \"\n#|\nexec ${venvpath}/bin/scheme-script \\\"\\\${0}\\\" \\\"\\\$@\\\"\n|#\n\" > \"\${OF}\"" echo "printf \"\n#|\nexec ${venvpath}/bin/scheme-script \\\"\\\${0}\\\" \\\"\\\$@\\\"\n|#\n\" > \"\${OF}\""
@ -307,7 +312,7 @@ if [ "${scheme_type}" = "interpreter" ]; then
else else
{ {
echo "#!/bin/sh" echo "#!/bin/sh"
echo "if [ \"\${SCHEME_VENV_DEBUG}\" = "1" ]; then set -x; fi" echo "if [ ! \"\${SCHEME_VENV_DEBUG}\" = \"\" ]; then set -x; fi"
echo "IF=\$(realpath \"\${1}\")" echo "IF=\$(realpath \"\${1}\")"
echo "if [ "${rnrs}" = "r6rs" ]; then OF=\"\${IF%.sps}\"; else OF=\"\${IF%.scm}\"; fi" echo "if [ "${rnrs}" = "r6rs" ]; then OF=\"\${IF%.sps}\"; else OF=\"\${IF%.scm}\"; fi"
echo "cd ${venvpath}/lib" echo "cd ${venvpath}/lib"

View File

@ -1,8 +1,7 @@
(import (scheme base) (import (scheme base)
(scheme write) (scheme write)
(scheme process-context) (scheme process-context)
(retropikzel hello) (retropikzel hello))
(srfi 64))
(display "scheme-venv-script-test-success-") (display "scheme-venv-script-test-success-")
(hello) (hello)