Mercurial > emacs
comparison src/lread.c @ 83533:02e39decdc84
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-351
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-352
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-353
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-354
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-355
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-356
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-357
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-358
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-359
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-360
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-361
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-362
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-363
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-364
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-365
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-366
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-367
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-368
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-369
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-370
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-115
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-116
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-117
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-118
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-119
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-120
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-573
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 29 Jul 2006 09:59:12 +0000 |
parents | b19aaf4ab0ee 9ac2eb12b7f1 |
children | c71725faff1a |
comparison
equal
deleted
inserted
replaced
83532:b19aaf4ab0ee | 83533:02e39decdc84 |
---|---|
214 Lisp_Object, Lisp_Object, | 214 Lisp_Object, Lisp_Object, |
215 Lisp_Object, Lisp_Object)); | 215 Lisp_Object, Lisp_Object)); |
216 static Lisp_Object load_unwind P_ ((Lisp_Object)); | 216 static Lisp_Object load_unwind P_ ((Lisp_Object)); |
217 static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); | 217 static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); |
218 | 218 |
219 static void invalid_syntax P_ ((const char *, int)) NO_RETURN; | |
220 static void end_of_file_error P_ (()) NO_RETURN; | |
221 | |
219 | 222 |
220 /* Handle unreading and rereading of characters. | 223 /* Handle unreading and rereading of characters. |
221 Write READCHAR to read a character, | 224 Write READCHAR to read a character, |
222 UNREAD(c) to unread c to be read again. | 225 UNREAD(c) to unread c to be read again. |
223 | 226 |
434 static void substitute_in_interval P_ ((INTERVAL, Lisp_Object)); | 437 static void substitute_in_interval P_ ((INTERVAL, Lisp_Object)); |
435 | 438 |
436 | 439 |
437 /* Get a character from the tty. */ | 440 /* Get a character from the tty. */ |
438 | 441 |
439 extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); | |
440 | |
441 /* Read input events until we get one that's acceptable for our purposes. | 442 /* Read input events until we get one that's acceptable for our purposes. |
442 | 443 |
443 If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed | 444 If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed |
444 until we get a character we like, and then stuffed into | 445 until we get a character we like, and then stuffed into |
445 unread_switch_frame. | 446 unread_switch_frame. |
452 get isn't an ASCII character with modifiers. If it's zero but | 453 get isn't an ASCII character with modifiers. If it's zero but |
453 ASCII_REQUIRED is non-zero, we just re-read until we get an ASCII | 454 ASCII_REQUIRED is non-zero, we just re-read until we get an ASCII |
454 character. | 455 character. |
455 | 456 |
456 If INPUT_METHOD is nonzero, we invoke the current input method | 457 If INPUT_METHOD is nonzero, we invoke the current input method |
457 if the character warrants that. */ | 458 if the character warrants that. |
459 | |
460 If SECONDS is a number, we wait that many seconds for input, and | |
461 return Qnil if no input arrives within that time. */ | |
458 | 462 |
459 Lisp_Object | 463 Lisp_Object |
460 read_filtered_event (no_switch_frame, ascii_required, error_nonascii, | 464 read_filtered_event (no_switch_frame, ascii_required, error_nonascii, |
461 input_method) | 465 input_method, seconds) |
462 int no_switch_frame, ascii_required, error_nonascii, input_method; | 466 int no_switch_frame, ascii_required, error_nonascii, input_method; |
467 Lisp_Object seconds; | |
463 { | 468 { |
464 Lisp_Object val, delayed_switch_frame; | 469 Lisp_Object val, delayed_switch_frame; |
470 EMACS_TIME end_time; | |
465 | 471 |
466 #ifdef HAVE_WINDOW_SYSTEM | 472 #ifdef HAVE_WINDOW_SYSTEM |
467 if (display_hourglass_p) | 473 if (display_hourglass_p) |
468 cancel_hourglass (); | 474 cancel_hourglass (); |
469 #endif | 475 #endif |
470 | 476 |
471 delayed_switch_frame = Qnil; | 477 delayed_switch_frame = Qnil; |
472 | 478 |
473 /* Read until we get an acceptable event. */ | 479 /* Compute timeout. */ |
480 if (NUMBERP (seconds)) | |
481 { | |
482 EMACS_TIME wait_time; | |
483 int sec, usec; | |
484 double duration = extract_float (seconds); | |
485 | |
486 sec = (int) duration; | |
487 usec = (duration - sec) * 1000000; | |
488 EMACS_GET_TIME (end_time); | |
489 EMACS_SET_SECS_USECS (wait_time, sec, usec); | |
490 EMACS_ADD_TIME (end_time, end_time, wait_time); | |
491 } | |
492 | |
493 /* Read until we get an acceptable event. */ | |
474 retry: | 494 retry: |
475 do | 495 do |
476 val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0); | 496 val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0, |
497 NUMBERP (seconds) ? &end_time : NULL); | |
477 while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ | 498 while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ |
478 | 499 |
479 if (BUFFERP (val)) | 500 if (BUFFERP (val)) |
480 goto retry; | 501 goto retry; |
481 | 502 |
490 { | 511 { |
491 delayed_switch_frame = val; | 512 delayed_switch_frame = val; |
492 goto retry; | 513 goto retry; |
493 } | 514 } |
494 | 515 |
495 if (ascii_required) | 516 if (ascii_required && !(NUMBERP (seconds) && NILP (val))) |
496 { | 517 { |
497 /* Convert certain symbols to their ASCII equivalents. */ | 518 /* Convert certain symbols to their ASCII equivalents. */ |
498 if (SYMBOLP (val)) | 519 if (SYMBOLP (val)) |
499 { | 520 { |
500 Lisp_Object tem, tem1; | 521 Lisp_Object tem, tem1; |
535 #endif | 556 #endif |
536 | 557 |
537 return val; | 558 return val; |
538 } | 559 } |
539 | 560 |
540 DEFUN ("read-char", Fread_char, Sread_char, 0, 2, 0, | 561 DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0, |
541 doc: /* Read a character from the command input (keyboard or macro). | 562 doc: /* Read a character from the command input (keyboard or macro). |
542 It is returned as a number. | 563 It is returned as a number. |
543 If the user generates an event which is not a character (i.e. a mouse | 564 If the user generates an event which is not a character (i.e. a mouse |
544 click or function key event), `read-char' signals an error. As an | 565 click or function key event), `read-char' signals an error. As an |
545 exception, switch-frame events are put off until non-ASCII events can | 566 exception, switch-frame events are put off until non-ASCII events can |
548 `read-event' or `read-char-exclusive' instead. | 569 `read-event' or `read-char-exclusive' instead. |
549 | 570 |
550 If the optional argument PROMPT is non-nil, display that as a prompt. | 571 If the optional argument PROMPT is non-nil, display that as a prompt. |
551 If the optional argument INHERIT-INPUT-METHOD is non-nil and some | 572 If the optional argument INHERIT-INPUT-METHOD is non-nil and some |
552 input method is turned on in the current buffer, that input method | 573 input method is turned on in the current buffer, that input method |
553 is used for reading a character. */) | 574 is used for reading a character. |
554 (prompt, inherit_input_method) | 575 If the optional argument SECONDS is non-nil, it should be a number |
555 Lisp_Object prompt, inherit_input_method; | 576 specifying the maximum number of seconds to wait for input. If no |
577 input arrives in that time, return nil. SECONDS may be a | |
578 floating-point value. */) | |
579 (prompt, inherit_input_method, seconds) | |
580 Lisp_Object prompt, inherit_input_method, seconds; | |
556 { | 581 { |
557 if (! NILP (prompt)) | 582 if (! NILP (prompt)) |
558 message_with_string ("%s", prompt, 0); | 583 message_with_string ("%s", prompt, 0); |
559 return read_filtered_event (1, 1, 1, ! NILP (inherit_input_method)); | 584 return read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); |
560 } | 585 } |
561 | 586 |
562 DEFUN ("read-event", Fread_event, Sread_event, 0, 2, 0, | 587 DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, |
563 doc: /* Read an event object from the input stream. | 588 doc: /* Read an event object from the input stream. |
564 If the optional argument PROMPT is non-nil, display that as a prompt. | 589 If the optional argument PROMPT is non-nil, display that as a prompt. |
565 If the optional argument INHERIT-INPUT-METHOD is non-nil and some | 590 If the optional argument INHERIT-INPUT-METHOD is non-nil and some |
566 input method is turned on in the current buffer, that input method | 591 input method is turned on in the current buffer, that input method |
567 is used for reading a character. */) | 592 is used for reading a character. |
568 (prompt, inherit_input_method) | 593 If the optional argument SECONDS is non-nil, it should be a number |
569 Lisp_Object prompt, inherit_input_method; | 594 specifying the maximum number of seconds to wait for input. If no |
595 input arrives in that time, return nil. SECONDS may be a | |
596 floating-point value. */) | |
597 (prompt, inherit_input_method, seconds) | |
598 Lisp_Object prompt, inherit_input_method, seconds; | |
570 { | 599 { |
571 if (! NILP (prompt)) | 600 if (! NILP (prompt)) |
572 message_with_string ("%s", prompt, 0); | 601 message_with_string ("%s", prompt, 0); |
573 return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method)); | 602 return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method), seconds); |
574 } | 603 } |
575 | 604 |
576 DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 2, 0, | 605 DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0, |
577 doc: /* Read a character from the command input (keyboard or macro). | 606 doc: /* Read a character from the command input (keyboard or macro). |
578 It is returned as a number. Non-character events are ignored. | 607 It is returned as a number. Non-character events are ignored. |
579 | 608 |
580 If the optional argument PROMPT is non-nil, display that as a prompt. | 609 If the optional argument PROMPT is non-nil, display that as a prompt. |
581 If the optional argument INHERIT-INPUT-METHOD is non-nil and some | 610 If the optional argument INHERIT-INPUT-METHOD is non-nil and some |
582 input method is turned on in the current buffer, that input method | 611 input method is turned on in the current buffer, that input method |
583 is used for reading a character. */) | 612 is used for reading a character. |
584 (prompt, inherit_input_method) | 613 If the optional argument SECONDS is non-nil, it should be a number |
585 Lisp_Object prompt, inherit_input_method; | 614 specifying the maximum number of seconds to wait for input. If no |
615 input arrives in that time, return nil. SECONDS may be a | |
616 floating-point value. */) | |
617 (prompt, inherit_input_method, seconds) | |
618 Lisp_Object prompt, inherit_input_method, seconds; | |
586 { | 619 { |
587 if (! NILP (prompt)) | 620 if (! NILP (prompt)) |
588 message_with_string ("%s", prompt, 0); | 621 message_with_string ("%s", prompt, 0); |
589 return read_filtered_event (1, 1, 0, ! NILP (inherit_input_method)); | 622 return read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); |
590 } | 623 } |
591 | 624 |
592 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, | 625 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, |
593 doc: /* Don't use this yourself. */) | 626 doc: /* Don't use this yourself. */) |
594 () | 627 () |
797 } | 830 } |
798 | 831 |
799 if (fd == -1) | 832 if (fd == -1) |
800 { | 833 { |
801 if (NILP (noerror)) | 834 if (NILP (noerror)) |
802 Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"), | 835 xsignal2 (Qfile_error, build_string ("Cannot open load file"), file); |
803 Fcons (file, Qnil))); | 836 return Qnil; |
804 else | |
805 return Qnil; | |
806 } | 837 } |
807 | 838 |
808 /* Tell startup.el whether or not we found the user's init file. */ | 839 /* Tell startup.el whether or not we found the user's init file. */ |
809 if (EQ (Qt, Vuser_init_file)) | 840 if (EQ (Qt, Vuser_init_file)) |
810 Vuser_init_file = found; | 841 Vuser_init_file = found; |
841 count++; | 872 count++; |
842 if (count > 3) | 873 if (count > 3) |
843 { | 874 { |
844 if (fd >= 0) | 875 if (fd >= 0) |
845 emacs_close (fd); | 876 emacs_close (fd); |
846 Fsignal (Qerror, Fcons (build_string ("Recursive load"), | 877 signal_error ("Recursive load", Fcons (found, Vloads_in_progress)); |
847 Fcons (found, Vloads_in_progress))); | |
848 } | 878 } |
849 record_unwind_protect (record_load_unwind, Vloads_in_progress); | 879 record_unwind_protect (record_load_unwind, Vloads_in_progress); |
850 Vloads_in_progress = Fcons (found, Vloads_in_progress); | 880 Vloads_in_progress = Fcons (found, Vloads_in_progress); |
851 } | 881 } |
852 | 882 |
1339 end_of_file_error () | 1369 end_of_file_error () |
1340 { | 1370 { |
1341 Lisp_Object data; | 1371 Lisp_Object data; |
1342 | 1372 |
1343 if (STRINGP (Vload_file_name)) | 1373 if (STRINGP (Vload_file_name)) |
1344 data = Fcons (Vload_file_name, Qnil); | 1374 xsignal1 (Qend_of_file, Vload_file_name); |
1345 else | 1375 |
1346 data = Qnil; | 1376 xsignal0 (Qend_of_file); |
1347 | |
1348 Fsignal (Qend_of_file, data); | |
1349 } | 1377 } |
1350 | 1378 |
1351 /* UNIBYTE specifies how to set load_convert_to_unibyte | 1379 /* UNIBYTE specifies how to set load_convert_to_unibyte |
1352 for this invocation. | 1380 for this invocation. |
1353 READFUN, if non-nil, is used instead of `read'. | 1381 READFUN, if non-nil, is used instead of `read'. |
1694 || EQ (Vread_with_symbol_positions, stream)) | 1722 || EQ (Vread_with_symbol_positions, stream)) |
1695 Vread_symbol_positions_list = Fnreverse (Vread_symbol_positions_list); | 1723 Vread_symbol_positions_list = Fnreverse (Vread_symbol_positions_list); |
1696 return retval; | 1724 return retval; |
1697 } | 1725 } |
1698 | 1726 |
1727 | |
1728 /* Signal Qinvalid_read_syntax error. | |
1729 S is error string of length N (if > 0) */ | |
1730 | |
1731 static void | |
1732 invalid_syntax (s, n) | |
1733 const char *s; | |
1734 int n; | |
1735 { | |
1736 if (!n) | |
1737 n = strlen (s); | |
1738 xsignal1 (Qinvalid_read_syntax, make_string (s, n)); | |
1739 } | |
1740 | |
1741 | |
1699 /* Use this for recursive reads, in contexts where internal tokens | 1742 /* Use this for recursive reads, in contexts where internal tokens |
1700 are not allowed. */ | 1743 are not allowed. */ |
1701 | 1744 |
1702 static Lisp_Object | 1745 static Lisp_Object |
1703 read0 (readcharfun) | 1746 read0 (readcharfun) |
1705 { | 1748 { |
1706 register Lisp_Object val; | 1749 register Lisp_Object val; |
1707 int c; | 1750 int c; |
1708 | 1751 |
1709 val = read1 (readcharfun, &c, 0); | 1752 val = read1 (readcharfun, &c, 0); |
1710 if (c) | 1753 if (!c) |
1711 Fsignal (Qinvalid_read_syntax, Fcons (Fmake_string (make_number (1), | 1754 return val; |
1712 make_number (c)), | 1755 |
1713 Qnil)); | 1756 xsignal1 (Qinvalid_read_syntax, |
1714 | 1757 Fmake_string (make_number (1), make_number (c))); |
1715 return val; | |
1716 } | 1758 } |
1717 | 1759 |
1718 static int read_buffer_size; | 1760 static int read_buffer_size; |
1719 static char *read_buffer; | 1761 static char *read_buffer; |
1720 | 1762 |
1978 c = read_multibyte (c, readcharfun); | 2020 c = read_multibyte (c, readcharfun); |
1979 return c; | 2021 return c; |
1980 } | 2022 } |
1981 } | 2023 } |
1982 | 2024 |
1983 | |
1984 /* Read an integer in radix RADIX using READCHARFUN to read | 2025 /* Read an integer in radix RADIX using READCHARFUN to read |
1985 characters. RADIX must be in the interval [2..36]; if it isn't, a | 2026 characters. RADIX must be in the interval [2..36]; if it isn't, a |
1986 read error is signaled . Value is the integer read. Signals an | 2027 read error is signaled . Value is the integer read. Signals an |
1987 error if encountering invalid read syntax or if RADIX is out of | 2028 error if encountering invalid read syntax or if RADIX is out of |
1988 range. */ | 2029 range. */ |
2038 | 2079 |
2039 if (ndigits == 0 || invalid_p) | 2080 if (ndigits == 0 || invalid_p) |
2040 { | 2081 { |
2041 char buf[50]; | 2082 char buf[50]; |
2042 sprintf (buf, "integer, radix %d", radix); | 2083 sprintf (buf, "integer, radix %d", radix); |
2043 Fsignal (Qinvalid_read_syntax, Fcons (build_string (buf), Qnil)); | 2084 invalid_syntax (buf, 0); |
2044 } | 2085 } |
2045 | 2086 |
2046 return make_number (sign * number); | 2087 return make_number (sign * number); |
2047 } | 2088 } |
2048 | 2089 |
2149 error ("Invalid size char-table"); | 2190 error ("Invalid size char-table"); |
2150 XSETCHAR_TABLE (tmp, XCHAR_TABLE (tmp)); | 2191 XSETCHAR_TABLE (tmp, XCHAR_TABLE (tmp)); |
2151 XCHAR_TABLE (tmp)->top = Qnil; | 2192 XCHAR_TABLE (tmp)->top = Qnil; |
2152 return tmp; | 2193 return tmp; |
2153 } | 2194 } |
2154 Fsignal (Qinvalid_read_syntax, | 2195 invalid_syntax ("#^^", 3); |
2155 Fcons (make_string ("#^^", 3), Qnil)); | |
2156 } | 2196 } |
2157 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#^", 2), Qnil)); | 2197 invalid_syntax ("#^", 2); |
2158 } | 2198 } |
2159 if (c == '&') | 2199 if (c == '&') |
2160 { | 2200 { |
2161 Lisp_Object length; | 2201 Lisp_Object length; |
2162 length = read1 (readcharfun, pch, first_in_list); | 2202 length = read1 (readcharfun, pch, first_in_list); |
2174 /* We used to print 1 char too many | 2214 /* We used to print 1 char too many |
2175 when the number of bits was a multiple of 8. | 2215 when the number of bits was a multiple of 8. |
2176 Accept such input in case it came from an old version. */ | 2216 Accept such input in case it came from an old version. */ |
2177 && ! (XFASTINT (length) | 2217 && ! (XFASTINT (length) |
2178 == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR)) | 2218 == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR)) |
2179 Fsignal (Qinvalid_read_syntax, | 2219 invalid_syntax ("#&...", 5); |
2180 Fcons (make_string ("#&...", 5), Qnil)); | |
2181 | 2220 |
2182 val = Fmake_bool_vector (length, Qnil); | 2221 val = Fmake_bool_vector (length, Qnil); |
2183 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, | 2222 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, |
2184 size_in_chars); | 2223 size_in_chars); |
2185 /* Clear the extraneous bits in the last byte. */ | 2224 /* Clear the extraneous bits in the last byte. */ |
2186 if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) | 2225 if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) |
2187 XBOOL_VECTOR (val)->data[size_in_chars - 1] | 2226 XBOOL_VECTOR (val)->data[size_in_chars - 1] |
2188 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 2227 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
2189 return val; | 2228 return val; |
2190 } | 2229 } |
2191 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&...", 5), | 2230 invalid_syntax ("#&...", 5); |
2192 Qnil)); | |
2193 } | 2231 } |
2194 if (c == '[') | 2232 if (c == '[') |
2195 { | 2233 { |
2196 /* Accept compiled functions at read-time so that we don't have to | 2234 /* Accept compiled functions at read-time so that we don't have to |
2197 build them using function calls. */ | 2235 build them using function calls. */ |
2207 int ch; | 2245 int ch; |
2208 | 2246 |
2209 /* Read the string itself. */ | 2247 /* Read the string itself. */ |
2210 tmp = read1 (readcharfun, &ch, 0); | 2248 tmp = read1 (readcharfun, &ch, 0); |
2211 if (ch != 0 || !STRINGP (tmp)) | 2249 if (ch != 0 || !STRINGP (tmp)) |
2212 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); | 2250 invalid_syntax ("#", 1); |
2213 GCPRO1 (tmp); | 2251 GCPRO1 (tmp); |
2214 /* Read the intervals and their properties. */ | 2252 /* Read the intervals and their properties. */ |
2215 while (1) | 2253 while (1) |
2216 { | 2254 { |
2217 Lisp_Object beg, end, plist; | 2255 Lisp_Object beg, end, plist; |
2223 if (ch == 0) | 2261 if (ch == 0) |
2224 end = read1 (readcharfun, &ch, 0); | 2262 end = read1 (readcharfun, &ch, 0); |
2225 if (ch == 0) | 2263 if (ch == 0) |
2226 plist = read1 (readcharfun, &ch, 0); | 2264 plist = read1 (readcharfun, &ch, 0); |
2227 if (ch) | 2265 if (ch) |
2228 Fsignal (Qinvalid_read_syntax, | 2266 invalid_syntax ("Invalid string property list", 0); |
2229 Fcons (build_string ("invalid string property list"), | |
2230 Qnil)); | |
2231 Fset_text_properties (beg, end, plist, tmp); | 2267 Fset_text_properties (beg, end, plist, tmp); |
2232 } | 2268 } |
2233 UNGCPRO; | 2269 UNGCPRO; |
2234 return tmp; | 2270 return tmp; |
2235 } | 2271 } |
2378 return read_integer (readcharfun, 8); | 2414 return read_integer (readcharfun, 8); |
2379 else if (c == 'b' || c == 'B') | 2415 else if (c == 'b' || c == 'B') |
2380 return read_integer (readcharfun, 2); | 2416 return read_integer (readcharfun, 2); |
2381 | 2417 |
2382 UNREAD (c); | 2418 UNREAD (c); |
2383 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); | 2419 invalid_syntax ("#", 1); |
2384 | 2420 |
2385 case ';': | 2421 case ';': |
2386 while ((c = READCHAR) >= 0 && c != '\n'); | 2422 while ((c = READCHAR) >= 0 && c != '\n'); |
2387 goto retry; | 2423 goto retry; |
2388 | 2424 |
2472 && (index ("\"';()[]#?", next_char) | 2508 && (index ("\"';()[]#?", next_char) |
2473 || (!first_in_list && next_char == '`') | 2509 || (!first_in_list && next_char == '`') |
2474 || (new_backquote_flag && next_char == ',')))); | 2510 || (new_backquote_flag && next_char == ',')))); |
2475 } | 2511 } |
2476 UNREAD (next_char); | 2512 UNREAD (next_char); |
2477 if (!ok) | 2513 if (ok) |
2478 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("?", 1), Qnil)); | 2514 return make_number (c); |
2479 | 2515 |
2480 return make_number (c); | 2516 invalid_syntax ("?", 1); |
2481 } | 2517 } |
2482 | 2518 |
2483 case '"': | 2519 case '"': |
2484 { | 2520 { |
2485 char *p = read_buffer; | 2521 char *p = read_buffer; |
3120 { | 3156 { |
3121 if (flag > 0) | 3157 if (flag > 0) |
3122 { | 3158 { |
3123 if (ch == ']') | 3159 if (ch == ']') |
3124 return val; | 3160 return val; |
3125 Fsignal (Qinvalid_read_syntax, | 3161 invalid_syntax (") or . in a vector", 18); |
3126 Fcons (make_string (") or . in a vector", 18), Qnil)); | |
3127 } | 3162 } |
3128 if (ch == ')') | 3163 if (ch == ')') |
3129 return val; | 3164 return val; |
3130 if (ch == '.') | 3165 if (ch == '.') |
3131 { | 3166 { |
3214 return get_doc_string (val, 0, 0); | 3249 return get_doc_string (val, 0, 0); |
3215 } | 3250 } |
3216 | 3251 |
3217 return val; | 3252 return val; |
3218 } | 3253 } |
3219 return Fsignal (Qinvalid_read_syntax, Fcons (make_string (". in wrong context", 18), Qnil)); | 3254 invalid_syntax (". in wrong context", 18); |
3220 } | 3255 } |
3221 return Fsignal (Qinvalid_read_syntax, Fcons (make_string ("] in a list", 11), Qnil)); | 3256 invalid_syntax ("] in a list", 11); |
3222 } | 3257 } |
3223 tem = (read_pure && flag <= 0 | 3258 tem = (read_pure && flag <= 0 |
3224 ? pure_cons (elt, Qnil) | 3259 ? pure_cons (elt, Qnil) |
3225 : Fcons (elt, Qnil)); | 3260 : Fcons (elt, Qnil)); |
3226 if (!NILP (tail)) | 3261 if (!NILP (tail)) |