6 typedef __int64 WDL_INT64
;
7 typedef unsigned __int64 WDL_UINT64
;
11 typedef long long WDL_INT64
;
12 typedef unsigned long long WDL_UINT64
;
17 #define WDL_UINT64_CONST(x) (x##ui64)
18 #define WDL_INT64_CONST(x) (x##i64)
20 #define WDL_UINT64_CONST(x) (x##ULL)
21 #define WDL_INT64_CONST(x) (x##LL)
25 #if !defined(_MSC_VER) || _MSC_VER > 1200
26 #define WDL_DLGRET INT_PTR CALLBACK
28 #define WDL_DLGRET BOOL CALLBACK
36 typedef intptr_t INT_PTR
;
37 typedef uintptr_t UINT_PTR
;
40 #if defined(__ppc__) || !defined(__cplusplus)
41 typedef char WDL_bool
;
43 typedef bool WDL_bool
;
47 #define GWLP_USERDATA GWL_USERDATA
48 #define GWLP_WNDPROC GWL_WNDPROC
49 #define GWLP_HINSTANCE GWL_HINSTANCE
50 #define GWLP_HWNDPARENT GWL_HWNDPARENT
51 #define DWLP_USER DWL_USER
52 #define DWLP_DLGPROC DWL_DLGPROC
53 #define DWLP_MSGRESULT DWL_MSGRESULT
54 #define SetWindowLongPtr(a,b,c) SetWindowLong(a,b,c)
55 #define GetWindowLongPtr(a,b) GetWindowLong(a,b)
56 #define SetWindowLongPtrW(a,b,c) SetWindowLongW(a,b,c)
57 #define GetWindowLongPtrW(a,b) GetWindowLongW(a,b)
58 #define SetWindowLongPtrA(a,b,c) SetWindowLongA(a,b,c)
59 #define GetWindowLongPtrA(a,b) GetWindowLongA(a,b)
61 #define GCLP_WNDPROC GCL_WNDPROC
62 #define GCLP_HICON GCL_HICON
63 #define GCLP_HICONSM GCL_HICONSM
64 #define SetClassLongPtr(a,b,c) SetClassLong(a,b,c)
65 #define GetClassLongPtr(a,b) GetClassLong(a,b)
70 // for structures that contain doubles, or doubles in structures that are after stuff of questionable alignment (for OSX/linux)
71 #define WDL_FIXALIGN __attribute__ ((aligned (8)))
72 // usage: void func(int a, const char *fmt, ...) WDL_VARARG_WARN(printf,2,3); // note: if member function, this pointer is counted as well, so as member function that would be 3,4
73 #define WDL_VARARG_WARN(x,n,s) __attribute__ ((format (x,n,s)))
74 #define WDL_STATICFUNC_UNUSED __attribute__((unused))
78 #define WDL_VARARG_WARN(x,n,s)
79 #define WDL_STATICFUNC_UNUSED
82 #ifndef WDL_WANT_NEW_EXCEPTIONS
83 #if defined(__cplusplus)
85 #define WDL_NEW (std::nothrow)
92 #if !defined(max) && defined(WDL_DEFINE_MINMAX)
93 #define max(x,y) ((x)<(y)?(y):(x))
94 #define min(x,y) ((x)<(y)?(x):(y))
98 #define wdl_max(x,y) ((x)<(y)?(y):(x))
99 #define wdl_min(x,y) ((x)<(y)?(x):(y))
100 #define wdl_abs(x) ((x)<0 ? -(x) : (x))
105 #define strnicmp(x,y,z) strncasecmp(x,y,z)
108 #define stricmp(x,y) strcasecmp(x,y)
112 #ifdef WDL_BACKSLASHES_ARE_ORDINARY
113 #define WDL_IS_DIRCHAR(x) ((x) == '/')
115 // for multi-platform applications it seems better to treat backslashes as directory separators even if it
116 // isn't supported by the underying system (for resolving filenames, etc)
118 #define WDL_IS_DIRCHAR(x) ((x) == '\\' || (x) == '/')
120 #define WDL_IS_DIRCHAR(x) ((x) == '/' || (x) == '\\')
124 #if defined(_WIN32) && !defined(WDL_BACKSLASHES_ARE_ORDINARY)
125 #define WDL_DIRCHAR '\\'
126 #define WDL_DIRCHAR_STR "\\"
128 #define WDL_DIRCHAR '/'
129 #define WDL_DIRCHAR_STR "/"
132 #if defined(_WIN32) || defined(__APPLE__)
133 // on __APPLE__ we should ideally check the filesystem for case-sensitivity, assuming a case-insensitive-only match
134 #define wdl_filename_cmp(x,y) stricmp(x,y)
135 #define wdl_filename_cmpn(x,y,n) strnicmp(x,y,n)
137 #define wdl_filename_cmp(x,y) strcmp(x,y)
138 #define wdl_filename_cmpn(x,y,n) strncmp(x,y,n)
141 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
142 #define WDL_likely(x) (__builtin_expect(!!(x),1))
143 #define WDL_unlikely(x) (__builtin_expect(!!(x),0))
145 #define WDL_likely(x) (!!(x))
146 #define WDL_unlikely(x) (!!(x))
149 #if defined(_DEBUG) || defined(DEBUG)
151 #define WDL_ASSERT(x) assert(x)
152 #define WDL_NORMALLY(x) (assert(x),1)
153 #define WDL_NOT_NORMALLY(x) (assert(!(x)),0)
155 #define WDL_ASSERT(x)
156 #define WDL_NORMALLY(x) WDL_likely(x)
157 #define WDL_NOT_NORMALLY(x) WDL_unlikely(x)