changeset 22184:003ac1231096

(STRING_CHAR_AND_CHAR_LENGTH): New macro. (string_to_non_ascii_char): Adjusted for the new arg.
author Kenichi Handa <handa@m17n.org>
date Fri, 22 May 1998 09:44:27 +0000
parents 3eedfddbbadd
children 80a2aa51a6e1
files src/charset.h
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/charset.h	Fri May 22 09:44:27 1998 +0000
+++ b/src/charset.h	Fri May 22 09:44:27 1998 +0000
@@ -475,7 +475,7 @@
   ((c) >= 0				\
    && (SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, genericp)))
 
-/* This default value is used when nonascii-translate-table or
+/* This default value is used when nonascii-translation-table or
    nonascii-insert-offset fail to convert unibyte character to a valid
    multibyte character.  This makes a Latin-1 character.  */
 
@@ -574,7 +574,7 @@
   ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1	    	\
     || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > (len))	\
    ? (unsigned char) *(str)				    	\
-   : string_to_non_ascii_char (str, len, 0))
+   : string_to_non_ascii_char (str, len, 0, 0))
 
 /* This is like STRING_CHAR but the third arg ACTUAL_LEN is set to
    the length of the multi-byte form.  Just to know the length, use
@@ -584,7 +584,15 @@
   ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1	    	\
     || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > (len))	\
    ? (actual_len = 1), (unsigned char) *(str)		    	\
-   : string_to_non_ascii_char (str, len, &actual_len))
+   : string_to_non_ascii_char (str, len, &actual_len, 0))
+
+/* This is like STRING_CHAR_AND_LENGTH but the third arg ACTUAL_LEN
+   does not include garbage bytes following the multibyte character.  */
+#define STRING_CHAR_AND_CHAR_LENGTH(str, len, actual_len)	    	\
+  ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1	    	\
+    || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > (len))	\
+   ? (actual_len = 1), (unsigned char) *(str)		    	\
+   : string_to_non_ascii_char (str, len, &actual_len, 1))
 
 /* Fetch the "next" multibyte character from Lisp string STRING
    at byte position BYTEIDX, character position CHARIDX.
@@ -794,7 +802,8 @@
 extern int translate_char P_ ((Lisp_Object, int, int, int, int));
 extern int split_non_ascii_string P_ ((const unsigned char *, int, int *,
 				       unsigned char *, unsigned char *));
-extern int string_to_non_ascii_char P_ ((const unsigned char *, int, int *));
+extern int string_to_non_ascii_char P_ ((const unsigned char *, int, int *,
+					 int));
 extern int non_ascii_char_to_string P_ ((int, unsigned char *, unsigned char **));
 extern int multibyte_form_length P_ ((const unsigned char *, int));
 extern int str_cmpchar_id P_ ((const unsigned char *, int));
@@ -804,11 +813,11 @@
 				    Lisp_Object, int));
 extern int strwidth P_ ((unsigned char *, int));
 
-extern Lisp_Object Vcharacter_translation_table_vector;
+extern Lisp_Object Vtranslation_table_vector;
 
-/* Return a character translation table of id number ID.  */
+/* Return a translation table of id number ID.  */
 #define GET_TRANSLATION_TABLE(id) \
-  (XCONS(XVECTOR(Vcharacter_translation_table_vector)->contents[(id)])->cdr)
+  (XCONS(XVECTOR(Vtranslation_table_vector)->contents[(id)])->cdr)
 
 /* Copy LEN bytes from FROM to TO.  This macro should be used only
    when a caller knows that LEN is short and the obvious copy loop is