Mercurial > hg > xemacs-beta
comparison src/lread.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | e04119814345 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
471 Vfile_domain = val; | 471 Vfile_domain = val; |
472 return Qnil; | 472 return Qnil; |
473 } | 473 } |
474 #endif /* I18N3 */ | 474 #endif /* I18N3 */ |
475 | 475 |
476 DEFUN ("load-internal", Fload_internal, Sload_internal, 1, 4, 0 /* | 476 DEFUN ("load-internal", Fload_internal, 1, 4, 0, /* |
477 Execute a file of Lisp code named FILE. | 477 Execute a file of Lisp code named FILE. |
478 First try FILE with `.elc' appended, then try with `.el', | 478 First try FILE with `.elc' appended, then try with `.el', |
479 then try FILE unmodified. | 479 then try FILE unmodified. |
480 This function searches the directories in `load-path'. | 480 This function searches the directories in `load-path'. |
481 If optional second arg NOERROR is non-nil, | 481 If optional second arg NOERROR is non-nil, |
483 Print messages at start and end of loading unless | 483 Print messages at start and end of loading unless |
484 optional third arg NOMESSAGE is non-nil (ignored in -batch mode). | 484 optional third arg NOMESSAGE is non-nil (ignored in -batch mode). |
485 If optional fourth arg NOSUFFIX is non-nil, don't try adding | 485 If optional fourth arg NOSUFFIX is non-nil, don't try adding |
486 suffixes `.elc' or `.el' to the specified name FILE. | 486 suffixes `.elc' or `.el' to the specified name FILE. |
487 Return t if file exists. | 487 Return t if file exists. |
488 */ ) | 488 */ |
489 (file, no_error, nomessage, nosuffix) | 489 (file, no_error, nomessage, nosuffix)) |
490 Lisp_Object file, no_error, nomessage, nosuffix; | |
491 { | 490 { |
492 /* This function can GC */ | 491 /* This function can GC */ |
493 int fd = -1; | 492 int fd = -1; |
494 int speccount = specpdl_depth (); | 493 int speccount = specpdl_depth (); |
495 int source_only = 0; | 494 int source_only = 0; |
725 #endif /* VMS */ | 724 #endif /* VMS */ |
726 ); | 725 ); |
727 } | 726 } |
728 #endif /* 0 */ | 727 #endif /* 0 */ |
729 | 728 |
730 DEFUN ("locate-file", Flocate_file, Slocate_file, 2, 4, 0 /* | 729 DEFUN ("locate-file", Flocate_file, 2, 4, 0, /* |
731 Search for FILENAME through PATH-LIST, expanded by one of the optional | 730 Search for FILENAME through PATH-LIST, expanded by one of the optional |
732 SUFFIXES (string of suffixes separated by \":\"s), checking for access | 731 SUFFIXES (string of suffixes separated by \":\"s), checking for access |
733 MODE (0|1|2|4 = exists|executable|writeable|readable), default readable. | 732 MODE (0|1|2|4 = exists|executable|writeable|readable), default readable. |
734 | 733 |
735 `locate-file' keeps hash tables of the directories it searches through, | 734 `locate-file' keeps hash tables of the directories it searches through, |
736 in order to speed things up. It tries valiantly to not get confused in | 735 in order to speed things up. It tries valiantly to not get confused in |
737 the face of a changing and unpredictable environment, but can occasionally | 736 the face of a changing and unpredictable environment, but can occasionally |
738 get tripped up. In this case, you will have to call | 737 get tripped up. In this case, you will have to call |
739 `locate-file-clear-hashing' to get it back on track. See that function | 738 `locate-file-clear-hashing' to get it back on track. See that function |
740 for details. | 739 for details. |
741 */ ) | 740 */ |
742 (filename, path_list, suffixes, mode) | 741 (filename, path_list, suffixes, mode)) |
743 Lisp_Object filename, path_list, suffixes, mode; | |
744 { | 742 { |
745 /* This function can GC */ | 743 /* This function can GC */ |
746 Lisp_Object tp; | 744 Lisp_Object tp; |
747 | 745 |
748 CHECK_STRING (filename); | 746 CHECK_STRING (filename); |
1056 | 1054 |
1057 UNGCPRO; | 1055 UNGCPRO; |
1058 return val; | 1056 return val; |
1059 } | 1057 } |
1060 | 1058 |
1061 DEFUN ("locate-file-clear-hashing", Flocate_file_clear_hashing, | 1059 DEFUN ("locate-file-clear-hashing", Flocate_file_clear_hashing, 1, 1, 0, /* |
1062 Slocate_file_clear_hashing, 1, 1, 0 /* | |
1063 Clear the hash records for the specified list of directories. | 1060 Clear the hash records for the specified list of directories. |
1064 `locate-file' uses a hashing scheme to speed lookup, and will correctly | 1061 `locate-file' uses a hashing scheme to speed lookup, and will correctly |
1065 track the following environmental changes: | 1062 track the following environmental changes: |
1066 | 1063 |
1067 -- changes of any sort to the list of directories to be searched. | 1064 -- changes of any sort to the list of directories to be searched. |
1070 -- byte-compilation of a .el file into a .elc file. | 1067 -- byte-compilation of a .el file into a .elc file. |
1071 | 1068 |
1072 `locate-file' will primarily get confused if you add a file that shadows | 1069 `locate-file' will primarily get confused if you add a file that shadows |
1073 (i.e. has the same name as) another file further down in the directory list. | 1070 (i.e. has the same name as) another file further down in the directory list. |
1074 In this case, you must call `locate-file-clear-hashing'. | 1071 In this case, you must call `locate-file-clear-hashing'. |
1075 */ ) | 1072 */ |
1076 (path) | 1073 (path)) |
1077 Lisp_Object path; | |
1078 { | 1074 { |
1079 Lisp_Object pathtail; | 1075 Lisp_Object pathtail; |
1080 | 1076 |
1081 for (pathtail = path; !NILP (pathtail); pathtail = Fcdr (pathtail)) | 1077 for (pathtail = path; !NILP (pathtail); pathtail = Fcdr (pathtail)) |
1082 { | 1078 { |
1259 unbind_to (speccount, Qnil); | 1255 unbind_to (speccount, Qnil); |
1260 } | 1256 } |
1261 | 1257 |
1262 #ifndef standalone | 1258 #ifndef standalone |
1263 | 1259 |
1264 DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 2, "bBuffer: " /* | 1260 DEFUN ("eval-buffer", Feval_buffer, 0, 2, "bBuffer: ", /* |
1265 Execute BUFFER as Lisp code. | 1261 Execute BUFFER as Lisp code. |
1266 Programs can pass two arguments, BUFFER and PRINTFLAG. | 1262 Programs can pass two arguments, BUFFER and PRINTFLAG. |
1267 BUFFER is the buffer to evaluate (nil means use current buffer). | 1263 BUFFER is the buffer to evaluate (nil means use current buffer). |
1268 PRINTFLAG controls printing of output: | 1264 PRINTFLAG controls printing of output: |
1269 nil means discard it; anything else is stream for print. | 1265 nil means discard it; anything else is stream for print. |
1270 | 1266 |
1271 If there is no error, point does not move. If there is an error, | 1267 If there is no error, point does not move. If there is an error, |
1272 point remains at the end of the last character read from the buffer. | 1268 point remains at the end of the last character read from the buffer. |
1273 Execute BUFFER as Lisp code. | 1269 Execute BUFFER as Lisp code. |
1274 */ ) | 1270 */ |
1275 (bufname, printflag) | 1271 (bufname, printflag)) |
1276 Lisp_Object bufname, printflag; | |
1277 { | 1272 { |
1278 /* This function can GC */ | 1273 /* This function can GC */ |
1279 int speccount = specpdl_depth (); | 1274 int speccount = specpdl_depth (); |
1280 Lisp_Object tem, buf; | 1275 Lisp_Object tem, buf; |
1281 | 1276 |
1313 { | 1308 { |
1314 code omitted; | 1309 code omitted; |
1315 } | 1310 } |
1316 #endif | 1311 #endif |
1317 | 1312 |
1318 DEFUN ("eval-region", Feval_region, Seval_region, 2, 3, "r" /* | 1313 DEFUN ("eval-region", Feval_region, 2, 3, "r", /* |
1319 Execute the region as Lisp code. | 1314 Execute the region as Lisp code. |
1320 When called from programs, expects two arguments, | 1315 When called from programs, expects two arguments, |
1321 giving starting and ending indices in the current buffer | 1316 giving starting and ending indices in the current buffer |
1322 of the text to be executed. | 1317 of the text to be executed. |
1323 Programs can pass third argument PRINTFLAG which controls output: | 1318 Programs can pass third argument PRINTFLAG which controls output: |
1327 point remains at the end of the last character read from the buffer. | 1322 point remains at the end of the last character read from the buffer. |
1328 | 1323 |
1329 Note: Before evaling the region, this function narrows the buffer to it. | 1324 Note: Before evaling the region, this function narrows the buffer to it. |
1330 If the code being eval'd should happen to trigger a redisplay you may | 1325 If the code being eval'd should happen to trigger a redisplay you may |
1331 see some text temporarily disappear because of this. | 1326 see some text temporarily disappear because of this. |
1332 */ ) | 1327 */ |
1333 (b, e, printflag) | 1328 (b, e, printflag)) |
1334 Lisp_Object b, e, printflag; | |
1335 { | 1329 { |
1336 /* This function can GC */ | 1330 /* This function can GC */ |
1337 int speccount = specpdl_depth (); | 1331 int speccount = specpdl_depth (); |
1338 Lisp_Object tem; | 1332 Lisp_Object tem; |
1339 Lisp_Object cbuf = Fcurrent_buffer (); | 1333 Lisp_Object cbuf = Fcurrent_buffer (); |
1357 return unbind_to (speccount, Qnil); | 1351 return unbind_to (speccount, Qnil); |
1358 } | 1352 } |
1359 | 1353 |
1360 #endif /* standalone */ | 1354 #endif /* standalone */ |
1361 | 1355 |
1362 DEFUN ("read", Fread, Sread, 0, 1, 0 /* | 1356 DEFUN ("read", Fread, 0, 1, 0, /* |
1363 Read one Lisp expression as text from STREAM, return as Lisp object. | 1357 Read one Lisp expression as text from STREAM, return as Lisp object. |
1364 If STREAM is nil, use the value of `standard-input' (which see). | 1358 If STREAM is nil, use the value of `standard-input' (which see). |
1365 STREAM or the value of `standard-input' may be: | 1359 STREAM or the value of `standard-input' may be: |
1366 a buffer (read from point and advance it) | 1360 a buffer (read from point and advance it) |
1367 a marker (read from where it points and advance it) | 1361 a marker (read from where it points and advance it) |
1368 a function (call it with no arguments for each character, | 1362 a function (call it with no arguments for each character, |
1369 call it with a char as argument to push a char back) | 1363 call it with a char as argument to push a char back) |
1370 a string (takes text from string, starting at the beginning) | 1364 a string (takes text from string, starting at the beginning) |
1371 t (read text line using minibuffer and use it). | 1365 t (read text line using minibuffer and use it). |
1372 */ ) | 1366 */ |
1373 (stream) | 1367 (stream)) |
1374 Lisp_Object stream; | |
1375 { | 1368 { |
1376 if (NILP (stream)) | 1369 if (NILP (stream)) |
1377 stream = Vstandard_input; | 1370 stream = Vstandard_input; |
1378 if (EQ (stream, Qt)) | 1371 if (EQ (stream, Qt)) |
1379 stream = Qread_char; | 1372 stream = Qread_char; |
1394 return Fcar (Fread_from_string (stream, Qnil, Qnil)); | 1387 return Fcar (Fread_from_string (stream, Qnil, Qnil)); |
1395 | 1388 |
1396 return read0 (stream); | 1389 return read0 (stream); |
1397 } | 1390 } |
1398 | 1391 |
1399 DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0 /* | 1392 DEFUN ("read-from-string", Fread_from_string, 1, 3, 0, /* |
1400 Read one Lisp expression which is represented as text by STRING. | 1393 Read one Lisp expression which is represented as text by STRING. |
1401 Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). | 1394 Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). |
1402 START and END optionally delimit a substring of STRING from which to read; | 1395 START and END optionally delimit a substring of STRING from which to read; |
1403 they default to 0 and (length STRING) respectively. | 1396 they default to 0 and (length STRING) respectively. |
1404 */ ) | 1397 */ |
1405 (string, start, end) | 1398 (string, start, end)) |
1406 Lisp_Object string, start, end; | |
1407 { | 1399 { |
1408 Bytecount startval, endval; | 1400 Bytecount startval, endval; |
1409 Lisp_Object tem; | 1401 Lisp_Object tem; |
1410 Lisp_Object lispstream = Qnil; | 1402 Lisp_Object lispstream = Qnil; |
1411 struct gcpro gcpro1; | 1403 struct gcpro gcpro1; |
2852 } | 2844 } |
2853 | 2845 |
2854 void | 2846 void |
2855 syms_of_lread (void) | 2847 syms_of_lread (void) |
2856 { | 2848 { |
2857 defsubr (&Sread); | 2849 DEFSUBR (Fread); |
2858 defsubr (&Sread_from_string); | 2850 DEFSUBR (Fread_from_string); |
2859 defsubr (&Sload_internal); | 2851 DEFSUBR (Fload_internal); |
2860 defsubr (&Slocate_file); | 2852 DEFSUBR (Flocate_file); |
2861 defsubr (&Slocate_file_clear_hashing); | 2853 DEFSUBR (Flocate_file_clear_hashing); |
2862 defsubr (&Seval_buffer); | 2854 DEFSUBR (Feval_buffer); |
2863 defsubr (&Seval_region); | 2855 DEFSUBR (Feval_region); |
2864 #ifdef standalone | 2856 #ifdef standalone |
2865 defsubr (&Sread_char); | 2857 DEFSUBR (Fread_char); |
2866 #endif | 2858 #endif |
2867 | 2859 |
2868 defsymbol (&Qstandard_input, "standard-input"); | 2860 defsymbol (&Qstandard_input, "standard-input"); |
2869 defsymbol (&Qread_char, "read-char"); | 2861 defsymbol (&Qread_char, "read-char"); |
2870 defsymbol (&Qcurrent_load_list, "current-load-list"); | 2862 defsymbol (&Qcurrent_load_list, "current-load-list"); |