summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-07-13 09:31:16 +0000
committerGerd Moellmann <gerd@gnu.org>2001-07-13 09:31:16 +0000
commite06aa1f90f1f2e9cf3b85ff600b3b7c1ee2f8251 (patch)
tree62b82c5a12b55d1bcf069036fcb820e0091ff669
parent12bcae05840abde621f9de6c3917224c96d91a04 (diff)
downloademacs-e06aa1f90f1f2e9cf3b85ff600b3b7c1ee2f8251.tar.gz
(CHAR_STRING_NO_SIGNAL): New macro.
-rw-r--r--src/ChangeLog11
-rw-r--r--src/charset.h12
2 files changed, 23 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0174ffd8d80..06e678f4350 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2001-07-13 Gerd Moellmann <gerd@gnu.org>
+
+ * xdisp.c (get_next_display_element): Use CHAR_STRING_NO_SIGNAL
+ instead of CHAR_STRING which can signal an error.
+
+ * charset.c (char_to_string_1): Extracted from char_to_string.
+ Return -1 instead of signaling an error.
+ (char_to_string): Use it.
+
+ * charset.h (CHAR_STRING_NO_SIGNAL): New macro.
+
2001-07-12 Stefan Monnier <monnier@cs.yale.edu>
* coding.c (Ffind_coding_systems_region_internal): If safe_codings
diff --git a/src/charset.h b/src/charset.h
index e086c056282..961bb60afcb 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -1,6 +1,7 @@
/* Header for multibyte character handler.
Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
Licensed to the Free Software Foundation.
+ Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -531,6 +532,16 @@ extern int iso_charset_table[2][2][128];
: (*(str) = LEADING_CODE_8_BIT_CONTROL, *((str)+ 1) = c + 0x20, 2)) \
: char_to_string (c, (unsigned char *) str))
+/* Like CHAR_STRING but don't signal an error if C is invalid.
+ Value is -1 in this case. */
+
+#define CHAR_STRING_NO_SIGNAL(c, str) \
+ (SINGLE_BYTE_CHAR_P (c) \
+ ? ((ASCII_BYTE_P (c) || c >= 0xA0) \
+ ? (*(str) = (unsigned char)(c), 1) \
+ : (*(str) = LEADING_CODE_8_BIT_CONTROL, *((str)+ 1) = c + 0x20, 2)) \
+ : char_to_string_1 (c, (unsigned char *) str))
+
/* Return a character code of the character of which multi-byte form
is at STR and the length is LEN. If STR doesn't contain valid
multi-byte form, only the first byte in STR is returned. */
@@ -775,6 +786,7 @@ extern int translate_char P_ ((Lisp_Object, int, int, int, int));
extern int split_string P_ ((const unsigned char *, int, int *,
unsigned char *, unsigned char *));
extern int char_to_string P_ ((int, unsigned char *));
+extern int char_to_string_1 P_ ((int, unsigned char *));
extern int string_to_char P_ ((const unsigned char *, int, int *));
extern int char_printable_p P_ ((int c));
extern int multibyte_form_length P_ ((const unsigned char *, int));