]> code.delx.au - gnu-emacs/blobdiff - src/character.h
Minor adjustments to interning code.
[gnu-emacs] / src / character.h
index 2e1372eaf94a0b5377b1bdcfce6e0a8edb144e85..2cfeff85feeead1a2c23bd56df24ad68c62cc753 100644 (file)
@@ -292,7 +292,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
   } while (0)
 
 /* Return the character code of character whose multibyte form is at
-   P.  */
+   P.  Note that this macro unifies CJK characters whose codepoints
+   are in the Private Use Areas (PUAs), so it might return a different
+   codepoint from the one actually stored at P.  */
 
 #define STRING_CHAR(p)                                         \
   (!((p)[0] & 0x80)                                            \
@@ -309,7 +311,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /* Like STRING_CHAR, but set ACTUAL_LEN to the length of multibyte
-   form.  */
+   form.
+
+   Note: This macro returns the actual length of the character's
+   multibyte sequence as it is stored in a buffer or string.  The
+   character it returns might have a different codepoint that has a
+   different multibyte sequence of a different length, due to possible
+   unification of CJK characters inside string_char.  Therefore do NOT
+   assume that the length returned by this macro is identical to the
+   length of the multibyte sequence of the character it returns.  */
 
 #define STRING_CHAR_AND_LENGTH(p, actual_len)                  \
   (!((p)[0] & 0x80)                                            \
@@ -424,7 +434,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
          unsigned char *chp = BYTE_POS_ADDR (BYTEIDX);         \
          int chlen;                                            \
                                                                \
-         OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen);          \
+         OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen);         \
          BYTEIDX += chlen;                                     \
        }                                                       \
       else                                                     \
@@ -596,7 +606,7 @@ sanitize_char_width (EMACS_INT width)
    ? ASCII_CHAR_WIDTH (c)      \
    : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c))))
 
-/* If C is a variation selector, return the index numnber of the
+/* If C is a variation selector, return the index of the
    variation selector (1..256).  Otherwise, return 0.  */
 
 #define CHAR_VARIATION_SELECTOR_P(c)           \
@@ -655,7 +665,7 @@ typedef enum {
   UNICODE_CATEGORY_Cn
 } unicode_category_t;
 
-extern EMACS_INT char_resolve_modifier_mask (EMACS_INT);
+extern EMACS_INT char_resolve_modifier_mask (EMACS_INT) ATTRIBUTE_CONST;
 extern int char_string (unsigned, unsigned char *);
 extern int string_char (const unsigned char *,
                         const unsigned char **, int *);