Rizin
unix-like reverse engineering framework and cli tools
safe-ctype.h File Reference
#include <ctype.h>

Go to the source code of this file.

Macros

#define HOST_CHARSET_UNKNOWN   0
 
#define HOST_CHARSET_ASCII   1
 
#define HOST_CHARSET_EBCDIC   2
 
#define HOST_CHARSET   HOST_CHARSET_ASCII
 
#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)
 
#define ISBLANK(c)   _sch_test(c, _sch_isblank)
 
#define ISCNTRL(c)   _sch_test(c, _sch_iscntrl)
 
#define ISDIGIT(c)   _sch_test(c, _sch_isdigit)
 
#define ISGRAPH(c)   _sch_test(c, _sch_isgraph)
 
#define ISLOWER(c)   _sch_test(c, _sch_islower)
 
#define ISPRINT(c)   _sch_test(c, _sch_isprint)
 
#define ISPUNCT(c)   _sch_test(c, _sch_ispunct)
 
#define ISSPACE(c)   _sch_test(c, _sch_isspace)
 
#define ISUPPER(c)   _sch_test(c, _sch_isupper)
 
#define ISXDIGIT(c)   _sch_test(c, _sch_isxdigit)
 
#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)
 
#define TOUPPER(c)   _sch_toupper[(c)&0xff]
 
#define TOLOWER(c)   _sch_tolower[(c)&0xff]
 
#define isalpha(c)   do_not_use_isalpha_with_safe_ctype
 
#define isalnum(c)   do_not_use_isalnum_with_safe_ctype
 
#define iscntrl(c)   do_not_use_iscntrl_with_safe_ctype
 
#define isdigit(c)   do_not_use_isdigit_with_safe_ctype
 
#define isgraph(c)   do_not_use_isgraph_with_safe_ctype
 
#define islower(c)   do_not_use_islower_with_safe_ctype
 
#define isprint(c)   do_not_use_isprint_with_safe_ctype
 
#define ispunct(c)   do_not_use_ispunct_with_safe_ctype
 
#define isspace(c)   do_not_use_isspace_with_safe_ctype
 
#define isupper(c)   do_not_use_isupper_with_safe_ctype
 
#define isxdigit(c)   do_not_use_isxdigit_with_safe_ctype
 
#define toupper(c)   do_not_use_toupper_with_safe_ctype
 
#define tolower(c)   do_not_use_tolower_with_safe_ctype
 

Enumerations

enum  {
  _sch_isblank = 0x0001 , _sch_iscntrl = 0x0002 , _sch_isdigit = 0x0004 , _sch_islower = 0x0008 ,
  _sch_isprint = 0x0010 , _sch_ispunct = 0x0020 , _sch_isspace = 0x0040 , _sch_isupper = 0x0080 ,
  _sch_isxdigit = 0x0100 , _sch_isidst = 0x0200 , _sch_isvsp = 0x0400 , _sch_isnvsp = 0x0800 ,
  _sch_isalpha = _sch_isupper | _sch_islower , _sch_isalnum = _sch_isalpha | _sch_isdigit , _sch_isidnum = _sch_isidst | _sch_isdigit , _sch_isgraph = _sch_isalnum | _sch_ispunct ,
  _sch_iscppsp = _sch_isvsp | _sch_isnvsp , _sch_isbasic = _sch_isprint | _sch_iscppsp
}
 

Variables

const unsigned short _sch_istable [256]
 
const unsigned char _sch_toupper [256]
 
const unsigned char _sch_tolower [256]
 

Macro Definition Documentation

◆ _sch_test

#define _sch_test (   c,
  bit 
)    (_sch_istable[(c)&0xff] & (unsigned short)(bit))

Definition at line 88 of file safe-ctype.h.

◆ HOST_CHARSET

#define HOST_CHARSET   HOST_CHARSET_ASCII

Definition at line 47 of file safe-ctype.h.

◆ HOST_CHARSET_ASCII

#define HOST_CHARSET_ASCII   1

Definition at line 43 of file safe-ctype.h.

◆ HOST_CHARSET_EBCDIC

#define HOST_CHARSET_EBCDIC   2

Definition at line 44 of file safe-ctype.h.

◆ HOST_CHARSET_UNKNOWN

#define HOST_CHARSET_UNKNOWN   0

Definition at line 42 of file safe-ctype.h.

◆ IS_ISOBASIC

#define IS_ISOBASIC (   c)    _sch_test(c, _sch_isbasic)

Definition at line 105 of file safe-ctype.h.

◆ IS_NVSPACE

#define IS_NVSPACE (   c)    _sch_test(c, _sch_isnvsp)

Definition at line 107 of file safe-ctype.h.

◆ IS_SPACE_OR_NUL

#define IS_SPACE_OR_NUL (   c)    _sch_test(c, _sch_iscppsp)

Definition at line 108 of file safe-ctype.h.

◆ IS_VSPACE

#define IS_VSPACE (   c)    _sch_test(c, _sch_isvsp)

Definition at line 106 of file safe-ctype.h.

◆ ISALNUM

#define ISALNUM (   c)    _sch_test(c, _sch_isalnum)

Definition at line 91 of file safe-ctype.h.

◆ isalnum

#define isalnum (   c)    do_not_use_isalnum_with_safe_ctype

Definition at line 127 of file safe-ctype.h.

◆ ISALPHA

#define ISALPHA (   c)    _sch_test(c, _sch_isalpha)

Definition at line 90 of file safe-ctype.h.

◆ isalpha

#define isalpha (   c)    do_not_use_isalpha_with_safe_ctype

Definition at line 125 of file safe-ctype.h.

◆ ISBLANK

#define ISBLANK (   c)    _sch_test(c, _sch_isblank)

Definition at line 92 of file safe-ctype.h.

◆ ISCNTRL

#define ISCNTRL (   c)    _sch_test(c, _sch_iscntrl)

Definition at line 93 of file safe-ctype.h.

◆ iscntrl

#define iscntrl (   c)    do_not_use_iscntrl_with_safe_ctype

Definition at line 129 of file safe-ctype.h.

◆ ISDIGIT

#define ISDIGIT (   c)    _sch_test(c, _sch_isdigit)

Definition at line 94 of file safe-ctype.h.

◆ isdigit

#define isdigit (   c)    do_not_use_isdigit_with_safe_ctype

Definition at line 131 of file safe-ctype.h.

◆ ISGRAPH

#define ISGRAPH (   c)    _sch_test(c, _sch_isgraph)

Definition at line 95 of file safe-ctype.h.

◆ isgraph

#define isgraph (   c)    do_not_use_isgraph_with_safe_ctype

Definition at line 133 of file safe-ctype.h.

◆ ISIDNUM

#define ISIDNUM (   c)    _sch_test(c, _sch_isidnum)

Definition at line 103 of file safe-ctype.h.

◆ ISIDST

#define ISIDST (   c)    _sch_test(c, _sch_isidst)

Definition at line 104 of file safe-ctype.h.

◆ ISLOWER

#define ISLOWER (   c)    _sch_test(c, _sch_islower)

Definition at line 96 of file safe-ctype.h.

◆ islower

#define islower (   c)    do_not_use_islower_with_safe_ctype

Definition at line 135 of file safe-ctype.h.

◆ ISPRINT

#define ISPRINT (   c)    _sch_test(c, _sch_isprint)

Definition at line 97 of file safe-ctype.h.

◆ isprint

#define isprint (   c)    do_not_use_isprint_with_safe_ctype

Definition at line 137 of file safe-ctype.h.

◆ ISPUNCT

#define ISPUNCT (   c)    _sch_test(c, _sch_ispunct)

Definition at line 98 of file safe-ctype.h.

◆ ispunct

#define ispunct (   c)    do_not_use_ispunct_with_safe_ctype

Definition at line 139 of file safe-ctype.h.

◆ ISSPACE

#define ISSPACE (   c)    _sch_test(c, _sch_isspace)

Definition at line 99 of file safe-ctype.h.

◆ isspace

#define isspace (   c)    do_not_use_isspace_with_safe_ctype

Definition at line 141 of file safe-ctype.h.

◆ ISUPPER

#define ISUPPER (   c)    _sch_test(c, _sch_isupper)

Definition at line 100 of file safe-ctype.h.

◆ isupper

#define isupper (   c)    do_not_use_isupper_with_safe_ctype

Definition at line 143 of file safe-ctype.h.

◆ ISXDIGIT

#define ISXDIGIT (   c)    _sch_test(c, _sch_isxdigit)

Definition at line 101 of file safe-ctype.h.

◆ isxdigit

#define isxdigit (   c)    do_not_use_isxdigit_with_safe_ctype

Definition at line 145 of file safe-ctype.h.

◆ TOLOWER

#define TOLOWER (   c)    _sch_tolower[(c)&0xff]

Definition at line 114 of file safe-ctype.h.

◆ tolower

#define tolower (   c)    do_not_use_tolower_with_safe_ctype

Definition at line 149 of file safe-ctype.h.

◆ TOUPPER

#define TOUPPER (   c)    _sch_toupper[(c)&0xff]

Definition at line 113 of file safe-ctype.h.

◆ toupper

#define toupper (   c)    do_not_use_toupper_with_safe_ctype

Definition at line 147 of file safe-ctype.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
_sch_isblank 
_sch_iscntrl 
_sch_isdigit 
_sch_islower 
_sch_isprint 
_sch_ispunct 
_sch_isspace 
_sch_isupper 
_sch_isxdigit 
_sch_isidst 
_sch_isvsp 
_sch_isnvsp 
_sch_isalpha 
_sch_isalnum 
_sch_isidnum 
_sch_isgraph 
_sch_iscppsp 
_sch_isbasic 

Definition at line 58 of file safe-ctype.h.

58  {
59  /* In C99 */
60  _sch_isblank = 0x0001, /* space \t */
61  _sch_iscntrl = 0x0002, /* nonprinting characters */
62  _sch_isdigit = 0x0004, /* 0-9 */
63  _sch_islower = 0x0008, /* a-z */
64  _sch_isprint = 0x0010, /* any printing character including ' ' */
65  _sch_ispunct = 0x0020, /* all punctuation */
66  _sch_isspace = 0x0040, /* space \t \n \r \f \v */
67  _sch_isupper = 0x0080, /* A-Z */
68  _sch_isxdigit = 0x0100, /* 0-9A-Fa-f */
69 
70  /* Extra categories useful to cpplib. */
71  _sch_isidst = 0x0200, /* A-Za-z_ */
72  _sch_isvsp = 0x0400, /* \n \r */
73  _sch_isnvsp = 0x0800, /* space \t \f \v \0 */
74 
75  /* Combinations of the above. */
76  _sch_isalpha = _sch_isupper | _sch_islower, /* A-Za-z */
77  _sch_isalnum = _sch_isalpha | _sch_isdigit, /* A-Za-z0-9 */
78  _sch_isidnum = _sch_isidst | _sch_isdigit, /* A-Za-z0-9_ */
79  _sch_isgraph = _sch_isalnum | _sch_ispunct, /* isprint and not space */
80  _sch_iscppsp = _sch_isvsp | _sch_isnvsp, /* isspace + \0 */
81  _sch_isbasic = _sch_isprint | _sch_iscppsp /* basic charset of ISO C
82  (plus ` and @) */
83 };
@ _sch_isalpha
Definition: safe-ctype.h:76
@ _sch_isupper
Definition: safe-ctype.h:67
@ _sch_isvsp
Definition: safe-ctype.h:72
@ _sch_isprint
Definition: safe-ctype.h:64
@ _sch_isdigit
Definition: safe-ctype.h:62
@ _sch_islower
Definition: safe-ctype.h:63
@ _sch_isidnum
Definition: safe-ctype.h:78
@ _sch_iscppsp
Definition: safe-ctype.h:80
@ _sch_iscntrl
Definition: safe-ctype.h:61
@ _sch_isxdigit
Definition: safe-ctype.h:68
@ _sch_isblank
Definition: safe-ctype.h:60
@ _sch_isgraph
Definition: safe-ctype.h:79
@ _sch_isspace
Definition: safe-ctype.h:66
@ _sch_isalnum
Definition: safe-ctype.h:77
@ _sch_ispunct
Definition: safe-ctype.h:65
@ _sch_isnvsp
Definition: safe-ctype.h:73
@ _sch_isidst
Definition: safe-ctype.h:71
@ _sch_isbasic
Definition: safe-ctype.h:81

Variable Documentation

◆ _sch_istable

const unsigned short _sch_istable[256]
extern

◆ _sch_tolower

const unsigned char _sch_tolower[256]
extern

◆ _sch_toupper

const unsigned char _sch_toupper[256]
extern