5050#define __pragma (...) _Pragma (#__VA_ARGS__)
5151#define __declspec (x )
5252#define CALLBACK
53+ #define TEXT (x ) strdup(x)
54+
55+ inline char * _strlwr_l (char * str, locale_t loc)
56+ {
57+ // TODO
58+ }
59+
60+ inline char * _strupr_l (char * str, locale_t loc)
61+ {
62+ // TODO
63+ }
64+
65+ #define VOID void
66+ #define HKL void *
67+ #define ActivateKeyboardLayout (x, y ) {}
68+ #define ScreenToClient (hwnd, p ) {}
5369
5470#define __except (X ) catch (X)
5571
5672/*
57- static inline long InterlockedExchange(volatile long * val, long new_val)
73+ static inline long InterlockedExchange(volatile long* val, long new_val)
5874{
5975 long old_val;
6076 do {
@@ -75,11 +91,11 @@ inline void Sleep(int ms)
7591}
7692
7793inline void _splitpath (
78- const char * path, // Path Input
79- char * drive, // Drive : Output
80- char * dir, // Directory : Output
81- char * fname, // Filename : Output
82- char * ext // Extension : Output
94+ const char * path, // Path Input
95+ char * drive, // Drive : Output
96+ char * dir, // Directory : Output
97+ char * fname, // Filename : Output
98+ char * ext // Extension : Output
8399){}
84100
85101inline unsigned long GetLastError ()
@@ -94,28 +110,34 @@ inline int GetExceptionCode()
94110
95111#define xr_unlink unlink
96112
97- typedef char BOOL;
113+ #include < inttypes.h>
114+ typedef int32_t BOOL;
115+ typedef uint8_t BYTE;
116+ typedef uint16_t WORD;
117+ typedef uint32_t DWORD;
118+ typedef int32_t LONG;
119+ #ifndef _LIBRAW_TYPES_H
120+ typedef int64_t INT64;
121+ typedef uint64_t UINT64;
122+ #endif
123+
98124typedef char * LPSTR;
99125typedef char * PSTR;
100126typedef char * LPTSTR;
101127typedef const char * LPCSTR;
102128typedef const char * LPCTSTR;
103- typedef unsigned char BYTE;
104129typedef unsigned char * LPBYTE;
105130typedef unsigned int UINT;
106131typedef int INT;
107- typedef long LONG;
108132typedef unsigned long ULONG;
109133typedef unsigned long & ULONG_PTR;
110134typedef long long int LARGE_INTEGER;
111135typedef unsigned long long int ULARGE_INTEGER;
112136
113- typedef unsigned short WORD;
114137typedef unsigned short * LPWORD;
115- typedef unsigned long DWORD;
116138typedef unsigned long * LPDWORD;
117- typedef const void * LPCVOID;
118- typedef long long int * PLARGE_INTEGER;
139+ typedef const void * LPCVOID;
140+ typedef long long int * PLARGE_INTEGER;
119141
120142typedef wchar_t WCHAR;
121143
@@ -131,6 +153,28 @@ typedef struct {
131153 WORD cbSize;
132154} WAVEFORMATEX, *LPWAVEFORMATEX;
133155
156+ typedef struct tagSTICKYKEYS
157+ {
158+ DWORD cbSize;
159+ DWORD dwFlags;
160+ } STICKYKEYS, *LPSTICKYKEYS;
161+
162+ typedef struct tagFILTERKEYS
163+ {
164+ UINT cbSize;
165+ DWORD dwFlags;
166+ DWORD iWaitMSec;
167+ DWORD iDelayMSec;
168+ DWORD iRepeatMSec;
169+ DWORD iBounceMSec;
170+ } FILTERKEYS, *LPFILTERKEYS;
171+
172+ typedef struct tagTOGGLEKEYS
173+ {
174+ DWORD cbSize;
175+ DWORD dwFlags;
176+ } TOGGLEKEYS, *LPTOGGLEKEYS;
177+
134178typedef struct _EXCEPTION_POINTERS {
135179} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
136180
@@ -145,18 +189,16 @@ typedef long LONG_PTR;
145189#endif // XR_X64
146190
147191typedef int HANDLE;
148- typedef void * HMODULE;
149- typedef void * LPVOID;
192+ typedef void * HMODULE;
193+ typedef void * LPVOID;
150194typedef UINT_PTR WPARAM;
151195typedef LONG_PTR LPARAM;
152196typedef long HRESULT;
153197typedef long LRESULT;
154198typedef long _W64;
155- // typedef void *HWND;
156- typedef SDL_Window *HWND;
157- typedef void *HDC;
158- // typedef void *HGLRC;
159- typedef SDL_GLContext HGLRC;
199+ // typedef void* HWND;
200+ typedef SDL_Window* HWND;
201+ typedef void * HDC;
160202typedef float FLOAT;
161203typedef unsigned char UINT8;
162204
@@ -172,10 +214,15 @@ typedef struct tagPOINT {
172214 long y;
173215} POINT, *PPOINT, *LPPOINT;
174216
217+ #define DWORD_PTR UINT_PTR
175218#define WM_USER 0x0400
219+ #define WA_INACTIVE 0
220+ #define HIWORD (l ) ((WORD)((DWORD_PTR)(l) >> 16 ))
221+ #define LOWORD (l ) ((WORD)((DWORD_PTR)(l) & 0xFFFF ))
176222
177- #define TRUE 1
178- #define FALSE 0
223+
224+ #define TRUE true
225+ #define FALSE false
179226#define NONE 0
180227#define CONST const
181228
@@ -196,9 +243,12 @@ typedef dirent DirEntryType;
196243#define strcmpi stricmp
197244#define lstrcpy strcpy
198245#define stricmp strcasecmp
199- #define strncpy_s (dest, size, source, num ) strncpy(dest, source, num)
200- #define strcpy_s (dest, num, source ) strcpy(dest, source)
246+ #define strupr SDL_strupr
247+ #define strncpy_s (dest, size, source, num ) (NULL == strncpy(dest, source, num))
248+ #define strcpy_s (dest, num, source ) (NULL == strcpy(dest, source))
249+ #define strcat_s (dest, num, source ) (dest == strcat(dest, source))
201250#define _vsnprintf vsnprintf
251+ #define vsprintf_s (dest, size, format, args ) vsprintf(dest, format, args)
202252#define _alloca alloca
203253#define _snprintf snprintf
204254#define sprintf_s (buffer, buffer_size, stringbuffer, ...) sprintf(buffer, stringbuffer, ##__VA_ARGS__)
@@ -241,7 +291,11 @@ inline int _filelength(int fd)
241291#define __max (a, b ) std::max(a, b)
242292#define __min (a, b ) std::min(a, b)
243293
244- #define xr_itoa SDL_itoa
294+ #define itoa SDL_itoa
295+ #define _itoa_s (value, buffer, radix ) SDL_itoa(value, buffer, radix)
296+ #define _locale_t locale_t
297+ #define _isalpha_l isalpha_l
298+ #define _create_locale (category, arg ) newlocale(category, arg, (locale_t ) 0 )
245299
246300#define ZeroMemory (p, sz ) memset((p), 0 , (sz))
247301#define CopyMemory (d, s, n ) memcpy(d, s, n)
@@ -256,4 +310,7 @@ inline int _filelength(int fd)
256310#define _MAX_DRIVE 3
257311#define _MAX_DIR 256
258312#define _MAX_FNAME 256
259- #define _MAX_EXT 256
313+ #define _MAX_EXT 256
314+
315+ #define SEM_FAILCRITICALERRORS 1
316+ #define SetErrorMode (x ) {}
0 commit comments