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 SCHEME=chibi
RNRS=r7rs RNRS=r7rs
LIBRARY=system LIBRARY=system
@ -23,9 +21,9 @@ endif
all: build all: build
build: retropikzel/${LIBRARY}/LICENSE retropikzel/${LIBRARY}/VERSION build: retropikzel/${LIBRARY}/LICENSE retropikzel/${LIBRARY}/VERSION
@rm -rf *.tgz rm -rf *.tgz
@echo "<pre>$$(cat retropikzel/${LIBRARY}/README.md)</pre>" > ${README} echo "<pre>$$(cat retropikzel/${LIBRARY}/README.md)</pre>" > ${README}
@snow-chibi package --version=${VERSION} --authors=${AUTHOR} --doc=${README} --description="${DESCRIPTION}" ${LIBRARY_FILE} snow-chibi package --version=${VERSION} --authors=${AUTHOR} --doc=${README} --description="${DESCRIPTION}" ${LIBRARY_FILE}
install: install:
snow-chibi install --impls=${SCHEME} ${SNOW_CHIBI_ARGS} ${PKG} snow-chibi install --impls=${SCHEME} ${SNOW_CHIBI_ARGS} ${PKG}
@ -34,22 +32,22 @@ uninstall:
-snow-chibi remove --impls=${SCHEME} ${PKG} -snow-chibi remove --impls=${SCHEME} ${PKG}
init-venv: build init-venv: build
@rm -rf venv rm -rf venv
@scheme-venv ${SCHEME} ${RNRS} 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 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 printf "#!r6rs\n(import (rnrs) (srfi :64) (retropikzel ${LIBRARY}))" > venv/test.sps
@cat ${TESTFILE} >> venv/test.scm cat ${TESTFILE} >> venv/test.scm
@cat ${TESTFILE} >> venv/test.sps 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 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 [ "${RNRS}" = "r6rs" ]; then cp -r retropikzel venv/lib/; fi
@if [ "${SCHEME}" = "chezs" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; 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}" = "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}" = "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 [ "${SCHEME}" = "racket" ]; then ./venv/bin/akku install akku-r7rs chez-srfi; fi
@if [ "${RNRS}" = "r6rs" ]; then ./venv/bin/akku install; 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}" = "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 [ "${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 if [ "${RNRS}" = "r7rs" ]; then ./venv/bin/snow-chibi install ${PKG}; fi
run-test: init-venv run-test: init-venv
if [ "${RNRS}" = "r6rs" ]; then ./venv/bin/scheme-compile venv/test.sps; fi 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-c-procedure c-system libc 'system 'int '(pointer))
(define (system command) (define (system command)
(let* ((command-pointer (string->c-utf8 command)) (let* ((command-pointer (string->c-bytevector command))
(result (c-system command-pointer))) (result (c-system command-pointer)))
(c-free command-pointer) (c-bytevector-free command-pointer)
result)) result))

View File

@ -1 +1 @@
1.1.3 1.1.4