diff options
| author | Gerd Moellmann | 2000-04-27 10:48:11 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-04-27 10:48:11 +0000 |
| commit | 9c97398c329025f3692aacb9c19f94d6d3cfcda2 (patch) | |
| tree | 5e0b3650e5bfb183bed16d1655bd2eba5be00d27 /src/lread.c | |
| parent | c02279de381400c639e33fe89f138f761b8a8fcb (diff) | |
| download | emacs-9c97398c329025f3692aacb9c19f94d6d3cfcda2.tar.gz emacs-9c97398c329025f3692aacb9c19f94d6d3cfcda2.zip | |
(end_of_file_error): New function.
(read1): Call it instead of signaling `end-of-file' directly.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c index c1d4dced48b..3235be321d7 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1111,6 +1111,22 @@ readevalloop_1 (old) | |||
| 1111 | return Qnil; | 1111 | return Qnil; |
| 1112 | } | 1112 | } |
| 1113 | 1113 | ||
| 1114 | /* Signal an `end-of-file' error, if possible with file name | ||
| 1115 | information. */ | ||
| 1116 | |||
| 1117 | static void | ||
| 1118 | end_of_file_error () | ||
| 1119 | { | ||
| 1120 | Lisp_Object data; | ||
| 1121 | |||
| 1122 | if (STRINGP (Vload_file_name)) | ||
| 1123 | data = Fcons (Vload_file_name, Qnil); | ||
| 1124 | else | ||
| 1125 | data = Qnil; | ||
| 1126 | |||
| 1127 | Fsignal (Qend_of_file, data); | ||
| 1128 | } | ||
| 1129 | |||
| 1114 | /* UNIBYTE specifies how to set load_convert_to_unibyte | 1130 | /* UNIBYTE specifies how to set load_convert_to_unibyte |
| 1115 | for this invocation. | 1131 | for this invocation. |
| 1116 | READFUN, if non-nil, is used instead of `read'. */ | 1132 | READFUN, if non-nil, is used instead of `read'. */ |
| @@ -1691,7 +1707,8 @@ read1 (readcharfun, pch, first_in_list) | |||
| 1691 | retry: | 1707 | retry: |
| 1692 | 1708 | ||
| 1693 | c = READCHAR; | 1709 | c = READCHAR; |
| 1694 | if (c < 0) return Fsignal (Qend_of_file, Qnil); | 1710 | if (c < 0) |
| 1711 | end_of_file_error (); | ||
| 1695 | 1712 | ||
| 1696 | switch (c) | 1713 | switch (c) |
| 1697 | { | 1714 | { |
| @@ -2009,7 +2026,8 @@ read1 (readcharfun, pch, first_in_list) | |||
| 2009 | case '?': | 2026 | case '?': |
| 2010 | { | 2027 | { |
| 2011 | c = READCHAR; | 2028 | c = READCHAR; |
| 2012 | if (c < 0) return Fsignal (Qend_of_file, Qnil); | 2029 | if (c < 0) |
| 2030 | end_of_file_error (); | ||
| 2013 | 2031 | ||
| 2014 | if (c == '\\') | 2032 | if (c == '\\') |
| 2015 | c = read_escape (readcharfun, 0); | 2033 | c = read_escape (readcharfun, 0); |
| @@ -2097,7 +2115,7 @@ read1 (readcharfun, pch, first_in_list) | |||
| 2097 | } | 2115 | } |
| 2098 | } | 2116 | } |
| 2099 | if (c < 0) | 2117 | if (c < 0) |
| 2100 | return Fsignal (Qend_of_file, Qnil); | 2118 | end_of_file_error (); |
| 2101 | 2119 | ||
| 2102 | /* If purifying, and string starts with \ newline, | 2120 | /* If purifying, and string starts with \ newline, |
| 2103 | return zero instead. This is for doc strings | 2121 | return zero instead. This is for doc strings |