1
0
Fork 0

Rename libs/data to libs/implementations. Code cleanup

This commit is contained in:
retropikzel 2025-12-05 12:49:58 +02:00
parent d1eb851b28
commit fee543372a
3 changed files with 7 additions and 55 deletions

View File

@ -11,7 +11,7 @@ endif
ifeq "${SCHEME}" "vicare" ifeq "${SCHEME}" "vicare"
DOCKERIMG="vicare" DOCKERIMG="vicare"
endif endif
STATIC_LIBS=libs.util.a libs.library-util.a libs.data.a libs.srfi-64-util.a STATIC_LIBS=libs.util.a libs.library-util.a libs.implementations.a libs.srfi-64-util.a
all: build-chibi all: build-chibi
@ -28,13 +28,13 @@ build-chicken:
ar rcs libs.util.a libs.util.o ar rcs libs.util.a libs.util.o
csc -R r7rs -X r7rs -static -c -J -unit libs.library-util -o libs.library-util.o libs/library-util.sld csc -R r7rs -X r7rs -static -c -J -unit libs.library-util -o libs.library-util.o libs/library-util.sld
ar rcs libs.library-util.a libs.library-util.o ar rcs libs.library-util.a libs.library-util.o
csc -R r7rs -X r7rs -static -c -J -unit libs.data -o libs.data.o libs/data.sld csc -R r7rs -X r7rs -static -c -J -unit libs.implementations -o libs.implementations.o libs/implementations.sld
ar rcs libs.data.a libs.data.o ar rcs libs.implementation.a libs.implementations.o
csc -R r7rs -X r7rs -static \ csc -R r7rs -X r7rs -static \
-o compile-scheme \ -o compile-scheme \
-uses libs.util \ -uses libs.util \
-uses libs.library-util \ -uses libs.library-util \
-uses libs.data \ -uses libs.implementations \
-uses foreign.c \ -uses foreign.c \
-uses srfi-170 \ -uses srfi-170 \
compile-scheme.scm compile-scheme.scm

View File

@ -110,9 +110,7 @@
(if input-file (if input-file
"a.out" "a.out"
#f)))) #f))))
(if (and (symbol=? scheme-type 'compiler) (if (and (symbol=? scheme-type 'compiler))
;(symbol=? compilation-target 'php)
)
(string-append outfile ".bin") (string-append outfile ".bin")
outfile))) outfile)))
@ -130,10 +128,7 @@
((member "-o" (command-line)) ((member "-o" (command-line))
(cadr (member "-o" (command-line)))) (cadr (member "-o" (command-line))))
(input-file (string-cut-from-end input-file 4))))) (input-file (string-cut-from-end input-file 4)))))
(if (and (symbol=? scheme-type 'compiler) outfile))
(symbol=? compilation-target 'php))
(string-append outfile ".bin")
outfile)))
(define prepend-directories (define prepend-directories
(letrec ((looper (lambda (rest result) (letrec ((looper (lambda (rest result)
@ -210,15 +205,12 @@
(list (list
(cond (cond
((symbol=? compilation-target 'windows) "") ((symbol=? compilation-target 'windows) "")
((symbol=? compilation-target 'php) "")
(else "exec")) (else "exec"))
(cond (cond
((symbol=? compilation-target 'windows) "%0%") ((symbol=? compilation-target 'windows) "%0%")
((symbol=? compilation-target 'php) "$binname")
(else "\"$0\"")) (else "\"$0\""))
(cond (cond
((symbol=? compilation-target 'windows) "") ((symbol=? compilation-target 'windows) "")
((symbol=? compilation-target 'php) "")
(else "\"$@\"")) (else "\"$@\""))
(if input-file input-file "") (if input-file input-file "")
(if output-file output-file "") (if output-file output-file "")
@ -283,24 +275,6 @@
#\newline #\newline
,scheme-program ,scheme-program
))) )))
((symbol=? compilation-target 'php)
(for-each
display
`("<?php"
" $descriptorspec = array(0 => fopen('php://stdin', 'r'), 1 => array('pipe', 'w'), 2 => fopen('php://stderr', 'w'));"
" $cwd = '.';"
" $filepath = $_SERVER['SCRIPT_FILENAME'];"
" $filename = $_SERVER['SCRIPT_NAME'];"
" $binname = '/tmp/test.bin';"
" system(\"tail -n+3 $filepath > $binname\");"
" $scheme_command = \"" ,scheme-command "\";"
" $process = proc_open($scheme_command, $descriptorspec, $pipes, $cwd, $_ENV);"
" echo stream_get_contents($pipes[1]);"
" die();"
" ?>"
#\newline
#\newline
,scheme-program)))
(else (else
(for-each (for-each
display display
@ -323,27 +297,5 @@
(let ((exit-code (system command))) (let ((exit-code (system command)))
(when (not (= exit-code 0)) (when (not (= exit-code 0))
(exit exit-code)))) (exit exit-code))))
scheme-command) scheme-command))
(cond
((symbol=? compilation-target 'php)
(let* ((php-file (string-cut-from-end output-file 4))
(port (open-binary-output-file php-file))
(bin (slurp-bytes output-file)))
(for-each
(lambda (item) (write-bytevector (string->utf8 item) port))
`("<?php"
" $descriptorspec = array(0 => fopen('php://stdin', 'r'), 1 => array('pipe', 'w'), 2 => fopen('php://stderr', 'w'));"
" $cwd = '.';"
" $filepath = $_SERVER['SCRIPT_FILENAME'];"
" $binname = '/tmp/test.bin';"
" system(\"tail -n+3 $filepath > $binname\");"
" $process = proc_open($binname, $descriptorspec, $pipes, $cwd, $_ENV);"
" echo stream_get_contents($pipes[1]);"
" die();"
" ?>"
,(string #\newline)
,(string #\newline)))
(write-bytevector bin port)
(close-output-port port)))
(else #t)))