diff --git a/Makefile b/Makefile index a5ed479..209346d 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,7 @@ test-r6rs: mkdir -p ${R6RSTMP} cp -r r6rs-testfiles/* ${R6RSTMP}/ cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs -o main --debug main.sps + cd ${R6RSTMP} && file main cd ${R6RSTMP} && ./main 1 2 3 > test-result.txt @grep "Test successfull (\"1\" \"2\" \"3\")" ${R6RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/test-result.txt && exit 1) @@ -113,7 +114,8 @@ test-r7rs: rm -rf ${R7RSTMP} mkdir -p ${R7RSTMP} cp -r r7rs-testfiles/* ${R7RSTMP}/ - cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs --debug main.scm + cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs -o main --debug main.scm + cd ${R7RSTMP} && file main -cd ${R7RSTMP} && ./main 1 2 3 > test-result.txt 2>&1 @grep "Test successfull (\"1\" \"2\" \"3\")" ${R7RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/test-result.txt && exit 1) diff --git a/README.md b/README.md index cc4e994..94fb8c4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ DESCRIPTION SUPPORTED IMPLEMENTATIONS Some implementations support both compiling and interpreting, in that case only the compiler functionality is used and the implementation is - marked as compiler. + marked as compiler. Except currently with Gambit. R6RS Compilers loko diff --git a/libs/implementations.sld b/libs/implementations.sld index 399d311..faf69ad 100644 --- a/libs/implementations.sld +++ b/libs/implementations.sld @@ -216,81 +216,47 @@ ,args))))) (gambit (type . compiler) - #;(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?) - `(,(string-append "gsc -:search=" - (apply string-append - (map (lambda (item) - (string-append item "/, ")) - (append prepend-directories - append-directories))) - (search-library-file (append append-directories - prepend-directories) - library-file))))) - (command . ,(lambda (exec-cmd - script-file - args - input-file - output-file - prepend-directories - append-directories - library-files - r6rs? - compilation-target) - (let ((library-files-paths - (map (lambda (item) - (search-library-file (append prepend-directories - append-directories) - item)) - library-files)) - (link-file - (string-append - (string-cut-from-end input-file 4) "_.c"))) - `(,(string-append "gsc -:search=" - (string-cut-from-end - (apply string-append - (map (lambda (item) - (string-append item ",")) - (append prepend-directories - append-directories))) - 1) - " -link -flat -nopreload " - (string-cut-from-end - (apply string-append - (map (lambda (item) - (string-append item " ")) - library-files-paths)) - 1) - " " - input-file) - ,(string-append "gsc -:search=" - (string-cut-from-end - (apply string-append - (map (lambda (item) - (string-append item ",")) - (append prepend-directories - append-directories))) - 1) - " -obj " - (apply string-append - (map (lambda (item) - (string-append (string-cut-from-end item 4) ".c ")) - library-files-paths)) - " " - (string-append (string-cut-from-end input-file 4) ".c") - " " - (string-append (string-cut-from-end input-file 4) "_.c")) - ,(string-append "gcc -o " - output-file - " " - (apply string-append - (map (lambda (item) - (string-append (string-cut-from-end item 4) ".o ")) - library-files-paths)) - " " - (string-append (string-cut-from-end input-file 4) ".o") - " " - (string-append (string-cut-from-end input-file 4) "_.o")) - ))))) + (command . ,(lambda (exec-cmd + script-file + args + input-file + output-file + prepend-directories + append-directories + library-files + r6rs? + compilation-target) + (let ((library-files-paths + (map (lambda (item) + (search-library-file (append prepend-directories + append-directories) + item)) + library-files))) + `(,(string-append "echo \"#!/usr/bin/env gsi -:r7rs,search=" + (apply string-append + (map (lambda (item) + (string-append item "/, ")) + (append prepend-directories + append-directories))) + "\" > " + (string-append output-file ".tmp")) + ,(string-append "cat " + input-file + " >> " + (string-append output-file ".tmp")) + ,(apply string-append + `(" gsc " + ,(util-getenv "COMPILE_R7RS_GAMBIT") + " -:r7rs,search=" + ,(apply string-append + (map (lambda (item) + (string-append item "/, ")) + (append prepend-directories + append-directories))) + " -o " + ,output-file + " -exe -nopreload " + ,(string-append output-file ".tmp")))))))) (gauche (type . interpreter) (command . ,(lambda (exec-cmd diff --git a/libs/util.sld b/libs/util.sld index 37b12a1..a4040f1 100644 --- a/libs/util.sld +++ b/libs/util.sld @@ -67,9 +67,9 @@ chibi chicken cyclone - ;gambit foment gauche + gambit guile kawa larceny @@ -88,8 +88,8 @@ chibi chicken cyclone - ;gambit foment + gambit gauche guile ikarus