Make many implementations pass all tests, clean up repo
This commit is contained in:
parent
d94cbd9baa
commit
de665ce967
1
Makefile
1
Makefile
|
|
@ -31,6 +31,7 @@ clean:
|
||||||
rm -rf retropikzel/pffi/${VERSION}/*.o*
|
rm -rf retropikzel/pffi/${VERSION}/*.o*
|
||||||
rm -rf retropikzel/pffi/${VERSION}/*.so
|
rm -rf retropikzel/pffi/${VERSION}/*.so
|
||||||
rm -rf retropikzel/pffi/${VERSION}/*.meta
|
rm -rf retropikzel/pffi/${VERSION}/*.meta
|
||||||
|
rm -rf retropikzel/pffi/${VERSION}/retropikzel.*
|
||||||
rm -rf retropikzel.*
|
rm -rf retropikzel.*
|
||||||
rm -rf test/*.c
|
rm -rf test/*.c
|
||||||
rm -rf test/*.o*
|
rm -rf test/*.o*
|
||||||
|
|
|
||||||
63
README.md
63
README.md
|
|
@ -6,7 +6,7 @@ For documentation see
|
||||||
For bugs you can use the
|
For bugs you can use the
|
||||||
[Bugs](https://codeberg.org/r7rs-pffi/pffi/projects/9101)
|
[Bugs](https://codeberg.org/r7rs-pffi/pffi/projects/9101)
|
||||||
|
|
||||||
## Supports
|
## All tests pass
|
||||||
|
|
||||||
- [Sagittarius](https://bitbucket.org/ktakashi/sagittarius-scheme/wiki/Home)
|
- [Sagittarius](https://bitbucket.org/ktakashi/sagittarius-scheme/wiki/Home)
|
||||||
- [Guile](https://www.gnu.org/software/guile/)
|
- [Guile](https://www.gnu.org/software/guile/)
|
||||||
|
|
@ -14,22 +14,69 @@ For bugs you can use the
|
||||||
- Needs atleast java 21
|
- Needs atleast java 21
|
||||||
- Needs jvm flags
|
- Needs jvm flags
|
||||||
- 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 FILENAME.scm
|
- 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 FILENAME.scm
|
||||||
|
|
||||||
## Support is work in progress
|
|
||||||
|
|
||||||
- [Racket](https://racket-lang.org/)
|
- [Racket](https://racket-lang.org/)
|
||||||
- [STKlos](https://stklos.net/)
|
|
||||||
- [Cyclone](https://justinethier.github.io/cyclone/)
|
|
||||||
- [Chicken](https://www.call-cc.org/)
|
- [Chicken](https://www.call-cc.org/)
|
||||||
|
|
||||||
## Support is waiting for the implementation
|
## Not all tests pass
|
||||||
|
|
||||||
|
- [STKlos](https://stklos.net/)
|
||||||
|
- [Cyclone](https://justinethier.github.io/cyclone/)
|
||||||
|
- [Gambit](https://gambitscheme.org)
|
||||||
|
|
||||||
|
## Waiting for the implementation
|
||||||
|
|
||||||
- [LIPS](https://lips.js.org/)
|
- [LIPS](https://lips.js.org/)
|
||||||
- Waiting for implementation to have cond-expand and library support
|
- Waiting for implementation to have cond-expand and library support
|
||||||
- Will only work on nodejs
|
- Will only work on nodejs
|
||||||
|
|
||||||
|
## Not supported
|
||||||
|
|
||||||
|
- [Chibi](https://synthcode.com/scheme/chibi)
|
||||||
|
- FFI requires C code
|
||||||
|
- [MIT-Scheme](https://www.gnu.org/software/mit-scheme/)
|
||||||
|
- FF requires C code
|
||||||
|
- [tr7](https://gitlab.com/jobol/tr7)
|
||||||
|
- FFI requires C code
|
||||||
|
- [Gauche](https://practical-scheme.net/gauche/)
|
||||||
|
- FFI requires C code
|
||||||
|
|
||||||
|
|
||||||
## Hacking
|
## Hacking
|
||||||
|
|
||||||
main.sld is the real main which is copied to other suffixes like .scm and .rkt.
|
main.sld is the real main which is copied to main.scm
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
On some implementations these are procedures, on some macros.
|
||||||
|
|
||||||
|
### pffi-shared-object-auto-load
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
- object-name (symbol)
|
||||||
|
- The name of the dynamic library file you want to load without the "lib" in fron of it or .so/.dll at the end
|
||||||
|
- addition-paths (list (string)...)
|
||||||
|
- Any additional paths you want to search for the library
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
- (object) Shared object, the type depends on the implementation
|
||||||
|
|
||||||
|
### pffi-shared-object-load
|
||||||
|
|
||||||
|
It is recommended to use the pffi-shared-object-auto-load instead of this
|
||||||
|
directly.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
- headers (list (string) ...) Headers that need to be included
|
||||||
|
- Example (list "curl/curl.h")
|
||||||
|
- path (string) The full path to the shared object you want to load, including any "lib" infront and .so/.dll at the end
|
||||||
|
- Example "libcurl.so"
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
- (object) Shared object, the type depends on the implementation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
20
manifest.scm
20
manifest.scm
|
|
@ -3,17 +3,23 @@
|
||||||
;; that accepts a '--manifest' (or '-m') option.
|
;; that accepts a '--manifest' (or '-m') option.
|
||||||
|
|
||||||
(specifications->manifest
|
(specifications->manifest
|
||||||
(list "guile"
|
(list
|
||||||
|
; Guile
|
||||||
|
"guile"
|
||||||
|
; Racket
|
||||||
"racket-minimal"
|
"racket-minimal"
|
||||||
|
; Gambit
|
||||||
"gambit-c"
|
"gambit-c"
|
||||||
|
; Chicken
|
||||||
"chicken"
|
"chicken"
|
||||||
|
; Gerbil
|
||||||
"gerbil"
|
"gerbil"
|
||||||
"openjdk"
|
; Cyclone
|
||||||
"curl"
|
|
||||||
"sdl2"
|
|
||||||
"sdl2-image"
|
|
||||||
"sdl2-ttf"
|
|
||||||
"sdl2-mixer"
|
|
||||||
"ck"
|
"ck"
|
||||||
|
; Kawa
|
||||||
|
"openjdk"
|
||||||
|
; Test libraries
|
||||||
|
"curl"
|
||||||
|
; Compilers
|
||||||
"zig"
|
"zig"
|
||||||
"gcc-toolchain"))
|
"gcc-toolchain"))
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,8 @@
|
||||||
|
|
||||||
(define pffi-pointer-null?
|
(define pffi-pointer-null?
|
||||||
(lambda (pointer)
|
(lambda (pointer)
|
||||||
(null-pointer? pointer)))
|
(and (pffi-pointer? pointer)
|
||||||
|
(null-pointer? pointer))))
|
||||||
|
|
||||||
(define pffi-pointer-set!
|
(define pffi-pointer-set!
|
||||||
(lambda (pointer type offset value)
|
(lambda (pointer type offset value)
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@
|
||||||
|
|
||||||
(define pffi-pointer-free
|
(define pffi-pointer-free
|
||||||
(lambda (pointer)
|
(lambda (pointer)
|
||||||
(invoke pointer 'unload)))
|
#t))
|
||||||
|
|
||||||
(define pffi-pointer-null?
|
(define pffi-pointer-null?
|
||||||
(lambda (pointer)
|
(lambda (pointer)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
;> # pffi
|
|
||||||
|
|
||||||
;> ## Procedures
|
|
||||||
(define-library
|
(define-library
|
||||||
(retropikzel pffi v0-1-0 main)
|
(retropikzel pffi v0-1-0 main)
|
||||||
(cond-expand
|
(cond-expand
|
||||||
|
|
@ -73,7 +70,6 @@
|
||||||
pffi-pointer-null
|
pffi-pointer-null
|
||||||
pffi-string->pointer
|
pffi-string->pointer
|
||||||
pffi-pointer->string
|
pffi-pointer->string
|
||||||
pffi-pointer->bytevector
|
|
||||||
pffi-pointer-free
|
pffi-pointer-free
|
||||||
pffi-pointer?
|
pffi-pointer?
|
||||||
pffi-pointer-null?
|
pffi-pointer-null?
|
||||||
|
|
@ -81,13 +77,8 @@
|
||||||
pffi-pointer-get
|
pffi-pointer-get
|
||||||
pffi-pointer-deref)
|
pffi-pointer-deref)
|
||||||
(begin
|
(begin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define library-version "v0-1-0")
|
(define library-version "v0-1-0")
|
||||||
|
|
||||||
;> ## Procedures
|
|
||||||
|
|
||||||
(define platform-file-extension
|
(define platform-file-extension
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(racket (if (equal? (system-type 'os) 'windows) ".dll" ".so"))
|
(racket (if (equal? (system-type 'os) 'windows) ".dll" ".so"))
|
||||||
|
|
@ -174,28 +165,6 @@
|
||||||
"/usr/lib/x86_64-linux-gnu"
|
"/usr/lib/x86_64-linux-gnu"
|
||||||
"/usr/local/lib"))))))
|
"/usr/local/lib"))))))
|
||||||
|
|
||||||
;> ### pffi-shared-object-load
|
|
||||||
;>
|
|
||||||
;> Arguments:
|
|
||||||
;> - path (string) The path to the shared object you want to load, including any "lib" infront and .so/.dll at the end
|
|
||||||
;>
|
|
||||||
;> Returns:
|
|
||||||
;>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;> ### pffi-shared-object-auto-load
|
|
||||||
;>
|
|
||||||
;> Arguments:
|
|
||||||
;> - object-name (symbol)
|
|
||||||
;> - The name of the dynamic library file you want to load without the "lib" in fron of it or .so/.dll at the end
|
|
||||||
;> - addition-paths (list (string)...)
|
|
||||||
;> - Any additional paths you want to search for the library
|
|
||||||
;>
|
|
||||||
;> Returns:
|
|
||||||
;> - (object) Shared object, the type depends on the implementation
|
|
||||||
|
|
||||||
(define-syntax pffi-shared-object-auto-load
|
(define-syntax pffi-shared-object-auto-load
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((pffi-shared-object-auto-load headers object-name additional-paths)
|
((pffi-shared-object-auto-load headers object-name additional-paths)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
;> # pffi
|
|
||||||
|
|
||||||
;> ## Procedures
|
|
||||||
(define-library
|
(define-library
|
||||||
(retropikzel pffi v0-1-0 main)
|
(retropikzel pffi v0-1-0 main)
|
||||||
(cond-expand
|
(cond-expand
|
||||||
|
|
@ -80,13 +77,8 @@
|
||||||
pffi-pointer-get
|
pffi-pointer-get
|
||||||
pffi-pointer-deref)
|
pffi-pointer-deref)
|
||||||
(begin
|
(begin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define library-version "v0-1-0")
|
(define library-version "v0-1-0")
|
||||||
|
|
||||||
;> ## Procedures
|
|
||||||
|
|
||||||
(define platform-file-extension
|
(define platform-file-extension
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(racket (if (equal? (system-type 'os) 'windows) ".dll" ".so"))
|
(racket (if (equal? (system-type 'os) 'windows) ".dll" ".so"))
|
||||||
|
|
@ -173,28 +165,6 @@
|
||||||
"/usr/lib/x86_64-linux-gnu"
|
"/usr/lib/x86_64-linux-gnu"
|
||||||
"/usr/local/lib"))))))
|
"/usr/local/lib"))))))
|
||||||
|
|
||||||
;> ### pffi-shared-object-load
|
|
||||||
;>
|
|
||||||
;> Arguments:
|
|
||||||
;> - path (string) The path to the shared object you want to load, including any "lib" infront and .so/.dll at the end
|
|
||||||
;>
|
|
||||||
;> Returns:
|
|
||||||
;>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;> ### pffi-shared-object-auto-load
|
|
||||||
;>
|
|
||||||
;> Arguments:
|
|
||||||
;> - object-name (symbol)
|
|
||||||
;> - The name of the dynamic library file you want to load without the "lib" in fron of it or .so/.dll at the end
|
|
||||||
;> - addition-paths (list (string)...)
|
|
||||||
;> - Any additional paths you want to search for the library
|
|
||||||
;>
|
|
||||||
;> Returns:
|
|
||||||
;> - (object) Shared object, the type depends on the implementation
|
|
||||||
|
|
||||||
(define-syntax pffi-shared-object-auto-load
|
(define-syntax pffi-shared-object-auto-load
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((pffi-shared-object-auto-load headers object-name additional-paths)
|
((pffi-shared-object-auto-load headers object-name additional-paths)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
(define pffi-pointer-allocate
|
(define pffi-pointer-allocate
|
||||||
(lambda (size)
|
(lambda (size)
|
||||||
(malloc size)))
|
(malloc size 'raw)))
|
||||||
|
|
||||||
(define pffi-pointer-null
|
(define pffi-pointer-null
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
(define pffi-pointer-allocate
|
(define pffi-pointer-allocate
|
||||||
(lambda (size)
|
(lambda (size)
|
||||||
(allocate-pointer size)))
|
(c-malloc size)))
|
||||||
|
|
||||||
(define pffi-pointer-null
|
(define pffi-pointer-null
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue