Changeset 5968 in vbox for trunk/include
- Timestamp:
- Dec 5, 2007 5:54:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/ctype.h
r5967 r5968 1 1 /** @file 2 * innotek Portable Runtime - ctype.h wrapper and asciivariants.2 * innotek Portable Runtime - ctype.h wrapper and C locale variants. 3 3 */ 4 4 … … 19 19 20 20 #ifdef IN_RING3 21 # include <ctype.h>21 # include <ctype.h> 22 22 23 23 # if defined(_MSC_VER) && !defined(isblank) … … 27 27 #endif /* IN_RING3 */ 28 28 29 /** @name C locale macros. 30 * 31 * @remarks The macros may reference the character more than once. 32 * @remarks Assumes a charset similar to ASCII. 33 * @remarks Can probably be optimized if someone has time. 34 * @{ */ 35 #define RT_C_IS_BLANK(ch) ( (ch) == ' ' || (ch) == '\t' ) 36 #define RT_C_IS_ALNUM(ch) ( RT_C_IS_DIGIT(ch) || RT_C_IS_ALPHA(ch) ) 37 #define RT_C_IS_ALPHA(ch) ( RT_C_IS_LOWER(ch) || RT_C_IS_UPPER(ch) ) 38 #define RT_C_IS_CNTRL(ch) ( (ch) >= 0 && (ch) < 32 ) 39 #define RT_C_IS_DIGIT(ch) ( (ch) >= '0' && (ch) <= '9' ) 40 #define RT_C_IS_LOWER(ch) ( (ch) >= 'a' && (ch) <= 'z' ) 41 #define RT_C_IS_GRAPH(ch) ( RT_C_IS_PRINT(ch) && !RT_C_IS_BLANK(ch) ) 42 #define RT_C_IS_PRINT(ch) ( (ch) >= 32 && (ch) < 127 ) /**< @todo possibly incorrect */ 43 #define RT_C_IS_PUNCT(ch) ( (ch) == ',' || (ch) == '.' || (ch) == ':' || (ch) == ';' || (ch) == '!' || (ch) == '?' ) /**< @todo possibly incorrect */ 44 #define RT_C_IS_SPACE(ch) ( (ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r' || (ch) == '\f' || (ch) == '\v' ) 45 #define RT_C_IS_UPPER(ch) ( (ch) >= 'A' && (ch) <= 'Z' ) 46 #define RT_C_IS_XDIGIT(ch) ( RT_C_IS_DIGIT(ch) || ((ch) >= 'a' && (ch) <= 'f') || ((ch) >= 'A' && (ch) <= 'F') ) 47 48 #define RT_C_TO_LOWER(ch) ( RT_C_IS_UPPER(ch) ? (ch) + ('a' - 'A') : (ch) ) 49 #define RT_C_TO_UPPER(ch) ( RT_C_IS_LOWER(ch) ? (ch) - ('a' - 'A') : (ch) ) 50 /** @} */ 51 29 52 #endif 30 53
Note:
See TracChangeset
for help on using the changeset viewer.