Mercurial > emacs
comparison src/lread.c @ 90140:02f1dbc4a199
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-35
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 228-240)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 53-58)
- Merge from emacs--cvs-trunk--0
- Update from CVS
- Collapse feature addition/removal within single ChangeLog entry
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 09 Apr 2005 02:16:29 +0000 |
parents | 7e3f621f1dd4 008bb0675c5b |
children | 146c086df160 |
comparison
equal
deleted
inserted
replaced
90139:e0d294b9b23e | 90140:02f1dbc4a199 |
---|---|
216 static int read_emacs_mule_char P_ ((int, int (*) (int, Lisp_Object), | 216 static int read_emacs_mule_char P_ ((int, int (*) (int, Lisp_Object), |
217 Lisp_Object)); | 217 Lisp_Object)); |
218 | 218 |
219 static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object, | 219 static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object, |
220 Lisp_Object (*) (), int, | 220 Lisp_Object (*) (), int, |
221 Lisp_Object, Lisp_Object, | |
221 Lisp_Object, Lisp_Object)); | 222 Lisp_Object, Lisp_Object)); |
222 static Lisp_Object load_unwind P_ ((Lisp_Object)); | 223 static Lisp_Object load_unwind P_ ((Lisp_Object)); |
223 static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); | 224 static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); |
224 | 225 |
225 | 226 |
1095 specbind (Qinhibit_file_name_operation, Qnil); | 1096 specbind (Qinhibit_file_name_operation, Qnil); |
1096 load_descriptor_list | 1097 load_descriptor_list |
1097 = Fcons (make_number (fileno (stream)), load_descriptor_list); | 1098 = Fcons (make_number (fileno (stream)), load_descriptor_list); |
1098 load_in_progress++; | 1099 load_in_progress++; |
1099 if (! version || version >= 22) | 1100 if (! version || version >= 22) |
1100 readevalloop (Qget_file_char, stream, file, Feval, 0, Qnil, Qnil); | 1101 readevalloop (Qget_file_char, stream, file, Feval, |
1102 0, Qnil, Qnil, Qnil, Qnil); | |
1101 else | 1103 else |
1102 { | 1104 { |
1103 /* We can't handle a file which was compiled with | 1105 /* We can't handle a file which was compiled with |
1104 byte-compile-dynamic by older version of Emacs. */ | 1106 byte-compile-dynamic by older version of Emacs. */ |
1105 specbind (Qload_force_doc_strings, Qt); | 1107 specbind (Qload_force_doc_strings, Qt); |
1106 readevalloop (Qget_emacs_mule_file_char, stream, file, Feval, 0, | 1108 readevalloop (Qget_emacs_mule_file_char, stream, file, Feval, |
1107 Qnil, Qnil); | 1109 0, Qnil, Qnil, Qnil, Qnil); |
1108 } | 1110 } |
1109 unbind_to (count, Qnil); | 1111 unbind_to (count, Qnil); |
1110 | 1112 |
1111 /* Run any load-hooks for this file. */ | 1113 /* Run any load-hooks for this file. */ |
1112 temp = Fassoc (file, Vafter_load_alist); | 1114 temp = Fassoc (file, Vafter_load_alist); |
1481 Fsignal (Qend_of_file, data); | 1483 Fsignal (Qend_of_file, data); |
1482 } | 1484 } |
1483 | 1485 |
1484 /* UNIBYTE specifies how to set load_convert_to_unibyte | 1486 /* UNIBYTE specifies how to set load_convert_to_unibyte |
1485 for this invocation. | 1487 for this invocation. |
1486 READFUN, if non-nil, is used instead of `read'. */ | 1488 READFUN, if non-nil, is used instead of `read'. |
1489 START, END is region in current buffer (from eval-region). */ | |
1487 | 1490 |
1488 static void | 1491 static void |
1489 readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, readfun) | 1492 readevalloop (readcharfun, stream, sourcename, evalfun, |
1493 printflag, unibyte, readfun, start, end) | |
1490 Lisp_Object readcharfun; | 1494 Lisp_Object readcharfun; |
1491 FILE *stream; | 1495 FILE *stream; |
1492 Lisp_Object sourcename; | 1496 Lisp_Object sourcename; |
1493 Lisp_Object (*evalfun) (); | 1497 Lisp_Object (*evalfun) (); |
1494 int printflag; | 1498 int printflag; |
1495 Lisp_Object unibyte, readfun; | 1499 Lisp_Object unibyte, readfun; |
1500 Lisp_Object start, end; | |
1496 { | 1501 { |
1497 register int c; | 1502 register int c; |
1498 register Lisp_Object val; | 1503 register Lisp_Object val; |
1499 int count = SPECPDL_INDEX (); | 1504 int count = SPECPDL_INDEX (); |
1500 struct gcpro gcpro1; | 1505 struct gcpro gcpro1; |
1516 LOADHIST_ATTACH (sourcename); | 1521 LOADHIST_ATTACH (sourcename); |
1517 | 1522 |
1518 continue_reading_p = 1; | 1523 continue_reading_p = 1; |
1519 while (continue_reading_p) | 1524 while (continue_reading_p) |
1520 { | 1525 { |
1526 int count1 = SPECPDL_INDEX (); | |
1527 | |
1521 if (b != 0 && NILP (b->name)) | 1528 if (b != 0 && NILP (b->name)) |
1522 error ("Reading from killed buffer"); | 1529 error ("Reading from killed buffer"); |
1523 | 1530 |
1531 if (!NILP (start)) | |
1532 { | |
1533 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
1534 record_unwind_protect (save_restriction_restore, save_restriction_save ()); | |
1535 Fgoto_char (start); | |
1536 Fnarrow_to_region (make_number (BEGV), end); | |
1537 } | |
1538 | |
1524 instream = stream; | 1539 instream = stream; |
1540 read_next: | |
1525 c = READCHAR; | 1541 c = READCHAR; |
1526 if (c == ';') | 1542 if (c == ';') |
1527 { | 1543 { |
1528 while ((c = READCHAR) != '\n' && c != -1); | 1544 while ((c = READCHAR) != '\n' && c != -1); |
1529 continue; | 1545 goto read_next; |
1530 } | 1546 } |
1531 if (c < 0) break; | 1547 if (c < 0) |
1548 { | |
1549 unbind_to (count1, Qnil); | |
1550 break; | |
1551 } | |
1532 | 1552 |
1533 /* Ignore whitespace here, so we can detect eof. */ | 1553 /* Ignore whitespace here, so we can detect eof. */ |
1534 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r') | 1554 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r') |
1535 continue; | 1555 goto read_next; |
1536 | 1556 |
1537 if (!NILP (Vpurify_flag) && c == '(') | 1557 if (!NILP (Vpurify_flag) && c == '(') |
1538 { | 1558 { |
1539 int count1 = SPECPDL_INDEX (); | |
1540 record_unwind_protect (unreadpure, Qnil); | 1559 record_unwind_protect (unreadpure, Qnil); |
1541 val = read_list (-1, readcharfun); | 1560 val = read_list (-1, readcharfun); |
1542 unbind_to (count1, Qnil); | |
1543 } | 1561 } |
1544 else | 1562 else |
1545 { | 1563 { |
1546 UNREAD (c); | 1564 UNREAD (c); |
1547 read_objects = Qnil; | 1565 read_objects = Qnil; |
1563 val = call1 (Vload_read_function, readcharfun); | 1581 val = call1 (Vload_read_function, readcharfun); |
1564 else | 1582 else |
1565 val = read_internal_start (readcharfun, Qnil, Qnil); | 1583 val = read_internal_start (readcharfun, Qnil, Qnil); |
1566 } | 1584 } |
1567 | 1585 |
1586 if (!NILP (start) && continue_reading_p) | |
1587 start = Fpoint_marker (); | |
1588 unbind_to (count1, Qnil); | |
1589 | |
1568 val = (*evalfun) (val); | 1590 val = (*evalfun) (val); |
1569 | 1591 |
1570 if (printflag) | 1592 if (printflag) |
1571 { | 1593 { |
1572 Vvalues = Fcons (val, Vvalues); | 1594 Vvalues = Fcons (val, Vvalues); |
1621 filename = XBUFFER (buf)->filename; | 1643 filename = XBUFFER (buf)->filename; |
1622 | 1644 |
1623 specbind (Qstandard_output, tem); | 1645 specbind (Qstandard_output, tem); |
1624 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1646 record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
1625 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); | 1647 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); |
1626 readevalloop (buf, 0, filename, Feval, !NILP (printflag), unibyte, Qnil); | 1648 readevalloop (buf, 0, filename, Feval, |
1649 !NILP (printflag), unibyte, Qnil, Qnil, Qnil); | |
1627 unbind_to (count, Qnil); | 1650 unbind_to (count, Qnil); |
1628 | 1651 |
1629 return Qnil; | 1652 return Qnil; |
1630 } | 1653 } |
1631 | 1654 |
1653 tem = Qsymbolp; | 1676 tem = Qsymbolp; |
1654 else | 1677 else |
1655 tem = printflag; | 1678 tem = printflag; |
1656 specbind (Qstandard_output, tem); | 1679 specbind (Qstandard_output, tem); |
1657 | 1680 |
1658 if (NILP (printflag)) | 1681 /* readevalloop calls functions which check the type of start and end. */ |
1659 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
1660 record_unwind_protect (save_restriction_restore, save_restriction_save ()); | |
1661 | |
1662 /* This both uses start and checks its type. */ | |
1663 Fgoto_char (start); | |
1664 Fnarrow_to_region (make_number (BEGV), end); | |
1665 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, | 1682 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, |
1666 !NILP (printflag), Qnil, read_function); | 1683 !NILP (printflag), Qnil, read_function, |
1684 start, end); | |
1667 | 1685 |
1668 return unbind_to (count, Qnil); | 1686 return unbind_to (count, Qnil); |
1669 } | 1687 } |
1670 | 1688 |
1671 | 1689 |