aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-04-11 12:40:15 +0000
committerKaroly Lorentey2005-04-11 12:40:15 +0000
commit221d5c8772dc29f854292ec7cb423fce925daecf (patch)
tree5fe05145ce31ffcc9d1a621c027410151e4a2106 /src/lread.c
parent1b9ab2508610fea57aa777956de14ee84d66862f (diff)
parent9552bee8c6e7c5ee16ca60cddebaebdf5d238e05 (diff)
downloademacs-221d5c8772dc29f854292ec7cb423fce925daecf.tar.gz
emacs-221d5c8772dc29f854292ec7cb423fce925daecf.zip
Merged from miles@gnu.org--gnu-2005 (patch 59, 240-245)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-240 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-241 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-242 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-243 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-244 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-245 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-59 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-326
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/src/lread.c b/src/lread.c
index 5b5ea478a16..d36d45c8c7d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -194,7 +194,7 @@ static int new_backquote_flag;
194/* A list of file names for files being loaded in Fload. Used to 194/* A list of file names for files being loaded in Fload. Used to
195 check for recursive loads. */ 195 check for recursive loads. */
196 196
197static Lisp_Object Vloads_in_progress; 197Lisp_Object Vloads_in_progress;
198 198
199/* Non-zero means load dangerous compiled Lisp files. */ 199/* Non-zero means load dangerous compiled Lisp files. */
200 200
@@ -207,6 +207,7 @@ static Lisp_Object Vbytecomp_version_regexp;
207static void to_multibyte P_ ((char **, char **, int *)); 207static void to_multibyte P_ ((char **, char **, int *));
208static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object, 208static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,
209 Lisp_Object (*) (), int, 209 Lisp_Object (*) (), int,
210 Lisp_Object, Lisp_Object,
210 Lisp_Object, Lisp_Object)); 211 Lisp_Object, Lisp_Object));
211static Lisp_Object load_unwind P_ ((Lisp_Object)); 212static Lisp_Object load_unwind P_ ((Lisp_Object));
212static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); 213static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object));
@@ -913,7 +914,8 @@ Return t if file exists. */)
913 load_descriptor_list 914 load_descriptor_list
914 = Fcons (make_number (fileno (stream)), load_descriptor_list); 915 = Fcons (make_number (fileno (stream)), load_descriptor_list);
915 load_in_progress++; 916 load_in_progress++;
916 readevalloop (Qget_file_char, stream, file, Feval, 0, Qnil, Qnil); 917 readevalloop (Qget_file_char, stream, file, Feval,
918 0, Qnil, Qnil, Qnil, Qnil);
917 unbind_to (count, Qnil); 919 unbind_to (count, Qnil);
918 920
919 /* Run any load-hooks for this file. */ 921 /* Run any load-hooks for this file. */
@@ -1291,16 +1293,19 @@ end_of_file_error ()
1291 1293
1292/* UNIBYTE specifies how to set load_convert_to_unibyte 1294/* UNIBYTE specifies how to set load_convert_to_unibyte
1293 for this invocation. 1295 for this invocation.
1294 READFUN, if non-nil, is used instead of `read'. */ 1296 READFUN, if non-nil, is used instead of `read'.
1297 START, END is region in current buffer (from eval-region). */
1295 1298
1296static void 1299static void
1297readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, readfun) 1300readevalloop (readcharfun, stream, sourcename, evalfun,
1301 printflag, unibyte, readfun, start, end)
1298 Lisp_Object readcharfun; 1302 Lisp_Object readcharfun;
1299 FILE *stream; 1303 FILE *stream;
1300 Lisp_Object sourcename; 1304 Lisp_Object sourcename;
1301 Lisp_Object (*evalfun) (); 1305 Lisp_Object (*evalfun) ();
1302 int printflag; 1306 int printflag;
1303 Lisp_Object unibyte, readfun; 1307 Lisp_Object unibyte, readfun;
1308 Lisp_Object start, end;
1304{ 1309{
1305 register int c; 1310 register int c;
1306 register Lisp_Object val; 1311 register Lisp_Object val;
@@ -1328,28 +1333,41 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read
1328 continue_reading_p = 1; 1333 continue_reading_p = 1;
1329 while (continue_reading_p) 1334 while (continue_reading_p)
1330 { 1335 {
1336 int count1 = SPECPDL_INDEX ();
1337
1331 if (b != 0 && NILP (b->name)) 1338 if (b != 0 && NILP (b->name))
1332 error ("Reading from killed buffer"); 1339 error ("Reading from killed buffer");
1333 1340
1341 if (!NILP (start))
1342 {
1343 record_unwind_protect (save_excursion_restore, save_excursion_save ());
1344 record_unwind_protect (save_restriction_restore, save_restriction_save ());
1345 Fgoto_char (start);
1346 Fnarrow_to_region (make_number (BEGV), end);
1347 }
1348
1334 instream = stream; 1349 instream = stream;
1350 read_next:
1335 c = READCHAR; 1351 c = READCHAR;
1336 if (c == ';') 1352 if (c == ';')
1337 { 1353 {
1338 while ((c = READCHAR) != '\n' && c != -1); 1354 while ((c = READCHAR) != '\n' && c != -1);
1339 continue; 1355 goto read_next;
1356 }
1357 if (c < 0)
1358 {
1359 unbind_to (count1, Qnil);
1360 break;
1340 } 1361 }
1341 if (c < 0) break;
1342 1362
1343 /* Ignore whitespace here, so we can detect eof. */ 1363 /* Ignore whitespace here, so we can detect eof. */
1344 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r') 1364 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r')
1345 continue; 1365 goto read_next;
1346 1366
1347 if (!NILP (Vpurify_flag) && c == '(') 1367 if (!NILP (Vpurify_flag) && c == '(')
1348 { 1368 {
1349 int count1 = SPECPDL_INDEX ();
1350 record_unwind_protect (unreadpure, Qnil); 1369 record_unwind_protect (unreadpure, Qnil);
1351 val = read_list (-1, readcharfun); 1370 val = read_list (-1, readcharfun);
1352 unbind_to (count1, Qnil);
1353 } 1371 }
1354 else 1372 else
1355 { 1373 {
@@ -1375,6 +1393,10 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read
1375 val = read_internal_start (readcharfun, Qnil, Qnil); 1393 val = read_internal_start (readcharfun, Qnil, Qnil);
1376 } 1394 }
1377 1395
1396 if (!NILP (start) && continue_reading_p)
1397 start = Fpoint_marker ();
1398 unbind_to (count1, Qnil);
1399
1378 val = (*evalfun) (val); 1400 val = (*evalfun) (val);
1379 1401
1380 if (printflag) 1402 if (printflag)
@@ -1433,7 +1455,8 @@ This function preserves the position of point. */)
1433 specbind (Qstandard_output, tem); 1455 specbind (Qstandard_output, tem);
1434 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 1456 record_unwind_protect (save_excursion_restore, save_excursion_save ());
1435 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); 1457 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
1436 readevalloop (buf, 0, filename, Feval, !NILP (printflag), unibyte, Qnil); 1458 readevalloop (buf, 0, filename, Feval,
1459 !NILP (printflag), unibyte, Qnil, Qnil, Qnil);
1437 unbind_to (count, Qnil); 1460 unbind_to (count, Qnil);
1438 1461
1439 return Qnil; 1462 return Qnil;
@@ -1465,15 +1488,10 @@ This function does not move point. */)
1465 tem = printflag; 1488 tem = printflag;
1466 specbind (Qstandard_output, tem); 1489 specbind (Qstandard_output, tem);
1467 1490
1468 if (NILP (printflag)) 1491 /* readevalloop calls functions which check the type of start and end. */
1469 record_unwind_protect (save_excursion_restore, save_excursion_save ());
1470 record_unwind_protect (save_restriction_restore, save_restriction_save ());
1471
1472 /* This both uses start and checks its type. */
1473 Fgoto_char (start);
1474 Fnarrow_to_region (make_number (BEGV), end);
1475 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, 1492 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval,
1476 !NILP (printflag), Qnil, read_function); 1493 !NILP (printflag), Qnil, read_function,
1494 start, end);
1477 1495
1478 return unbind_to (count, Qnil); 1496 return unbind_to (count, Qnil);
1479} 1497}