diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-21 15:53:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-21 15:53:52 -0700 |
commit | 6621bf2c4ad3969638cab8a35091ce70de1d1260 (patch) | |
tree | 08cb2d7f3fae0fb8694702b8d96737bf421e7c06 /tests | |
parent | b580e0f60eab4b23e782b0f2970823a51e5000bd (diff) | |
download | txr-6621bf2c4ad3969638cab8a35091ce70de1d1260.tar.gz txr-6621bf2c4ad3969638cab8a35091ce70de1d1260.tar.bz2 txr-6621bf2c4ad3969638cab8a35091ce70de1d1260.zip |
ffi: glob test: struct size on Linux and Cygwin.
* tests/017/glob-carray.tl (glob-t): Restructure
to case statement. Add padding to struct based on
looking at the glibc definition. Add FFI definition
based on Cygwin header.
* tests/017/glob-zarray.tl (glob-t): Likewise.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/017/glob-carray.tl | 31 | ||||
-rw-r--r-- | tests/017/glob-zarray.tl | 31 |
2 files changed, 40 insertions, 22 deletions
diff --git a/tests/017/glob-carray.tl b/tests/017/glob-carray.tl index f98359a8..d40dfdad 100644 --- a/tests/017/glob-carray.tl +++ b/tests/017/glob-carray.tl @@ -3,21 +3,30 @@ (defstruct glob-t nil pathc pathv (reserve 0)) -(cond - ((eq (os-symbol) :macos) - (deffi-type glob-t (struct glob-t - (pathc size-t) - (nil int) - (nil size-t) - (nil int) - (pathv (carray str-d)) - (nil (array 4 cptr))))) +(caseq (os-symbol) + (:macos + (deffi-type glob-t (struct glob-t + (pathc size-t) + (nil int) + (nil size-t) + (nil int) + (pathv (carray str-d)) + (nil (array 4 cptr))))) + ((:cygnal :cygwin) + (deffi-type glob-t (struct glob-t + (pathc size-t) + (nil size-t) + (nil size-t) + (nil int) + (pathv (carray str-d)) + (nil (array 6 cptr))))) (t (deffi-type glob-t (struct glob-t (pathc size-t) (pathv (carray str-d)) - (reserve size-t))))) + (reserve size-t) + (nil (array 5 cptr)))))) -(with-dyn-lib nil +(with-dyn-lib (libc) (deffi globb "glob" int (str int closure (ptr-out glob-t))) (deffi globfree "globfree" void ((ptr-in glob-t))) (deffi-cb glob-cb int (str int) -1)) diff --git a/tests/017/glob-zarray.tl b/tests/017/glob-zarray.tl index 0597da86..81d11bf8 100644 --- a/tests/017/glob-zarray.tl +++ b/tests/017/glob-zarray.tl @@ -3,19 +3,28 @@ (defstruct glob-t nil pathc pathv (reserve 0)) -(cond - ((eq (os-symbol) :macos) - (deffi-type glob-t (struct glob-t - (pathc size-t) - (nil int) - (nil size-t) - (nil int) - (pathv (ptr-out-d (zarray str-d))) - (nil (array 4 cptr))))) +(caseq (os-symbol) + (:macos + (deffi-type glob-t (struct glob-t + (pathc size-t) + (nil int) + (nil size-t) + (nil int) + (pathv (ptr-out-d (zarray str-d))) + (nil (array 4 cptr))))) + ((:cygnal :cygwin) + (deffi-type glob-t (struct glob-t + (pathc size-t) + (nil size-t) + (nil size-t) + (nil int) + (pathv (ptr-out-d (zarray str-d))) + (nil (array 6 cptr))))) (t (deffi-type glob-t (struct glob-t (pathc size-t) - (pathv (ptr-out-d (zarray str-d))) - (reserve size-t))))) + (pathv (ptr-out-d (zarray str-d))) + (reserve size-t) + (nil (array 5 cptr)))))) (with-dyn-lib (libc) (deffi globb "glob" int (str int closure (ptr-out glob-t))) |