X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=include%2Fsafe-ctype.h;h=69a3f74cc6fc48a38e489fe9acd9e3735469881c;hb=34920d91a5b766acf1806063e3b8507c709d5d4f;hp=d5fc649051a3c10ed62acfe0de16f4dc3be3d968;hpb=328cd6e949296bae4c7e06365c2279dce2deec28;p=deliverable%2Fbinutils-gdb.git diff --git a/include/safe-ctype.h b/include/safe-ctype.h index d5fc649051..69a3f74cc6 100644 --- a/include/safe-ctype.h +++ b/include/safe-ctype.h @@ -1,6 +1,6 @@ /* replacement macros. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. Contributed by Zack Weinberg . This file is part of the libiberty library. @@ -37,7 +37,24 @@ Boston, MA 02111-1307, USA. */ #ifdef isalpha #error "safe-ctype.h and ctype.h may not be used simultaneously" +#endif + +/* Determine host character set. */ +#define HOST_CHARSET_UNKNOWN 0 +#define HOST_CHARSET_ASCII 1 +#define HOST_CHARSET_EBCDIC 2 + +#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \ + && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 +# define HOST_CHARSET HOST_CHARSET_ASCII #else +# if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \ + && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A +# define HOST_CHARSET HOST_CHARSET_EBCDIC +# else +# define HOST_CHARSET HOST_CHARSET_UNKNOWN +# endif +#endif /* Categories. */ @@ -63,13 +80,15 @@ enum { _sch_isalnum = _sch_isalpha|_sch_isdigit, /* A-Za-z0-9 */ _sch_isidnum = _sch_isidst|_sch_isdigit, /* A-Za-z0-9_ */ _sch_isgraph = _sch_isalnum|_sch_ispunct, /* isprint and not space */ - _sch_iscppsp = _sch_isvsp|_sch_isnvsp /* isspace + \0 */ + _sch_iscppsp = _sch_isvsp|_sch_isnvsp, /* isspace + \0 */ + _sch_isbasic = _sch_isprint|_sch_iscppsp /* basic charset of ISO C + (plus ` and @) */ }; /* Character classification. */ extern const unsigned short _sch_istable[256]; -#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (bit)) +#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (unsigned short)(bit)) #define ISALPHA(c) _sch_test(c, _sch_isalpha) #define ISALNUM(c) _sch_test(c, _sch_isalnum) @@ -86,6 +105,7 @@ extern const unsigned short _sch_istable[256]; #define ISIDNUM(c) _sch_test(c, _sch_isidnum) #define ISIDST(c) _sch_test(c, _sch_isidst) +#define IS_ISOBASIC(c) _sch_test(c, _sch_isbasic) #define IS_VSPACE(c) _sch_test(c, _sch_isvsp) #define IS_NVSPACE(c) _sch_test(c, _sch_isnvsp) #define IS_SPACE_OR_NUL(c) _sch_test(c, _sch_iscppsp) @@ -96,5 +116,4 @@ extern const unsigned char _sch_tolower[256]; #define TOUPPER(c) _sch_toupper[(c) & 0xff] #define TOLOWER(c) _sch_tolower[(c) & 0xff] -#endif /* no ctype.h */ #endif /* SAFE_CTYPE_H */