test non standard integral types used on Windows

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7840 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-11-10 21:23:07 +00:00
commit 5924cd83f4
2 changed files with 77 additions and 0 deletions

View file

@ -162,6 +162,7 @@ CPP_TEST_CASES += \
li_cdata \
li_cpointer \
li_typemaps \
li_windows \
long_long_apply \
member_template \
minherit \

View file

@ -0,0 +1,76 @@
%module li_windows
%include "windows.i"
%inline %{
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#include <windows.h>
#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; }
%}