comparison src/lread.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 2b6fa2618f76
children 93e076dd7825
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
221 return signal_continuable_error (Qinvalid_read_syntax, string, Qunbound); 221 return signal_continuable_error (Qinvalid_read_syntax, string, Qunbound);
222 } 222 }
223 223
224 224
225 /* Handle unreading and rereading of characters. */ 225 /* Handle unreading and rereading of characters. */
226 static Emchar 226 static Ichar
227 readchar (Lisp_Object readcharfun) 227 readchar (Lisp_Object readcharfun)
228 { 228 {
229 /* This function can GC */ 229 /* This function can GC */
230 230
231 if (BUFFERP (readcharfun)) 231 if (BUFFERP (readcharfun))
232 { 232 {
233 Emchar c; 233 Ichar c;
234 struct buffer *b = XBUFFER (readcharfun); 234 struct buffer *b = XBUFFER (readcharfun);
235 235
236 if (!BUFFER_LIVE_P (b)) 236 if (!BUFFER_LIVE_P (b))
237 invalid_operation ("Reading from killed buffer", Qunbound); 237 invalid_operation ("Reading from killed buffer", Qunbound);
238 238
243 243
244 return c; 244 return c;
245 } 245 }
246 else if (LSTREAMP (readcharfun)) 246 else if (LSTREAMP (readcharfun))
247 { 247 {
248 Emchar c = Lstream_get_emchar (XLSTREAM (readcharfun)); 248 Ichar c = Lstream_get_ichar (XLSTREAM (readcharfun));
249 #ifdef DEBUG_XEMACS /* testing Mule */ 249 #ifdef DEBUG_XEMACS /* testing Mule */
250 static int testing_mule = 0; /* Change via debugger */ 250 static int testing_mule = 0; /* Change via debugger */
251 if (testing_mule) 251 if (testing_mule)
252 { 252 {
253 if (c >= 0x20 && c <= 0x7E) stderr_out ("%c", c); 253 if (c >= 0x20 && c <= 0x7E) stderr_out ("%c", c);
257 #endif /* testing Mule */ 257 #endif /* testing Mule */
258 return c; 258 return c;
259 } 259 }
260 else if (MARKERP (readcharfun)) 260 else if (MARKERP (readcharfun))
261 { 261 {
262 Emchar c; 262 Ichar c;
263 Charbpos mpos = marker_position (readcharfun); 263 Charbpos mpos = marker_position (readcharfun);
264 struct buffer *inbuffer = XMARKER (readcharfun)->buffer; 264 struct buffer *inbuffer = XMARKER (readcharfun)->buffer;
265 265
266 if (mpos >= BUF_ZV (inbuffer)) 266 if (mpos >= BUF_ZV (inbuffer))
267 return -1; 267 return -1;
281 281
282 /* Unread the character C in the way appropriate for the stream READCHARFUN. 282 /* Unread the character C in the way appropriate for the stream READCHARFUN.
283 If the stream is a user function, call it with the char as argument. */ 283 If the stream is a user function, call it with the char as argument. */
284 284
285 static void 285 static void
286 unreadchar (Lisp_Object readcharfun, Emchar c) 286 unreadchar (Lisp_Object readcharfun, Ichar c)
287 { 287 {
288 if (c == -1) 288 if (c == -1)
289 /* Don't back up the pointer if we're unreading the end-of-input mark, 289 /* Don't back up the pointer if we're unreading the end-of-input mark,
290 since readchar didn't advance it when we read it. */ 290 since readchar didn't advance it when we read it. */
291 ; 291 ;
292 else if (BUFFERP (readcharfun)) 292 else if (BUFFERP (readcharfun))
293 BUF_SET_PT (XBUFFER (readcharfun), BUF_PT (XBUFFER (readcharfun)) - 1); 293 BUF_SET_PT (XBUFFER (readcharfun), BUF_PT (XBUFFER (readcharfun)) - 1);
294 else if (LSTREAMP (readcharfun)) 294 else if (LSTREAMP (readcharfun))
295 { 295 {
296 Lstream_unget_emchar (XLSTREAM (readcharfun), c); 296 Lstream_unget_ichar (XLSTREAM (readcharfun), c);
297 #ifdef DEBUG_XEMACS /* testing Mule */ 297 #ifdef DEBUG_XEMACS /* testing Mule */
298 { 298 {
299 static int testing_mule = 0; /* Set this using debugger */ 299 static int testing_mule = 0; /* Set this using debugger */
300 if (testing_mule) 300 if (testing_mule)
301 fprintf (stderr, 301 fprintf (stderr,
311 } 311 }
312 312
313 static Lisp_Object read0 (Lisp_Object readcharfun); 313 static Lisp_Object read0 (Lisp_Object readcharfun);
314 static Lisp_Object read1 (Lisp_Object readcharfun); 314 static Lisp_Object read1 (Lisp_Object readcharfun);
315 static Lisp_Object read_list (Lisp_Object readcharfun, 315 static Lisp_Object read_list (Lisp_Object readcharfun,
316 Emchar terminator, 316 Ichar terminator,
317 int allow_dotted_lists, 317 int allow_dotted_lists,
318 int check_for_doc_references); 318 int check_for_doc_references);
319 319
320 static void readevalloop (Lisp_Object readcharfun, 320 static void readevalloop (Lisp_Object readcharfun,
321 Lisp_Object sourcefile, 321 Lisp_Object sourcefile,
521 /* Avoid weird lossage with null string as arg, 521 /* Avoid weird lossage with null string as arg,
522 since it would try to load a directory as a Lisp file. 522 since it would try to load a directory as a Lisp file.
523 Unix truly sucks. */ 523 Unix truly sucks. */
524 if (XSTRING_LENGTH (file) > 0) 524 if (XSTRING_LENGTH (file) > 0)
525 { 525 {
526 Intbyte *foundstr; 526 Ibyte *foundstr;
527 int foundlen; 527 int foundlen;
528 528
529 fd = locate_file (Vload_path, file, 529 fd = locate_file (Vload_path, file,
530 ((!NILP (nosuffix)) ? Qnil : 530 ((!NILP (nosuffix)) ? Qnil :
531 build_string (load_ignore_elc_files ? ".el:" : 531 build_string (load_ignore_elc_files ? ".el:" :
542 UNGCPRO; 542 UNGCPRO;
543 return Qnil; 543 return Qnil;
544 } 544 }
545 } 545 }
546 546
547 foundstr = (Intbyte *) ALLOCA (XSTRING_LENGTH (found) + 1); 547 foundstr = (Ibyte *) ALLOCA (XSTRING_LENGTH (found) + 1);
548 qxestrcpy (foundstr, XSTRING_DATA (found)); 548 qxestrcpy (foundstr, XSTRING_DATA (found));
549 foundlen = qxestrlen (foundstr); 549 foundlen = qxestrlen (foundstr);
550 550
551 /* The omniscient JWZ thinks this is worthless, but I beg to 551 /* The omniscient JWZ thinks this is worthless, but I beg to
552 differ. --ben */ 552 differ. --ben */
859 /* Map FUN over SUFFIXES, as described above. FUN will be called with a 859 /* Map FUN over SUFFIXES, as described above. FUN will be called with a
860 char * containing the current file name, and ARG. Mapping stops when 860 char * containing the current file name, and ARG. Mapping stops when
861 FUN returns non-zero. */ 861 FUN returns non-zero. */
862 static void 862 static void
863 locate_file_map_suffixes (Lisp_Object filename, Lisp_Object suffixes, 863 locate_file_map_suffixes (Lisp_Object filename, Lisp_Object suffixes,
864 int (*fun) (Intbyte *, void *), 864 int (*fun) (Ibyte *, void *),
865 void *arg) 865 void *arg)
866 { 866 {
867 /* This function can GC */ 867 /* This function can GC */
868 Intbyte *fn; 868 Ibyte *fn;
869 int fn_len, max; 869 int fn_len, max;
870 870
871 /* Calculate maximum size of any filename made from 871 /* Calculate maximum size of any filename made from
872 this path element/specified file name and any possible suffix. */ 872 this path element/specified file name and any possible suffix. */
873 if (CONSP (suffixes)) 873 if (CONSP (suffixes))
886 else 886 else
887 /* Just take the easy way out */ 887 /* Just take the easy way out */
888 max = XSTRING_LENGTH (suffixes); 888 max = XSTRING_LENGTH (suffixes);
889 889
890 fn_len = XSTRING_LENGTH (filename); 890 fn_len = XSTRING_LENGTH (filename);
891 fn = (Intbyte *) ALLOCA (max + fn_len + 1); 891 fn = (Ibyte *) ALLOCA (max + fn_len + 1);
892 memcpy (fn, XSTRING_DATA (filename), fn_len); 892 memcpy (fn, XSTRING_DATA (filename), fn_len);
893 893
894 /* Loop over suffixes. */ 894 /* Loop over suffixes. */
895 if (!STRINGP (suffixes)) 895 if (!STRINGP (suffixes))
896 { 896 {
916 } 916 }
917 } 917 }
918 else 918 else
919 { 919 {
920 /* Case c) */ 920 /* Case c) */
921 const Intbyte *nsuffix = XSTRING_DATA (suffixes); 921 const Ibyte *nsuffix = XSTRING_DATA (suffixes);
922 922
923 while (1) 923 while (1)
924 { 924 {
925 Intbyte *esuffix = qxestrchr (nsuffix, ':'); 925 Ibyte *esuffix = qxestrchr (nsuffix, ':');
926 Bytecount lsuffix = esuffix ? esuffix - nsuffix : 926 Bytecount lsuffix = esuffix ? esuffix - nsuffix :
927 qxestrlen (nsuffix); 927 qxestrlen (nsuffix);
928 928
929 /* Concatenate path element/specified name with the suffix. */ 929 /* Concatenate path element/specified name with the suffix. */
930 qxestrncpy (fn + fn_len, nsuffix, lsuffix); 930 qxestrncpy (fn + fn_len, nsuffix, lsuffix);
947 Lisp_Object *storeptr; 947 Lisp_Object *storeptr;
948 int mode; 948 int mode;
949 }; 949 };
950 950
951 static int 951 static int
952 locate_file_in_directory_mapper (Intbyte *fn, void *arg) 952 locate_file_in_directory_mapper (Ibyte *fn, void *arg)
953 { 953 {
954 struct locate_file_in_directory_mapper_closure *closure = 954 struct locate_file_in_directory_mapper_closure *closure =
955 (struct locate_file_in_directory_mapper_closure *) arg; 955 (struct locate_file_in_directory_mapper_closure *) arg;
956 struct stat st; 956 struct stat st;
957 957
1055 } 1055 }
1056 return -1; 1056 return -1;
1057 } 1057 }
1058 1058
1059 static int 1059 static int
1060 locate_file_construct_suffixed_files_mapper (Intbyte *fn, void *arg) 1060 locate_file_construct_suffixed_files_mapper (Ibyte *fn, void *arg)
1061 { 1061 {
1062 Lisp_Object *tail = (Lisp_Object *) arg; 1062 Lisp_Object *tail = (Lisp_Object *) arg;
1063 *tail = Fcons (build_intstring (fn), *tail); 1063 *tail = Fcons (build_intstring (fn), *tail);
1064 return 0; 1064 return 0;
1065 } 1065 }
1312 Lisp_Object sourcename, 1312 Lisp_Object sourcename,
1313 Lisp_Object (*evalfun) (Lisp_Object), 1313 Lisp_Object (*evalfun) (Lisp_Object),
1314 int printflag) 1314 int printflag)
1315 { 1315 {
1316 /* This function can GC */ 1316 /* This function can GC */
1317 REGISTER Emchar c; 1317 REGISTER Ichar c;
1318 REGISTER Lisp_Object val = Qnil; 1318 REGISTER Lisp_Object val = Qnil;
1319 int speccount = specpdl_depth (); 1319 int speccount = specpdl_depth ();
1320 struct gcpro gcpro1, gcpro2; 1320 struct gcpro gcpro1, gcpro2;
1321 struct buffer *b = 0; 1321 struct buffer *b = 0;
1322 1322
1562 { 1562 {
1563 Lisp_Object val = read1 (readcharfun); 1563 Lisp_Object val = read1 (readcharfun);
1564 1564
1565 if (CONSP (val) && UNBOUNDP (XCAR (val))) 1565 if (CONSP (val) && UNBOUNDP (XCAR (val)))
1566 { 1566 {
1567 Emchar c = XCHAR (XCDR (val)); 1567 Ichar c = XCHAR (XCDR (val));
1568 free_cons (val); 1568 free_cons (val);
1569 return Fsignal (Qinvalid_read_syntax, 1569 return Fsignal (Qinvalid_read_syntax,
1570 list1 (Fchar_to_string (make_char (c)))); 1570 list1 (Fchar_to_string (make_char (c))));
1571 } 1571 }
1572 1572
1573 return val; 1573 return val;
1574 } 1574 }
1575 1575
1576 static Emchar 1576 static Ichar
1577 read_escape (Lisp_Object readcharfun) 1577 read_escape (Lisp_Object readcharfun)
1578 { 1578 {
1579 /* This function can GC */ 1579 /* This function can GC */
1580 Emchar c = readchar (readcharfun); 1580 Ichar c = readchar (readcharfun);
1581 1581
1582 if (c < 0) 1582 if (c < 0)
1583 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun)); 1583 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1584 1584
1585 switch (c) 1585 switch (c)
1651 case '5': 1651 case '5':
1652 case '6': 1652 case '6':
1653 case '7': 1653 case '7':
1654 /* An octal escape, as in ANSI C. */ 1654 /* An octal escape, as in ANSI C. */
1655 { 1655 {
1656 REGISTER Emchar i = c - '0'; 1656 REGISTER Ichar i = c - '0';
1657 REGISTER int count = 0; 1657 REGISTER int count = 0;
1658 while (++count < 3) 1658 while (++count < 3)
1659 { 1659 {
1660 if ((c = readchar (readcharfun)) >= '0' && c <= '7') 1660 if ((c = readchar (readcharfun)) >= '0' && c <= '7')
1661 i = (i << 3) + (c - '0'); 1661 i = (i << 3) + (c - '0');
1675 /* A hex escape, as in ANSI C, except that we only allow latin-1 1675 /* A hex escape, as in ANSI C, except that we only allow latin-1
1676 characters to be read this way. What is "\x4e03" supposed to 1676 characters to be read this way. What is "\x4e03" supposed to
1677 mean, anyways, if the internal representation is hidden? 1677 mean, anyways, if the internal representation is hidden?
1678 This is also consistent with the treatment of octal escapes. */ 1678 This is also consistent with the treatment of octal escapes. */
1679 { 1679 {
1680 REGISTER Emchar i = 0; 1680 REGISTER Ichar i = 0;
1681 REGISTER int count = 0; 1681 REGISTER int count = 0;
1682 while (++count <= 2) 1682 while (++count <= 2)
1683 { 1683 {
1684 c = readchar (readcharfun); 1684 c = readchar (readcharfun);
1685 /* Remember, can't use isdigit(), isalpha() etc. on Emchars */ 1685 /* Remember, can't use isdigit(), isalpha() etc. on Ichars */
1686 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); 1686 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0');
1687 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; 1687 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10;
1688 else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; 1688 else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10;
1689 else 1689 else
1690 { 1690 {
1707 1707
1708 1708
1709 1709
1710 /* read symbol-constituent stuff into `Vread_buffer_stream'. */ 1710 /* read symbol-constituent stuff into `Vread_buffer_stream'. */
1711 static Bytecount 1711 static Bytecount
1712 read_atom_0 (Lisp_Object readcharfun, Emchar firstchar, int *saw_a_backslash) 1712 read_atom_0 (Lisp_Object readcharfun, Ichar firstchar, int *saw_a_backslash)
1713 { 1713 {
1714 /* This function can GC */ 1714 /* This function can GC */
1715 Emchar c = ((firstchar) >= 0 ? firstchar : readchar (readcharfun)); 1715 Ichar c = ((firstchar) >= 0 ? firstchar : readchar (readcharfun));
1716 Lstream_rewind (XLSTREAM (Vread_buffer_stream)); 1716 Lstream_rewind (XLSTREAM (Vread_buffer_stream));
1717 1717
1718 *saw_a_backslash = 0; 1718 *saw_a_backslash = 0;
1719 1719
1720 while (c > 040 /* #### - comma should be here as should backquote */ 1720 while (c > 040 /* #### - comma should be here as should backquote */
1733 c = readchar (readcharfun); 1733 c = readchar (readcharfun);
1734 if (c < 0) 1734 if (c < 0)
1735 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun)); 1735 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1736 *saw_a_backslash = 1; 1736 *saw_a_backslash = 1;
1737 } 1737 }
1738 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c); 1738 Lstream_put_ichar (XLSTREAM (Vread_buffer_stream), c);
1739 QUIT; 1739 QUIT;
1740 c = readchar (readcharfun); 1740 c = readchar (readcharfun);
1741 } 1741 }
1742 1742
1743 if (c >= 0) 1743 if (c >= 0)
1744 unreadchar (readcharfun, c); 1744 unreadchar (readcharfun, c);
1745 /* blasted terminating 0 */ 1745 /* blasted terminating 0 */
1746 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), 0); 1746 Lstream_put_ichar (XLSTREAM (Vread_buffer_stream), 0);
1747 Lstream_flush (XLSTREAM (Vread_buffer_stream)); 1747 Lstream_flush (XLSTREAM (Vread_buffer_stream));
1748 1748
1749 return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1; 1749 return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1;
1750 } 1750 }
1751 1751
1752 static Lisp_Object parse_integer (const Intbyte *buf, Bytecount len, int base); 1752 static Lisp_Object parse_integer (const Ibyte *buf, Bytecount len, int base);
1753 1753
1754 static Lisp_Object 1754 static Lisp_Object
1755 read_atom (Lisp_Object readcharfun, 1755 read_atom (Lisp_Object readcharfun,
1756 Emchar firstchar, 1756 Ichar firstchar,
1757 int uninterned_symbol) 1757 int uninterned_symbol)
1758 { 1758 {
1759 /* This function can GC */ 1759 /* This function can GC */
1760 int saw_a_backslash; 1760 int saw_a_backslash;
1761 Bytecount len = read_atom_0 (readcharfun, firstchar, &saw_a_backslash); 1761 Bytecount len = read_atom_0 (readcharfun, firstchar, &saw_a_backslash);
1802 else 1802 else
1803 abort (); 1803 abort ();
1804 return make_int (number); 1804 return make_int (number);
1805 } 1805 }
1806 #else 1806 #else
1807 return parse_integer ((Intbyte *) read_ptr, len, 10); 1807 return parse_integer ((Ibyte *) read_ptr, len, 10);
1808 #endif 1808 #endif
1809 } 1809 }
1810 } 1810 }
1811 #ifdef LISP_FLOAT_TYPE 1811 #ifdef LISP_FLOAT_TYPE
1812 if (isfloat_string (read_ptr)) 1812 if (isfloat_string (read_ptr))
1815 } 1815 }
1816 1816
1817 { 1817 {
1818 Lisp_Object sym; 1818 Lisp_Object sym;
1819 if (uninterned_symbol) 1819 if (uninterned_symbol)
1820 sym = Fmake_symbol ( make_string ((Intbyte *) read_ptr, len)); 1820 sym = Fmake_symbol ( make_string ((Ibyte *) read_ptr, len));
1821 else 1821 else
1822 { 1822 {
1823 Lisp_Object name = make_string ((Intbyte *) read_ptr, len); 1823 Lisp_Object name = make_string ((Ibyte *) read_ptr, len);
1824 sym = Fintern (name, Qnil); 1824 sym = Fintern (name, Qnil);
1825 } 1825 }
1826 return sym; 1826 return sym;
1827 } 1827 }
1828 } 1828 }
1829 1829
1830 1830
1831 static Lisp_Object 1831 static Lisp_Object
1832 parse_integer (const Intbyte *buf, Bytecount len, int base) 1832 parse_integer (const Ibyte *buf, Bytecount len, int base)
1833 { 1833 {
1834 const Intbyte *lim = buf + len; 1834 const Ibyte *lim = buf + len;
1835 const Intbyte *p = buf; 1835 const Ibyte *p = buf;
1836 EMACS_UINT num = 0; 1836 EMACS_UINT num = 0;
1837 int negativland = 0; 1837 int negativland = 0;
1838 1838
1839 if (*p == '-') 1839 if (*p == '-')
1840 { 1840 {
1917 Lisp_Object val; 1917 Lisp_Object val;
1918 1918
1919 while (1) 1919 while (1)
1920 { 1920 {
1921 unsigned char bit; 1921 unsigned char bit;
1922 Emchar c = readchar (readcharfun); 1922 Ichar c = readchar (readcharfun);
1923 if (c == '0') 1923 if (c == '0')
1924 bit = 0; 1924 bit = 0;
1925 else if (c == '1') 1925 else if (c == '1')
1926 bit = 1; 1926 bit = 1;
1927 else 1927 else
1991 } 1991 }
1992 1992
1993 static Lisp_Object 1993 static Lisp_Object
1994 read_structure (Lisp_Object readcharfun) 1994 read_structure (Lisp_Object readcharfun)
1995 { 1995 {
1996 Emchar c = readchar (readcharfun); 1996 Ichar c = readchar (readcharfun);
1997 Lisp_Object list = Qnil; 1997 Lisp_Object list = Qnil;
1998 Lisp_Object orig_list = Qnil; 1998 Lisp_Object orig_list = Qnil;
1999 Lisp_Object already_seen = Qnil; 1999 Lisp_Object already_seen = Qnil;
2000 int keyword_count; 2000 int keyword_count;
2001 struct structure_type *st; 2001 struct structure_type *st;
2080 int terminator); 2080 int terminator);
2081 static Lisp_Object read_vector (Lisp_Object readcharfun, int terminator); 2081 static Lisp_Object read_vector (Lisp_Object readcharfun, int terminator);
2082 2082
2083 /* Get the next character; filter out whitespace and comments */ 2083 /* Get the next character; filter out whitespace and comments */
2084 2084
2085 static Emchar 2085 static Ichar
2086 reader_nextchar (Lisp_Object readcharfun) 2086 reader_nextchar (Lisp_Object readcharfun)
2087 { 2087 {
2088 /* This function can GC */ 2088 /* This function can GC */
2089 Emchar c; 2089 Ichar c;
2090 2090
2091 retry: 2091 retry:
2092 QUIT; 2092 QUIT;
2093 c = readchar (readcharfun); 2093 c = readchar (readcharfun);
2094 if (c < 0) 2094 if (c < 0)
2129 use read0(). */ 2129 use read0(). */
2130 2130
2131 static Lisp_Object 2131 static Lisp_Object
2132 read1 (Lisp_Object readcharfun) 2132 read1 (Lisp_Object readcharfun)
2133 { 2133 {
2134 Emchar c; 2134 Ichar c;
2135 2135
2136 retry: 2136 retry:
2137 c = reader_nextchar (readcharfun); 2137 c = reader_nextchar (readcharfun);
2138 2138
2139 switch (c) 2139 switch (c)
2140 { 2140 {
2141 case '(': 2141 case '(':
2142 { 2142 {
2143 #ifdef LISP_BACKQUOTES /* old backquote compatibility in lisp reader */ 2143 #ifdef LISP_BACKQUOTES /* old backquote compatibility in lisp reader */
2144 /* if this is disabled, then other code in eval.c must be enabled */ 2144 /* if this is disabled, then other code in eval.c must be enabled */
2145 Emchar ch = reader_nextchar (readcharfun); 2145 Ichar ch = reader_nextchar (readcharfun);
2146 switch (ch) 2146 switch (ch)
2147 { 2147 {
2148 case '`': 2148 case '`':
2149 { 2149 {
2150 Lisp_Object tem; 2150 Lisp_Object tem;
2226 pair. 2226 pair.
2227 */ 2227 */
2228 c = readchar (readcharfun); 2228 c = readchar (readcharfun);
2229 unreadchar (readcharfun, c); 2229 unreadchar (readcharfun, c);
2230 2230
2231 /* Can't use isdigit on Emchars */ 2231 /* Can't use isdigit on Ichars */
2232 if (c < '0' || c > '9') 2232 if (c < '0' || c > '9')
2233 return noseeum_cons (Qunbound, make_char ('.')); 2233 return noseeum_cons (Qunbound, make_char ('.'));
2234 2234
2235 /* Note that read_atom will loop 2235 /* Note that read_atom will loop
2236 at least once, assuring that we will not try to UNREAD 2236 at least once, assuring that we will not try to UNREAD
2288 GCPRO1 (tmp); 2288 GCPRO1 (tmp);
2289 /* Read the intervals and their properties. */ 2289 /* Read the intervals and their properties. */
2290 while (1) 2290 while (1)
2291 { 2291 {
2292 Lisp_Object beg, end, plist; 2292 Lisp_Object beg, end, plist;
2293 Emchar ch; 2293 Ichar ch;
2294 int invalid = 0; 2294 int invalid = 0;
2295 2295
2296 beg = read1 (readcharfun); 2296 beg = read1 (readcharfun);
2297 if (CONSP (beg) && UNBOUNDP (XCAR (beg))) 2297 if (CONSP (beg) && UNBOUNDP (XCAR (beg)))
2298 { 2298 {
2533 { 2533 {
2534 if (Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) == 0) 2534 if (Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) == 0)
2535 cancel = 1; 2535 cancel = 1;
2536 } 2536 }
2537 else 2537 else
2538 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c); 2538 Lstream_put_ichar (XLSTREAM (Vread_buffer_stream), c);
2539 QUIT; 2539 QUIT;
2540 } 2540 }
2541 if (c < 0) 2541 if (c < 0)
2542 return Fsignal (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 2542 return Fsignal (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun)));
2543 2543
2576 2576
2577 int 2577 int
2578 isfloat_string (const char *cp) 2578 isfloat_string (const char *cp)
2579 { 2579 {
2580 int state = 0; 2580 int state = 0;
2581 const Intbyte *ucp = (const Intbyte *) cp; 2581 const Ibyte *ucp = (const Ibyte *) cp;
2582 2582
2583 if (*ucp == '+' || *ucp == '-') 2583 if (*ucp == '+' || *ucp == '-')
2584 ucp++; 2584 ucp++;
2585 2585
2586 if (*ucp >= '0' && *ucp <= '9') 2586 if (*ucp >= '0' && *ucp <= '9')
2624 } 2624 }
2625 #endif /* LISP_FLOAT_TYPE */ 2625 #endif /* LISP_FLOAT_TYPE */
2626 2626
2627 static void * 2627 static void *
2628 sequence_reader (Lisp_Object readcharfun, 2628 sequence_reader (Lisp_Object readcharfun,
2629 Emchar terminator, 2629 Ichar terminator,
2630 void *state, 2630 void *state,
2631 void * (*conser) (Lisp_Object readcharfun, 2631 void * (*conser) (Lisp_Object readcharfun,
2632 void *state, Charcount len)) 2632 void *state, Charcount len))
2633 { 2633 {
2634 Charcount len; 2634 Charcount len;
2635 2635
2636 for (len = 0; ; len++) 2636 for (len = 0; ; len++)
2637 { 2637 {
2638 Emchar ch; 2638 Ichar ch;
2639 2639
2640 QUIT; 2640 QUIT;
2641 ch = reader_nextchar (readcharfun); 2641 ch = reader_nextchar (readcharfun);
2642 2642
2643 if (ch == terminator) 2643 if (ch == terminator)
2659 { 2659 {
2660 Lisp_Object head; 2660 Lisp_Object head;
2661 Lisp_Object tail; 2661 Lisp_Object tail;
2662 int length; 2662 int length;
2663 int allow_dotted_lists; 2663 int allow_dotted_lists;
2664 Emchar terminator; 2664 Ichar terminator;
2665 }; 2665 };
2666 2666
2667 static void * 2667 static void *
2668 read_list_conser (Lisp_Object readcharfun, void *state, Charcount len) 2668 read_list_conser (Lisp_Object readcharfun, void *state, Charcount len)
2669 { 2669 {
2673 elt = read1 (readcharfun); 2673 elt = read1 (readcharfun);
2674 2674
2675 if (CONSP (elt) && UNBOUNDP (XCAR (elt))) 2675 if (CONSP (elt) && UNBOUNDP (XCAR (elt)))
2676 { 2676 {
2677 Lisp_Object tem = elt; 2677 Lisp_Object tem = elt;
2678 Emchar ch; 2678 Ichar ch;
2679 2679
2680 elt = XCDR (elt); 2680 elt = XCDR (elt);
2681 free_cons (tem); 2681 free_cons (tem);
2682 tem = Qnil; 2682 tem = Qnil;
2683 ch = XCHAR (elt); 2683 ch = XCHAR (elt);
2755 free_list() on the returned list here. 2755 free_list() on the returned list here.
2756 */ 2756 */
2757 2757
2758 static Lisp_Object 2758 static Lisp_Object
2759 read_list (Lisp_Object readcharfun, 2759 read_list (Lisp_Object readcharfun,
2760 Emchar terminator, 2760 Ichar terminator,
2761 int allow_dotted_lists, 2761 int allow_dotted_lists,
2762 int check_for_doc_references) 2762 int check_for_doc_references)
2763 { 2763 {
2764 struct read_list_state s; 2764 struct read_list_state s;
2765 struct gcpro gcpro1, gcpro2; 2765 struct gcpro gcpro1, gcpro2;
2849 return s.head; 2849 return s.head;
2850 } 2850 }
2851 2851
2852 static Lisp_Object 2852 static Lisp_Object
2853 read_vector (Lisp_Object readcharfun, 2853 read_vector (Lisp_Object readcharfun,
2854 Emchar terminator) 2854 Ichar terminator)
2855 { 2855 {
2856 Lisp_Object tem; 2856 Lisp_Object tem;
2857 Lisp_Object *p; 2857 Lisp_Object *p;
2858 int len; 2858 int len;
2859 int i; 2859 int i;
2886 } 2886 }
2887 return s.head; 2887 return s.head;
2888 } 2888 }
2889 2889
2890 static Lisp_Object 2890 static Lisp_Object
2891 read_compiled_function (Lisp_Object readcharfun, Emchar terminator) 2891 read_compiled_function (Lisp_Object readcharfun, Ichar terminator)
2892 { 2892 {
2893 /* Accept compiled functions at read-time so that we don't 2893 /* Accept compiled functions at read-time so that we don't
2894 have to build them at load-time. */ 2894 have to build them at load-time. */
2895 Lisp_Object stuff; 2895 Lisp_Object stuff;
2896 Lisp_Object make_byte_code_args[COMPILED_DOMAIN + 1]; 2896 Lisp_Object make_byte_code_args[COMPILED_DOMAIN + 1];