From 86bc20b37e04b5037bb4795a553cfc3d58a3a516 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 10 Nov 2005 21:23:07 +0000 Subject: [PATCH] test non standard integral types used on Windows git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7840 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 1 + Examples/test-suite/li_windows.i | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 Examples/test-suite/li_windows.i diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 41e1d9e9f..c8e1f57bd 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -162,6 +162,7 @@ CPP_TEST_CASES += \ li_cdata \ li_cpointer \ li_typemaps \ + li_windows \ long_long_apply \ member_template \ minherit \ diff --git a/Examples/test-suite/li_windows.i b/Examples/test-suite/li_windows.i new file mode 100644 index 000000000..ccbb7b55f --- /dev/null +++ b/Examples/test-suite/li_windows.i @@ -0,0 +1,76 @@ +%module li_windows + +%include "windows.i" + +%inline %{ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) + #include +#else + // Use equivalent typs for non-windows systems + #define __int8 char + #define __int16 short + #define __int32 long + #define __int64 long long +#endif + +// Non ISO integral types + __int8 int8_val ( __int8 i) { return i; } + __int16 int16_val( __int16 i) { return i; } + __int32 int32_val( __int32 i) { return i; } + __int64 int64_val( __int64 i) { return i; } +unsigned __int8 uint8_val (unsigned __int8 i) { return i; } +unsigned __int16 uint16_val(unsigned __int16 i) { return i; } +unsigned __int32 uint32_val(unsigned __int32 i) { return i; } +unsigned __int64 uint64_val(unsigned __int64 i) { return i; } + +const __int8& int8_ref (const __int8& i) { return i; } +const __int16& int16_ref(const __int16& i) { return i; } +const __int32& int32_ref(const __int32& i) { return i; } +const __int64& int64_ref(const __int64& i) { return i; } +const unsigned __int8& uint8_ref (const unsigned __int8& i) { return i; } +const unsigned __int16& uint16_ref(const unsigned __int16& i) { return i; } +const unsigned __int32& uint32_ref(const unsigned __int32& i) { return i; } +const unsigned __int64& uint64_ref(const unsigned __int64& i) { return i; } + + __int8 int8_global; + __int16 int16_global; + __int32 int32_global; + __int64 int64_global; +unsigned __int8 uint8_global; +unsigned __int16 uint16_global; +unsigned __int32 uint32_global; +unsigned __int64 uint64_global; + +struct WindowsInts { + __int8 int8_member; + __int16 int16_member; + __int32 int32_member; + __int64 int64_member; + unsigned __int8 uint8_member; + unsigned __int16 uint16_member; + unsigned __int32 uint32_member; + unsigned __int64 uint64_member; +}; + +// Typedef for non ISO integral types +typedef __int8 int8; +typedef __int16 int16; +typedef __int32 int32; +typedef __int64 int64; + +typedef unsigned __int8 uint8; +typedef unsigned __int16 uint16; +typedef unsigned __int32 uint32; +typedef unsigned __int64 uint64; + + int8 int8_td (int8 i) { return i; } + int16 int16_td(int16 i) { return i; } + int32 int32_td(int32 i) { return i; } + int64 int64_td(int64 i) { return i; } +uint8 uint8_td (int8 i) { return i; } +uint16 uint16_td(int16 i) { return i; } +uint32 uint32_td(int32 i) { return i; } +uint64 uint64_td(int64 i) { return i; } + +%} +