Routines for checking and changing character types
Note: All of these functions are inline functions which are implemented using GNU C smart macros (except the simplest ones, which are ordinary macros). Some of them expand to relatively large code, so if you call any of them more than twice in a program, it will be a good idea to define an ordinary function which calls this macro. For example, if you want to call isxdigit more than twice, define the following to save memory:
int _isxdigit(int c) { return isxdigit (c); }
Then call _isxdigit instead.
short _tolower (short c); |
Translates uppercase characters to lowercase.
_tolower does the same conversion as tolower or toextlower, except that it should be used only when c is known to be uppercase (either ordinary or foreign). It is faster, and generates much shorter code than tolower. _tolower returns the converted value of c if it is uppercase; otherwise, the result is undefined. _tolower is a simple macro.
short _toupper (short c); |
Translates uppercase characters to lowercase.
_toupper does the same conversion as toupper or toextupper, except that it should be used only when c is known to be lowercase (either ordinary or foreign). It is faster, and generates much shorter code than toupper. _toupper returns the converted value of c if it is lowercase; otherwise, the result is undefined. _toupper is a simple macro.
short isalnum (short c); |
Checks whether a character is an alphanumeric.
isalnum returns nonzero if c is a letter ('A' to 'Z' or 'a' to 'z') or a digit ('0' to '9'), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a medium-sized code.
short isalpha (short c); |
Checks whether a character is a letter.
isalpha returns nonzero if c is a letter ('A' to 'Z' or 'a' to 'z'), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a relatively small code.
short isascii (short c); |
Checks whether a character is an ASCII character.
isascii returns nonzero if c is in the range 0 to 127 (0x00-0x7F), otherwise it returns zero. It is a simple macro.
short iscntrl (short c); |
Checks whether a character is a control character.
iscntrl returns nonzero if c is a TIOS control character, otherwise it returns zero. Note that in TIOS control characters are reduced to the range from 0x00 to 0x0D. iscntrl is a simple macro.
short isdigit (short c); |
Checks whether a character is a digit.
isdigit returns nonzero if c is a digit ('0' to '9'), otherwise it returns zero. It is a small inline function which is implemented using GNU C smart macros.
short isextalnum (short c); |
Checks whether a character is an extended alphanumeric.
isextalnum returns nonzero if c is a symbol which may be used in variable names, including ordinary alphanumerics (see isalnum), underscore ('_') and foreign alphanumerics (see isfrgnalnum), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros and a library variable. The first call of isextalnum expands to a large code, but any next call of it expands to a relatively small code.
short isextlower (short c); |
Checks whether a character is a lowercase, including foreign ones.
isextlower returns nonzero if c is a lowercase letter, either ordinary ('a' to 'z') or foreign one (see isfrgnlower), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a medium-sized code.
short isextpunct (short c); |
Checks whether a character is an extended punctuation character.
isextpunct returns nonzero if c is a character which is printable (see isprint but which is not an extended alphanumeric (see isextalnum), otherwise it returns zero. Extended punctuation characters include ordinary punctuation characters (see ispunct) and some extra ones. isextpunct is an inline function which is implemented using GNU C smart macros. The first call of it expands to a large code, but any next call of it expands to a relatively small code.
short isextupper (short c); |
Checks whether a character is an uppercase, including foreign ones.
isextupper returns nonzero if c is an uppercase letter, either ordinary ('A' to 'Z') or foreign one (see isfrgnupper), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a medium-sized code.
short isfrgn (short c); |
Checks whether a character is a foreign letter.
isfrgn returns nonzero if c is a foreign letter (including Greek ones), either uppercase or lowercase (see isGreek, isfrgnupper and isfrgnlower), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a relatively large code.
short isfrgnalnum (short c); |
Checks whether a character is a foreign letter which is valid in a variable name.
isfrgnalnum is the same as isfrgn, except small Greek "pi" is excluded, because it is the reserved symbol and it is not valid in a variable name. isfrgnalnum is an inline function which is implemented using GNU C smart macros, which expands to a relatively large code.
short isfrgnlower (short c); |
Checks whether a character is a foreign lowercase.
isfrgnlower returns nonzero if c is a non-Greek foreign lowercase letter (0xE0 to 0xFE except 0xF7), otherwise it returns zero. It is a relatively small inline function which is implemented using GNU C smart macros.
short isfrgnupper (short c); |
Checks whether a character is a foreign uppercase.
isfrgnupper returns nonzero if c is a non-Greek foreign uppercase letter (0xC0 to 0xDE except 0xD7), otherwise it returns zero. It is a relatively small inline function which is implemented using GNU C smart macros.
short isgraph (short c); |
Checks whether a character is a graph character.
isgraph returns nonzero if c is printing character, like isprint, except that a space character is excluded; otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a relatively small code.
short isGreek (short c); |
Checks whether a character is a Greek letter.
isGreek returns nonzero if c is a Greek letter (0x80 to 0x94 and 0xB5), otherwise it returns zero. It is a relatively small inline function which is implemented using GNU C smart macros.
short islower (short c); |
Checks whether a character is a lowercase.
islower returns nonzero if c is a lowercase letter ('a' to 'z'), otherwise it returns zero. It is a small inline function which is implemented using GNU C smart macros.
short isprint (short c); |
Checks whether a character is a printing character.
isprint returns nonzero if c is a printing character, otherwise it returns zero. In TIOS, all characters in a range 0x0E to 0xFF and 0x0B are marked as "printable". isprint is a relatively small inline function which is implemented using GNU C smart macros.
short ispunct (short c); |
Checks whether a character is a punctuation character.
ispunct returns nonzero if c is a punctuation character, otherwise it returns zero. Punctuation characters are all characters in standard ASCII graph range (0x21 to 0x7F), which are not alphanumeric character (see isalnum). ispunct is an inline function which is implemented using GNU C smart macros, which expands to a relatively large code.
short isspace (short c); |
Checks whether a character is a white space.
isspace returns nonzero if c is a space, tab, carriage return, new line, vertical tab, or formfeed (0x09 to 0x0D and 0x20), otherwise it returns zero. It is a relatively small inline function which is implemented using GNU C smart macros.
short isupper (short c); |
Checks whether a character is an uppercase.
isupper returns nonzero if c is an uppercase letter ('A' to 'Z'), otherwise it returns zero. It is a small inline function which is implemented using GNU C smart macros.
short isxdigit (short c); |
Checks whether a character is a hex digit.
isxdigit returns nonzero if c is a hexadecimal digit ('0' to '9', 'A' to 'F' or 'a' to 'f'), otherwise it returns zero. It is an inline function which is implemented using GNU C smart macros, which expands to a medium-sized code.
short toascii (short c); |
Translates characters to ASCII format.
toascii converts the integer c to ASCII by clearing all but the lower 7 bits. This gives a value in the range 0 to 127. Returns the converted value of c. toascii is a simple macro.
short toextlower (short c); |
Translates characters to lowercase, including foreign ones.
toextlower works like tolower, but it also converts foreign uppercase characters (see isfrgnupper). toextupper is an inline function which is implemented using GNU C smart macros, which expands to a medium-sized code.
short toextupper (short c); |
Translates characters to uppercase, including foreign ones.
toextupper works like toupper, but it also converts foreign lowercase characters (see isfrgnlower). toextupper is an inline function which is implemented using GNU C smart macros, which expands to a medium-sized code.
short tolower (short c); |
Translates characters to lowercase.
tolower is a function that converts an integer c to its lowercase value ('a' to 'z') if it was uppercase ('A' to 'Z'). All others are left unchanged. Returns the converted value of c. tolower is a relatively small inline function which is implemented using GNU C smart macros.
short toupper (short c); |
Translates characters to uppercase.
toupper is a function that converts an integer c to its uppercase value ('A' to 'Z') if it was lowercase ('a' to 'z'). All others are left unchanged. Returns the converted value of c. toupper is a relatively small inline function which is implemented using GNU C smart macros.