Update system to new (foreign c)

This commit is contained in:
retropikzel 2026-02-27 09:09:12 +02:00
parent 0b7dacedbd
commit a8cb73d828
3 changed files with 23 additions and 25 deletions

View File

@ -1,5 +1,3 @@
.SILENT: build install test-r6rs test-r6rs-docker test-r7rs test-r7rs-docker clean
.PHONY: test-r6rs test-r7rs example.scm example.sps
SCHEME=chibi
RNRS=r7rs
LIBRARY=system
@ -23,9 +21,9 @@ endif
all: build
build: retropikzel/${LIBRARY}/LICENSE retropikzel/${LIBRARY}/VERSION
@rm -rf *.tgz
@echo "<pre>$$(cat retropikzel/${LIBRARY}/README.md)</pre>" > ${README}
@snow-chibi package --version=${VERSION} --authors=${AUTHOR} --doc=${README} --description="${DESCRIPTION}" ${LIBRARY_FILE}
rm -rf *.tgz
echo "<pre>$$(cat retropikzel/${LIBRARY}/README.md)</pre>" > ${README}
snow-chibi package --version=${VERSION} --authors=${AUTHOR} --doc=${README} --description="${DESCRIPTION}" ${LIBRARY_FILE}
install:
snow-chibi install --impls=${SCHEME} ${SNOW_CHIBI_ARGS} ${PKG}
@ -34,22 +32,22 @@ uninstall:
-snow-chibi remove --impls=${SCHEME} ${PKG}
init-venv: build
@rm -rf venv
@scheme-venv ${SCHEME} ${RNRS} venv
@echo "(import (scheme base) (scheme write) (scheme read) (scheme char) (scheme file) (scheme process-context) (srfi 64) (retropikzel ${LIBRARY}))" > venv/test.scm
@printf "#!r6rs\n(import (rnrs) (srfi :64) (retropikzel ${LIBRARY}))" > venv/test.sps
@cat ${TESTFILE} >> venv/test.scm
@cat ${TESTFILE} >> venv/test.sps
@if [ "${RNRS}" = "r6rs" ]; then if [ -d ../foreign-c ]; then cp -r ../foreign-c/foreign venv/lib/; fi; fi
@if [ "${RNRS}" = "r6rs" ]; then cp -r retropikzel venv/lib/; fi
@if [ "${SCHEME}" = "chezs" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
@if [ "${SCHEME}" = "ikarus" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
@if [ "${SCHEME}" = "ironscheme" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
@if [ "${SCHEME}" = "racket" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
@if [ "${RNRS}" = "r6rs" ]; then ./venv/bin/akku install; fi
@if [ "${SCHEME}" = "chicken" ]; then ./venv/bin/snow-chibi install --always-yes srfi.64; fi
@if [ "${SCHEME}-${RNRS}" = "mosh-r7rs" ]; then ./venv/bin/snow-chibi install --always-yes srfi.64; fi
@if [ "${RNRS}" = "r7rs" ]; then ./venv/bin/snow-chibi install ${PKG}; fi
rm -rf venv
scheme-venv ${SCHEME} ${RNRS} venv
echo "(import (scheme base) (scheme write) (scheme read) (scheme char) (scheme file) (scheme process-context) (srfi 64) (retropikzel ${LIBRARY}))" > venv/test.scm
printf "#!r6rs\n(import (rnrs) (srfi :64) (retropikzel ${LIBRARY}))" > venv/test.sps
cat ${TESTFILE} >> venv/test.scm
cat ${TESTFILE} >> venv/test.sps
if [ "${RNRS}" = "r6rs" ]; then if [ -d ../foreign-c ]; then cp -r ../foreign-c/foreign venv/lib/; fi; fi
if [ "${RNRS}" = "r6rs" ]; then cp -r retropikzel venv/lib/; fi
if [ "${SCHEME}" = "chezs" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
if [ "${SCHEME}" = "ikarus" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
if [ "${SCHEME}" = "ironscheme" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
if [ "${SCHEME}" = "racket" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
if [ "${RNRS}" = "r6rs" ]; then ./venv/bin/akku install; fi
if [ "${SCHEME}" = "chicken" ]; then ./venv/bin/snow-chibi install --always-yes srfi.64; fi
if [ "${SCHEME}-${RNRS}" = "mosh-r7rs" ]; then ./venv/bin/snow-chibi install --always-yes srfi.64; fi
if [ "${RNRS}" = "r7rs" ]; then ./venv/bin/snow-chibi install ${PKG}; fi
run-test: init-venv
if [ "${RNRS}" = "r6rs" ]; then ./venv/bin/scheme-compile venv/test.sps; fi

View File

@ -1,8 +1,8 @@
(define-c-library libc '("stdlib.h") libc-name '((additional-versions ("6"))))
(define-c-library libc '("stdlib.h") #f '())
(define-c-procedure c-system libc 'system 'int '(pointer))
(define (system command)
(let* ((command-pointer (string->c-utf8 command))
(let* ((command-pointer (string->c-bytevector command))
(result (c-system command-pointer)))
(c-free command-pointer)
(c-bytevector-free command-pointer)
result))

View File

@ -1 +1 @@
1.1.3
1.1.4