diff options
| author | Paul Eggert | 2011-03-15 14:14:06 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-15 14:14:06 -0700 |
| commit | 5da9919f99ebacbc511113134ef8f687a562d5b8 (patch) | |
| tree | 93ca25d179a3ad53796e4132fc98c06ecb704a91 /src/buffer.h | |
| parent | b313f9d86378db4dd4619923572b07513c53ceac (diff) | |
| download | emacs-5da9919f99ebacbc511113134ef8f687a562d5b8.tar.gz emacs-5da9919f99ebacbc511113134ef8f687a562d5b8.zip | |
Use functions, not macros, for up- and down-casing.
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 58 |
1 files changed, 21 insertions, 37 deletions
diff --git a/src/buffer.h b/src/buffer.h index 996e4e59c27..d80875a0811 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1027,46 +1027,30 @@ extern int last_per_buffer_idx; | |||
| 1027 | #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ | 1027 | #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ |
| 1028 | (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) | 1028 | (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) |
| 1029 | 1029 | ||
| 1030 | /* Current buffer's map from characters to lower-case characters. */ | 1030 | /* Downcase a character C, or make no change if that cannot be done. */ |
| 1031 | 1031 | static inline int | |
| 1032 | #define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) | 1032 | downcase (int c) |
| 1033 | |||
| 1034 | /* Current buffer's map from characters to upper-case characters. */ | ||
| 1035 | |||
| 1036 | #define UPCASE_TABLE BVAR (current_buffer, upcase_table) | ||
| 1037 | |||
| 1038 | /* Downcase a character, or make no change if that cannot be done. */ | ||
| 1039 | |||
| 1040 | static inline EMACS_INT | ||
| 1041 | downcase (int ch) | ||
| 1042 | { | 1033 | { |
| 1043 | Lisp_Object down = CHAR_TABLE_REF (DOWNCASE_TABLE, ch); | 1034 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); |
| 1044 | return NATNUMP (down) ? XFASTINT (down) : ch; | 1035 | Lisp_Object down = CHAR_TABLE_REF (downcase_table, c); |
| 1036 | return NATNUMP (down) ? XFASTINT (down) : c; | ||
| 1045 | } | 1037 | } |
| 1046 | #define DOWNCASE(CH) downcase (CH) | ||
| 1047 | |||
| 1048 | /* 1 if CH is upper case. */ | ||
| 1049 | |||
| 1050 | #define UPPERCASEP(CH) (DOWNCASE (CH) != (CH)) | ||
| 1051 | |||
| 1052 | /* 1 if CH is neither upper nor lower case. */ | ||
| 1053 | 1038 | ||
| 1054 | #define NOCASEP(CH) (UPCASE1 (CH) == (CH)) | 1039 | /* 1 if C is upper case. */ |
| 1040 | static inline int uppercasep (int c) { return downcase (c) != c; } | ||
| 1055 | 1041 | ||
| 1056 | /* 1 if CH is lower case. */ | 1042 | /* Upcase a character C known to be not upper case. */ |
| 1057 | 1043 | static inline int | |
| 1058 | #define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH)) | 1044 | upcase1 (int c) |
| 1059 | |||
| 1060 | /* Upcase a character, or make no change if that cannot be done. */ | ||
| 1061 | |||
| 1062 | #define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH)) | ||
| 1063 | |||
| 1064 | /* Upcase a character known to be not upper case. */ | ||
| 1065 | |||
| 1066 | static inline EMACS_INT | ||
| 1067 | upcase1 (int ch) | ||
| 1068 | { | 1045 | { |
| 1069 | Lisp_Object up = CHAR_TABLE_REF (UPCASE_TABLE, ch); | 1046 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); |
| 1070 | return NATNUMP (up) ? XFASTINT (up) : ch; | 1047 | Lisp_Object up = CHAR_TABLE_REF (upcase_table, c); |
| 1048 | return NATNUMP (up) ? XFASTINT (up) : c; | ||
| 1071 | } | 1049 | } |
| 1072 | #define UPCASE1(CH) upcase1 (CH) | 1050 | |
| 1051 | /* 1 if C is lower case. */ | ||
| 1052 | static inline int lowercasep (int c) | ||
| 1053 | { return !uppercasep (c) && upcase1 (c) != c; } | ||
| 1054 | |||
| 1055 | /* Upcase a character C, or make no change if that cannot be done. */ | ||
| 1056 | static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } | ||