1 /* 2 * nsis_tchar.h 3 * 4 * This file is a part of NSIS. 5 * 6 * Copyright (C) 1999-2007 Nullsoft and Contributors 7 * 8 * This software is provided 'as-is', without any express or implied 9 * warranty. 10 * 11 * For Unicode support by Jim Park -- 08/30/2007 12 */ 13 14 // Jim Park: Only those we use are listed here. 15 16 #pragma once 17 18 #ifdef _UNICODE 19 20 #ifndef _T 21 #define __T(x) L ## x 22 #define _T(x) __T(x) 23 #define _TEXT(x) __T(x) 24 #endif 25 typedef wchar_t TCHAR; 26 typedef wchar_t _TUCHAR; 27 28 // program 29 #define _tmain wmain 30 #define _tWinMain wWinMain 31 #define _tenviron _wenviron 32 #define __targv __wargv 33 34 // printfs 35 #define _ftprintf fwprintf 36 #define _sntprintf _snwprintf 37 #define _stprintf _swprintf 38 #define _tprintf wprintf 39 #define _vftprintf vfwprintf 40 #define _vsntprintf _vsnwprintf 41 #define _vstprintf _vswprintf 42 43 // scanfs 44 #define _tscanf wscanf 45 #define _stscanf swscanf 46 47 // string manipulations 48 #define _tcscat wcscat 49 #define _tcschr wcschr 50 #define _tcsclen wcslen 51 #define _tcscpy wcscpy 52 #define _tcsdup _wcsdup 53 #define _tcslen wcslen 54 #define _tcsnccpy wcsncpy 55 #define _tcsncpy wcsncpy 56 #define _tcsrchr wcsrchr 57 #define _tcsstr wcsstr 58 #define _tcstok wcstok 59 60 // string comparisons 61 #define _tcscmp wcscmp 62 #define _tcsicmp _wcsicmp 63 #define _tcsncicmp _wcsnicmp 64 #define _tcsncmp wcsncmp 65 #define _tcsnicmp _wcsnicmp 66 67 // upper / lower 68 #define _tcslwr _wcslwr 69 #define _tcsupr _wcsupr 70 #define _totlower towlower 71 #define _totupper towupper 72 73 // conversions to numbers 74 #define _tcstoi64 _wcstoi64 75 #define _tcstol wcstol 76 #define _tcstoul wcstoul 77 #define _tstof _wtof 78 #define _tstoi _wtoi 79 #define _tstoi64 _wtoi64 80 #define _ttoi _wtoi 81 #define _ttoi64 _wtoi64 82 #define _ttol _wtol 83 84 // conversion from numbers to strings 85 #define _itot _itow 86 #define _ltot _ltow 87 #define _i64tot _i64tow 88 #define _ui64tot _ui64tow 89 90 // file manipulations 91 #define _tfopen _wfopen 92 #define _topen _wopen 93 #define _tremove _wremove 94 #define _tunlink _wunlink 95 96 // reading and writing to i/o 97 #define _fgettc fgetwc 98 #define _fgetts fgetws 99 #define _fputts fputws 100 #define _gettchar getwchar 101 102 // directory 103 #define _tchdir _wchdir 104 105 // environment 106 #define _tgetenv _wgetenv 107 #define _tsystem _wsystem 108 109 // time 110 #define _tcsftime wcsftime 111 112 #else // ANSI 113 114 #ifndef _T 115 #define _T(x) x 116 #define _TEXT(x) x 117 #endif 118 typedef char TCHAR; 119 typedef unsigned char _TUCHAR; 120 121 // program 122 #define _tmain main 123 #define _tWinMain WinMain 124 #define _tenviron environ 125 #define __targv __argv 126 127 // printfs 128 #define _ftprintf fprintf 129 #define _sntprintf _snprintf 130 #define _stprintf sprintf 131 #define _tprintf printf 132 #define _vftprintf vfprintf 133 #define _vsntprintf _vsnprintf 134 #define _vstprintf vsprintf 135 136 // scanfs 137 #define _tscanf scanf 138 #define _stscanf sscanf 139 140 // string manipulations 141 #define _tcscat strcat 142 #define _tcschr strchr 143 #define _tcsclen strlen 144 #define _tcscnlen strnlen 145 #define _tcscpy strcpy 146 #define _tcsdup _strdup 147 #define _tcslen strlen 148 #define _tcsnccpy strncpy 149 #define _tcsrchr strrchr 150 #define _tcsstr strstr 151 #define _tcstok strtok 152 153 // string comparisons 154 #define _tcscmp strcmp 155 #define _tcsicmp _stricmp 156 #define _tcsncmp strncmp 157 #define _tcsncicmp _strnicmp 158 #define _tcsnicmp _strnicmp 159 160 // upper / lower 161 #define _tcslwr _strlwr 162 #define _tcsupr _strupr 163 164 #define _totupper toupper 165 #define _totlower tolower 166 167 // conversions to numbers 168 #define _tcstol strtol 169 #define _tcstoul strtoul 170 #define _tstof atof 171 #define _tstoi atoi 172 #define _tstoi64 _atoi64 173 #define _tstoi64 _atoi64 174 #define _ttoi atoi 175 #define _ttoi64 _atoi64 176 #define _ttol atol 177 178 // conversion from numbers to strings 179 #define _i64tot _i64toa 180 #define _itot _itoa 181 #define _ltot _ltoa 182 #define _ui64tot _ui64toa 183 184 // file manipulations 185 #define _tfopen fopen 186 #define _topen _open 187 #define _tremove remove 188 #define _tunlink _unlink 189 190 // reading and writing to i/o 191 #define _fgettc fgetc 192 #define _fgetts fgets 193 #define _fputts fputs 194 #define _gettchar getchar 195 196 // directory 197 #define _tchdir _chdir 198 199 // environment 200 #define _tgetenv getenv 201 #define _tsystem system 202 203 // time 204 #define _tcsftime strftime 205 206 #endif 207 208 // is functions (the same in Unicode / ANSI) 209 #define _istgraph isgraph 210 #define _istascii __isascii 211 212 #define __TFILE__ _T(__FILE__) 213 #define __TDATE__ _T(__DATE__) 214 #define __TTIME__ _T(__TIME__) 215