Started moving tests to their own files
This commit is contained in:
parent
1fc93b2f5a
commit
30add0ee3a
|
|
@ -20,3 +20,4 @@ test/size-of
|
||||||
retropikzel/pffi/*/*.c
|
retropikzel/pffi/*/*.c
|
||||||
retropikzel/pffi/*/*.o*
|
retropikzel/pffi/*/*.o*
|
||||||
retropikzel/pffi/*/*.so
|
retropikzel/pffi/*/*.so
|
||||||
|
tmp
|
||||||
|
|
|
||||||
35
Makefile
35
Makefile
|
|
@ -7,18 +7,12 @@ RACKET=racket -I r7rs --make -S $(shell pwd) --script
|
||||||
STKLOS=STKLOS_FRAMES=200 stklos -A . --compiler-flags='+line-info,+time-display,unroll-iterations=3' -f
|
STKLOS=STKLOS_FRAMES=200 stklos -A . --compiler-flags='+line-info,+time-display,unroll-iterations=3' -f
|
||||||
KAWA=java --add-exports java.base/jdk.internal.foreign.abi=ALL-UNNAMED --add-exports java.base/jdk.internal.foreign.layout=ALL-UNNAMED --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED --enable-native-access=ALL-UNNAMED --enable-preview -jar kawa.jar --r7rs --full-tailcalls -Dkawa.import.path=".."
|
KAWA=java --add-exports java.base/jdk.internal.foreign.abi=ALL-UNNAMED --add-exports java.base/jdk.internal.foreign.layout=ALL-UNNAMED --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED --enable-native-access=ALL-UNNAMED --enable-preview -jar kawa.jar --r7rs --full-tailcalls -Dkawa.import.path=".."
|
||||||
CYCLONE=cyclone -t -A .
|
CYCLONE=cyclone -t -A .
|
||||||
GAMBIT=gsc -:r7rs,search=$(shell pwd)
|
|
||||||
GAMBIT_I=gsi -:r7rs,search=$(shell pwd)
|
|
||||||
CHICKEN=csc -X r7rs -R r7rs
|
CHICKEN=csc -X r7rs -R r7rs
|
||||||
CHICKEN_I=csi -R r7rs
|
CHICKEN_I=csi -R r7rs
|
||||||
GERBIL=gxc -prelude :scheme/r7rs -exe
|
GERBIL=gxc -prelude :scheme/r7rs -exe
|
||||||
GERBIL_I=gxi --lang r7rs
|
GERBIL_I=gxi --lang r7rs
|
||||||
|
|
||||||
build: build-main-scm build-main-chicken build-main-gambit build-main-gerbil
|
build: build-main-scm
|
||||||
|
|
||||||
build-rkt:
|
|
||||||
#echo "#lang r7rs" > retropikzel/pffi/${VERSION}/main.rkt
|
|
||||||
#cat retropikzel/pffi/${VERSION}/main.sld >> retropikzel/pffi/${VERSION}/main.rkt
|
|
||||||
|
|
||||||
build-main-scm:
|
build-main-scm:
|
||||||
cp retropikzel/pffi/${VERSION}/main.sld retropikzel/pffi/${VERSION}/main.scm
|
cp retropikzel/pffi/${VERSION}/main.sld retropikzel/pffi/${VERSION}/main.scm
|
||||||
|
|
@ -31,17 +25,6 @@ build-main-chicken:
|
||||||
${CHICKEN} -sJ retropikzel.pffi.${VERSION}.chicken.scm
|
${CHICKEN} -sJ retropikzel.pffi.${VERSION}.chicken.scm
|
||||||
${CHICKEN} -sJ retropikzel.pffi.${VERSION}.main.scm
|
${CHICKEN} -sJ retropikzel.pffi.${VERSION}.main.scm
|
||||||
|
|
||||||
build-main-gambit:
|
|
||||||
${GAMBIT} -obj retropikzel/pffi/${VERSION}/gambit.scm
|
|
||||||
${GAMBIT} -obj retropikzel/pffi/${VERSION}/main.sld
|
|
||||||
#cp retropikzel/pffi/${VERSION}/*.o* test/
|
|
||||||
|
|
||||||
build-main-gerbil:
|
|
||||||
#${GAMBIT} -obj retropikzel/pffi/${VERSION}/gambit.scm
|
|
||||||
#${GAMBIT} -obj retropikzel/pffi/${VERSION}/main.sld
|
|
||||||
#cp retropikzel/pffi/${VERSION}/*.o* test/
|
|
||||||
|
|
||||||
|
|
||||||
update-documentation:
|
update-documentation:
|
||||||
schubert document
|
schubert document
|
||||||
mkdir -p docutmp
|
mkdir -p docutmp
|
||||||
|
|
@ -54,6 +37,10 @@ documentation:
|
||||||
schubert document
|
schubert document
|
||||||
VERSION=${VERSION} bash doc/generate.sh > documentation.md
|
VERSION=${VERSION} bash doc/generate.sh > documentation.md
|
||||||
|
|
||||||
|
test-sagittarius:
|
||||||
|
${SASH} ./test/import.scm
|
||||||
|
${SASH} ./test/
|
||||||
|
|
||||||
test/import.scm: clean build
|
test/import.scm: clean build
|
||||||
${SASH} $@
|
${SASH} $@
|
||||||
${GUILE} $@
|
${GUILE} $@
|
||||||
|
|
@ -65,19 +52,15 @@ test/import.scm: clean build
|
||||||
${CHICKEN} $@ && ./test/import
|
${CHICKEN} $@ && ./test/import
|
||||||
#${GERBIL} $@
|
#${GERBIL} $@
|
||||||
|
|
||||||
test/import.scm: clean build
|
|
||||||
${RACKET} $@
|
|
||||||
#${GAMBIT} -exe $@ && ./test/import
|
|
||||||
|
|
||||||
test/pffi-define.scm: clean build
|
test/pffi-define.scm: clean build
|
||||||
${SASH} $@
|
${SASH} $@
|
||||||
${GUILE} $@
|
${GUILE} $@
|
||||||
|
${RACKET} $@
|
||||||
${KAWA} $@
|
${KAWA} $@
|
||||||
${CHICKEN} -L -lcurl $@ && ./test/pffi-define
|
${CHICKEN} -L -lcurl $@ && ./test/pffi-define
|
||||||
|
|
||||||
test/pffi-define.scm: clean build
|
test/pffi-define.scm: clean build
|
||||||
${RACKET} $@
|
${GAMBIT} -ld-options -lcurl -exe $@ && ./test/pffi-define
|
||||||
#${CYCLONE} -CLNK -lcurl $@ && test/pffi-define
|
|
||||||
|
|
||||||
test/size-of.scm:
|
test/size-of.scm:
|
||||||
${SASH} $@
|
${SASH} $@
|
||||||
|
|
@ -106,6 +89,9 @@ test/sdl2.scm:
|
||||||
#${STKLOS} $@
|
#${STKLOS} $@
|
||||||
${KAWA} $@
|
${KAWA} $@
|
||||||
|
|
||||||
|
tmp:
|
||||||
|
mkdir -p tmp
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf docutmp
|
rm -rf docutmp
|
||||||
rm -rf retropikzel/pffi/${VERSION}/*.c
|
rm -rf retropikzel/pffi/${VERSION}/*.c
|
||||||
|
|
@ -125,3 +111,4 @@ clean:
|
||||||
rm -rf *.o
|
rm -rf *.o
|
||||||
rm -rf *.so
|
rm -rf *.so
|
||||||
rm -rf *.a
|
rm -rf *.a
|
||||||
|
rm -rf tmp
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ For bugs you can use the
|
||||||
|
|
||||||
- [Racket](https://racket-lang.org/)
|
- [Racket](https://racket-lang.org/)
|
||||||
- [STKlos](https://stklos.net/)
|
- [STKlos](https://stklos.net/)
|
||||||
|
- [Cyclone](https://justinethier.github.io/cyclone/)
|
||||||
|
- [Chicken](https://www.call-cc.org/)
|
||||||
|
|
||||||
## Support is waiting for the implementation
|
## Support is waiting for the implementation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,9 @@
|
||||||
(lambda (object)
|
(lambda (object)
|
||||||
(error "Not defined")))
|
(error "Not defined")))
|
||||||
|
|
||||||
(define-syntax pffi-define
|
(define pffi-define
|
||||||
(syntax-rules ()
|
(lambda (scheme-name shared-object c-name return-type argument-types)
|
||||||
((pffi-define scheme-name shared-object c-name return-type argument-types)
|
(error "Not defined")))
|
||||||
(c-define scheme-name
|
|
||||||
(pffi-type->native-type return-type)
|
|
||||||
(symbol->string c-name)
|
|
||||||
string
|
|
||||||
)
|
|
||||||
)))
|
|
||||||
|
|
||||||
|
|
||||||
(define pffi-size-of
|
(define pffi-size-of
|
||||||
(lambda (type)
|
(lambda (type)
|
||||||
|
|
@ -63,14 +56,10 @@
|
||||||
(lambda (pointer size)
|
(lambda (pointer size)
|
||||||
(error "Not defined")))
|
(error "Not defined")))
|
||||||
|
|
||||||
(define-syntax pffi-shared-object-load
|
|
||||||
(syntax-rules ()
|
|
||||||
((header path)
|
|
||||||
(c-declare (string-append "#include <" header ">")))
|
|
||||||
|
|
||||||
;(error "Not defined")
|
(define pffi-shared-object-load
|
||||||
|
(lambda (headers)
|
||||||
))
|
(error "Not defined")))
|
||||||
|
|
||||||
(define pffi-pointer-free
|
(define pffi-pointer-free
|
||||||
(lambda (pointer)
|
(lambda (pointer)
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,9 @@
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((pffi-shared-object-auto-load headers object-name additional-paths)
|
((pffi-shared-object-auto-load headers object-name additional-paths)
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(cyclone (pffi-shared-object-load headers object-path))
|
(cyclone (pffi-shared-object-load headers))
|
||||||
(chicken (pffi-shared-object-load headers object-path))
|
(chicken (pffi-shared-object-load headers))
|
||||||
|
(gambit (pffi-shared-object-load headers))
|
||||||
(else
|
(else
|
||||||
(let* ((paths (append auto-load-paths additional-paths))
|
(let* ((paths (append auto-load-paths additional-paths))
|
||||||
(shared-object #f))
|
(shared-object #f))
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,9 @@
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((pffi-shared-object-auto-load headers object-name additional-paths)
|
((pffi-shared-object-auto-load headers object-name additional-paths)
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(cyclone (pffi-shared-object-load headers object-path))
|
(cyclone (pffi-shared-object-load headers))
|
||||||
(chicken (pffi-shared-object-load headers object-path))
|
(chicken (pffi-shared-object-load headers))
|
||||||
|
(gambit (pffi-shared-object-load headers))
|
||||||
(else
|
(else
|
||||||
(let* ((paths (append auto-load-paths additional-paths))
|
(let* ((paths (append auto-load-paths additional-paths))
|
||||||
(shared-object #f))
|
(shared-object #f))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
make clean
|
||||||
|
make tmp
|
||||||
|
|
||||||
|
VERSION=v0-1-0
|
||||||
|
|
||||||
|
|
||||||
|
GAMBIT="gsc -:r7rs,search=."
|
||||||
|
GAMBIT_I="gsi -:r7rs,search=."
|
||||||
|
|
||||||
|
|
||||||
|
${GAMBIT} -obj retropikzel/pffi/${VERSION}/gambit.scm
|
||||||
|
${GAMBIT} -obj retropikzel/pffi/${VERSION}/main.sld
|
||||||
|
${GAMBIT_I} ./test/import.scm
|
||||||
|
${GAMBIT} -o ./tmp/import ./test/import.scm
|
||||||
|
./tmp/import
|
||||||
22
test.scm
22
test.scm
|
|
@ -1,17 +1,17 @@
|
||||||
(import (scheme base)
|
(import (scheme base)
|
||||||
(scheme write)
|
(scheme write)
|
||||||
(scheme file)
|
(scheme file)
|
||||||
(scheme eval)
|
(scheme process-context))
|
||||||
(scheme process-context)
|
|
||||||
(cyclone foreign))
|
(define t "hello")
|
||||||
|
|
||||||
|
|
||||||
(define-syntax pffi-shared-object-load
|
(define-syntax pffi-shared-object-load
|
||||||
(er-macro-transformer
|
(syntax-rules ()
|
||||||
(lambda (expr rename compare)
|
((pffi-shared-object-load headers path)
|
||||||
(let* ((headers (cdr (car (cdr expr)))))
|
(begin (display "hello")
|
||||||
`(begin
|
|
||||||
,@ (map
|
))
|
||||||
(lambda (header)
|
)
|
||||||
`(include-c-header ,(string-append "<" header ">")))
|
|
||||||
headers))))))
|
)
|
||||||
|
|
|
||||||
BIN
test/SDL2.dll
BIN
test/SDL2.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,9 +1,10 @@
|
||||||
(import (scheme base)
|
(import (scheme base)
|
||||||
(scheme write)
|
(scheme write)
|
||||||
(retropikzel pffi v0-1-0 main))
|
;(retropikzel pffi v0-1-0 main)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
(display "Hello")
|
(display "Hello")
|
||||||
(newline)
|
(newline)
|
||||||
(flush-output-port)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,24 @@
|
||||||
(scheme eval)
|
(scheme eval)
|
||||||
(retropikzel pffi v0-1-0 main))
|
(retropikzel pffi v0-1-0 main))
|
||||||
|
|
||||||
(define libcurl (pffi-shared-object-auto-load (list "curl/curl.h") "curl" (list)))
|
;(define libcurl (pffi-shared-object-auto-load (list "curl/curl.h") "curl" (list)))
|
||||||
|
|
||||||
(display libcurl)
|
(c-declare "#include <curl/curl.h>")
|
||||||
(newline)
|
;(display libcurl)
|
||||||
|
;(newline)
|
||||||
|
|
||||||
(pffi-define curl-version libcurl 'curl_version 'string (list))
|
(define curl-version
|
||||||
|
(c-lambda ()
|
||||||
|
char-string
|
||||||
|
"curl_version"))
|
||||||
|
|
||||||
|
;(pffi-define curl-version libcurl 'curl_version 'string (list))
|
||||||
|
|
||||||
(display "=================")
|
(display "=================")
|
||||||
(newline)
|
(newline)
|
||||||
|
|
||||||
(display (pffi-pointer->string (curl-version)))
|
(display (curl-version))
|
||||||
|
;(display (pffi-pointer->string (curl-version)))
|
||||||
|
|
||||||
(newline)
|
(newline)
|
||||||
(display "=================")
|
(display "=================")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue