ReactOS 0.4.16-dev-1142-g8029339
wine2ros.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Wine-To-ReactOS
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Reducing dependency on Wine
5 * COPYRIGHT: Copyright 2025 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 */
7
8#pragma once
9
10/* <wine/debug.h> */
11#if DBG
12 #ifndef __RELFILE__
13 #define __RELFILE__ __FILE__
14 #endif
15
16 #define ERR_LEVEL 0x1
17 #define TRACE_LEVEL 0x8
18
19 #define WINE_DEFAULT_DEBUG_CHANNEL(x) static PCSTR DbgDefaultChannel = #x;
20
22
23 #define DBG_PRINT(ch, level, tag, fmt, ...) (void)( \
24 (((level) == ERR_LEVEL) || IntIsDebugChannelEnabled(ch)) ? \
25 (DbgPrint("(%s:%d) %s" fmt, __RELFILE__, __LINE__, (tag), ##__VA_ARGS__), FALSE) : TRUE \
26 )
27
28 #define ERR(fmt, ...) DBG_PRINT(DbgDefaultChannel, ERR_LEVEL, "err: ", fmt, ##__VA_ARGS__)
29 #define WARN(fmt, ...) DBG_PRINT(DbgDefaultChannel, ERR_LEVEL, "warn: ", fmt, ##__VA_ARGS__)
30 #define FIXME(fmt, ...) DBG_PRINT(DbgDefaultChannel, ERR_LEVEL, "fixme: ", fmt, ##__VA_ARGS__)
31 #define TRACE(fmt, ...) DBG_PRINT(DbgDefaultChannel, TRACE_LEVEL, "", fmt, ##__VA_ARGS__)
32
33 #define UNIMPLEMENTED FIXME("%s is unimplemented", __FUNCTION__);
34
38#else
39 #define WINE_DEFAULT_DEBUG_CHANNEL(x)
40 #define IntIsDebugChannelEnabled(channel) FALSE
41 #define DBG_PRINT(ch, level)
42 #define ERR(fmt, ...)
43 #define WARN(fmt, ...)
44 #define FIXME(fmt, ...)
45 #define TRACE(fmt, ...)
46 #define UNIMPLEMENTED
47 #define debugstr_a(pszA) ((PCSTR)NULL)
48 #define debugstr_w(pszW) ((PCSTR)NULL)
49 #define debugstr_guid(id) ((PCSTR)NULL)
50#endif
51
52/* <wine/unicode.h> */
53#define memicmpW(s1,s2,n) _wcsnicmp((s1),(s2),(n))
54#define strlenW(s) wcslen((s))
55#define strcpyW(d,s) wcscpy((d),(s))
56#define strcatW(d,s) wcscat((d),(s))
57#define strcspnW(d,s) wcscspn((d),(s))
58#define strstrW(d,s) wcsstr((d),(s))
59#define strtolW(s,e,b) wcstol((s),(e),(b))
60#define strchrW(s,c) wcschr((s),(c))
61#define strrchrW(s,c) wcsrchr((s),(c))
62#define strncmpW(s1,s2,n) wcsncmp((s1),(s2),(n))
63#define strncpyW(s1,s2,n) wcsncpy((s1),(s2),(n))
64#define strcmpW(s1,s2) wcscmp((s1),(s2))
65#define strcmpiW(s1,s2) _wcsicmp((s1),(s2))
66#define strncmpiW(s1,s2,n) _wcsnicmp((s1),(s2),(n))
67#define strtoulW(s1,s2,b) wcstoul((s1),(s2),(b))
68#define strspnW(str, accept) wcsspn((str),(accept))
69#define strpbrkW(str, accept) wcspbrk((str),(accept))
70#define tolowerW(n) towlower((n))
71#define toupperW(n) towupper((n))
72#define islowerW(n) iswlower((n))
73#define isupperW(n) iswupper((n))
74#define isalphaW(n) iswalpha((n))
75#define isalnumW(n) iswalnum((n))
76#define isdigitW(n) iswdigit((n))
77#define isxdigitW(n) iswxdigit((n))
78#define isspaceW(n) iswspace((n))
79#define iscntrlW(n) iswcntrl((n))
80#define atoiW(s) _wtoi((s))
81#define atolW(s) _wtol((s))
82#define strlwrW(s) _wcslwr((s))
83#define struprW(s) _wcsupr((s))
84#define sprintfW _swprintf
85#define vsprintfW _vswprintf
86#define snprintfW _snwprintf
87#define vsnprintfW _vsnwprintf
88#define isprintW iswprint
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
const uint16_t * PCWSTR
Definition: typedefs.h:57
const char * PCSTR
Definition: typedefs.h:52
#define IntIsDebugChannelEnabled(channel)
Definition: wine2ros.h:40
#define debugstr_a(pszA)
Definition: wine2ros.h:47
#define debugstr_w(pszW)
Definition: wine2ros.h:48
#define debugstr_guid(id)
Definition: wine2ros.h:49