Warning, file /include/readline/chardefs.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef _CHARDEFS_H_
0023 #define _CHARDEFS_H_
0024
0025 #include <ctype.h>
0026
0027 #if defined (HAVE_CONFIG_H)
0028 # if defined (HAVE_STRING_H)
0029 # include <string.h>
0030 # endif
0031 # if defined (HAVE_STRINGS_H)
0032 # include <strings.h>
0033 # endif
0034 #else
0035 # include <string.h>
0036 #endif
0037
0038 #ifndef whitespace
0039 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
0040 #endif
0041
0042 #ifdef CTRL
0043 # undef CTRL
0044 #endif
0045 #ifdef UNCTRL
0046 # undef UNCTRL
0047 #endif
0048
0049
0050 #define control_character_threshold 0x020
0051 #define control_character_mask 0x1f
0052 #define meta_character_threshold 0x07f
0053 #define control_character_bit 0x40
0054 #define meta_character_bit 0x080
0055 #define largest_char 255
0056
0057 #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
0058 #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
0059
0060 #define CTRL(c) ((c) & control_character_mask)
0061 #define META(c) ((c) | meta_character_bit)
0062
0063 #define UNMETA(c) ((c) & (~meta_character_bit))
0064 #define UNCTRL(c) _rl_to_upper(((c)|control_character_bit))
0065
0066 #ifndef UCHAR_MAX
0067 # define UCHAR_MAX 255
0068 #endif
0069 #ifndef CHAR_MAX
0070 # define CHAR_MAX 127
0071 #endif
0072
0073
0074 #if defined (HAVE_STDLIB_H) && defined (HAVE_STRING_H)
0075 # define IN_CTYPE_DOMAIN(c) 1
0076 # define NON_NEGATIVE(c) 1
0077 #else
0078 # define IN_CTYPE_DOMAIN(c) ((c) >= 0 && (c) <= CHAR_MAX)
0079 # define NON_NEGATIVE(c) ((unsigned char)(c) == (c))
0080 #endif
0081
0082 #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus)
0083 # define isxdigit(c) (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
0084 #endif
0085
0086
0087 #undef ISPRINT
0088
0089
0090
0091 #define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum ((unsigned char)c))
0092 #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char)c))
0093 #define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit ((unsigned char)c))
0094 #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower ((unsigned char)c))
0095 #define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint ((unsigned char)c))
0096 #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char)c))
0097 #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char)c))
0098
0099 #define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c))
0100 #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c))
0101 #define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
0102
0103 #define _rl_alphabetic_p(c) (NON_NEGATIVE(c) && ISALNUM(c))
0104 #define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c))
0105
0106 #ifndef _rl_to_upper
0107 # define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)(c)) : (c))
0108 # define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)(c)) : (c))
0109 #endif
0110
0111 #ifndef _rl_digit_value
0112 # define _rl_digit_value(x) ((x) - '0')
0113 #endif
0114
0115 #ifndef _rl_isident
0116 # define _rl_isident(c) (ISALNUM(c) || (c) == '_')
0117 #endif
0118
0119 #ifndef ISOCTAL
0120 # define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
0121 #endif
0122 #define OCTVALUE(c) ((c) - '0')
0123
0124 #define HEXVALUE(c) \
0125 (((c) >= 'a' && (c) <= 'f') \
0126 ? (c)-'a'+10 \
0127 : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0')
0128
0129 #ifndef NEWLINE
0130 #define NEWLINE '\n'
0131 #endif
0132
0133 #ifndef RETURN
0134 #define RETURN CTRL('M')
0135 #endif
0136
0137 #ifndef RUBOUT
0138 #define RUBOUT 0x7f
0139 #endif
0140
0141 #ifndef TAB
0142 #define TAB '\t'
0143 #endif
0144
0145 #ifdef ABORT_CHAR
0146 #undef ABORT_CHAR
0147 #endif
0148 #define ABORT_CHAR CTRL('G')
0149
0150 #ifdef PAGE
0151 #undef PAGE
0152 #endif
0153 #define PAGE CTRL('L')
0154
0155 #ifdef SPACE
0156 #undef SPACE
0157 #endif
0158 #define SPACE ' '
0159
0160 #ifdef ESC
0161 #undef ESC
0162 #endif
0163 #define ESC CTRL('[')
0164
0165 #endif