Merge "Changes our ctype identifiers to match the BSDs"
This commit is contained in:
		@@ -44,12 +44,14 @@
 | 
			
		||||
 | 
			
		||||
#define	_CTYPE_U	0x01
 | 
			
		||||
#define	_CTYPE_L	0x02
 | 
			
		||||
#define	_CTYPE_N	0x04
 | 
			
		||||
#define	_CTYPE_D	0x04
 | 
			
		||||
#define	_CTYPE_S	0x08
 | 
			
		||||
#define	_CTYPE_P	0x10
 | 
			
		||||
#define	_CTYPE_C	0x20
 | 
			
		||||
#define	_CTYPE_X	0x40
 | 
			
		||||
#define	_CTYPE_B	0x80
 | 
			
		||||
#define	_CTYPE_R	(_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_D|_CTYPE_B)
 | 
			
		||||
#define	_CTYPE_A	(_CTYPE_L|_CTYPE_U)
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
@@ -57,17 +59,6 @@ extern const char	*_ctype_;
 | 
			
		||||
extern const short	*_tolower_tab_;
 | 
			
		||||
extern const short	*_toupper_tab_;
 | 
			
		||||
 | 
			
		||||
/* extern __inline is a GNU C extension */
 | 
			
		||||
#ifdef __GNUC__
 | 
			
		||||
#  if defined(__GNUC_STDC_INLINE__)
 | 
			
		||||
#define	__CTYPE_INLINE	extern __inline __attribute__((__gnu_inline__))
 | 
			
		||||
#  else
 | 
			
		||||
#define	__CTYPE_INLINE	extern __inline
 | 
			
		||||
#  endif
 | 
			
		||||
#else
 | 
			
		||||
#define	__CTYPE_INLINE	static __inline
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__GNUC__) || defined(_ANSI_LIBRARY) || defined(lint)
 | 
			
		||||
int	isalnum(int);
 | 
			
		||||
int	isalpha(int);
 | 
			
		||||
@@ -97,111 +88,6 @@ int	_toupper(int);
 | 
			
		||||
 | 
			
		||||
#endif /* __GNUC__ || _ANSI_LIBRARY || lint */
 | 
			
		||||
 | 
			
		||||
#if defined(NDEBUG)
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isalnum(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_U|_CTYPE_L|_CTYPE_N)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isalpha(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_U|_CTYPE_L)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int iscntrl(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_C));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isdigit(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_N));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isgraph(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int islower(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_L));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isprint(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int ispunct(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_P));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isspace(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_S));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isupper(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_U));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isxdigit(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_N|_CTYPE_X)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int tolower(int c)
 | 
			
		||||
{
 | 
			
		||||
	if ((unsigned int)c > 255)
 | 
			
		||||
		return (c);
 | 
			
		||||
	return ((_tolower_tab_ + 1)[c]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int toupper(int c)
 | 
			
		||||
{
 | 
			
		||||
	if ((unsigned int)c > 255)
 | 
			
		||||
		return (c);
 | 
			
		||||
	return ((_toupper_tab_ + 1)[c]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
 | 
			
		||||
    || __XPG_VISIBLE > 600
 | 
			
		||||
__CTYPE_INLINE int isblank(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == ' ' || c == '\t');
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if __BSD_VISIBLE || __XPG_VISIBLE
 | 
			
		||||
__CTYPE_INLINE int isascii(int c)
 | 
			
		||||
{
 | 
			
		||||
	return ((unsigned int)c <= 0177);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int toascii(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c & 0177);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int _tolower(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c - 'A' + 'a');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int _toupper(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c - 'a' + 'A');
 | 
			
		||||
}
 | 
			
		||||
#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
 | 
			
		||||
 | 
			
		||||
#endif /* NDEBUG */
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#undef __CTYPE_INLINE
 | 
			
		||||
 | 
			
		||||
#endif /* !_CTYPE_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@
 | 
			
		||||
 | 
			
		||||
#define _U _CTYPE_U
 | 
			
		||||
#define _L _CTYPE_L
 | 
			
		||||
#define _N _CTYPE_N
 | 
			
		||||
#define _D _CTYPE_D
 | 
			
		||||
#define _S _CTYPE_S
 | 
			
		||||
#define _P _CTYPE_P
 | 
			
		||||
#define _C _CTYPE_C
 | 
			
		||||
@@ -53,8 +53,8 @@ const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
 | 
			
		||||
	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C,
 | 
			
		||||
   _S|(char)_B,	_P,	_P,	_P,	_P,	_P,	_P,	_P,
 | 
			
		||||
	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P,
 | 
			
		||||
	_N,	_N,	_N,	_N,	_N,	_N,	_N,	_N,
 | 
			
		||||
	_N,	_N,	_P,	_P,	_P,	_P,	_P,	_P,
 | 
			
		||||
	_D,	_D,	_D,	_D,	_D,	_D,	_D,	_D,
 | 
			
		||||
	_D,	_D,	_P,	_P,	_P,	_P,	_P,	_P,
 | 
			
		||||
	_P,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U,
 | 
			
		||||
	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U,
 | 
			
		||||
	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U,
 | 
			
		||||
@@ -85,13 +85,9 @@ const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
 | 
			
		||||
 | 
			
		||||
const char *_ctype_ = _C_ctype_;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// TODO: fix the header file so we don't have to duplicate all this inlined stuff.
 | 
			
		||||
 | 
			
		||||
#if 1 /* ndef NDEBUG */
 | 
			
		||||
int isalnum(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_D)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int isalpha(int c)
 | 
			
		||||
@@ -106,12 +102,12 @@ int iscntrl(int c)
 | 
			
		||||
 | 
			
		||||
int isdigit(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _D));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int isgraph(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_D)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int islower(int c)
 | 
			
		||||
@@ -121,7 +117,7 @@ int islower(int c)
 | 
			
		||||
 | 
			
		||||
int isprint(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_D|_B)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ispunct(int c)
 | 
			
		||||
@@ -141,18 +137,14 @@ int isupper(int c)
 | 
			
		||||
 | 
			
		||||
int isxdigit(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_D|_X)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
 | 
			
		||||
    || __XPG_VISIBLE > 600
 | 
			
		||||
int isblank(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == ' ' || c == '\t');
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if __BSD_VISIBLE || __XPG_VISIBLE
 | 
			
		||||
int isascii(int c)
 | 
			
		||||
{
 | 
			
		||||
	return ((unsigned int)c <= 0177);
 | 
			
		||||
@@ -163,6 +155,5 @@ int toascii(int c)
 | 
			
		||||
	return (c & 0177);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
 | 
			
		||||
 | 
			
		||||
#endif /* !NDBEUG */
 | 
			
		||||
__strong_alias(_toupper, toupper);
 | 
			
		||||
__strong_alias(_tolower, tolower);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user