~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/msvcrt/ctype.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * msvcrt.dll ctype functions
  3  *
  4  * Copyright 2000 Jon Griffiths
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include "msvcrt.h"
 22 #include "winnls.h"
 23 
 24 /* Some abbreviations to make the following table readable */
 25 #define _C_ MSVCRT__CONTROL
 26 #define _S_ MSVCRT__SPACE
 27 #define _P_ MSVCRT__PUNCT
 28 #define _D_ MSVCRT__DIGIT
 29 #define _H_ MSVCRT__HEX
 30 #define _U_ MSVCRT__UPPER
 31 #define _L_ MSVCRT__LOWER
 32 
 33 WORD MSVCRT__ctype [257] = {
 34   0, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _S_|_C_, _S_|_C_,
 35   _S_|_C_, _S_|_C_, _S_|_C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_,
 36   _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _S_|MSVCRT__BLANK,
 37   _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_,
 38   _P_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_,
 39   _D_|_H_, _D_|_H_, _D_|_H_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _U_|_H_,
 40   _U_|_H_, _U_|_H_, _U_|_H_, _U_|_H_, _U_|_H_, _U_, _U_, _U_, _U_, _U_,
 41   _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_,
 42   _U_, _P_, _P_, _P_, _P_, _P_, _P_, _L_|_H_, _L_|_H_, _L_|_H_, _L_|_H_,
 43   _L_|_H_, _L_|_H_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_,
 44   _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _P_, _P_, _P_, _P_,
 45   _C_, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 46   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 47   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 48   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 49   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 50   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 51 };
 52 
 53 /* Internal: Current ctype table for locale */
 54 WORD MSVCRT_current_ctype[257];
 55 
 56 /* pctype is used by macros in the Win32 headers. It must point
 57  * To a table of flags exactly like ctype. To allow locale
 58  * changes to affect ctypes (i.e. isleadbyte), we use a second table
 59  * and update its flags whenever the current locale changes.
 60  */
 61 WORD* MSVCRT__pctype = MSVCRT_current_ctype + 1;
 62 
 63 /*********************************************************************
 64  *              __pctype_func (MSVCRT.@)
 65  */
 66 WORD** CDECL MSVCRT___pctype_func(void)
 67 {
 68   return &MSVCRT__pctype;
 69 }
 70 
 71 /*********************************************************************
 72  *              _isctype (MSVCRT.@)
 73  */
 74 int CDECL _isctype(int c, int type)
 75 {
 76   if (c >= -1 && c <= 255)
 77     return MSVCRT__pctype[c] & type;
 78 
 79   if (MSVCRT___mb_cur_max != 1 && c > 0)
 80   {
 81     /* FIXME: Is there a faster way to do this? */
 82     WORD typeInfo;
 83     char convert[3], *pconv = convert;
 84 
 85     if (MSVCRT__pctype[(UINT)c >> 8] & MSVCRT__LEADBYTE)
 86       *pconv++ = (UINT)c >> 8;
 87     *pconv++ = c & 0xff;
 88     *pconv = 0;
 89     /* FIXME: Use ctype LCID, not lc_all */
 90     if (GetStringTypeExA(MSVCRT_current_lc_all_lcid, CT_CTYPE1,
 91                          convert, convert[1] ? 2 : 1, &typeInfo))
 92       return typeInfo & type;
 93   }
 94   return 0;
 95 }
 96 
 97 /*********************************************************************
 98  *              isalnum (MSVCRT.@)
 99  */
100 int CDECL MSVCRT_isalnum(int c)
101 {
102   return _isctype( c, MSVCRT__ALPHA | MSVCRT__DIGIT );
103 }
104 
105 /*********************************************************************
106  *              isalpha (MSVCRT.@)
107  */
108 int CDECL MSVCRT_isalpha(int c)
109 {
110   return _isctype( c, MSVCRT__ALPHA );
111 }
112 
113 /*********************************************************************
114  *              iscntrl (MSVCRT.@)
115  */
116 int CDECL MSVCRT_iscntrl(int c)
117 {
118   return _isctype( c, MSVCRT__CONTROL );
119 }
120 
121 /*********************************************************************
122  *              isdigit (MSVCRT.@)
123  */
124 int CDECL MSVCRT_isdigit(int c)
125 {
126   return _isctype( c, MSVCRT__DIGIT );
127 }
128 
129 /*********************************************************************
130  *              isgraph (MSVCRT.@)
131  */
132 int CDECL MSVCRT_isgraph(int c)
133 {
134   return _isctype( c, MSVCRT__ALPHA | MSVCRT__DIGIT | MSVCRT__PUNCT );
135 }
136 
137 /*********************************************************************
138  *              isleadbyte (MSVCRT.@)
139  */
140 int CDECL MSVCRT_isleadbyte(int c)
141 {
142   return _isctype( c, MSVCRT__LEADBYTE );
143 }
144 
145 /*********************************************************************
146  *              islower (MSVCRT.@)
147  */
148 int CDECL MSVCRT_islower(int c)
149 {
150   return _isctype( c, MSVCRT__LOWER );
151 }
152 
153 /*********************************************************************
154  *              isprint (MSVCRT.@)
155  */
156 int CDECL MSVCRT_isprint(int c)
157 {
158   return _isctype( c, MSVCRT__ALPHA | MSVCRT__DIGIT | MSVCRT__BLANK | MSVCRT__PUNCT );
159 }
160 
161 /*********************************************************************
162  *              ispunct (MSVCRT.@)
163  */
164 int CDECL MSVCRT_ispunct(int c)
165 {
166   return _isctype( c, MSVCRT__PUNCT );
167 }
168 
169 /*********************************************************************
170  *              isspace (MSVCRT.@)
171  */
172 int CDECL MSVCRT_isspace(int c)
173 {
174   return _isctype( c, MSVCRT__SPACE );
175 }
176 
177 /*********************************************************************
178  *              isupper (MSVCRT.@)
179  */
180 int CDECL MSVCRT_isupper(int c)
181 {
182   return _isctype( c, MSVCRT__UPPER );
183 }
184 
185 /*********************************************************************
186  *              isxdigit (MSVCRT.@)
187  */
188 int CDECL MSVCRT_isxdigit(int c)
189 {
190   return _isctype( c, MSVCRT__HEX );
191 }
192 
193 /*********************************************************************
194  *              __isascii (MSVCRT.@)
195  */
196 int CDECL MSVCRT___isascii(int c)
197 {
198   return isascii((unsigned)c);
199 }
200 
201 /*********************************************************************
202  *              __toascii (MSVCRT.@)
203  */
204 int CDECL MSVCRT___toascii(int c)
205 {
206   return (unsigned)c & 0x7f;
207 }
208 
209 /*********************************************************************
210  *              iswascii (MSVCRT.@)
211  *
212  */
213 int CDECL MSVCRT_iswascii(MSVCRT_wchar_t c)
214 {
215   return ((unsigned)c < 0x80);
216 }
217 
218 /*********************************************************************
219  *              __iscsym (MSVCRT.@)
220  */
221 int CDECL MSVCRT___iscsym(int c)
222 {
223   return (c < 127 && (isalnum(c) || c == '_'));
224 }
225 
226 /*********************************************************************
227  *              __iscsymf (MSVCRT.@)
228  */
229 int CDECL MSVCRT___iscsymf(int c)
230 {
231   return (c < 127 && (isalpha(c) || c == '_'));
232 }
233 
234 /*********************************************************************
235  *              _toupper (MSVCRT.@)
236  */
237 int CDECL MSVCRT__toupper(int c)
238 {
239     return c - 0x20;  /* sic */
240 }
241 
242 /*********************************************************************
243  *              _tolower (MSVCRT.@)
244  */
245 int CDECL MSVCRT__tolower(int c)
246 {
247     return c + 0x20;  /* sic */
248 }
249 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.