/[emacs]/emacs/src/print.c
ViewVC logotype

Diff of /emacs/src/print.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.190 by monnier, Tue Jul 22 19:22:02 2003 UTC revision 1.190.2.1 by handa, Mon Sep 8 12:48:12 2003 UTC
# Line 24  Boston, MA 02111-1307, USA.  */ Line 24  Boston, MA 02111-1307, USA.  */
24  #include <stdio.h>  #include <stdio.h>
25  #include "lisp.h"  #include "lisp.h"
26  #include "buffer.h"  #include "buffer.h"
27  #include "charset.h"  #include "character.h"
28  #include "keyboard.h"  #include "keyboard.h"
29  #include "frame.h"  #include "frame.h"
30  #include "window.h"  #include "window.h"
# Line 463  print_string (string, printcharfun) Line 463  print_string (string, printcharfun)
463      {      {
464        int chars;        int chars;
465    
466          if (print_escape_nonascii)
467            string = string_escape_byte8 (string);
468    
469        if (STRING_MULTIBYTE (string))        if (STRING_MULTIBYTE (string))
470          chars = SCHARS (string);          chars = SCHARS (string);
471        else if (EQ (printcharfun, Qt)        else if (! print_escape_nonascii
472                 ? ! NILP (buffer_defaults.enable_multibyte_characters)                 && (EQ (printcharfun, Qt)
473                 : ! NILP (current_buffer->enable_multibyte_characters))                     ? ! NILP (buffer_defaults.enable_multibyte_characters)
474                       : ! NILP (current_buffer->enable_multibyte_characters)))
475          {          {
476            /* If unibyte string STRING contains 8-bit codes, we must            /* If unibyte string STRING contains 8-bit codes, we must
477               convert STRING to a multibyte string containing the same               convert STRING to a multibyte string containing the same
# Line 513  print_string (string, printcharfun) Line 517  print_string (string, printcharfun)
517              int len;              int len;
518              int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i,              int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i,
519                                               size_byte - i, len);                                               size_byte - i, len);
             if (!CHAR_VALID_P (ch, 0))  
               {  
                 ch = SREF (string, i);  
                 len = 1;  
               }  
520              PRINTCHAR (ch);              PRINTCHAR (ch);
521              i += len;              i += len;
522            }            }
# Line 1435  print_object (obj, printcharfun, escapef Line 1434  print_object (obj, printcharfun, escapef
1434                  {                  {
1435                    c = STRING_CHAR_AND_LENGTH (str + i_byte,                    c = STRING_CHAR_AND_LENGTH (str + i_byte,
1436                                                size_byte - i_byte, len);                                                size_byte - i_byte, len);
1437                    if (CHAR_VALID_P (c, 0))                    i_byte += len;
                     i_byte += len;  
                   else  
                     c = str[i_byte++];  
1438                  }                  }
1439                else                else
1440                  c = str[i_byte++];                  c = str[i_byte++];
# Line 1456  print_object (obj, printcharfun, escapef Line 1452  print_object (obj, printcharfun, escapef
1452                    PRINTCHAR ('f');                    PRINTCHAR ('f');
1453                  }                  }
1454                else if (multibyte                else if (multibyte
1455                         && ! ASCII_BYTE_P (c)                         && (CHAR_BYTE8_P (c) || print_escape_multibyte))
                        && (SINGLE_BYTE_CHAR_P (c) || print_escape_multibyte))  
1456                  {                  {
1457                    /* When multibyte is disabled,                    /* When multibyte is disabled,
1458                       print multibyte string chars using hex escapes.                       print multibyte string chars using hex escapes.
# Line 1465  print_object (obj, printcharfun, escapef Line 1460  print_object (obj, printcharfun, escapef
1460                       when found in a multibyte string, always use a hex escape                       when found in a multibyte string, always use a hex escape
1461                       so it reads back as multibyte.  */                       so it reads back as multibyte.  */
1462                    unsigned char outbuf[50];                    unsigned char outbuf[50];
1463                    sprintf (outbuf, "\\x%x", c);  
1464                      if (CHAR_BYTE8_P (c))
1465                        sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c));
1466                      else
1467                        {
1468                          sprintf (outbuf, "\\x%04x", c);
1469                          need_nonhex = 1;
1470                        }
1471                    strout (outbuf, -1, -1, printcharfun, 0);                    strout (outbuf, -1, -1, printcharfun, 0);
                   need_nonhex = 1;  
1472                  }                  }
1473                else if (! multibyte                else if (! multibyte
1474                         && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c)                         && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c)
# Line 1732  print_object (obj, printcharfun, escapef Line 1733  print_object (obj, printcharfun, escapef
1733    
1734            PRINTCHAR ('#');            PRINTCHAR ('#');
1735            PRINTCHAR ('&');            PRINTCHAR ('&');
1736            sprintf (buf, "%d", XBOOL_VECTOR (obj)->size);            if (sizeof (int) == sizeof (EMACS_INT))
1737                sprintf (buf, "%d", XBOOL_VECTOR (obj)->size);
1738              else if (sizeof (long) == sizeof (EMACS_INT))
1739                sprintf (buf, "%ld", XBOOL_VECTOR (obj)->size);
1740              else
1741                abort ();
1742            strout (buf, -1, -1, printcharfun, 0);            strout (buf, -1, -1, printcharfun, 0);
1743            PRINTCHAR ('\"');            PRINTCHAR ('\"');
1744    
# Line 1747  print_object (obj, printcharfun, escapef Line 1753  print_object (obj, printcharfun, escapef
1753              {              {
1754                QUIT;                QUIT;
1755                c = XBOOL_VECTOR (obj)->data[i];                c = XBOOL_VECTOR (obj)->data[i];
1756                if (c == '\n' && print_escape_newlines)                if (! ASCII_BYTE_P (c))
1757                    {
1758                      sprintf (buf, "\\%03o", c);
1759                      strout (buf, -1, -1, printcharfun, 0);
1760                    }
1761                  else if (c == '\n' && print_escape_newlines)
1762                  {                  {
1763                    PRINTCHAR ('\\');                    PRINTCHAR ('\\');
1764                    PRINTCHAR ('n');                    PRINTCHAR ('n');
# Line 1841  print_object (obj, printcharfun, escapef Line 1852  print_object (obj, printcharfun, escapef
1852                PRINTCHAR ('#');                PRINTCHAR ('#');
1853                size &= PSEUDOVECTOR_SIZE_MASK;                size &= PSEUDOVECTOR_SIZE_MASK;
1854              }              }
1855            if (CHAR_TABLE_P (obj))            if (CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj))
1856              {              {
1857                /* We print a char-table as if it were a vector,                /* We print a char-table as if it were a vector,
1858                   lumping the parent and default slots in with the                   lumping the parent and default slots in with the

Legend:
Removed from v.1.190  
changed lines
  Added in v.1.190.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26