[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/character.c,v
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] Changes to emacs/src/character.c,v |
Date: |
Wed, 05 Mar 2008 02:08:31 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kenichi Handa <handa> 08/03/05 02:08:31
Index: character.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/character.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- character.c 12 Feb 2008 21:35:15 -0000 1.4
+++ character.c 5 Mar 2008 02:08:30 -0000 1.5
@@ -96,22 +96,17 @@
-/* Store multibyte form of character C at P. If C has modifier bits,
- handle them appropriately. */
+/* If character code C has modifier masks, reflect them to the
+ character code if possible. Return the resulting code. */
int
-char_string (c, p)
- unsigned c;
- unsigned char *p;
+char_resolve_modifier_mask (c)
+ int c;
{
- int bytes;
+ /* An non-ASCII character can't reflect modifier bits to the code. */
+ if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
+ return c;
- if (c & CHAR_MODIFIER_MASK)
- {
- /* As an non-ASCII character can't have modifier bits, we just
- ignore the bits. */
- if (ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
- {
/* For Meta, Shift, and Control modifiers, we need special care. */
if (c & CHAR_META)
{
@@ -130,9 +125,9 @@
{
/* Simulate the code in lread.c. */
/* Allow `\C- ' and `\C-?'. */
- if (c == (CHAR_CTL | ' '))
+ if ((c & ~CHAR_CTL) == ' ')
c = 0;
- else if (c == (CHAR_CTL | '?'))
+ else if ((c & ~CHAR_CTL) == '?')
c = 127;
/* ASCII control chars are made from letters (both cases),
as well as the non-letters within 0100...0137. */
@@ -141,8 +136,24 @@
else if ((c & 0177) >= 0100 && (c & 0177) <= 0137)
c &= (037 | (~0177 & ~CHAR_CTL));
}
- }
+ return c;
+}
+
+
+/* Store multibyte form of character C at P. If C has modifier bits,
+ handle them appropriately. */
+
+int
+char_string (c, p)
+ unsigned c;
+ unsigned char *p;
+{
+ int bytes;
+
+ if (c & CHAR_MODIFIER_MASK)
+ {
+ c = (unsigned) char_resolve_modifier_mask ((int) c);
/* If C still has any modifier bits, just ignore it. */
c &= ~CHAR_MODIFIER_MASK;
}
- [Emacs-diffs] Changes to emacs/src/character.c,v,
Kenichi Handa <=