Commit d701e6de authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Define _T[USX]?CHAR/_TINT/TCHAR types, for compatibility.

Do not depend on other files being included first. Have the same include graph as the MS headers. Protect against trying to use libc when not possible. Cleanups.
parent adb4cb38
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#error Wine should not include tchar.h internally #error Wine should not include tchar.h internally
#endif #endif
#if defined(_UNICODE) || defined(_MBCS)
#error You must use msvcrt when builing in Unicode/MBCS mode
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -42,14 +46,16 @@ extern "C" { ...@@ -42,14 +46,16 @@ extern "C" {
* tchar mappings * tchar mappings
*/ */
#ifndef _UNICODE #ifndef _UNICODE
#include <string.h> # ifndef _MBCS
#ifndef _MBCS # include <string.h>
#define WINE_tchar_routine(std,mbcs,unicode) std # define WINE_tchar_routine(std,mbcs,unicode) std
#else /* _MBCS defined */ # else
#define WINE_tchar_routine(std,mbcs,unicode) mbcs # include <mbstring.h>
#endif # define WINE_tchar_routine(std,mbcs,unicode) mbcs
#else /* _UNICODE defined */ # endif
#define WINE_tchar_routine(std,mbcs,unicode) unicode #else /* _UNICODE */
# include <wchar.h>
# define WINE_tchar_routine(std,mbcs,unicode) unicode
#endif #endif
#define WINE_tchar_true(a) (1) #define WINE_tchar_true(a) (1)
...@@ -212,12 +218,45 @@ extern "C" { ...@@ -212,12 +218,45 @@ extern "C" {
#define _T(x) __T(x) #define _T(x) __T(x)
#define _TEXT(x) __T(x) #define _TEXT(x) __T(x)
typedef CHAR _TCHARA; #ifdef _UNICODE
typedef WCHAR _TCHARW; #ifndef _WCTYPE_T_DEFINED
DECL_WINELIB_TYPE_AW(_TCHAR) typedef unsigned short wint_t;
typedef UCHAR _TUCHARA; typedef unsigned short wctype_t;
typedef WCHAR _TUCHARW; #define _WCTYPE_T_DEFINED
DECL_WINELIB_TYPE_AW(_TUCHAR) #endif
#ifndef __TCHAR_DEFINED
#ifdef WINE_UNICODE_NATIVE
typedef wchar_t _TCHAR;
#else
typedef unsigned short _TCHAR;
#endif
typedef _TCHAR _TUCHAR;
typedef _TCHAR _TSCHAR;
typedef _TCHAR _TXCHAR;
typedef _TCHAR _TINT;
#define __TCHAR_DEFINED
#endif
#else /* _UNICODE */
#ifndef __TCHAR_DEFINED
typedef char _TCHAR;
typedef unsigned char _TUCHAR;
typedef signed char _TSCHAR;
#ifndef _MBCS
typedef unsigned char _TXCHAR;
typedef int _TINT;
#else
typedef char _TXCHAR;
typedef unsigned int _TINT;
#endif
#endif
#endif
#ifndef _TCHAR_DEFINED
typedef _TCHAR TCHAR, *PTCHAR;
#define _TCHAR_DEFINED
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment