diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-15 14:14:06 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-15 14:14:06 -0700 |
commit | 5da9919f99ebacbc511113134ef8f687a562d5b8 (patch) | |
tree | 93ca25d179a3ad53796e4132fc98c06ecb704a91 /src/buffer.h | |
parent | b313f9d86378db4dd4619923572b07513c53ceac (diff) | |
download | emacs-5da9919f99ebacbc511113134ef8f687a562d5b8.tar.gz |
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; #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) -/* Current buffer's map from characters to lower-case characters. */ - -#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) - -/* Current buffer's map from characters to upper-case characters. */ - -#define UPCASE_TABLE BVAR (current_buffer, upcase_table) - -/* Downcase a character, or make no change if that cannot be done. */ - -static inline EMACS_INT -downcase (int ch) +/* Downcase a character C, or make no change if that cannot be done. */ +static inline int +downcase (int c) { - Lisp_Object down = CHAR_TABLE_REF (DOWNCASE_TABLE, ch); - return NATNUMP (down) ? XFASTINT (down) : ch; + Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); + Lisp_Object down = CHAR_TABLE_REF (downcase_table, c); + return NATNUMP (down) ? XFASTINT (down) : c; } -#define DOWNCASE(CH) downcase (CH) - -/* 1 if CH is upper case. */ - -#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH)) - -/* 1 if CH is neither upper nor lower case. */ -#define NOCASEP(CH) (UPCASE1 (CH) == (CH)) +/* 1 if C is upper case. */ +static inline int uppercasep (int c) { return downcase (c) != c; } -/* 1 if CH is lower case. */ - -#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH)) - -/* Upcase a character, or make no change if that cannot be done. */ - -#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH)) - -/* Upcase a character known to be not upper case. */ - -static inline EMACS_INT -upcase1 (int ch) +/* Upcase a character C known to be not upper case. */ +static inline int +upcase1 (int c) { - Lisp_Object up = CHAR_TABLE_REF (UPCASE_TABLE, ch); - return NATNUMP (up) ? XFASTINT (up) : ch; + Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); + Lisp_Object up = CHAR_TABLE_REF (upcase_table, c); + return NATNUMP (up) ? XFASTINT (up) : c; } -#define UPCASE1(CH) upcase1 (CH) + +/* 1 if C is lower case. */ +static inline int lowercasep (int c) +{ return !uppercasep (c) && upcase1 (c) != c; } + +/* Upcase a character C, or make no change if that cannot be done. */ +static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } |