/*
 *  ctype.h	Character Handling
 *
 *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
 */
#ifndef _CTYPE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif

/* macros for MS compatibility */
#ifndef _CRTAPI1
 #define _CRTAPI1
#endif
#ifndef _CRTAPI2
 #define _CRTAPI2
#endif
#ifndef _CRTIMP
 #define _CRTIMP
#endif

#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#ifndef _WCHAR_T_DEFINED_
#define _WCHAR_T_DEFINED_
#ifdef __cplusplus
typedef long char wchar_t;
#else
typedef unsigned short wchar_t;
#endif
#else
#ifndef _WCHAR_T_DEFINED_
#define _WCHAR_T_DEFINED_
#endif
#endif
#endif

#if defined(__NT__) && (defined(__UNICODE__) || defined(_UNICODE))
#ifndef _UNICHAR_DEFINED_
  typedef wchar_t _UNICHAR;
#define _UNICHAR_DEFINED_
#endif
#if !defined(NO_EXT_KEYS) /* extensions enabled */
 #define _unichar	_UNICHAR
#endif
#endif

#define _LOWER	0x80
#define _UPPER	0x40
#define _DIGIT	0x20
#define _XDIGT	0x10
#define _PRINT	0x08
#define _PUNCT	0x04
#define _SPACE	0x02
#define _CNTRL	0x01

extern	int	isalnum(int);
extern	int	isalpha(int);
extern	int	iscntrl(int);
extern	int	isdigit(int);
extern	int	isgraph(int);
extern	int	islower(int);
extern	int	isprint(int);
extern	int	ispunct(int);
extern	int	isspace(int);
extern	int	isupper(int);
extern	int	isxdigit(int);
extern	int	tolower(int);
extern	int	_tolower(int);
extern	int	toupper(int);
extern	int	_toupper(int);
extern	int	__iscsymf(int);
extern	int	__iscsym(int);

#if !defined(NO_EXT_KEYS) /* extensions enabled */
 extern  int	isascii(int);
 extern  int	__isascii(int);
 #define isascii(__c) ((unsigned)(__c) <= 0x7f)
 #define __isascii(__c) ((unsigned)(__c) <= 0x7f)
#endif

#ifdef M_I86HM
extern const char __far _IsTable[257];
#else
extern const char __near _IsTable[257];
#endif

#define isalnum(__c) (_IsTable[(unsigned char)((__c)+1)] & (_LOWER|_UPPER|_DIGIT))
#define isalpha(__c) (_IsTable[(unsigned char)((__c)+1)] & (_LOWER|_UPPER))
#define iscntrl(__c) (_IsTable[(unsigned char)((__c)+1)] & _CNTRL)
#define isdigit(__c) (_IsTable[(unsigned char)((__c)+1)] & _DIGIT)
#define isgraph(__c) ((_IsTable[(unsigned char)((__c)+1)] & (_PRINT|_SPACE)) == _PRINT)
#define islower(__c) (_IsTable[(unsigned char)((__c)+1)] & _LOWER)
#define isprint(__c) (_IsTable[(unsigned char)((__c)+1)] & _PRINT)
#define ispunct(__c) (_IsTable[(unsigned char)((__c)+1)] & _PUNCT)
#define isspace(__c) (_IsTable[(unsigned char)((__c)+1)] & _SPACE)
#define isupper(__c) (_IsTable[(unsigned char)((__c)+1)] & _UPPER)
#define isxdigit(__c) (_IsTable[(unsigned char)((__c)+1)] & _XDIGT)
#define __iscsymf(__c) (isalpha(__c)||((__c)=='_'))
#define __iscsym(__c) (isalnum(__c)||((__c)=='_'))

#if !defined(NO_EXT_KEYS) && defined(__NT__) && (defined(__UNICODE__) || defined(_UNICODE))
extern int _uisalpha( int );
extern int _uisalnum( int );
extern int _uisascii( int );
extern int _uiscntrl( int );
extern int _uisprint( int );
extern int _uisgraph( int );
extern int _uisdigit( int );
extern int _uisxdigit( int );
extern int _uislower( int );
extern int _uisupper( int );
extern int _uisspace( int );
extern int _uispunct( int );
extern int _utolower( int );
extern int _utoupper( int );
#endif

#define _CTYPE_H_INCLUDED
#ifdef __cplusplus
};
#endif
#endif
