2010-11-04 00:46:47 +03:00
|
|
|
/*
|
2012-07-19 22:11:40 +04:00
|
|
|
* Copyright 2003-2012 Haiku, Inc. All Rights Reserved.
|
2010-11-04 00:46:47 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-08-16 11:13:55 +04:00
|
|
|
#ifndef _CTYPE_H
|
|
|
|
#define _CTYPE_H
|
2010-11-04 00:46:47 +03:00
|
|
|
|
2003-08-16 11:13:55 +04:00
|
|
|
|
2022-05-30 09:55:46 +03:00
|
|
|
#include <locale_t.h>
|
|
|
|
|
|
|
|
|
2003-08-16 11:13:55 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int isalnum(int);
|
|
|
|
int isalpha(int);
|
|
|
|
int isascii(int);
|
|
|
|
int isblank(int);
|
|
|
|
int iscntrl(int);
|
|
|
|
int isdigit(int);
|
|
|
|
int isgraph(int);
|
|
|
|
int islower(int);
|
|
|
|
int isprint(int);
|
|
|
|
int ispunct(int);
|
|
|
|
int isspace(int);
|
|
|
|
int isupper(int);
|
|
|
|
int isxdigit(int);
|
|
|
|
int toascii(int);
|
|
|
|
int tolower(int);
|
|
|
|
int toupper(int);
|
|
|
|
|
2022-05-30 09:55:46 +03:00
|
|
|
|
|
|
|
int isalnum_l(int, locale_t);
|
|
|
|
int isalpha_l(int, locale_t);
|
|
|
|
int isblank_l(int, locale_t);
|
|
|
|
int iscntrl_l(int, locale_t);
|
|
|
|
int isdigit_l(int, locale_t);
|
|
|
|
int isgraph_l(int, locale_t);
|
|
|
|
int islower_l(int, locale_t);
|
|
|
|
int isprint_l(int, locale_t);
|
|
|
|
int ispunct_l(int, locale_t);
|
|
|
|
int isspace_l(int, locale_t);
|
|
|
|
int isupper_l(int, locale_t);
|
|
|
|
int isxdigit_l(int, locale_t);
|
|
|
|
int tolower_l(int, locale_t);
|
|
|
|
int toupper_l(int, locale_t);
|
|
|
|
|
2004-07-06 04:29:52 +04:00
|
|
|
enum {
|
|
|
|
_ISblank = 0x0001, /* blank */
|
|
|
|
_IScntrl = 0x0002, /* control */
|
|
|
|
_ISpunct = 0x0004, /* punctuation */
|
|
|
|
_ISalnum = 0x0008, /* alpha-numeric */
|
|
|
|
_ISupper = 0x0100, /* uppercase */
|
|
|
|
_ISlower = 0x0200, /* lowercase */
|
|
|
|
_ISalpha = 0x0400, /* alphabetic */
|
|
|
|
_ISdigit = 0x0800, /* digit */
|
|
|
|
_ISxdigit = 0x1000, /* hexadecimal digit */
|
|
|
|
_ISspace = 0x2000, /* white space */
|
|
|
|
_ISprint = 0x4000, /* printing */
|
2007-03-14 23:36:42 +03:00
|
|
|
_ISgraph = 0x8000 /* graphical */
|
2004-07-06 04:29:52 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Characteristics */
|
|
|
|
extern const unsigned short int *__ctype_b;
|
|
|
|
/* Case conversions */
|
|
|
|
extern const int *__ctype_tolower;
|
|
|
|
extern const int *__ctype_toupper;
|
|
|
|
|
2022-05-30 09:55:46 +03:00
|
|
|
extern const unsigned short int **__ctype_b_loc();
|
|
|
|
extern const int **__ctype_tolower_loc();
|
|
|
|
extern const int **__ctype_toupper_loc();
|
|
|
|
|
2004-07-06 04:29:52 +04:00
|
|
|
#define __isctype(c, type) \
|
2022-05-30 09:55:46 +03:00
|
|
|
((*__ctype_b_loc())[(int)(c)] & (unsigned short int)type)
|
|
|
|
|
|
|
|
#define tolower(c) ((int)(*__ctype_tolower_loc())[(int)(c)])
|
|
|
|
#define toupper(c) ((int)(*__ctype_toupper_loc())[(int)(c)])
|
2004-07-06 04:29:52 +04:00
|
|
|
|
|
|
|
#define isascii(c) (((c) & ~0x7f) == 0) /* ASCII characters have bit 8 cleared */
|
|
|
|
#define toascii(c) ((c) & 0x7f) /* Clear higher bits */
|
|
|
|
|
2004-12-07 20:24:16 +03:00
|
|
|
#define _tolower(c) tolower(c)
|
|
|
|
#define _toupper(c) toupper(c)
|
2004-07-06 04:29:52 +04:00
|
|
|
|
|
|
|
#define isalnum(c) __isctype((c), _ISalnum)
|
|
|
|
#define isalpha(c) __isctype((c), _ISalpha)
|
|
|
|
#define isblank(c) __isctype((c), _ISblank)
|
|
|
|
#define iscntrl(c) __isctype((c), _IScntrl)
|
|
|
|
#define isdigit(c) __isctype((c), _ISdigit)
|
|
|
|
#define islower(c) __isctype((c), _ISlower)
|
|
|
|
#define isgraph(c) __isctype((c), _ISgraph)
|
|
|
|
#define isprint(c) __isctype((c), _ISprint)
|
|
|
|
#define ispunct(c) __isctype((c), _ISpunct)
|
|
|
|
#define isspace(c) __isctype((c), _ISspace)
|
|
|
|
#define isupper(c) __isctype((c), _ISupper)
|
|
|
|
#define isxdigit(c) __isctype((c), _ISxdigit)
|
2003-08-16 11:13:55 +04:00
|
|
|
|
2011-11-22 20:32:39 +04:00
|
|
|
extern unsigned short int __ctype_mb_cur_max;
|
|
|
|
|
2003-08-16 11:13:55 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
#endif /* _CTYPE_H */
|