Changeset 1093
- Timestamp:
- 03/20/11 08:18:14 (2 years ago)
- Location:
- branches/reyalp-ptp
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
include/ctype.h (modified) (1 diff)
-
include/stdlib.h (modified) (1 diff)
-
platform/generic/wrappers.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/reyalp-ptp
-
branches/reyalp-ptp/include/ctype.h
r993 r1093 1 1 #ifndef CTYPE_H 2 2 #define CTYPE_H 3 3 // dummy for lua code 4 4 #include <stdlib.h> 5 6 static inline int iscntrl( int c ) {7 return 0;8 }9 10 static inline int isalnum( int c ) {11 return isalpha(c) || isdigit(c);12 }13 14 5 #endif -
branches/reyalp-ptp/include/stdlib.h
r871 r1093 100 100 extern int ispunct(int c); 101 101 extern int isxdigit(int c); 102 extern int iscntrl(int c); 103 extern int isalnum(int c); 102 104 103 105 extern long sprintf(char *s, const char *st, ...); -
branches/reyalp-ptp/platform/generic/wrappers.c
r1068 r1093 15 15 #define _X 0x40 /* hex digit */ 16 16 #define _SP 0x80 /* hard space (0x20) */ 17 unsigned char _ctype[] = { 17 static int _ctype(int c,int t) { 18 static unsigned char ctypes[] = { 18 19 _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 19 20 _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ … … 40 41 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 41 42 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 43 // have to handle EOF (-1) 44 if( (unsigned)c >= sizeof(ctypes)) { 45 return 0; 46 } 47 return ctypes[c] & t; 48 } 42 49 #endif 43 50 … … 286 293 return _isdigit(c); 287 294 #else 288 return _ctype [c]&_D;295 return _ctype(c,_D); 289 296 #endif 290 297 } … … 294 301 return _isspace(c); 295 302 #else 296 return _ctype [c]&_S;303 return _ctype(c,_S); 297 304 #endif 298 305 … … 303 310 return _isalpha(c); 304 311 #else 305 return _ctype [c]&(_U|_L);312 return _ctype(c,(_U|_L)); 306 313 #endif 307 314 } … … 311 318 return _isupper(c); 312 319 #else 313 return _ctype [c]&_U;320 return _ctype(c,_U); 314 321 #endif 315 322 … … 320 327 return _islower(c); 321 328 #else 322 return _ctype [c]&_L;329 return _ctype(c,_L); 323 330 #endif 324 331 … … 329 336 return _ispunct(c); 330 337 #else 331 return _ctype [c]&_P;338 return _ctype(c,_P); 332 339 #endif 333 340 } … … 337 344 return _isxdigit(c); 338 345 #else 339 return _ctype[c]&(_X|_D); 346 return _ctype(c,(_X|_D)); 347 #endif 348 } 349 350 int isalnum(int c) { 351 return (isdigit(c) || isalpha(c)); 352 } 353 354 int iscntrl(int c) { 355 #if !CAM_DRYOS 356 return ((c >=0 && c <32) || c == 127); // don't want to require the whole ctype table on vxworks just for this one 357 #else 358 return _ctype(c,_C); 340 359 #endif 341 360 }
Note: See TracChangeset
for help on using the changeset viewer.