From fee543372a54a731c7fdc8aac62711041a88cd7d Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 5 Dec 2025 12:49:58 +0200 Subject: [PATCH] Rename libs/data to libs/implementations. Code cleanup --- Makefile | 8 ++-- compile-scheme.scm | 54 ++------------------------ libs/{data.sld => implementations.sld} | 0 3 files changed, 7 insertions(+), 55 deletions(-) rename libs/{data.sld => implementations.sld} (100%) diff --git a/Makefile b/Makefile index 341657d..f275536 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ endif ifeq "${SCHEME}" "vicare" DOCKERIMG="vicare" 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 @@ -28,13 +28,13 @@ build-chicken: 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 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 - ar rcs libs.data.a libs.data.o + csc -R r7rs -X r7rs -static -c -J -unit libs.implementations -o libs.implementations.o libs/implementations.sld + ar rcs libs.implementation.a libs.implementations.o csc -R r7rs -X r7rs -static \ -o compile-scheme \ -uses libs.util \ -uses libs.library-util \ - -uses libs.data \ + -uses libs.implementations \ -uses foreign.c \ -uses srfi-170 \ compile-scheme.scm diff --git a/compile-scheme.scm b/compile-scheme.scm index d7b3583..f41d65c 100644 --- a/compile-scheme.scm +++ b/compile-scheme.scm @@ -110,9 +110,7 @@ (if input-file "a.out" #f)))) - (if (and (symbol=? scheme-type 'compiler) - ;(symbol=? compilation-target 'php) - ) + (if (and (symbol=? scheme-type 'compiler)) (string-append outfile ".bin") outfile))) @@ -130,10 +128,7 @@ ((member "-o" (command-line)) (cadr (member "-o" (command-line)))) (input-file (string-cut-from-end input-file 4))))) - (if (and (symbol=? scheme-type 'compiler) - (symbol=? compilation-target 'php)) - (string-append outfile ".bin") - outfile))) + outfile)) (define prepend-directories (letrec ((looper (lambda (rest result) @@ -210,15 +205,12 @@ (list (cond ((symbol=? compilation-target 'windows) "") - ((symbol=? compilation-target 'php) "") (else "exec")) (cond ((symbol=? compilation-target 'windows) "%0%") - ((symbol=? compilation-target 'php) "$binname") (else "\"$0\"")) (cond ((symbol=? compilation-target 'windows) "") - ((symbol=? compilation-target 'php) "") (else "\"$@\"")) (if input-file input-file "") (if output-file output-file "") @@ -283,24 +275,6 @@ #\newline ,scheme-program ))) - ((symbol=? compilation-target 'php) - (for-each - display - `(" 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 (for-each display @@ -323,27 +297,5 @@ (let ((exit-code (system command))) (when (not (= exit-code 0)) (exit exit-code)))) - 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)) - `(" 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))) + scheme-command)) diff --git a/libs/data.sld b/libs/implementations.sld similarity index 100% rename from libs/data.sld rename to libs/implementations.sld