emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/lread.c


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/lread.c
Date: Sat, 29 Dec 2001 22:24:17 -0500

Index: emacs/src/lread.c
diff -c emacs/src/lread.c:1.274 emacs/src/lread.c:1.275
*** emacs/src/lread.c:1.274     Thu Dec 20 13:26:46 2001
--- emacs/src/lread.c   Sat Dec 29 22:24:17 2001
***************
*** 1503,1516 ****
    return str[0];
  }
  
! /* Read a \-escape sequence, assuming we already read the `\'.  */
  
  static int
! read_escape (readcharfun, stringp)
       Lisp_Object readcharfun;
       int stringp;
  {
    register int c = READCHAR;
    switch (c)
      {
      case -1:
--- 1503,1523 ----
    return str[0];
  }
  
! /* Read a \-escape sequence, assuming we already read the `\'.
!    If the escape sequence forces unibyte, store 1 into *BYTEREP.
!    If the escape sequence forces multibyte, store 2 into *BYTEREP.
!    Otherwise store 0 into *BYTEREP.  */
  
  static int
! read_escape (readcharfun, stringp, byterep)
       Lisp_Object readcharfun;
       int stringp;
+      int *byterep;
  {
    register int c = READCHAR;
+ 
+   *byterep = 0;
+ 
    switch (c)
      {
      case -1:
***************
*** 1547,1553 ****
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0);
        return c | meta_modifier;
  
      case 'S':
--- 1554,1560 ----
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0, byterep);
        return c | meta_modifier;
  
      case 'S':
***************
*** 1556,1562 ****
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0);
        return c | shift_modifier;
  
      case 'H':
--- 1563,1569 ----
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0, byterep);
        return c | shift_modifier;
  
      case 'H':
***************
*** 1565,1571 ****
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0);
        return c | hyper_modifier;
  
      case 'A':
--- 1572,1578 ----
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0, byterep);
        return c | hyper_modifier;
  
      case 'A':
***************
*** 1574,1580 ****
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0);
        return c | alt_modifier;
  
      case 's':
--- 1581,1587 ----
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0, byterep);
        return c | alt_modifier;
  
      case 's':
***************
*** 1583,1589 ****
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0);
        return c | super_modifier;
  
      case 'C':
--- 1590,1596 ----
        error ("Invalid escape character syntax");
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0, byterep);
        return c | super_modifier;
  
      case 'C':
***************
*** 1593,1599 ****
      case '^':
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0);
        if ((c & ~CHAR_MODIFIER_MASK) == '?')
        return 0177 | (c & CHAR_MODIFIER_MASK);
        else if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
--- 1600,1606 ----
      case '^':
        c = READCHAR;
        if (c == '\\')
!       c = read_escape (readcharfun, 0, byterep);
        if ((c & ~CHAR_MODIFIER_MASK) == '?')
        return 0177 | (c & CHAR_MODIFIER_MASK);
        else if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
***************
*** 1632,1637 ****
--- 1639,1646 ----
                break;
              }
          }
+       
+       *byterep = 1;
        return i;
        }
  
***************
*** 1662,1667 ****
--- 1671,1678 ----
                break;
              }
          }
+ 
+       *byterep = 2;
        return i;
        }
  
***************
*** 2115,2126 ****
  
      case '?':
        {
        c = READCHAR;
        if (c < 0)
          end_of_file_error ();
  
        if (c == '\\')
!         c = read_escape (readcharfun, 0);
        else if (BASE_LEADING_CODE_P (c))
          c = read_multibyte (c, readcharfun);
  
--- 2126,2139 ----
  
      case '?':
        {
+       int discard;
+ 
        c = READCHAR;
        if (c < 0)
          end_of_file_error ();
  
        if (c == '\\')
!         c = read_escape (readcharfun, 0, &discard);
        else if (BASE_LEADING_CODE_P (c))
          c = read_multibyte (c, readcharfun);
  
***************
*** 2155,2161 ****
  
            if (c == '\\')
              {
!               c = read_escape (readcharfun, 1);
  
                /* C is -1 if \ newline has just been seen */
                if (c == -1)
--- 2168,2176 ----
  
            if (c == '\\')
              {
!               int byterep;
! 
!               c = read_escape (readcharfun, 1, &byterep);
  
                /* C is -1 if \ newline has just been seen */
                if (c == -1)
***************
*** 2165,2175 ****
                    continue;
                  }
  
!               /* If an escape specifies a non-ASCII single-byte character,
!                  this must be a unibyte string.  */
!               if (SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK))
!                   && ! ASCII_BYTE_P ((c & ~CHAR_MODIFIER_MASK)))
                  force_singlebyte = 1;
              }
  
            if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
--- 2180,2189 ----
                    continue;
                  }
  
!               if (byterep == 1)
                  force_singlebyte = 1;
+               else if (byterep == 2)
+                 force_multibyte = 1;
              }
  
            if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]