Mercurial > emacs
changeset 88384:4bff91d684f4
* print.c: Include "character.h" instead of "charset.h".
(print_string): Convert 8-bit raw bytes to octal form by
string_escape_byte8.
(print_object): Adjusted for the new multibyte form. Print 8-bit
raw bytes always in octal form. Handle sub char table correctly.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 01 Mar 2002 01:45:03 +0000 |
parents | 0b4249d736a0 |
children | c60e206fcf58 |
files | src/print.c |
diffstat | 1 files changed, 16 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/print.c Fri Mar 01 01:44:45 2002 +0000 +++ b/src/print.c Fri Mar 01 01:45:03 2002 +0000 @@ -24,7 +24,7 @@ #include <stdio.h> #include "lisp.h" #include "buffer.h" -#include "charset.h" +#include "character.h" #include "keyboard.h" #include "frame.h" #include "window.h" @@ -460,11 +460,15 @@ { int chars; + if (print_escape_nonascii) + string = string_escape_byte8 (string); + if (STRING_MULTIBYTE (string)) chars = XSTRING (string)->size; - else if (EQ (printcharfun, Qt) - ? ! NILP (buffer_defaults.enable_multibyte_characters) - : ! NILP (current_buffer->enable_multibyte_characters)) + else if (! print_escape_nonascii + && (EQ (printcharfun, Qt) + ? ! NILP (buffer_defaults.enable_multibyte_characters) + : ! NILP (current_buffer->enable_multibyte_characters))) { /* If unibyte string STRING contains 8-bit codes, we must convert STRING to a multibyte string containing the same @@ -1409,10 +1413,7 @@ { c = STRING_CHAR_AND_LENGTH (str + i_byte, size_byte - i_byte, len); - if (CHAR_VALID_P (c, 0)) - i_byte += len; - else - c = str[i_byte++]; + i_byte += len; } else c = str[i_byte++]; @@ -1430,12 +1431,16 @@ PRINTCHAR ('f'); } else if (multibyte && ! ASCII_BYTE_P (c) - && print_escape_multibyte) + && (print_escape_multibyte || CHAR_BYTE8_P (c))) { /* When multibyte is disabled, print multibyte string chars using hex escapes. */ unsigned char outbuf[50]; - sprintf (outbuf, "\\x%x", c); + + if (CHAR_BYTE8_P (c)) + sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c)); + else + sprintf (outbuf, "\\x%04x", c); strout (outbuf, -1, -1, printcharfun, 0); need_nonhex = 1; } @@ -1787,7 +1792,7 @@ PRINTCHAR ('#'); size &= PSEUDOVECTOR_SIZE_MASK; } - if (CHAR_TABLE_P (obj)) + if (CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)) { /* We print a char-table as if it were a vector, lumping the parent and default slots in with the