diff options
| author | Kenichi Handa | 2002-03-01 01:45:03 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-03-01 01:45:03 +0000 |
| commit | 8b4b4467b507ed2f43a58a3537f68776fedfa240 (patch) | |
| tree | 63db5f4109f72816ad7dc4521e35edfd7a87bf96 | |
| parent | 1571601b93f6e09394efba4b8b3252729ce5ce12 (diff) | |
| download | emacs-8b4b4467b507ed2f43a58a3537f68776fedfa240.tar.gz emacs-8b4b4467b507ed2f43a58a3537f68776fedfa240.zip | |
* 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.
| -rw-r--r-- | src/print.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/print.c b/src/print.c index f0501bd0fb7..053f6622865 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include "lisp.h" | 25 | #include "lisp.h" |
| 26 | #include "buffer.h" | 26 | #include "buffer.h" |
| 27 | #include "charset.h" | 27 | #include "character.h" |
| 28 | #include "keyboard.h" | 28 | #include "keyboard.h" |
| 29 | #include "frame.h" | 29 | #include "frame.h" |
| 30 | #include "window.h" | 30 | #include "window.h" |
| @@ -460,11 +460,15 @@ print_string (string, printcharfun) | |||
| 460 | { | 460 | { |
| 461 | int chars; | 461 | int chars; |
| 462 | 462 | ||
| 463 | if (print_escape_nonascii) | ||
| 464 | string = string_escape_byte8 (string); | ||
| 465 | |||
| 463 | if (STRING_MULTIBYTE (string)) | 466 | if (STRING_MULTIBYTE (string)) |
| 464 | chars = XSTRING (string)->size; | 467 | chars = XSTRING (string)->size; |
| 465 | else if (EQ (printcharfun, Qt) | 468 | else if (! print_escape_nonascii |
| 466 | ? ! NILP (buffer_defaults.enable_multibyte_characters) | 469 | && (EQ (printcharfun, Qt) |
| 467 | : ! NILP (current_buffer->enable_multibyte_characters)) | 470 | ? ! NILP (buffer_defaults.enable_multibyte_characters) |
| 471 | : ! NILP (current_buffer->enable_multibyte_characters))) | ||
| 468 | { | 472 | { |
| 469 | /* If unibyte string STRING contains 8-bit codes, we must | 473 | /* If unibyte string STRING contains 8-bit codes, we must |
| 470 | convert STRING to a multibyte string containing the same | 474 | convert STRING to a multibyte string containing the same |
| @@ -1409,10 +1413,7 @@ print_object (obj, printcharfun, escapeflag) | |||
| 1409 | { | 1413 | { |
| 1410 | c = STRING_CHAR_AND_LENGTH (str + i_byte, | 1414 | c = STRING_CHAR_AND_LENGTH (str + i_byte, |
| 1411 | size_byte - i_byte, len); | 1415 | size_byte - i_byte, len); |
| 1412 | if (CHAR_VALID_P (c, 0)) | 1416 | i_byte += len; |
| 1413 | i_byte += len; | ||
| 1414 | else | ||
| 1415 | c = str[i_byte++]; | ||
| 1416 | } | 1417 | } |
| 1417 | else | 1418 | else |
| 1418 | c = str[i_byte++]; | 1419 | c = str[i_byte++]; |
| @@ -1430,12 +1431,16 @@ print_object (obj, printcharfun, escapeflag) | |||
| 1430 | PRINTCHAR ('f'); | 1431 | PRINTCHAR ('f'); |
| 1431 | } | 1432 | } |
| 1432 | else if (multibyte && ! ASCII_BYTE_P (c) | 1433 | else if (multibyte && ! ASCII_BYTE_P (c) |
| 1433 | && print_escape_multibyte) | 1434 | && (print_escape_multibyte || CHAR_BYTE8_P (c))) |
| 1434 | { | 1435 | { |
| 1435 | /* When multibyte is disabled, | 1436 | /* When multibyte is disabled, |
| 1436 | print multibyte string chars using hex escapes. */ | 1437 | print multibyte string chars using hex escapes. */ |
| 1437 | unsigned char outbuf[50]; | 1438 | unsigned char outbuf[50]; |
| 1438 | sprintf (outbuf, "\\x%x", c); | 1439 | |
| 1440 | if (CHAR_BYTE8_P (c)) | ||
| 1441 | sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c)); | ||
| 1442 | else | ||
| 1443 | sprintf (outbuf, "\\x%04x", c); | ||
| 1439 | strout (outbuf, -1, -1, printcharfun, 0); | 1444 | strout (outbuf, -1, -1, printcharfun, 0); |
| 1440 | need_nonhex = 1; | 1445 | need_nonhex = 1; |
| 1441 | } | 1446 | } |
| @@ -1787,7 +1792,7 @@ print_object (obj, printcharfun, escapeflag) | |||
| 1787 | PRINTCHAR ('#'); | 1792 | PRINTCHAR ('#'); |
| 1788 | size &= PSEUDOVECTOR_SIZE_MASK; | 1793 | size &= PSEUDOVECTOR_SIZE_MASK; |
| 1789 | } | 1794 | } |
| 1790 | if (CHAR_TABLE_P (obj)) | 1795 | if (CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)) |
| 1791 | { | 1796 | { |
| 1792 | /* We print a char-table as if it were a vector, | 1797 | /* We print a char-table as if it were a vector, |
| 1793 | lumping the parent and default slots in with the | 1798 | lumping the parent and default slots in with the |