Mobile API Reference  MicroStrategy 2019
PDCtchar.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : PDCtchar.h
3 // AUTHOR : Perl Script
4 // CREATION : 6/13/02
5 // Copyright (C) MicroStrategy, Inc. 2002
6 //==============================================================================================
7 #ifndef PDCtchar_h
8 #define PDCtchar_h
9 
10 // this must be the *first* file included
11 #include "ProtectedSource/Prolog.h"
12 
13 #if defined(WIN32) && !defined(_USE_MSI_COM)
14  #include <TCHAR.H>
15 #else
16  //==============================================================================================
17  // FILENAME : tchar.h
18  // AUTHOR : Yuling Ma
19  // CREATION : 10/9/01
20  // Copyright (C) MicroStrategy Incorporated 2001
21  //==============================================================================================
22 
23  // This header file stands in for the standard 'tchar.h' header file used in VC++
24  // We make minimal effort to declare symbols and functions in the same file as
25  // used in Windows.
26 
27  // We are using this file to hold symbols and declarations that seem to be part of
28  // the windows environment.
29 
30  #ifndef __TCHAR_H__
31  #define __TCHAR_H__
32 
33  #include "PDCrpc.h"
34  #include "PDCwtypes.h"
35  #include "PDCwchar.h"
36  #include "PDCstdio.h"
37  #include "PDCassert.h"
38 
39 #ifdef NO_WCHAR_SUPPORT
40  #define __T(x) x
41  typedef char _TCHAR;
42  #define _itot
43  #define _ui64tot
44 
45  #define _tcscmp
46 #else
47  #define __T(x) L ## x
48  typedef wchar_t _TCHAR;
49  #define _itot _itow
50 
51  #define _ui64tot _ui64tow
52 
53  #define _tcscmp wcscmp
54 
55  // BEWARE: need to implement the following function
56  inline wchar_t* _itow( Int32 value, wchar_t *string, Int32 radix )
57  {
58  // not full imp yet
59  if (radix==10) {
60  swprintf(string, 1000, L"%d", value);
61  return string;
62  } else if (radix==16) {
63  swprintf(string, 1000, L"%x", value);
64  return string;
65  } else {
66  assert(false);
67  }
68  return 0;
69  }
70 
71  inline wchar_t* _ltow( long iVal, wchar_t* iStr, int iRadix )
72  {
73  // now only support 10
74  assert(iRadix == 10);
75 
76  int lInt = (int)iVal;
77  swprintf(iStr, 1000, L"%d", lInt);
78  return iStr;
79  }
80 
81  inline long _wtol( const wchar_t *string )
82  {
83  long lLongValue = 0;
84  if(string == NULL)
85  return lLongValue;
86 
87  wchar_t* lpEnd = NULL;
88  lLongValue = wcstol(string, &lpEnd, 10);
89  return lLongValue;
90  }
91 
92 #endif
93 
94  #define _T(x) __T(x)
95  #define _TEXT(x) __T(x)
96  #define __TEXT(quote) L##quote
97  #define TEXT(quote) __TEXT(quote)
98 
99  #ifdef WIN32
100  #ifdef _UNICODE
101 
102  #define _fgettc fgetwc
103  #define _fgettc_nolock _fgetwc_nolock
104  #define _fgettchar _fgetwchar
105  #define _fgetts fgetws
106  #define _fputtc fputwc
107  #define _fputtc_nolock _fputwc_nolock
108  #define _fputtchar _fputwchar
109  #define _fputts fputws
110  #define _cputts _cputws
111  #define _cgetts _cgetws
112  #define _cgetts_s _cgetws_s
113  #define _gettc getwc
114  #define _gettc_nolock _getwc_nolock
115  #define _gettch _getwch
116  #define _gettch_nolock _getwch_nolock
117  #define _gettche _getwche
118  #define _gettche_nolock _getwche_nolock
119  #define _gettchar getwchar
120  #define _gettchar_nolock _getwchar_nolock
121  #define _getts _getws
122  #define _getts_s _getws_s
123  #define _puttc putwc
124  #define _puttc_nolock _putwc_nolock
125  #define _puttchar putwchar
126  #define _puttchar_nolock _putwchar_nolock
127  #define _puttch _putwch
128  #define _puttch_nolock _putwch_nolock
129  #define _putts _putws
130  #define _ungettc ungetwc
131  #define _ungettc_nolock _ungetwc_nolock
132  #define _ungettch _ungetwch
133  #define _ungettch_nolock _ungetwch_nolock
134 
135  #else // !_UNICODE
136 
137  #define _fgettc fgetc
138  #define _fgettc_nolock _fgetc_nolock
139  #define _fgettchar _fgetchar
140  #define _fgetts fgets
141  #define _fputtc fputc
142  #define _fputtc_nolock _fputc_nolock
143  #define _fputtchar _fputchar
144  #define _fputts fputs
145  #define _cputts _cputs
146  #define _gettc getc
147  #define _gettc_nolock _getc_nolock
148  #define _gettch _getch
149  #define _gettch_nolock _getch_nolock
150  #define _gettche _getche
151  #define _gettche_nolock _getche_nolock
152  #define _gettchar getchar
153  #define _gettchar_nolock _getchar_nolock
154  #define _getts gets
155  #define _getts_s gets_s
156  #define _cgetts _cgets
157  #define _cgetts_s _cgets_s
158  #define _puttc putc
159  #define _puttc_nolock _putc_nolock
160  #define _puttchar putchar
161  #define _puttchar_nolock _putchar_nolock
162  #define _puttch _putch
163  #define _puttch_nolock _putch_nolock
164  #define _putts puts
165  #define _ungettc ungetc
166  #define _ungettc_nolock _ungetc_nolock
167  #define _ungettch _ungetch
168  #define _ungettch_nolock _ungetch_nolock
169 
170  #endif // _UNICODE
171  #endif
172 
173  #endif /* __TCHAR_H__ */
174 #endif // WIN32 && !_USE_MSI_COM
175 
176 
177 // this must be the *last* file included
178 #include "ProtectedSource/Epilog.h"
179 
180 #endif // PDCtchar_h
wchar_t * _itow(Int32 value, wchar_t *string, Int32 radix)
Definition: PDCtchar.h:56
long _wtol(const wchar_t *string)
Definition: PDCtchar.h:81
#define Int32
Definition: BasicTypes.h:20
wchar_t * _ltow(long iVal, wchar_t *iStr, int iRadix)
Definition: PDCtchar.h:71
wchar_t _TCHAR
Definition: PDCtchar.h:48
#define NULL
Definition: Null.h:10