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

Diff of /emacs/src/lread.c

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

revision 1.256.4.1 by gerd, Tue Oct 23 14:10:43 2001 UTC revision 1.256.4.2 by gerd, Tue Oct 30 16:08:54 2001 UTC
# Line 193  int load_dangerous_libraries; Line 193  int load_dangerous_libraries;
193    
194  static Lisp_Object Vbytecomp_version_regexp;  static Lisp_Object Vbytecomp_version_regexp;
195    
196    static void to_multibyte P_ ((char **, char **, int *));
197  static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,  static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,
198                                Lisp_Object (*) (), int,                                Lisp_Object (*) (), int,
199                                Lisp_Object, Lisp_Object));                                Lisp_Object, Lisp_Object));
# Line 1757  read_integer (readcharfun, radix) Line 1758  read_integer (readcharfun, radix)
1758  }  }
1759    
1760    
1761    /* Convert unibyte text in read_buffer to multibyte.
1762    
1763       Initially, *P is a pointer after the end of the unibyte text, and
1764       the pointer *END points after the end of read_buffer.
1765    
1766       If read_buffer doesn't have enough room to hold the result
1767       of the conversion, reallocate it and adjust *P and *END.
1768    
1769       At the end, make *P point after the result of the conversion, and
1770       return in *NCHARS the number of characters in the converted
1771       text.  */
1772    
1773    static void
1774    to_multibyte (p, end, nchars)
1775         char **p, **end;
1776         int *nchars;
1777    {
1778      int nbytes;
1779    
1780      parse_str_as_multibyte (read_buffer, *p - read_buffer, &nbytes, nchars);
1781      if (nbytes > read_buffer_size)
1782        {
1783          int offset = *p - read_buffer;
1784          read_buffer_size *= 2;
1785          read_buffer = (char *) xrealloc (read_buffer, read_buffer_size);
1786          *p = read_buffer + offset;
1787          *end = read_buffer + read_buffer_size;
1788        }
1789    
1790      if (nbytes != *nchars)
1791        nbytes = str_as_multibyte (read_buffer, read_buffer_size,
1792                                   *p - read_buffer, nchars);
1793      
1794      *p = read_buffer + nbytes;
1795    }
1796    
1797    
1798  /* If the next token is ')' or ']' or '.', we store that character  /* If the next token is ')' or ']' or '.', we store that character
1799     in *PCH and the return value is not interesting.  Else, we store     in *PCH and the return value is not interesting.  Else, we store
1800     zero in *PCH and we read and return one lisp object.     zero in *PCH and we read and return one lisp object.
# Line 2110  read1 (readcharfun, pch, first_in_list) Line 2148  read1 (readcharfun, pch, first_in_list)
2148    
2149      case '"':      case '"':
2150        {        {
2151          register char *p = read_buffer;          char *p = read_buffer;
2152          register char *end = read_buffer + read_buffer_size;          char *end = read_buffer + read_buffer_size;
2153          register int c;          register int c;
2154          /* Nonzero if we saw an escape sequence specifying          /* Nonzero if we saw an escape sequence specifying
2155             a multibyte character.  */             a multibyte character.  */
# Line 2196  read1 (readcharfun, pch, first_in_list) Line 2234  read1 (readcharfun, pch, first_in_list)
2234            return make_number (0);            return make_number (0);
2235    
2236          if (force_multibyte)          if (force_multibyte)
2237            p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer,            to_multibyte (&p, &end, &nchars);
                                               p - read_buffer, &nchars);  
2238          else if (force_singlebyte)          else if (force_singlebyte)
2239            nchars = p - read_buffer;            nchars = p - read_buffer;
2240          else if (load_convert_to_unibyte)          else if (load_convert_to_unibyte)
2241            {            {
2242              Lisp_Object string;              Lisp_Object string;
2243              p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer,              to_multibyte (&p, &end, &nchars);
                                                 p - read_buffer, &nchars);  
2244              if (p - read_buffer != nchars)              if (p - read_buffer != nchars)
2245                {                {
2246                  string = make_multibyte_string (read_buffer, nchars,                  string = make_multibyte_string (read_buffer, nchars,
# Line 2214  read1 (readcharfun, pch, first_in_list) Line 2250  read1 (readcharfun, pch, first_in_list)
2250            }            }
2251          else if (EQ (readcharfun, Qget_file_char)          else if (EQ (readcharfun, Qget_file_char)
2252                   || EQ (readcharfun, Qlambda))                   || EQ (readcharfun, Qlambda))
2253            /* Nowadays, reading directly from a file is used only for            {
2254               compiled Emacs Lisp files, and those always use the              /* Nowadays, reading directly from a file is used only for
2255               Emacs internal encoding.  Meanwhile, Qlambda is used                 compiled Emacs Lisp files, and those always use the
2256               for reading dynamic byte code (compiled with                 Emacs internal encoding.  Meanwhile, Qlambda is used
2257               byte-compile-dynamic = t).  */                 for reading dynamic byte code (compiled with
2258            p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer,                 byte-compile-dynamic = t).  */
2259                                                p - read_buffer, &nchars);              to_multibyte (&p, &end, &nchars);
2260              }
2261          else          else
2262            /* In all other cases, if we read these bytes as            /* In all other cases, if we read these bytes as
2263               separate characters, treat them as separate characters now.  */               separate characters, treat them as separate characters now.  */

Legend:
Removed from v.1.256.4.1  
changed lines
  Added in v.1.256.4.2

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