//----------------------------------------------------------------
//
// NeuroChip NM6403, C run-time library
// 1997-1999 (c) RC Module Inc.
// cctype,
//
//----------------------------------------------------------------

#ifndef _CCTYPE_HEADER
#define _CCTYPE_HEADER


#include <_nsstd.h>


extern "C" unsigned short _ctype[];
extern "C" unsigned short *_pctype;
//extern wchar_t *_pwctype;


_NS_STD_BEGIN

/* set bit masks for the possible character types */

#define _UPPER		0x1	/* upper case letter */
#define _LOWER		0x2	/* lower case letter */
#define _DIGIT		0x4	/* digit[0-9] */
#define _SPACE		0x8	/* tab, carriage return, newline, */
				/* vertical tab or form feed */
#define _PUNCT		0x10	/* punctuation character */
#define _CONTROL	0x20	/* control character */
#define _BLANK		0x40	/* space char */
#define _HEX		0x80	/* hexadecimal digit */

#define _LEADBYTE	0x8000			/* multibyte leadbyte */
#define _ALPHA		(0x0100|_UPPER|_LOWER)	/* alphabetic character */


inline int isalpha(int _C)	{return (_pctype[_C] & (_UPPER|_LOWER)); }
inline int isupper(int _C)	{return (_pctype[_C] & _UPPER); }
inline int islower(int _C)	{return (_pctype[_C] & _LOWER); }
inline int isdigit(int _C)	{return (_pctype[_C] & _DIGIT); }
inline int isxdigit(int _C)	{return (_pctype[_C] & _HEX); }
inline int isspace(int _C)	{return (_pctype[_C] & _SPACE); }
inline int ispunct(int _C)	{return (_pctype[_C] & _PUNCT); }
inline int isalnum(int _C)	{return (_pctype[_C] & (_UPPER|_LOWER|_DIGIT)); }
inline int isprint(int _C)
	{return (_pctype[_C] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT)); }
inline int isgraph(int _C)
	{return (_pctype[_C] & (_PUNCT|_UPPER|_LOWER|_DIGIT)); }
inline int iscntrl(int _C)	{return (_pctype[_C] & _CONTROL); }

inline int tolower(int c)	{ return isupper(c) ? ((c)-'A'+'a'):c; }
inline int toupper(int c)  { return islower(c) ? ((c)-'a'+'A'):c; }

#define __isascii(_c)	( (unsigned)(_c) < 0x80 )
#define __toascii(_c)	( (_c) & 0x7f )

#define isascii __isascii
#define toascii __toascii
#define iscsymf __iscsymf
#define iscsym	__iscsym

_NS_STD_END


#endif  // _CCTYPE_HEADER
