This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=17d819d4c43701e0e0e92f6c2001343d4730db83 The branch, wip-ffi has been updated via 17d819d4c43701e0e0e92f6c2001343d4730db83 (commit) from 3435f3c07c27c62fcd0a6112243a27ea4ae7b462 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 17d819d4c43701e0e0e92f6c2001343d4730db83 Author: Andy Wingo <wi...@pobox.com> Date: Wed Jan 27 22:25:29 2010 +0100 add a test for ffi and pointers * test-suite/standalone/test-ffi: * test-suite/standalone/test-ffi-lib.c: Add a pointer test. ----------------------------------------------------------------------- Summary of changes: test-suite/standalone/test-ffi | 17 ++++++++++++++++- test-suite/standalone/test-ffi-lib.c | 7 +++++++ 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/test-suite/standalone/test-ffi b/test-suite/standalone/test-ffi index 3e3471a..5487625 100755 --- a/test-suite/standalone/test-ffi +++ b/test-suite/standalone/test-ffi @@ -2,7 +2,8 @@ exec guile -q -s "$0" "$@" !# -(use-modules (system foreign)) +(use-modules (system foreign) + (rnrs bytevector)) (define lib (dynamic-link (string-append (getenv "builddir") "/libtest-ffi"))) @@ -152,6 +153,20 @@ exec guile -q -s "$0" "$@" (test (f-sum-struct (make-c-struct (list int8 int16 int32 int64) (list -1 2000 -30000 40000000000))) (+ -1 2000 -30000 40000000000)) +;; +;; Structs +;; +(define f-memcpy + (make-foreign-function '* (dynamic-func "test_ffi_memcpy" lib) + (list '* '* int32))) +(let* ((src (bytevector->foreign (u8-list->bytevector '(0 1 2 3 4 5 6 7)))) + (dest (bytevector->foreign (make-bytevector 16 0))) + (res (f-memcpy dest src (bytevector-length (foreign->bytevector src))))) + (or (= (foreign-ref dest) (foreign-ref res)) + (error "memcpy res not equal to dest")) + (or (equal? (bytevector->u8-list (foreign->bytevector dest)) + '(0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0)) + (error "unexpected dest"))) ;; Local Variables: diff --git a/test-suite/standalone/test-ffi-lib.c b/test-suite/standalone/test-ffi-lib.c index d999101..8dec3d3 100644 --- a/test-suite/standalone/test-ffi-lib.c +++ b/test-suite/standalone/test-ffi-lib.c @@ -206,3 +206,10 @@ scm_t_int64 test_ffi_sum_struct (struct foo foo) { return foo.d + foo.c + foo.b + foo.a; } + + +void* test_ffi_memcpy (void *dest, void *src, scm_t_int32 n); +void* test_ffi_memcpy (void *dest, void *src, scm_t_int32 n) +{ + return memcpy (dest, src, n); +} hooks/post-receive -- GNU Guile