#define PER_BUFFER_VALUE(BUFFER, OFFSET) \
(*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
\f
-/* 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); }
multibyte = 1;
if (! multibyte)
MAKE_CHAR_MULTIBYTE (c1);
- c = DOWNCASE (c1);
+ c = downcase (c1);
if (inword)
XSETFASTINT (obj, c | flags);
else if (c == (XFASTINT (obj) & ~flagbits))
{
if (! inword)
- c = UPCASE1 (c1);
+ c = upcase1 (c1);
if (! multibyte)
MAKE_CHAR_UNIBYTE (c);
XSETFASTINT (obj, c | flags);
MAKE_CHAR_MULTIBYTE (c);
c1 = c;
if (inword && flag != CASE_CAPITALIZE_UP)
- c = DOWNCASE (c);
- else if (!UPPERCASEP (c)
+ c = downcase (c);
+ else if (!uppercasep (c)
&& (!inword || flag != CASE_CAPITALIZE_UP))
- c = UPCASE1 (c1);
+ c = upcase1 (c1);
if ((int) flag >= (int) CASE_CAPITALIZE)
inword = (SYNTAX (c) == Sword);
if (c != c1)
}
c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
if (inword && flag != CASE_CAPITALIZE_UP)
- c = DOWNCASE (c);
- else if (!UPPERCASEP (c)
+ c = downcase (c);
+ else if (!uppercasep (c)
&& (!inword || flag != CASE_CAPITALIZE_UP))
- c = UPCASE1 (c);
+ c = upcase1 (c);
if ((int) flag >= (int) CASE_CAPITALIZE)
inword = (SYNTAX (c) == Sword);
o += CHAR_STRING (c, o);
}
c2 = c;
if (inword && flag != CASE_CAPITALIZE_UP)
- c = DOWNCASE (c);
- else if (!UPPERCASEP (c)
+ c = downcase (c);
+ else if (!uppercasep (c)
&& (!inword || flag != CASE_CAPITALIZE_UP))
- c = UPCASE1 (c);
+ c = upcase1 (c);
if ((int) flag >= (int) CASE_CAPITALIZE)
inword = ((SYNTAX (c) == Sword)
&& (inword || !syntax_prefix_flag_p (c)));
if (completion_ignore_case)
{
while (l
- && (DOWNCASE ((unsigned char) *s1++)
- == DOWNCASE ((unsigned char) *s2++)))
+ && (downcase ((unsigned char) *s1++)
+ == downcase ((unsigned char) *s2++)))
l--;
}
else
memcpy (r, p, q - p);
r[q - p] = 0;
strcat (r, SSDATA (login));
- r[q - p] = UPCASE ((unsigned char) r[q - p]);
+ r[q - p] = upcase ((unsigned char) r[q - p]);
strcat (r, q + 1);
full = build_string (r);
}
{
int i1, i2;
/* Check they're chars, not just integers, otherwise we could get array
- bounds violations in DOWNCASE. */
+ bounds violations in downcase. */
CHECK_CHARACTER (c1);
CHECK_CHARACTER (c2);
/* Do these in separate statements,
then compare the variables.
- because of the way DOWNCASE uses temp variables. */
+ because of the way downcase uses temp variables. */
i1 = XFASTINT (c1);
if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! ASCII_CHAR_P (i1))
{
MAKE_CHAR_MULTIBYTE (i2);
}
- i1 = DOWNCASE (i1);
- i2 = DOWNCASE (i2);
+ i1 = downcase (i1);
+ i2 = downcase (i2);
return (i1 == i2 ? Qt : Qnil);
}
\f
str = SSDATA (errstring);
c = STRING_CHAR ((unsigned char *) str);
- Faset (errstring, make_number (0), make_number (DOWNCASE (c)));
+ Faset (errstring, make_number (0), make_number (downcase (c)));
}
xsignal (Qfile_error,
&& /* indec.start >= t && fkey.start >= t && */ keytran.start >= t
&& INTEGERP (key)
&& ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK))
- && UPPERCASEP (XINT (key) & ~CHAR_MODIFIER_MASK))
+ && uppercasep (XINT (key) & ~CHAR_MODIFIER_MASK))
|| (XINT (key) & shift_modifier)))
{
Lisp_Object new_key;
if (XINT (key) & shift_modifier)
XSETINT (new_key, XINT (key) & ~shift_modifier);
else
- XSETINT (new_key, (DOWNCASE (XINT (key) & ~CHAR_MODIFIER_MASK)
+ XSETINT (new_key, (downcase (XINT (key) & ~CHAR_MODIFIER_MASK)
| (XINT (key) & CHAR_MODIFIER_MASK)));
/* We have to do this unconditionally, regardless of whether
|| (INTEGERP (key)
&& (KEY_TO_CHAR (key)
< XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size)
- && UPPERCASEP (KEY_TO_CHAR (key))))
+ && uppercasep (KEY_TO_CHAR (key))))
{
Lisp_Object new_key
= (modifiers & shift_modifier
? apply_modifiers (modifiers & ~shift_modifier,
XCAR (breakdown))
- : make_number (DOWNCASE (KEY_TO_CHAR (key)) | modifiers));
+ : make_number (downcase (KEY_TO_CHAR (key)) | modifiers));
original_uppercase = key;
original_uppercase_position = t - 1;
string = (code_convert_string_norecord
(string, Vlocale_coding_system, 0));
c1 = STRING_CHAR (SDATA (string));
- c2 = DOWNCASE (c1);
+ c2 = downcase (c1);
if (c1 != c2)
Faset (string, make_number (0), make_number (c2));
}
|| ((c) >= 'A' && (c) <= 'Z')) \
: SYNTAX (c) == Sword)
-# define ISLOWER(c) (LOWERCASEP (c))
+# define ISLOWER(c) lowercasep (c)
# define ISPUNCT(c) (IS_REAL_ASCII (c) \
? ((c) > ' ' && (c) < 0177 \
# define ISSPACE(c) (SYNTAX (c) == Swhitespace)
-# define ISUPPER(c) (UPPERCASEP (c))
+# define ISUPPER(c) uppercasep (c)
# define ISWORD(c) (SYNTAX (c) == Sword)
else
FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, pos, pos_byte);
- if (LOWERCASEP (c))
+ if (lowercasep (c))
{
/* Cannot be all caps if any original char is lower case */
else
some_multiletter_word = 1;
}
- else if (UPPERCASEP (c))
+ else if (uppercasep (c))
{
some_uppercase = 1;
if (SYNTAX (prevc) != Sword)