summaryrefslogtreecommitdiff
path: root/Examples/test-suite
diff options
context:
space:
mode:
authorBrian Caine <brian.d.caine@gmail.com>2016-07-09 21:39:28 -0400
committerOlly Betts <olly@survex.com>2016-12-16 15:15:13 +1300
commit391bb79cbaa914db2dbbe2edec5c2af1d76bed86 (patch)
treeef8f59ca4bcefc4c8497cdce5326e9a0fd1788a8 /Examples/test-suite
parent88b4827d8753657c62ae143a64f8d8c668680d70 (diff)
downloadswig-391bb79cbaa914db2dbbe2edec5c2af1d76bed86.tar.gz
Added support for guile's native pointer type
Diffstat (limited to 'Examples/test-suite')
-rw-r--r--Examples/test-suite/guile/argout_runme.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/Examples/test-suite/guile/argout_runme.scm b/Examples/test-suite/guile/argout_runme.scm
new file mode 100644
index 000000000..8bbb96cc9
--- /dev/null
+++ b/Examples/test-suite/guile/argout_runme.scm
@@ -0,0 +1,16 @@
+;; tests support for native guile pointers
+;; https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html
+(dynamic-call "scm_init_argout_module" (dynamic-link "./libargout"))
+
+(use-modules (srfi srfi-4) (system foreign))
+
+(define initial-value 42)
+(define some-s32-data (s32vector initial-value))
+
+(if (not (= (incp (bytevector->pointer some-s32-data)) initial-value))
+ (error "Didn't read s32 data" initial-value some-s32-data))
+
+(if (not (= (s32vector-ref some-s32-data 0) (+ initial-value 1)))
+ (error "Failed to increment s32 data" some-s32-data))
+
+(exit 0)