Git init
[framework/multimedia/gstreamer0.10.git] / win32 / common / gtchar.h
1 /* 
2
3  * tchar.h
4
5  *
6
7  * Unicode mapping layer for the standard C library. By including this
8
9  * file and using the 't' names for string functions
10
11  * (eg. _tprintf) you can make code which can be easily adapted to both
12
13  * Unicode and non-unicode environments. In a unicode enabled compile define
14
15  * _UNICODE before including tchar.h, otherwise the standard non-unicode
16
17  * library functions will be used.
18
19  *
20
21  * Note that you still need to include string.h or stdlib.h etc. to define
22
23  * the appropriate functions. Also note that there are several defines
24
25  * included for non-ANSI functions which are commonly available (but using
26
27  * the convention of prepending an underscore to non-ANSI library function
28
29  * names).
30
31  *
32
33  * This file is part of the Mingw32 package.
34
35  *
36
37  * Contributors:
38
39  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
40
41  *
42
43  *  THIS SOFTWARE IS NOT COPYRIGHTED
44
45  *
46
47  *  This source code is offered for use in the public domain. You may
48
49  *  use, modify or distribute it freely.
50
51  *
52
53  *  This code is distributed in the hope that it will be useful but
54
55  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
56
57  *  DISCLAIMED. This includes but is not limited to warranties of
58
59  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
60
61  *
62
63  * $Revision$
64
65  * $Author$
66
67  * $Date$
68
69  *
70
71  */
72
73
74
75 #ifndef _TCHAR_H_
76
77 #define _TCHAR_H_
78
79
80
81 /* All the headers include this file. */
82
83 /*#include <_mingw.h>*/
84
85
86
87 /*
88
89  * NOTE: This tests _UNICODE, which is different from the UNICODE define
90
91  *       used to differentiate Win32 API calls.
92
93  */
94
95 #ifdef  _UNICODE
96
97
98
99
100
101 /*
102
103  * Use TCHAR instead of char or wchar_t. It will be appropriately translated
104
105  * if _UNICODE is correctly defined (or not).
106
107  */
108
109 #ifndef _TCHAR_DEFINED
110
111 #ifndef RC_INVOKED
112
113 typedef wchar_t TCHAR;
114
115 typedef wchar_t _TCHAR;
116
117 #endif  /* Not RC_INVOKED */
118
119 #define _TCHAR_DEFINED
120
121 #endif
122
123
124
125
126
127 /*
128
129  * __TEXT is a private macro whose specific use is to force the expansion of a
130
131  * macro passed as an argument to the macros _T or _TEXT.  DO NOT use this
132
133  * macro within your programs.  It's name and function could change without
134
135  * notice.
136
137  */
138
139 #define __TEXT(q)       L##q
140
141
142
143 /*  for porting from other Windows compilers */
144
145 #if 0  // no  wide startup module
146
147 #define _tmain      wmain
148
149 #define _tWinMain   wWinMain
150
151 #define _tenviron   _wenviron
152
153 #define __targv     __wargv
154
155 #endif
156
157
158
159 /*
160
161  * Unicode functions
162
163  */
164
165 #define _tprintf        wprintf
166
167 #define _ftprintf       fwprintf
168
169 #define _stprintf       swprintf
170
171 #define _sntprintf      _snwprintf
172
173 #define _vtprintf       vwprintf
174
175 #define _vftprintf      vfwprintf
176
177 #define _vstprintf      vswprintf
178
179 #define _vsntprintf     _vsnwprintf
180
181 #define _tscanf         wscanf
182
183 #define _ftscanf        fwscanf
184
185 #define _stscanf        swscanf
186
187 #define _fgettc         fgetwc
188
189 #define _fgettchar      _fgetwchar
190
191 #define _fgetts         fgetws
192
193 #define _fputtc         fputwc
194
195 #define _fputtchar      _fputwchar
196
197 #define _fputts         fputws
198
199 #define _gettc          getwc
200
201 #define _getts          _getws
202
203 #define _puttc          putwc
204
205 #define _putts          _putws
206
207 #define _ungettc        ungetwc
208
209 #define _tcstod         wcstod
210
211 #define _tcstol         wcstol
212
213 #define _tcstoul        wcstoul
214
215 #define _itot           _itow
216
217 #define _ltot           _ltow
218
219 #define _ultot          _ultow
220
221 #define _ttoi           _wtoi
222
223 #define _ttol           _wtol
224
225 #define _tcscat         wcscat
226
227 #define _tcschr         wcschr
228
229 #define _tcscmp         wcscmp
230
231 #define _tcscpy         wcscpy
232
233 #define _tcscspn        wcscspn
234
235 #define _tcslen         wcslen
236
237 #define _tcsncat        wcsncat
238
239 #define _tcsncmp        wcsncmp
240
241 #define _tcsncpy        wcsncpy
242
243 #define _tcspbrk        wcspbrk
244
245 #define _tcsrchr        wcsrchr
246
247 #define _tcsspn         wcsspn
248
249 #define _tcsstr         wcsstr
250
251 #define _tcstok         wcstok
252
253 #define _tcsdup         _wcsdup
254
255 #define _tcsicmp        _wcsicmp
256
257 #define _tcsnicmp       _wcsnicmp
258
259 #define _tcsnset        _wcsnset
260
261 #define _tcsrev         _wcsrev
262
263 #define _tcsset         _wcsset
264
265 #define _tcslwr         _wcslwr
266
267 #define _tcsupr         _wcsupr
268
269 #define _tcsxfrm        wcsxfrm
270
271 #define _tcscoll        wcscoll
272
273 #define _tcsicoll       _wcsicoll
274
275 #define _istalpha       iswalpha
276
277 #define _istupper       iswupper
278
279 #define _istlower       iswlower
280
281 #define _istdigit       iswdigit
282
283 #define _istxdigit      iswxdigit
284
285 #define _istspace       iswspace
286
287 #define _istpunct       iswpunct
288
289 #define _istalnum       iswalnum
290
291 #define _istprint       iswprint
292
293 #define _istgraph       iswgraph
294
295 #define _istcntrl       iswcntrl
296
297 #define _istascii       iswascii
298
299 #define _totupper       towupper
300
301 #define _totlower       towlower
302
303 #define _tcsftime       wcsftime
304
305 /* Macro functions */ 
306
307 #define _tcsdec     _wcsdec
308
309 #define _tcsinc     _wcsinc
310
311 #define _tcsnbcnt   _wcsncnt
312
313 #define _tcsnccnt   _wcsncnt
314
315 #define _tcsnextc   _wcsnextc
316
317 #define _tcsninc    _wcsninc
318
319 #define _tcsspnp    _wcsspnp
320
321 #define _wcsdec(_wcs1, _wcs2) ((_wcs1)>=(_wcs2) ? NULL : (_wcs2)-1)
322
323 #define _wcsinc(_wcs)  ((_wcs)+1)
324
325 #define _wcsnextc(_wcs) ((unsigned int) *(_wcs))
326
327 #define _wcsninc(_wcs, _inc) (((_wcs)+(_inc)))
328
329 #define _wcsncnt(_wcs, _cnt) ((wcslen(_wcs)>_cnt) ? _count : wcslen(_wcs))
330
331 #define _wcsspnp(_wcs1, _wcs2) ((*((_wcs1)+wcsspn(_wcs1,_wcs2))) ? ((_wcs1)+wcsspn(_wcs1,_wcs2)) : NULL)
332
333
334
335 #if 1  /* defined __MSVCRT__ */
336
337 /*
338
339  *   These wide functions not in crtdll.dll.
340
341  *   Define macros anyway so that _wfoo rather than _tfoo is undefined
342
343  */
344
345 #define _ttoi64     _wtoi64
346
347 #define _i64tot     _i64tow
348
349 #define _ui64tot    _ui64tow
350
351 #define _tasctime       _wasctime
352
353 #define _tctime         _wctime
354
355 #define _tstrdate       _wstrdate
356
357 #define _tstrtime       _wstrtime
358
359 #define _tutime         _wutime
360
361 #define _tcsnccoll  _wcsncoll
362
363 #define _tcsncoll   _wcsncoll
364
365 #define _tcsncicoll _wcsnicoll
366
367 #define _tcsnicoll  _wcsnicoll
368
369 #define _taccess    _waccess
370
371 #define _tchmod     _wchmod
372
373 #define _tcreat     _wcreat
374
375 #define _tfindfirst _wfindfirst
376
377 #define _tfindnext  _wfindnext
378
379 #define _tfdopen    _wfdopen
380
381 #define _tfopen     _wfopen
382
383 #define _tgetenv    _wgetenv
384
385 #define _tputenv    _wputenv
386
387 #define _tsearchenv _wsearchenv
388
389 #define _tmakepath  _wmakepath
390
391 #define _tsplitpath _wsplitpath
392
393 #define _tfullpath  _wfullpath
394
395 #define _tmktemp    _wmktemp
396
397 #define _topen      _wopen
398
399 #define _tremove    _wremove
400
401 #define _trename    _wrename
402
403 #define _tsopen     _wsopen
404
405 #define _tsetlocale _wsetlocale
406
407 #define _tunlink    _wunlink
408
409 #define _tfinddata_t    _wfinddata_t
410
411 #define _tfindfirsti64  _wfindfirsti64
412
413 #define _tfindnexti64   _wfindnexti64
414
415 #define _tfinddatai64_t _wfinddatai64_t
416
417 #endif  /* __MSVCRT__ */
418
419
420
421 /* dirent structures and functions */
422
423 #define _tdirent        _wdirent
424
425 #define _TDIR           _WDIR
426
427 #define _topendir       _wopendir
428
429 #define _tclosedir      _wclosedir
430
431 #define _treaddir       _wreaddir
432
433 #define _trewinddir     _wrewinddir
434
435 #define _ttelldir       _wtelldir
436
437 #define _tseekdir       _wseekdir
438
439 #else   /* Not _UNICODE */
440
441
442
443 /*
444
445  * TCHAR, the type you should use instead of char.
446
447  */
448
449 #ifndef _TCHAR_DEFINED
450
451 #ifndef RC_INVOKED
452
453 typedef char    TCHAR;
454
455 typedef char    _TCHAR;
456
457 #endif
458
459 #define _TCHAR_DEFINED
460
461 #endif
462
463
464
465 /*
466
467  * __TEXT is a private macro whose specific use is to force the expansion of a
468
469  * macro passed as an argument to the macros _T or _TEXT.  DO NOT use this
470
471  * macro within your programs.  It's name and function could change without
472
473  * notice.
474
475  */
476
477 #define __TEXT(q)       q
478
479
480
481 /*  for porting from other Windows compilers */
482
483 #define _tmain      main
484
485 #define _tWinMain   WinMain
486
487 #define _tenviron  _environ
488
489 #define __targv     __argv
490
491
492
493 /*
494
495  * Non-unicode (standard) functions
496
497  */
498
499
500
501 #define _tprintf        printf
502
503 #define _ftprintf       fprintf
504
505 #define _stprintf       sprintf
506
507 #define _sntprintf      _snprintf
508
509 #define _vtprintf       vprintf
510
511 #define _vftprintf      vfprintf
512
513 #define _vstprintf      vsprintf
514
515 #define _vsntprintf     _vsnprintf
516
517 #define _tscanf         scanf
518
519 #define _ftscanf        fscanf
520
521 #define _stscanf        sscanf
522
523 #define _fgettc         fgetc
524
525 #define _fgettchar      _fgetchar
526
527 #define _fgetts         fgets
528
529 #define _fputtc         fputc
530
531 #define _fputtchar      _fputchar
532
533 #define _fputts         fputs
534
535 #define _tfdopen        _fdopen
536
537 #define _tfopen         fopen
538
539 #define _tgetenv        getenv
540
541 #define _tputenv        _putenv
542
543 #define _tsearchenv     _searchenv
544
545 #define _tmakepath      _makepath
546
547 #define _tsplitpath     _splitpath
548
549 #define _tfullpath      _fullpath
550
551 #define _gettc          getc
552
553 #define _getts          gets
554
555 #define _puttc          putc
556
557 #define _putts          puts
558
559 #define _ungettc        ungetc
560
561 #define _tcstod         strtod
562
563 #define _tcstol         strtol
564
565 #define _tcstoul        strtoul
566
567 #define _itot           _itoa
568
569 #define _ltot           _ltoa
570
571 #define _ultot          _ultoa
572
573 #define _ttoi           atoi
574
575 #define _ttol           atol
576
577 #define _tcscat         strcat
578
579 #define _tcschr         strchr
580
581 #define _tcscmp         strcmp
582
583 #define _tcscpy         strcpy
584
585 #define _tcscspn        strcspn
586
587 #define _tcslen         strlen
588
589 #define _tcsncat        strncat
590
591 #define _tcsncmp        strncmp
592
593 #define _tcsncpy        strncpy
594
595 #define _tcspbrk        strpbrk
596
597 #define _tcsrchr        strrchr
598
599 #define _tcsspn         strspn
600
601 #define _tcsstr         strstr
602
603 #define _tcstok         strtok
604
605 #define _tcsdup         _strdup
606
607 #define _tcsicmp        _stricmp
608
609 #define _tcsnicmp       _strnicmp
610
611 #define _tcsnset        _strnset
612
613 #define _tcsrev         _strrev
614
615 #define _tcsset         _strset
616
617 #define _tcslwr         _strlwr
618
619 #define _tcsupr         _strupr
620
621 #define _tcsxfrm        strxfrm
622
623 #define _tcscoll        strcoll
624
625 #define _tcsicoll       _stricoll
626
627 #define _istalpha       isalpha
628
629 #define _istupper       isupper
630
631 #define _istlower       islower
632
633 #define _istdigit       isdigit
634
635 #define _istxdigit      isxdigit
636
637 #define _istspace       isspace
638
639 #define _istpunct       ispunct
640
641 #define _istalnum       isalnum
642
643 #define _istprint       isprint
644
645 #define _istgraph       isgraph
646
647 #define _istcntrl       iscntrl
648
649 #define _istascii       isascii
650
651 #define _totupper       toupper
652
653 #define _totlower       tolower
654
655 #define _tasctime       asctime
656
657 #define _tctime         ctime
658
659 #define _tstrdate       _strdate
660
661 #define _tstrtime       _strtime
662
663 #define _tutime         _utime
664
665 #define _tcsftime       strftime
666
667 /* Macro functions */ 
668
669 #define _tcsdec     _strdec
670
671 #define _tcsinc     _strinc
672
673 #define _tcsnbcnt   _strncnt
674
675 #define _tcsnccnt   _strncnt
676
677 #define _tcsnextc   _strnextc
678
679 #define _tcsninc    _strninc
680
681 #define _tcsspnp    _strspnp
682
683 #define _strdec(_str1, _str2) ((_str1)>=(_str2) ? NULL : (_str2)-1)
684
685 #define _strinc(_str)  ((_str)+1)
686
687 #define _strnextc(_str) ((unsigned int) *(_str))
688
689 #define _strninc(_str, _inc) (((_str)+(_inc)))
690
691 #define _strncnt(_str, _cnt) ((strlen(_str)>_cnt) ? _count : strlen(_str))
692
693 #define _strspnp(_str1, _str2) ((*((_str1)+strspn(_str1,_str2))) ? ((_str1)+strspn(_str1,_str2)) : NULL)
694
695
696
697 #define _tchmod     _chmod
698
699 #define _tcreat     _creat
700
701 #define _tfindfirst _findfirst
702
703 #define _tfindnext  _findnext
704
705 #define _tmktemp    _mktemp
706
707 #define _topen      _open
708
709 #define _taccess    _access
710
711 #define _tremove    remove
712
713 #define _trename    rename
714
715 #define _tsopen     _sopen
716
717 #define _tsetlocale setlocale
718
719 #define _tunlink    _unlink
720
721 #define _tfinddata_t    _finddata_t
722
723
724
725 #if 1  /* defined __MSVCRT__ */
726
727 /* Not in crtdll.dll. Define macros anyway? */
728
729 #define _ttoi64     _atoi64
730
731 #define _i64tot     _i64toa
732
733 #define _ui64tot    _ui64toa
734
735 #define _tcsnccoll  _strncoll
736
737 #define _tcsncoll   _strncoll
738
739 #define _tcsncicoll _strnicoll
740
741 #define _tcsnicoll  _strnicoll
742
743 #define _tfindfirsti64  _findfirsti64
744
745 #define _tfindnexti64   _findnexti64
746
747 #define _tfinddatai64_t _finddatai64_t
748
749 #endif  /* __MSVCRT__ */
750
751
752
753 /* dirent structures and functions */
754
755 #define _tdirent        dirent
756
757 #define _TDIR           DIR
758
759 #define _topendir       opendir
760
761 #define _tclosedir      closedir
762
763 #define _treaddir       readdir
764
765 #define _trewinddir     rewinddir
766
767 #define _ttelldir       telldir
768
769 #define _tseekdir       seekdir
770
771
772
773 #endif  /* Not _UNICODE */
774
775
776
777 /*
778
779  * UNICODE a constant string when _UNICODE is defined else returns the string
780
781  * unmodified.  Also defined in w32api/winnt.h.
782
783  */
784
785 #define _TEXT(x)        __TEXT(x)
786
787 #define _T(x)           __TEXT(x)
788
789
790
791 #endif  /* Not _TCHAR_H_ */
792
793
794