Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
typedef int strfun (char * Data, size_t * Length);
strfun *Query = NULL;

View file

@ -0,0 +1,17 @@
#lang racket
(require ffi/unsafe)
(define xlib (ffi-lib "./x.so"))
(set-ffi-obj! "Query" xlib (_fun _pointer _pointer -> _bool)
(λ(bs len)
(define out #"Here I am")
(let ([bs (make-sized-byte-string bs (ptr-ref len _int))])
(and ((bytes-length out) . <= . (bytes-length bs))
(begin (bytes-copy! bs 0 out)
(ptr-set! len _int (bytes-length out))
#t)))))
((get-ffi-obj "main" xlib (_fun _int (_list i _bytes) -> _void))
0 '())