summaryrefslogtreecommitdiffstats
path: root/other-licenses/nsis/Contrib/ExDLL/tchar.h
blob: 5c18ffb778d58651acd55cdcd60e31b97ddd6810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*
 * tchar.h
 * 
 * This file is a part of NSIS.
 * 
 * Copyright (C) 1999-2007 Nullsoft and Contributors
 * 
 * This software is provided 'as-is', without any express or implied
 * warranty.
 *
 * For Unicode support by Jim Park -- 08/30/2007
 */

// Jim Park: Only those we use are listed here.

#pragma once

#ifdef _UNICODE

#ifndef _T
#define __T(x)   L ## x
#define _T(x)    __T(x)
#define _TEXT(x) __T(x)
#endif
typedef wchar_t TCHAR;
typedef wchar_t _TUCHAR;

// program
#define _tmain      wmain
#define _tWinMain   wWinMain
#define _tenviron   _wenviron
#define __targv     __wargv

// printfs
#define _ftprintf   fwprintf
#define _sntprintf  _snwprintf
#define _stprintf   _swprintf
#define _tprintf    wprintf
#define _vftprintf  vfwprintf
#define _vsntprintf _vsnwprintf
#define _vstprintf  _vswprintf

// scanfs
#define _tscanf     wscanf
#define _stscanf    swscanf

// string manipulations
#define _tcscat     wcscat
#define _tcschr     wcschr
#define _tcsclen    wcslen
#define _tcscpy     wcscpy
#define _tcsdup     _wcsdup
#define _tcslen     wcslen
#define _tcsnccpy   wcsncpy
#define _tcsncpy    wcsncpy
#define _tcsrchr    wcsrchr
#define _tcsstr     wcsstr
#define _tcstok     wcstok

// string comparisons
#define _tcscmp     wcscmp
#define _tcsicmp    _wcsicmp
#define _tcsncicmp  _wcsnicmp
#define _tcsncmp    wcsncmp
#define _tcsnicmp   _wcsnicmp

// upper / lower
#define _tcslwr     _wcslwr
#define _tcsupr     _wcsupr
#define _totlower   towlower
#define _totupper   towupper

// conversions to numbers
#define _tcstoi64   _wcstoi64
#define _tcstol     wcstol
#define _tcstoul    wcstoul
#define _tstof      _wtof
#define _tstoi      _wtoi
#define _tstoi64    _wtoi64
#define _ttoi       _wtoi
#define _ttoi64     _wtoi64
#define _ttol       _wtol

// conversion from numbers to strings
#define _itot       _itow
#define _ltot       _ltow
#define _i64tot     _i64tow
#define _ui64tot    _ui64tow

// file manipulations
#define _tfopen     _wfopen
#define _topen      _wopen
#define _tremove    _wremove
#define _tunlink    _wunlink

// reading and writing to i/o
#define _fgettc     fgetwc
#define _fgetts     fgetws
#define _fputts     fputws
#define _gettchar   getwchar

// directory
#define _tchdir     _wchdir

// environment
#define _tgetenv    _wgetenv
#define _tsystem    _wsystem

// time
#define _tcsftime   wcsftime

#else // ANSI

#ifndef _T
#define _T(x)    x
#define _TEXT(x) x
#endif
typedef char            TCHAR;
typedef unsigned char   _TUCHAR;

// program
#define _tmain      main
#define _tWinMain   WinMain
#define _tenviron   environ
#define __targv     __argv

// printfs
#define _ftprintf   fprintf
#define _sntprintf  _snprintf
#define _stprintf   sprintf
#define _tprintf    printf
#define _vftprintf  vfprintf
#define _vsntprintf _vsnprintf
#define _vstprintf  vsprintf

// scanfs
#define _tscanf     scanf
#define _stscanf    sscanf

// string manipulations
#define _tcscat     strcat
#define _tcschr     strchr
#define _tcsclen    strlen
#define _tcscnlen   strnlen
#define _tcscpy     strcpy
#define _tcsdup     _strdup
#define _tcslen     strlen
#define _tcsnccpy   strncpy
#define _tcsrchr    strrchr
#define _tcsstr     strstr
#define _tcstok     strtok

// string comparisons
#define _tcscmp     strcmp
#define _tcsicmp    _stricmp
#define _tcsncmp    strncmp
#define _tcsncicmp  _strnicmp
#define _tcsnicmp   _strnicmp

// upper / lower
#define _tcslwr     _strlwr
#define _tcsupr     _strupr

#define _totupper   toupper
#define _totlower   tolower

// conversions to numbers
#define _tcstol     strtol
#define _tcstoul    strtoul
#define _tstof      atof
#define _tstoi      atoi
#define _tstoi64    _atoi64
#define _tstoi64    _atoi64
#define _ttoi       atoi
#define _ttoi64     _atoi64
#define _ttol       atol

// conversion from numbers to strings
#define _i64tot     _i64toa
#define _itot       _itoa
#define _ltot       _ltoa
#define _ui64tot    _ui64toa

// file manipulations
#define _tfopen     fopen
#define _topen      _open
#define _tremove    remove
#define _tunlink    _unlink

// reading and writing to i/o
#define _fgettc     fgetc
#define _fgetts     fgets
#define _fputts     fputs
#define _gettchar   getchar

// directory
#define _tchdir     _chdir

// environment
#define _tgetenv    getenv
#define _tsystem    system

// time
#define _tcsftime   strftime

#endif

// is functions (the same in Unicode / ANSI)
#define _istgraph   isgraph
#define _istascii   __isascii