Commit 8ac90470 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(CHAR_TABLE_REF): Do not check validity of CT.

(CHAR_TABLE_SET): Likewise.
(DOWNCASE_TABLE): Return case-table instead of the contents field.
(UPCASE_TABLE): Likewise.
(DOWNCASE): Use CHAR_TABLE_REF.
(NOCASEP): Use UPCASE1.
(UPCASE1): Use CHAR_TABLE_REF.
parent a0615d90
...@@ -608,22 +608,23 @@ struct Lisp_Vector ...@@ -608,22 +608,23 @@ struct Lisp_Vector
(((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
/* Almost equivalent to Faref (CT, IDX) with optimization for ASCII /* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
and 8-bit Europeans characters. Do not follow parent. */ and 8-bit Europeans characters. For these characters, do not check
#define CHAR_TABLE_REF(CT, IDX) \ validity of CT. Do not follow parent. */
(CHAR_TABLE_P (CT) && IDX >= 0 && IDX < CHAR_TABLE_SINGLE_BYTE_SLOTS \ #define CHAR_TABLE_REF(CT, IDX) \
? (!NILP (XCHAR_TABLE (CT)->contents[IDX]) \ (XFASTINT (IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
? XCHAR_TABLE (CT)->contents[IDX] \ ? (!NILP (XCHAR_TABLE (CT)->contents[XFASTINT (IDX)])\
: XCHAR_TABLE (CT)->defalt) \ ? XCHAR_TABLE (CT)->contents[XFASTINT (IDX)] \
: XCHAR_TABLE (CT)->defalt) \
: Faref (CT, IDX)) : Faref (CT, IDX))
/* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and /* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and
8-bit Europeans characters. */ 8-bit Europeans characters. Do not check validity of CT. */
#define CHAR_TABLE_SET(CT, IDX, VAL) \ #define CHAR_TABLE_SET(CT, IDX, VAL) \
do { \ do { \
if (CHAR_TABLE_P (CT) && IDX >= 0 && IDX < CHAR_TABLE_SINGLE_BYTE_SLOTS) \ if (XFASTINT (IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS) \
XCHAR_TABLE (CT)->contents[IDX] = VAL; \ XCHAR_TABLE (CT)->contents[XFASTINT (IDX)] = VAL; \
else \ else \
Faset (CT, IDX, VAL); \ Faset (CT, IDX, VAL); \
} while (0) } while (0)
struct Lisp_Char_Table struct Lisp_Char_Table
...@@ -1315,17 +1316,24 @@ extern char *stack_bottom; ...@@ -1315,17 +1316,24 @@ extern char *stack_bottom;
#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
/* Variables used locally in the following case handling macros. */
extern Lisp_Object case_temp1, case_temp2;
/* Current buffer's map from characters to lower-case characters. */ /* Current buffer's map from characters to lower-case characters. */
#define DOWNCASE_TABLE XCHAR_TABLE (current_buffer->downcase_table)->contents #define DOWNCASE_TABLE current_buffer->downcase_table
/* Current buffer's map from characters to upper-case characters. */ /* Current buffer's map from characters to upper-case characters. */
#define UPCASE_TABLE XCHAR_TABLE (current_buffer->upcase_table)->contents #define UPCASE_TABLE current_buffer->upcase_table
/* Downcase a character, or make no change if that cannot be done. */ /* Downcase a character, or make no change if that cannot be done. */
#define DOWNCASE(CH) (XFASTINT (DOWNCASE_TABLE[CH])) #define DOWNCASE(CH) \
((case_temp1 = (CH), \
case_temp2 = CHAR_TABLE_REF (DOWNCASE_TABLE, case_temp1), \
NATNUMP (case_temp2)) \
? XFASTINT (case_temp2) : case_temp1)
/* 1 if CH is upper case. */ /* 1 if CH is upper case. */
...@@ -1333,7 +1341,7 @@ extern char *stack_bottom; ...@@ -1333,7 +1341,7 @@ extern char *stack_bottom;
/* 1 if CH is neither upper nor lower case. */ /* 1 if CH is neither upper nor lower case. */
#define NOCASEP(CH) (XFASTINT (UPCASE_TABLE[CH]) == (CH)) #define NOCASEP(CH) (UPCASE1 (CH) == (CH))
/* 1 if CH is lower case. */ /* 1 if CH is lower case. */
...@@ -1345,7 +1353,11 @@ extern char *stack_bottom; ...@@ -1345,7 +1353,11 @@ extern char *stack_bottom;
/* Upcase a character known to be not upper case. */ /* Upcase a character known to be not upper case. */
#define UPCASE1(CH) (XFASTINT (UPCASE_TABLE[CH])) #define UPCASE1(CH) \
((case_temp1 = (CH), \
case_temp2 = CHAR_TABLE_REF (UPCASE_TABLE, case_temp1), \
NATNUMP (case_temp2)) \
? XFASTINT (case_temp2) : case_temp1)
extern Lisp_Object Vascii_downcase_table; extern Lisp_Object Vascii_downcase_table;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment