From 6621bf2c4ad3969638cab8a35091ce70de1d1260 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 21 May 2017 15:53:52 -0700 Subject: 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. --- tests/017/glob-carray.tl | 31 ++++++++++++++++++++----------- tests/017/glob-zarray.tl | 31 ++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 22 deletions(-) (limited to 'tests') 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))) -- cgit v1.2.3