1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *     Silenio Quarti
14  *******************************************************************************/
15 
16 #ifndef ECLIPSE_UNICODE_H
17 #define ECLIPSE_UNICODE_H
18 
19 #ifdef _WIN32
20 
21 #ifdef UNICODE
22 #define _UNICODE
23 #endif
24 #include <windows.h>
25 #include <tchar.h>
26 #include <ctype.h>
27 
28 #ifdef __MINGW32__
29 # ifdef UNICODE
30 #  ifndef _TCHAR
31 #   define _TCHAR TCHAR
32 #  endif /* _TCHAR */
33 #  ifndef _tgetcwd
34 #   define _tgetcwd _wgetcwd
35 #  endif /* _tgetcwd */
36 #  ifndef _tstat
37 #   define _tstat _wstat
38 #  endif /* _tstat */
39 #  ifndef _topendir
40 #   define _topendir _wopendir
41 #  endif /* _topendir */
42 #  ifndef _treaddir
43 #   define _treaddir _wreaddir
44 #  endif /* _treaddir */
45 #  ifndef _tclosedir
46 #   define _tclosedir _wclosedir
47 #  endif /* _tclosedir */
48 #  ifndef _tDIR
49 #   define _tDIR _WDIR
50 #  endif /* _tDIR */
51 # else /* UNICODE */
52 #  ifndef _TCHAR
53 #   define _TCHAR char
54 #  endif /* _TCHAR */
55 #  ifndef _tgetcwd
56 #   define _tgetcwd getcwd
57 #  endif /* _tgetcwd */
58 #  ifndef _tstat
59 #   define _tstat _stat
60 #  endif /* _tstat */
61 #  ifndef _topendir
62 #error message!
63 #   define _topendir opendir
64 #  endif /* _topendir */
65 #  ifndef _treaddir
66 #   define _treaddir readdir
67 #  endif /* _treaddir */
68 #  ifndef _tclosedir
69 #   define _tclosedir closedir
70 #  endif /* _tclosedir */
71 #  ifndef _tDIR
72 #   define _tDIR DIR
73 #  endif /* _tDIR */
74 # endif /* UNICODE */
75 #endif /* __MINGW32__ */
76 
77 #define _T_ECLIPSE _T
78 
79 #else /* Platforms other than Windows */
80 
81 #define _TCHAR char
82 #define _T_ECLIPSE(s) s
83 #define _fgetts fgets
84 #define _stat stat
85 #define _stprintf sprintf
86 #define _ftprintf fprintf
87 #define _stscanf sscanf
88 #define _tcscat strcat
89 #define _tcschr strchr
90 #define _tcspbrk strpbrk
91 #define _tcscmp strcmp
92 #define _tcscpy strcpy
93 #define _tcsdup strdup
94 #define _tcsicmp strcasecmp
95 #define _tcslen strlen
96 #define _tcsncpy strncpy
97 #define _tcsrchr strrchr
98 #define _tfopen fopen
99 #define _tgetcwd getcwd
100 #define _tgetenv getenv
101 #define _tcstol strtol
102 #define _tcstok strtok
103 #ifndef LINUX
104 #define _totupper toupper
105 #endif /* LINUX */
106 #define _tprintf printf
107 #define _tstat stat
108 #define _tcsncmp strncmp
109 #define _tcsstr strstr
110 #define _topendir opendir
111 #define _treaddir readdir
112 #define _tclosedir closedir
113 #define _tDIR DIR
114 #endif /* _WIN32 */
115 
116 #endif /* ECLIPSE_UNICODE_H */
117