1 /* Lisp parsing and input streams.
2 Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 1999
3 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
25 #include <sys/types.h>
30 #include "intervals.h"
36 #include "termhooks.h"
39 #include <sys/inode.h>
44 #include <unistd.h> /* to get X_OK */
61 #endif /* HAVE_SETLOCALE */
68 #define file_offset off_t
69 #define file_tell ftello
71 #define file_offset long
72 #define file_tell ftell
77 Lisp_Object Qread_char
, Qget_file_char
, Qstandard_input
, Qcurrent_load_list
;
78 Lisp_Object Qvariable_documentation
, Vvalues
, Vstandard_input
, Vafter_load_alist
;
79 Lisp_Object Qascii_character
, Qload
, Qload_file_name
;
80 Lisp_Object Qbackquote
, Qcomma
, Qcomma_at
, Qcomma_dot
, Qfunction
;
81 Lisp_Object Qinhibit_file_name_operation
;
83 extern Lisp_Object Qevent_symbol_element_mask
;
84 extern Lisp_Object Qfile_exists_p
;
86 /* non-zero if inside `load' */
89 /* Directory in which the sources were found. */
90 Lisp_Object Vsource_directory
;
92 /* Search path for files to be loaded. */
93 Lisp_Object Vload_path
;
95 /* File name of user's init file. */
96 Lisp_Object Vuser_init_file
;
98 /* This is the user-visible association list that maps features to
99 lists of defs in their load files. */
100 Lisp_Object Vload_history
;
102 /* This is used to build the load history. */
103 Lisp_Object Vcurrent_load_list
;
105 /* List of files that were preloaded. */
106 Lisp_Object Vpreloaded_file_list
;
108 /* Name of file actually being read by `load'. */
109 Lisp_Object Vload_file_name
;
111 /* Function to use for reading, in `load' and friends. */
112 Lisp_Object Vload_read_function
;
114 /* The association list of objects read with the #n=object form.
115 Each member of the list has the form (n . object), and is used to
116 look up the object for the corresponding #n# construct.
117 It must be set to nil before all top-level calls to read0. */
118 Lisp_Object read_objects
;
120 /* Nonzero means load should forcibly load all dynamic doc strings. */
121 static int load_force_doc_strings
;
123 /* Nonzero means read should convert strings to unibyte. */
124 static int load_convert_to_unibyte
;
126 /* Function to use for loading an Emacs lisp source file (not
127 compiled) instead of readevalloop. */
128 Lisp_Object Vload_source_file_function
;
130 /* List of all DEFVAR_BOOL variables. Used by the byte optimizer. */
131 Lisp_Object Vbyte_boolean_vars
;
133 /* List of descriptors now open for Fload. */
134 static Lisp_Object load_descriptor_list
;
136 /* File for get_file_char to read from. Use by load. */
137 static FILE *instream
;
139 /* When nonzero, read conses in pure space */
140 static int read_pure
;
142 /* For use within read-from-string (this reader is non-reentrant!!) */
143 static int read_from_string_index
;
144 static int read_from_string_index_byte
;
145 static int read_from_string_limit
;
147 /* Number of bytes left to read in the buffer character
148 that `readchar' has already advanced over. */
149 static int readchar_backlog
;
151 /* This contains the last string skipped with #@. */
152 static char *saved_doc_string
;
153 /* Length of buffer allocated in saved_doc_string. */
154 static int saved_doc_string_size
;
155 /* Length of actual data in saved_doc_string. */
156 static int saved_doc_string_length
;
157 /* This is the file position that string came from. */
158 static file_offset saved_doc_string_position
;
160 /* This contains the previous string skipped with #@.
161 We copy it from saved_doc_string when a new string
162 is put in saved_doc_string. */
163 static char *prev_saved_doc_string
;
164 /* Length of buffer allocated in prev_saved_doc_string. */
165 static int prev_saved_doc_string_size
;
166 /* Length of actual data in prev_saved_doc_string. */
167 static int prev_saved_doc_string_length
;
168 /* This is the file position that string came from. */
169 static file_offset prev_saved_doc_string_position
;
171 /* Nonzero means inside a new-style backquote
172 with no surrounding parentheses.
173 Fread initializes this to zero, so we need not specbind it
174 or worry about what happens to it when there is an error. */
175 static int new_backquote_flag
;
177 /* Handle unreading and rereading of characters.
178 Write READCHAR to read a character,
179 UNREAD(c) to unread c to be read again.
181 These macros actually read/unread a byte code, multibyte characters
182 are not handled here. The caller should manage them if necessary.
185 #define READCHAR readchar (readcharfun)
186 #define UNREAD(c) unreadchar (readcharfun, c)
189 readchar (readcharfun
)
190 Lisp_Object readcharfun
;
195 if (BUFFERP (readcharfun
))
197 register struct buffer
*inbuffer
= XBUFFER (readcharfun
);
199 int pt_byte
= BUF_PT_BYTE (inbuffer
);
200 int orig_pt_byte
= pt_byte
;
202 if (readchar_backlog
> 0)
203 /* We get the address of the byte just passed,
204 which is the last byte of the character.
205 The other bytes in this character are consecutive with it,
206 because the gap can't be in the middle of a character. */
207 return *(BUF_BYTE_ADDRESS (inbuffer
, BUF_PT_BYTE (inbuffer
) - 1)
208 - --readchar_backlog
);
210 if (pt_byte
>= BUF_ZV_BYTE (inbuffer
))
213 readchar_backlog
= -1;
215 if (! NILP (inbuffer
->enable_multibyte_characters
))
217 /* Fetch the character code from the buffer. */
218 unsigned char *p
= BUF_BYTE_ADDRESS (inbuffer
, pt_byte
);
219 BUF_INC_POS (inbuffer
, pt_byte
);
220 c
= STRING_CHAR (p
, pt_byte
- orig_pt_byte
);
224 c
= BUF_FETCH_BYTE (inbuffer
, pt_byte
);
227 SET_BUF_PT_BOTH (inbuffer
, BUF_PT (inbuffer
) + 1, pt_byte
);
231 if (MARKERP (readcharfun
))
233 register struct buffer
*inbuffer
= XMARKER (readcharfun
)->buffer
;
235 int bytepos
= marker_byte_position (readcharfun
);
236 int orig_bytepos
= bytepos
;
238 if (readchar_backlog
> 0)
239 /* We get the address of the byte just passed,
240 which is the last byte of the character.
241 The other bytes in this character are consecutive with it,
242 because the gap can't be in the middle of a character. */
243 return *(BUF_BYTE_ADDRESS (inbuffer
, XMARKER (readcharfun
)->bytepos
- 1)
244 - --readchar_backlog
);
246 if (bytepos
>= BUF_ZV_BYTE (inbuffer
))
249 readchar_backlog
= -1;
251 if (! NILP (inbuffer
->enable_multibyte_characters
))
253 /* Fetch the character code from the buffer. */
254 unsigned char *p
= BUF_BYTE_ADDRESS (inbuffer
, bytepos
);
255 BUF_INC_POS (inbuffer
, bytepos
);
256 c
= STRING_CHAR (p
, bytepos
- orig_bytepos
);
260 c
= BUF_FETCH_BYTE (inbuffer
, bytepos
);
264 XMARKER (readcharfun
)->bytepos
= bytepos
;
265 XMARKER (readcharfun
)->charpos
++;
270 if (EQ (readcharfun
, Qlambda
))
271 return read_bytecode_char (0);
273 if (EQ (readcharfun
, Qget_file_char
))
277 /* Interrupted reads have been observed while reading over the network */
278 while (c
== EOF
&& ferror (instream
) && errno
== EINTR
)
287 if (STRINGP (readcharfun
))
289 if (read_from_string_index
>= read_from_string_limit
)
292 FETCH_STRING_CHAR_ADVANCE (c
, readcharfun
,
293 read_from_string_index
,
294 read_from_string_index_byte
);
299 tem
= call0 (readcharfun
);
306 /* Unread the character C in the way appropriate for the stream READCHARFUN.
307 If the stream is a user function, call it with the char as argument. */
310 unreadchar (readcharfun
, c
)
311 Lisp_Object readcharfun
;
315 /* Don't back up the pointer if we're unreading the end-of-input mark,
316 since readchar didn't advance it when we read it. */
318 else if (BUFFERP (readcharfun
))
320 struct buffer
*b
= XBUFFER (readcharfun
);
321 int bytepos
= BUF_PT_BYTE (b
);
323 if (readchar_backlog
>= 0)
328 if (! NILP (b
->enable_multibyte_characters
))
329 BUF_DEC_POS (b
, bytepos
);
333 BUF_PT_BYTE (b
) = bytepos
;
336 else if (MARKERP (readcharfun
))
338 struct buffer
*b
= XMARKER (readcharfun
)->buffer
;
339 int bytepos
= XMARKER (readcharfun
)->bytepos
;
341 if (readchar_backlog
>= 0)
345 XMARKER (readcharfun
)->charpos
--;
346 if (! NILP (b
->enable_multibyte_characters
))
347 BUF_DEC_POS (b
, bytepos
);
351 XMARKER (readcharfun
)->bytepos
= bytepos
;
354 else if (STRINGP (readcharfun
))
356 read_from_string_index
--;
357 read_from_string_index_byte
358 = string_char_to_byte (readcharfun
, read_from_string_index
);
360 else if (EQ (readcharfun
, Qlambda
))
361 read_bytecode_char (1);
362 else if (EQ (readcharfun
, Qget_file_char
))
363 ungetc (c
, instream
);
365 call1 (readcharfun
, make_number (c
));
368 static Lisp_Object
read0 (), read1 (), read_list (), read_vector ();
369 static int read_multibyte ();
370 static Lisp_Object
substitute_object_recurse ();
371 static void substitute_object_in_subtree (), substitute_in_interval ();
374 /* Get a character from the tty. */
376 extern Lisp_Object
read_char ();
378 /* Read input events until we get one that's acceptable for our purposes.
380 If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed
381 until we get a character we like, and then stuffed into
384 If ASCII_REQUIRED is non-zero, we check function key events to see
385 if the unmodified version of the symbol has a Qascii_character
386 property, and use that character, if present.
388 If ERROR_NONASCII is non-zero, we signal an error if the input we
389 get isn't an ASCII character with modifiers. If it's zero but
390 ASCII_REQUIRED is non-zero, we just re-read until we get an ASCII
393 If INPUT_METHOD is nonzero, we invoke the current input method
394 if the character warrants that. */
397 read_filtered_event (no_switch_frame
, ascii_required
, error_nonascii
,
399 int no_switch_frame
, ascii_required
, error_nonascii
, input_method
;
401 register Lisp_Object val
, delayed_switch_frame
;
403 #ifdef HAVE_WINDOW_SYSTEM
404 if (display_busy_cursor_p
)
405 cancel_busy_cursor ();
408 delayed_switch_frame
= Qnil
;
410 /* Read until we get an acceptable event. */
412 val
= read_char (0, 0, 0,
413 (input_method
? Qnil
: Qt
),
419 /* switch-frame events are put off until after the next ASCII
420 character. This is better than signaling an error just because
421 the last characters were typed to a separate minibuffer frame,
422 for example. Eventually, some code which can deal with
423 switch-frame events will read it and process it. */
425 && EVENT_HAS_PARAMETERS (val
)
426 && EQ (EVENT_HEAD (val
), Qswitch_frame
))
428 delayed_switch_frame
= val
;
434 /* Convert certain symbols to their ASCII equivalents. */
437 Lisp_Object tem
, tem1
;
438 tem
= Fget (val
, Qevent_symbol_element_mask
);
441 tem1
= Fget (Fcar (tem
), Qascii_character
);
442 /* Merge this symbol's modifier bits
443 with the ASCII equivalent of its basic code. */
445 XSETFASTINT (val
, XINT (tem1
) | XINT (Fcar (Fcdr (tem
))));
449 /* If we don't have a character now, deal with it appropriately. */
454 Vunread_command_events
= Fcons (val
, Qnil
);
455 error ("Non-character input-event");
462 if (! NILP (delayed_switch_frame
))
463 unread_switch_frame
= delayed_switch_frame
;
465 #ifdef HAVE_WINDOW_SYSTEM
466 if (display_busy_cursor_p
)
467 start_busy_cursor ();
472 DEFUN ("read-char", Fread_char
, Sread_char
, 0, 2, 0,
473 "Read a character from the command input (keyboard or macro).\n\
474 It is returned as a number.\n\
475 If the user generates an event which is not a character (i.e. a mouse\n\
476 click or function key event), `read-char' signals an error. As an\n\
477 exception, switch-frame events are put off until non-ASCII events can\n\
479 If you want to read non-character events, or ignore them, call\n\
480 `read-event' or `read-char-exclusive' instead.\n\
482 If the optional argument PROMPT is non-nil, display that as a prompt.\n\
483 If the optional argument INHERIT-INPUT-METHOD is non-nil and some\n\
484 input method is turned on in the current buffer, that input method\n\
485 is used for reading a character.")
486 (prompt
, inherit_input_method
)
487 Lisp_Object prompt
, inherit_input_method
;
490 message_with_string ("%s", prompt
, 0);
491 return read_filtered_event (1, 1, 1, ! NILP (inherit_input_method
));
494 DEFUN ("read-event", Fread_event
, Sread_event
, 0, 2, 0,
495 "Read an event object from the input stream.\n\
496 If the optional argument PROMPT is non-nil, display that as a prompt.\n\
497 If the optional argument INHERIT-INPUT-METHOD is non-nil and some\n\
498 input method is turned on in the current buffer, that input method\n\
499 is used for reading a character.")
500 (prompt
, inherit_input_method
)
501 Lisp_Object prompt
, inherit_input_method
;
504 message_with_string ("%s", prompt
, 0);
505 return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method
));
508 DEFUN ("read-char-exclusive", Fread_char_exclusive
, Sread_char_exclusive
, 0, 2, 0,
509 "Read a character from the command input (keyboard or macro).\n\
510 It is returned as a number. Non-character events are ignored.\n\
512 If the optional argument PROMPT is non-nil, display that as a prompt.\n\
513 If the optional argument INHERIT-INPUT-METHOD is non-nil and some\n\
514 input method is turned on in the current buffer, that input method\n\
515 is used for reading a character.")
516 (prompt
, inherit_input_method
)
517 Lisp_Object prompt
, inherit_input_method
;
520 message_with_string ("%s", prompt
, 0);
521 return read_filtered_event (1, 1, 0, ! NILP (inherit_input_method
));
524 DEFUN ("get-file-char", Fget_file_char
, Sget_file_char
, 0, 0, 0,
525 "Don't use this yourself.")
528 register Lisp_Object val
;
529 XSETINT (val
, getc (instream
));
533 static void readevalloop ();
534 static Lisp_Object
load_unwind ();
535 static Lisp_Object
load_descriptor_unwind ();
537 /* Non-zero means load dangerous compiled Lisp files. */
539 int load_dangerous_libraries
;
541 /* A regular expression used to detect files compiled with Emacs. */
543 static Lisp_Object Vbytecomp_version_regexp
;
546 /* Value is non-zero if the file asswociated with file descriptor FD
547 is a compiled Lisp file that's safe to load. Only files compiled
548 with Emacs are safe to load. Files compiled with XEmacs can lead
549 to a crash in Fbyte_code because of an incompatible change in the
560 /* Read the first few bytes from the file, and look for a line
561 specifying the byte compiler version used. */
562 nbytes
= emacs_read (fd
, buf
, sizeof buf
- 1);
567 /* Skip to the next newline, skipping over the initial `ELC'
568 with NUL bytes following it. */
569 for (i
= 0; i
< nbytes
&& buf
[i
] != '\n'; ++i
)
573 && fast_c_string_match_ignore_case (Vbytecomp_version_regexp
,
578 lseek (fd
, 0, SEEK_SET
);
583 DEFUN ("load", Fload
, Sload
, 1, 5, 0,
584 "Execute a file of Lisp code named FILE.\n\
585 First try FILE with `.elc' appended, then try with `.el',\n\
586 then try FILE unmodified.\n\
587 This function searches the directories in `load-path'.\n\
588 If optional second arg NOERROR is non-nil,\n\
589 report no error if FILE doesn't exist.\n\
590 Print messages at start and end of loading unless\n\
591 optional third arg NOMESSAGE is non-nil.\n\
592 If optional fourth arg NOSUFFIX is non-nil, don't try adding\n\
593 suffixes `.elc' or `.el' to the specified name FILE.\n\
594 If optional fifth arg MUST-SUFFIX is non-nil, insist on\n\
595 the suffix `.elc' or `.el'; don't accept just FILE unless\n\
596 it ends in one of those suffixes or includes a directory name.\n\
597 Return t if file exists.")
598 (file
, noerror
, nomessage
, nosuffix
, must_suffix
)
599 Lisp_Object file
, noerror
, nomessage
, nosuffix
, must_suffix
;
601 register FILE *stream
;
602 register int fd
= -1;
603 register Lisp_Object lispstream
;
604 int count
= specpdl_ptr
- specpdl
;
608 /* 1 means we printed the ".el is newer" message. */
610 /* 1 means we are loading a compiled file. */
619 CHECK_STRING (file
, 0);
621 /* If file name is magic, call the handler. */
622 handler
= Ffind_file_name_handler (file
, Qload
);
624 return call5 (handler
, Qload
, file
, noerror
, nomessage
, nosuffix
);
626 /* Do this after the handler to avoid
627 the need to gcpro noerror, nomessage and nosuffix.
628 (Below here, we care only whether they are nil or not.) */
629 file
= Fsubstitute_in_file_name (file
);
631 /* Avoid weird lossage with null string as arg,
632 since it would try to load a directory as a Lisp file */
633 if (XSTRING (file
)->size
> 0)
635 int size
= STRING_BYTES (XSTRING (file
));
639 if (! NILP (must_suffix
))
641 /* Don't insist on adding a suffix if FILE already ends with one. */
643 && !strcmp (XSTRING (file
)->data
+ size
- 3, ".el"))
646 && !strcmp (XSTRING (file
)->data
+ size
- 4, ".elc"))
648 /* Don't insist on adding a suffix
649 if the argument includes a directory name. */
650 else if (! NILP (Ffile_name_directory (file
)))
654 fd
= openp (Vload_path
, file
,
655 (!NILP (nosuffix
) ? ""
656 : ! NILP (must_suffix
) ? ".elc.gz:.elc:.el.gz:.el"
657 : ".elc:.elc.gz:.el.gz:.el:"),
666 Fsignal (Qfile_error
, Fcons (build_string ("Cannot open load file"),
667 Fcons (file
, Qnil
)));
672 /* Tell startup.el whether or not we found the user's init file. */
673 if (EQ (Qt
, Vuser_init_file
))
674 Vuser_init_file
= found
;
676 /* If FD is 0, that means openp found a magic file. */
679 if (NILP (Fequal (found
, file
)))
680 /* If FOUND is a different file name from FILE,
681 find its handler even if we have already inhibited
682 the `load' operation on FILE. */
683 handler
= Ffind_file_name_handler (found
, Qt
);
685 handler
= Ffind_file_name_handler (found
, Qload
);
686 if (! NILP (handler
))
687 return call5 (handler
, Qload
, found
, noerror
, nomessage
, Qt
);
690 /* Load .elc files directly, but not when they are
691 remote and have no handler! */
692 if (!bcmp (&(XSTRING (found
)->data
[STRING_BYTES (XSTRING (found
)) - 4]),
699 if (!safe_to_load_p (fd
))
702 if (!load_dangerous_libraries
)
703 error ("File `%s' was not compiled in Emacs",
704 XSTRING (found
)->data
);
705 else if (!NILP (nomessage
))
706 message_with_string ("File `%s' not compiled in Emacs", found
, 1);
714 stat ((char *)XSTRING (found
)->data
, &s1
);
715 XSTRING (found
)->data
[STRING_BYTES (XSTRING (found
)) - 1] = 0;
716 result
= stat ((char *)XSTRING (found
)->data
, &s2
);
717 if (result
>= 0 && (unsigned) s1
.st_mtime
< (unsigned) s2
.st_mtime
)
719 /* Make the progress messages mention that source is newer. */
722 /* If we won't print another message, mention this anyway. */
723 if (! NILP (nomessage
))
724 message_with_string ("Source file `%s' newer than byte-compiled file",
727 XSTRING (found
)->data
[STRING_BYTES (XSTRING (found
)) - 1] = 'c';
733 /* We are loading a source file (*.el). */
734 if (!NILP (Vload_source_file_function
))
738 return call4 (Vload_source_file_function
, found
, file
,
739 NILP (noerror
) ? Qnil
: Qt
,
740 NILP (nomessage
) ? Qnil
: Qt
);
746 stream
= fopen ((char *) XSTRING (found
)->data
, fmode
);
747 #else /* not WINDOWSNT */
748 stream
= fdopen (fd
, fmode
);
749 #endif /* not WINDOWSNT */
753 error ("Failure to create stdio stream for %s", XSTRING (file
)->data
);
756 if (! NILP (Vpurify_flag
))
757 Vpreloaded_file_list
= Fcons (file
, Vpreloaded_file_list
);
759 if (NILP (nomessage
))
762 message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...",
765 message_with_string ("Loading %s (source)...", file
, 1);
767 message_with_string ("Loading %s (compiled; note, source file is newer)...",
769 else /* The typical case; compiled file newer than source file. */
770 message_with_string ("Loading %s...", file
, 1);
774 lispstream
= Fcons (Qnil
, Qnil
);
775 XSETFASTINT (XCAR (lispstream
), (EMACS_UINT
)stream
>> 16);
776 XSETFASTINT (XCDR (lispstream
), (EMACS_UINT
)stream
& 0xffff);
777 record_unwind_protect (load_unwind
, lispstream
);
778 record_unwind_protect (load_descriptor_unwind
, load_descriptor_list
);
779 specbind (Qload_file_name
, found
);
780 specbind (Qinhibit_file_name_operation
, Qnil
);
782 = Fcons (make_number (fileno (stream
)), load_descriptor_list
);
784 readevalloop (Qget_file_char
, stream
, file
, Feval
, 0, Qnil
, Qnil
);
785 unbind_to (count
, Qnil
);
787 /* Run any load-hooks for this file. */
788 temp
= Fassoc (file
, Vafter_load_alist
);
790 Fprogn (Fcdr (temp
));
793 if (saved_doc_string
)
794 free (saved_doc_string
);
795 saved_doc_string
= 0;
796 saved_doc_string_size
= 0;
798 if (prev_saved_doc_string
)
799 xfree (prev_saved_doc_string
);
800 prev_saved_doc_string
= 0;
801 prev_saved_doc_string_size
= 0;
803 if (!noninteractive
&& NILP (nomessage
))
806 message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...done",
809 message_with_string ("Loading %s (source)...done", file
, 1);
811 message_with_string ("Loading %s (compiled; note, source file is newer)...done",
813 else /* The typical case; compiled file newer than source file. */
814 message_with_string ("Loading %s...done", file
, 1);
820 load_unwind (stream
) /* used as unwind-protect function in load */
823 fclose ((FILE *) (XFASTINT (XCAR (stream
)) << 16
824 | XFASTINT (XCDR (stream
))));
825 if (--load_in_progress
< 0) load_in_progress
= 0;
830 load_descriptor_unwind (oldlist
)
833 load_descriptor_list
= oldlist
;
837 /* Close all descriptors in use for Floads.
838 This is used when starting a subprocess. */
845 for (tail
= load_descriptor_list
; !NILP (tail
); tail
= XCDR (tail
))
846 emacs_close (XFASTINT (XCAR (tail
)));
851 complete_filename_p (pathname
)
852 Lisp_Object pathname
;
854 register unsigned char *s
= XSTRING (pathname
)->data
;
855 return (IS_DIRECTORY_SEP (s
[0])
856 || (XSTRING (pathname
)->size
> 2
857 && IS_DEVICE_SEP (s
[1]) && IS_DIRECTORY_SEP (s
[2]))
867 /* Search for a file whose name is STR, looking in directories
868 in the Lisp list PATH, and trying suffixes from SUFFIX.
869 SUFFIX is a string containing possible suffixes separated by colons.
870 On success, returns a file descriptor. On failure, returns -1.
872 EXEC_ONLY nonzero means don't open the files,
873 just look for one that is executable. In this case,
874 returns 1 on success.
876 If STOREPTR is nonzero, it points to a slot where the name of
877 the file actually found should be stored as a Lisp string.
878 nil is stored there on failure.
880 If the file we find is remote, return 0
881 but store the found remote file name in *STOREPTR.
882 We do not check for remote files if EXEC_ONLY is nonzero. */
885 openp (path
, str
, suffix
, storeptr
, exec_only
)
886 Lisp_Object path
, str
;
888 Lisp_Object
*storeptr
;
894 register char *fn
= buf
;
897 Lisp_Object filename
;
905 if (complete_filename_p (str
))
908 for (; !NILP (path
); path
= Fcdr (path
))
912 filename
= Fexpand_file_name (str
, Fcar (path
));
913 if (!complete_filename_p (filename
))
914 /* If there are non-absolute elts in PATH (eg ".") */
915 /* Of course, this could conceivably lose if luser sets
916 default-directory to be something non-absolute... */
918 filename
= Fexpand_file_name (filename
, current_buffer
->directory
);
919 if (!complete_filename_p (filename
))
920 /* Give up on this path element! */
924 /* Calculate maximum size of any filename made from
925 this path element/specified file name and any possible suffix. */
926 want_size
= strlen (suffix
) + STRING_BYTES (XSTRING (filename
)) + 1;
927 if (fn_size
< want_size
)
928 fn
= (char *) alloca (fn_size
= 100 + want_size
);
932 /* Loop over suffixes. */
935 char *esuffix
= (char *) index (nsuffix
, ':');
936 int lsuffix
= esuffix
? esuffix
- nsuffix
: strlen (nsuffix
);
939 /* Concatenate path element/specified name with the suffix.
940 If the directory starts with /:, remove that. */
941 if (XSTRING (filename
)->size
> 2
942 && XSTRING (filename
)->data
[0] == '/'
943 && XSTRING (filename
)->data
[1] == ':')
945 strncpy (fn
, XSTRING (filename
)->data
+ 2,
946 STRING_BYTES (XSTRING (filename
)) - 2);
947 fn
[STRING_BYTES (XSTRING (filename
)) - 2] = 0;
951 strncpy (fn
, XSTRING (filename
)->data
,
952 STRING_BYTES (XSTRING (filename
)));
953 fn
[STRING_BYTES (XSTRING (filename
))] = 0;
956 if (lsuffix
!= 0) /* Bug happens on CCI if lsuffix is 0. */
957 strncat (fn
, nsuffix
, lsuffix
);
959 /* Check that the file exists and is not a directory. */
963 handler
= Ffind_file_name_handler (filename
, Qfile_exists_p
);
964 if (! NILP (handler
) && ! exec_only
)
969 string
= build_string (fn
);
970 exists
= ! NILP (exec_only
? Ffile_executable_p (string
)
971 : Ffile_readable_p (string
));
973 && ! NILP (Ffile_directory_p (build_string (fn
))))
978 /* We succeeded; return this descriptor and filename. */
980 *storeptr
= build_string (fn
);
987 int exists
= (stat (fn
, &st
) >= 0
988 && (st
.st_mode
& S_IFMT
) != S_IFDIR
);
991 /* Check that we can access or open it. */
993 fd
= (access (fn
, X_OK
) == 0) ? 1 : -1;
995 fd
= emacs_open (fn
, O_RDONLY
, 0);
999 /* We succeeded; return this descriptor and filename. */
1001 *storeptr
= build_string (fn
);
1008 /* Advance to next suffix. */
1011 nsuffix
+= lsuffix
+ 1;
1022 /* Merge the list we've accumulated of globals from the current input source
1023 into the load_history variable. The details depend on whether
1024 the source has an associated file name or not. */
1027 build_load_history (stream
, source
)
1031 register Lisp_Object tail
, prev
, newelt
;
1032 register Lisp_Object tem
, tem2
;
1033 register int foundit
, loading
;
1035 loading
= stream
|| !NARROWED
;
1037 tail
= Vload_history
;
1040 while (!NILP (tail
))
1044 /* Find the feature's previous assoc list... */
1045 if (!NILP (Fequal (source
, Fcar (tem
))))
1049 /* If we're loading, remove it. */
1053 Vload_history
= Fcdr (tail
);
1055 Fsetcdr (prev
, Fcdr (tail
));
1058 /* Otherwise, cons on new symbols that are not already members. */
1061 tem2
= Vcurrent_load_list
;
1063 while (CONSP (tem2
))
1065 newelt
= Fcar (tem2
);
1067 if (NILP (Fmemq (newelt
, tem
)))
1068 Fsetcar (tail
, Fcons (Fcar (tem
),
1069 Fcons (newelt
, Fcdr (tem
))));
1082 /* If we're loading, cons the new assoc onto the front of load-history,
1083 the most-recently-loaded position. Also do this if we didn't find
1084 an existing member for the current source. */
1085 if (loading
|| !foundit
)
1086 Vload_history
= Fcons (Fnreverse (Vcurrent_load_list
),
1091 unreadpure () /* Used as unwind-protect function in readevalloop */
1098 readevalloop_1 (old
)
1101 load_convert_to_unibyte
= ! NILP (old
);
1105 /* Signal an `end-of-file' error, if possible with file name
1109 end_of_file_error ()
1113 if (STRINGP (Vload_file_name
))
1114 data
= Fcons (Vload_file_name
, Qnil
);
1118 Fsignal (Qend_of_file
, data
);
1121 /* UNIBYTE specifies how to set load_convert_to_unibyte
1122 for this invocation.
1123 READFUN, if non-nil, is used instead of `read'. */
1126 readevalloop (readcharfun
, stream
, sourcename
, evalfun
, printflag
, unibyte
, readfun
)
1127 Lisp_Object readcharfun
;
1129 Lisp_Object sourcename
;
1130 Lisp_Object (*evalfun
) ();
1132 Lisp_Object unibyte
, readfun
;
1135 register Lisp_Object val
;
1136 int count
= specpdl_ptr
- specpdl
;
1137 struct gcpro gcpro1
;
1138 struct buffer
*b
= 0;
1139 int continue_reading_p
;
1141 if (BUFFERP (readcharfun
))
1142 b
= XBUFFER (readcharfun
);
1143 else if (MARKERP (readcharfun
))
1144 b
= XMARKER (readcharfun
)->buffer
;
1146 specbind (Qstandard_input
, readcharfun
);
1147 specbind (Qcurrent_load_list
, Qnil
);
1148 record_unwind_protect (readevalloop_1
, load_convert_to_unibyte
? Qt
: Qnil
);
1149 load_convert_to_unibyte
= !NILP (unibyte
);
1151 readchar_backlog
= -1;
1153 GCPRO1 (sourcename
);
1155 LOADHIST_ATTACH (sourcename
);
1157 continue_reading_p
= 1;
1158 while (continue_reading_p
)
1160 if (b
!= 0 && NILP (b
->name
))
1161 error ("Reading from killed buffer");
1167 while ((c
= READCHAR
) != '\n' && c
!= -1);
1172 /* Ignore whitespace here, so we can detect eof. */
1173 if (c
== ' ' || c
== '\t' || c
== '\n' || c
== '\f' || c
== '\r')
1176 if (!NILP (Vpurify_flag
) && c
== '(')
1178 int count1
= specpdl_ptr
- specpdl
;
1179 record_unwind_protect (unreadpure
, Qnil
);
1180 val
= read_list (-1, readcharfun
);
1181 unbind_to (count1
, Qnil
);
1186 read_objects
= Qnil
;
1187 if (!NILP (readfun
))
1189 val
= call1 (readfun
, readcharfun
);
1191 /* If READCHARFUN has set point to ZV, we should
1192 stop reading, even if the form read sets point
1193 to a different value when evaluated. */
1194 if (BUFFERP (readcharfun
))
1196 struct buffer
*b
= XBUFFER (readcharfun
);
1197 if (BUF_PT (b
) == BUF_ZV (b
))
1198 continue_reading_p
= 0;
1201 else if (! NILP (Vload_read_function
))
1202 val
= call1 (Vload_read_function
, readcharfun
);
1204 val
= read0 (readcharfun
);
1207 val
= (*evalfun
) (val
);
1211 Vvalues
= Fcons (val
, Vvalues
);
1212 if (EQ (Vstandard_output
, Qt
))
1219 build_load_history (stream
, sourcename
);
1222 unbind_to (count
, Qnil
);
1225 DEFUN ("eval-buffer", Feval_buffer
, Seval_buffer
, 0, 5, "",
1226 "Execute the current buffer as Lisp code.\n\
1227 Programs can pass two arguments, BUFFER and PRINTFLAG.\n\
1228 BUFFER is the buffer to evaluate (nil means use current buffer).\n\
1229 PRINTFLAG controls printing of output:\n\
1230 nil means discard it; anything else is stream for print.\n\
1232 If the optional third argument FILENAME is non-nil,\n\
1233 it specifies the file name to use for `load-history'.\n\
1234 The optional fourth argument UNIBYTE specifies `load-convert-to-unibyte'\n\
1235 for this invocation.\n\
1237 The optional fifth argument DO-ALLOW-PRINT, if not-nil, specifies that\n\
1238 `print' and related functions should work normally even if PRINTFLAG is nil.\n\
1240 This function preserves the position of point.")
1241 (buffer
, printflag
, filename
, unibyte
, do_allow_print
)
1242 Lisp_Object buffer
, printflag
, filename
, unibyte
, do_allow_print
;
1244 int count
= specpdl_ptr
- specpdl
;
1245 Lisp_Object tem
, buf
;
1248 buf
= Fcurrent_buffer ();
1250 buf
= Fget_buffer (buffer
);
1252 error ("No such buffer");
1254 if (NILP (printflag
) && NILP (do_allow_print
))
1259 if (NILP (filename
))
1260 filename
= XBUFFER (buf
)->filename
;
1262 specbind (Qstandard_output
, tem
);
1263 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
1264 BUF_SET_PT (XBUFFER (buf
), BUF_BEGV (XBUFFER (buf
)));
1265 readevalloop (buf
, 0, filename
, Feval
, !NILP (printflag
), unibyte
, Qnil
);
1266 unbind_to (count
, Qnil
);
1272 XDEFUN ("eval-current-buffer", Feval_current_buffer
, Seval_current_buffer
, 0, 1, "",
1273 "Execute the current buffer as Lisp code.\n\
1274 Programs can pass argument PRINTFLAG which controls printing of output:\n\
1275 nil means discard it; anything else is stream for print.\n\
1277 If there is no error, point does not move. If there is an error,\n\
1278 point remains at the end of the last character read from the buffer.")
1280 Lisp_Object printflag
;
1282 int count
= specpdl_ptr
- specpdl
;
1283 Lisp_Object tem
, cbuf
;
1285 cbuf
= Fcurrent_buffer ()
1287 if (NILP (printflag
))
1291 specbind (Qstandard_output
, tem
);
1292 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
1294 readevalloop (cbuf
, 0, XBUFFER (cbuf
)->filename
, Feval
,
1295 !NILP (printflag
), Qnil
, Qnil
);
1296 return unbind_to (count
, Qnil
);
1300 DEFUN ("eval-region", Feval_region
, Seval_region
, 2, 4, "r",
1301 "Execute the region as Lisp code.\n\
1302 When called from programs, expects two arguments,\n\
1303 giving starting and ending indices in the current buffer\n\
1304 of the text to be executed.\n\
1305 Programs can pass third argument PRINTFLAG which controls output:\n\
1306 nil means discard it; anything else is stream for printing it.\n\
1307 Also the fourth argument READ-FUNCTION, if non-nil, is used\n\
1308 instead of `read' to read each expression. It gets one argument\n\
1309 which is the input stream for reading characters.\n\
1311 This function does not move point.")
1312 (start
, end
, printflag
, read_function
)
1313 Lisp_Object start
, end
, printflag
, read_function
;
1315 int count
= specpdl_ptr
- specpdl
;
1316 Lisp_Object tem
, cbuf
;
1318 cbuf
= Fcurrent_buffer ();
1320 if (NILP (printflag
))
1324 specbind (Qstandard_output
, tem
);
1326 if (NILP (printflag
))
1327 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
1328 record_unwind_protect (save_restriction_restore
, save_restriction_save ());
1330 /* This both uses start and checks its type. */
1332 Fnarrow_to_region (make_number (BEGV
), end
);
1333 readevalloop (cbuf
, 0, XBUFFER (cbuf
)->filename
, Feval
,
1334 !NILP (printflag
), Qnil
, read_function
);
1336 return unbind_to (count
, Qnil
);
1340 DEFUN ("read", Fread
, Sread
, 0, 1, 0,
1341 "Read one Lisp expression as text from STREAM, return as Lisp object.\n\
1342 If STREAM is nil, use the value of `standard-input' (which see).\n\
1343 STREAM or the value of `standard-input' may be:\n\
1344 a buffer (read from point and advance it)\n\
1345 a marker (read from where it points and advance it)\n\
1346 a function (call it with no arguments for each character,\n\
1347 call it with a char as argument to push a char back)\n\
1348 a string (takes text from string, starting at the beginning)\n\
1349 t (read text line using minibuffer and use it).")
1353 extern Lisp_Object
Fread_minibuffer ();
1356 stream
= Vstandard_input
;
1357 if (EQ (stream
, Qt
))
1358 stream
= Qread_char
;
1360 readchar_backlog
= -1;
1361 new_backquote_flag
= 0;
1362 read_objects
= Qnil
;
1364 if (EQ (stream
, Qread_char
))
1365 return Fread_minibuffer (build_string ("Lisp expression: "), Qnil
);
1367 if (STRINGP (stream
))
1368 return Fcar (Fread_from_string (stream
, Qnil
, Qnil
));
1370 return read0 (stream
);
1373 DEFUN ("read-from-string", Fread_from_string
, Sread_from_string
, 1, 3, 0,
1374 "Read one Lisp expression which is represented as text by STRING.\n\
1375 Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).\n\
1376 START and END optionally delimit a substring of STRING from which to read;\n\
1377 they default to 0 and (length STRING) respectively.")
1378 (string
, start
, end
)
1379 Lisp_Object string
, start
, end
;
1381 int startval
, endval
;
1384 CHECK_STRING (string
,0);
1387 endval
= XSTRING (string
)->size
;
1390 CHECK_NUMBER (end
, 2);
1391 endval
= XINT (end
);
1392 if (endval
< 0 || endval
> XSTRING (string
)->size
)
1393 args_out_of_range (string
, end
);
1400 CHECK_NUMBER (start
, 1);
1401 startval
= XINT (start
);
1402 if (startval
< 0 || startval
> endval
)
1403 args_out_of_range (string
, start
);
1406 read_from_string_index
= startval
;
1407 read_from_string_index_byte
= string_char_to_byte (string
, startval
);
1408 read_from_string_limit
= endval
;
1410 new_backquote_flag
= 0;
1411 read_objects
= Qnil
;
1413 tem
= read0 (string
);
1414 return Fcons (tem
, make_number (read_from_string_index
));
1417 /* Use this for recursive reads, in contexts where internal tokens
1422 Lisp_Object readcharfun
;
1424 register Lisp_Object val
;
1427 val
= read1 (readcharfun
, &c
, 0);
1429 Fsignal (Qinvalid_read_syntax
, Fcons (Fmake_string (make_number (1),
1436 static int read_buffer_size
;
1437 static char *read_buffer
;
1439 /* Read multibyte form and return it as a character. C is a first
1440 byte of multibyte form, and rest of them are read from
1444 read_multibyte (c
, readcharfun
)
1446 Lisp_Object readcharfun
;
1448 /* We need the actual character code of this multibyte
1450 unsigned char str
[MAX_MULTIBYTE_LENGTH
];
1454 while ((c
= READCHAR
) >= 0xA0
1455 && len
< MAX_MULTIBYTE_LENGTH
)
1458 return STRING_CHAR (str
, len
);
1461 /* Read a \-escape sequence, assuming we already read the `\'. */
1464 read_escape (readcharfun
, stringp
)
1465 Lisp_Object readcharfun
;
1468 register int c
= READCHAR
;
1472 error ("End of file");
1502 error ("Invalid escape character syntax");
1505 c
= read_escape (readcharfun
, 0);
1506 return c
| meta_modifier
;
1511 error ("Invalid escape character syntax");
1514 c
= read_escape (readcharfun
, 0);
1515 return c
| shift_modifier
;
1520 error ("Invalid escape character syntax");
1523 c
= read_escape (readcharfun
, 0);
1524 return c
| hyper_modifier
;
1529 error ("Invalid escape character syntax");
1532 c
= read_escape (readcharfun
, 0);
1533 return c
| alt_modifier
;
1538 error ("Invalid escape character syntax");
1541 c
= read_escape (readcharfun
, 0);
1542 return c
| super_modifier
;
1547 error ("Invalid escape character syntax");
1551 c
= read_escape (readcharfun
, 0);
1552 if ((c
& ~CHAR_MODIFIER_MASK
) == '?')
1553 return 0177 | (c
& CHAR_MODIFIER_MASK
);
1554 else if (! SINGLE_BYTE_CHAR_P ((c
& ~CHAR_MODIFIER_MASK
)))
1555 return c
| ctrl_modifier
;
1556 /* ASCII control chars are made from letters (both cases),
1557 as well as the non-letters within 0100...0137. */
1558 else if ((c
& 0137) >= 0101 && (c
& 0137) <= 0132)
1559 return (c
& (037 | ~0177));
1560 else if ((c
& 0177) >= 0100 && (c
& 0177) <= 0137)
1561 return (c
& (037 | ~0177));
1563 return c
| ctrl_modifier
;
1573 /* An octal escape, as in ANSI C. */
1575 register int i
= c
- '0';
1576 register int count
= 0;
1579 if ((c
= READCHAR
) >= '0' && c
<= '7')
1594 /* A hex escape, as in ANSI C. */
1600 if (c
>= '0' && c
<= '9')
1605 else if ((c
>= 'a' && c
<= 'f')
1606 || (c
>= 'A' && c
<= 'F'))
1609 if (c
>= 'a' && c
<= 'f')
1624 if (BASE_LEADING_CODE_P (c
))
1625 c
= read_multibyte (c
, readcharfun
);
1631 /* Read an integer in radix RADIX using READCHARFUN to read
1632 characters. RADIX must be in the interval [2..36]; if it isn't, a
1633 read error is signaled . Value is the integer read. Signals an
1634 error if encountering invalid read syntax or if RADIX is out of
1638 read_integer (readcharfun
, radix
)
1639 Lisp_Object readcharfun
;
1642 int number
, ndigits
, invalid_p
, c
, sign
;
1644 if (radix
< 2 || radix
> 36)
1648 number
= ndigits
= invalid_p
= 0;
1664 if (c
>= '0' && c
<= '9')
1666 else if (c
>= 'a' && c
<= 'z')
1667 digit
= c
- 'a' + 10;
1668 else if (c
>= 'A' && c
<= 'Z')
1669 digit
= c
- 'A' + 10;
1676 if (digit
< 0 || digit
>= radix
)
1679 number
= radix
* number
+ digit
;
1685 if (ndigits
== 0 || invalid_p
)
1688 sprintf (buf
, "integer, radix %d", radix
);
1689 Fsignal (Qinvalid_read_syntax
, Fcons (build_string (buf
), Qnil
));
1692 return make_number (sign
* number
);
1696 /* If the next token is ')' or ']' or '.', we store that character
1697 in *PCH and the return value is not interesting. Else, we store
1698 zero in *PCH and we read and return one lisp object.
1700 FIRST_IN_LIST is nonzero if this is the first element of a list. */
1703 read1 (readcharfun
, pch
, first_in_list
)
1704 register Lisp_Object readcharfun
;
1709 int uninterned_symbol
= 0;
1717 end_of_file_error ();
1722 return read_list (0, readcharfun
);
1725 return read_vector (readcharfun
, 0);
1742 tmp
= read_vector (readcharfun
, 0);
1743 if (XVECTOR (tmp
)->size
< CHAR_TABLE_STANDARD_SLOTS
1744 || XVECTOR (tmp
)->size
> CHAR_TABLE_STANDARD_SLOTS
+ 10)
1745 error ("Invalid size char-table");
1746 XSETCHAR_TABLE (tmp
, XCHAR_TABLE (tmp
));
1747 XCHAR_TABLE (tmp
)->top
= Qt
;
1756 tmp
= read_vector (readcharfun
, 0);
1757 if (XVECTOR (tmp
)->size
!= SUB_CHAR_TABLE_STANDARD_SLOTS
)
1758 error ("Invalid size char-table");
1759 XSETCHAR_TABLE (tmp
, XCHAR_TABLE (tmp
));
1760 XCHAR_TABLE (tmp
)->top
= Qnil
;
1763 Fsignal (Qinvalid_read_syntax
,
1764 Fcons (make_string ("#^^", 3), Qnil
));
1766 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#^", 2), Qnil
));
1771 length
= read1 (readcharfun
, pch
, first_in_list
);
1775 Lisp_Object tmp
, val
;
1776 int size_in_chars
= ((XFASTINT (length
) + BITS_PER_CHAR
- 1)
1780 tmp
= read1 (readcharfun
, pch
, first_in_list
);
1781 if (size_in_chars
!= XSTRING (tmp
)->size
1782 /* We used to print 1 char too many
1783 when the number of bits was a multiple of 8.
1784 Accept such input in case it came from an old version. */
1785 && ! (XFASTINT (length
)
1786 == (XSTRING (tmp
)->size
- 1) * BITS_PER_CHAR
))
1787 Fsignal (Qinvalid_read_syntax
,
1788 Fcons (make_string ("#&...", 5), Qnil
));
1790 val
= Fmake_bool_vector (length
, Qnil
);
1791 bcopy (XSTRING (tmp
)->data
, XBOOL_VECTOR (val
)->data
,
1793 /* Clear the extraneous bits in the last byte. */
1794 if (XINT (length
) != size_in_chars
* BITS_PER_CHAR
)
1795 XBOOL_VECTOR (val
)->data
[size_in_chars
- 1]
1796 &= (1 << (XINT (length
) % BITS_PER_CHAR
)) - 1;
1799 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#&...", 5),
1804 /* Accept compiled functions at read-time so that we don't have to
1805 build them using function calls. */
1807 tmp
= read_vector (readcharfun
, 1);
1808 return Fmake_byte_code (XVECTOR (tmp
)->size
,
1809 XVECTOR (tmp
)->contents
);
1814 struct gcpro gcpro1
;
1817 /* Read the string itself. */
1818 tmp
= read1 (readcharfun
, &ch
, 0);
1819 if (ch
!= 0 || !STRINGP (tmp
))
1820 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#", 1), Qnil
));
1822 /* Read the intervals and their properties. */
1825 Lisp_Object beg
, end
, plist
;
1827 beg
= read1 (readcharfun
, &ch
, 0);
1831 end
= read1 (readcharfun
, &ch
, 0);
1833 plist
= read1 (readcharfun
, &ch
, 0);
1835 Fsignal (Qinvalid_read_syntax
,
1836 Fcons (build_string ("invalid string property list"),
1838 Fset_text_properties (beg
, end
, plist
, tmp
);
1844 /* #@NUMBER is used to skip NUMBER following characters.
1845 That's used in .elc files to skip over doc strings
1846 and function definitions. */
1851 /* Read a decimal integer. */
1852 while ((c
= READCHAR
) >= 0
1853 && c
>= '0' && c
<= '9')
1861 if (load_force_doc_strings
&& EQ (readcharfun
, Qget_file_char
))
1863 /* If we are supposed to force doc strings into core right now,
1864 record the last string that we skipped,
1865 and record where in the file it comes from. */
1867 /* But first exchange saved_doc_string
1868 with prev_saved_doc_string, so we save two strings. */
1870 char *temp
= saved_doc_string
;
1871 int temp_size
= saved_doc_string_size
;
1872 file_offset temp_pos
= saved_doc_string_position
;
1873 int temp_len
= saved_doc_string_length
;
1875 saved_doc_string
= prev_saved_doc_string
;
1876 saved_doc_string_size
= prev_saved_doc_string_size
;
1877 saved_doc_string_position
= prev_saved_doc_string_position
;
1878 saved_doc_string_length
= prev_saved_doc_string_length
;
1880 prev_saved_doc_string
= temp
;
1881 prev_saved_doc_string_size
= temp_size
;
1882 prev_saved_doc_string_position
= temp_pos
;
1883 prev_saved_doc_string_length
= temp_len
;
1886 if (saved_doc_string_size
== 0)
1888 saved_doc_string_size
= nskip
+ 100;
1889 saved_doc_string
= (char *) xmalloc (saved_doc_string_size
);
1891 if (nskip
> saved_doc_string_size
)
1893 saved_doc_string_size
= nskip
+ 100;
1894 saved_doc_string
= (char *) xrealloc (saved_doc_string
,
1895 saved_doc_string_size
);
1898 saved_doc_string_position
= file_tell (instream
);
1900 /* Copy that many characters into saved_doc_string. */
1901 for (i
= 0; i
< nskip
&& c
>= 0; i
++)
1902 saved_doc_string
[i
] = c
= READCHAR
;
1904 saved_doc_string_length
= i
;
1908 /* Skip that many characters. */
1909 for (i
= 0; i
< nskip
&& c
>= 0; i
++)
1916 return Vload_file_name
;
1918 return Fcons (Qfunction
, Fcons (read0 (readcharfun
), Qnil
));
1919 /* #:foo is the uninterned symbol named foo. */
1922 uninterned_symbol
= 1;
1926 /* Reader forms that can reuse previously read objects. */
1927 if (c
>= '0' && c
<= '9')
1932 /* Read a non-negative integer. */
1933 while (c
>= '0' && c
<= '9')
1939 /* #n=object returns object, but associates it with n for #n#. */
1942 /* Make a placeholder for #n# to use temporarily */
1943 Lisp_Object placeholder
;
1946 placeholder
= Fcons(Qnil
, Qnil
);
1947 cell
= Fcons (make_number (n
), placeholder
);
1948 read_objects
= Fcons (cell
, read_objects
);
1950 /* Read the object itself. */
1951 tem
= read0 (readcharfun
);
1953 /* Now put it everywhere the placeholder was... */
1954 substitute_object_in_subtree (tem
, placeholder
);
1956 /* ...and #n# will use the real value from now on. */
1957 Fsetcdr (cell
, tem
);
1961 /* #n# returns a previously read object. */
1964 tem
= Fassq (make_number (n
), read_objects
);
1967 /* Fall through to error message. */
1969 else if (c
== 'r' || c
== 'R')
1970 return read_integer (readcharfun
, n
);
1972 /* Fall through to error message. */
1974 else if (c
== 'x' || c
== 'X')
1975 return read_integer (readcharfun
, 16);
1976 else if (c
== 'o' || c
== 'O')
1977 return read_integer (readcharfun
, 8);
1978 else if (c
== 'b' || c
== 'B')
1979 return read_integer (readcharfun
, 2);
1982 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#", 1), Qnil
));
1985 while ((c
= READCHAR
) >= 0 && c
!= '\n');
1990 return Fcons (Qquote
, Fcons (read0 (readcharfun
), Qnil
));
2000 new_backquote_flag
= 1;
2001 value
= read0 (readcharfun
);
2002 new_backquote_flag
= 0;
2004 return Fcons (Qbackquote
, Fcons (value
, Qnil
));
2008 if (new_backquote_flag
)
2010 Lisp_Object comma_type
= Qnil
;
2015 comma_type
= Qcomma_at
;
2017 comma_type
= Qcomma_dot
;
2020 if (ch
>= 0) UNREAD (ch
);
2021 comma_type
= Qcomma
;
2024 new_backquote_flag
= 0;
2025 value
= read0 (readcharfun
);
2026 new_backquote_flag
= 1;
2027 return Fcons (comma_type
, Fcons (value
, Qnil
));
2036 end_of_file_error ();
2039 c
= read_escape (readcharfun
, 0);
2040 else if (BASE_LEADING_CODE_P (c
))
2041 c
= read_multibyte (c
, readcharfun
);
2043 return make_number (c
);
2048 register char *p
= read_buffer
;
2049 register char *end
= read_buffer
+ read_buffer_size
;
2051 /* Nonzero if we saw an escape sequence specifying
2052 a multibyte character. */
2053 int force_multibyte
= 0;
2054 /* Nonzero if we saw an escape sequence specifying
2055 a single-byte character. */
2056 int force_singlebyte
= 0;
2060 while ((c
= READCHAR
) >= 0
2063 if (end
- p
< MAX_MULTIBYTE_LENGTH
)
2065 char *new = (char *) xrealloc (read_buffer
, read_buffer_size
*= 2);
2066 p
+= new - read_buffer
;
2067 read_buffer
+= new - read_buffer
;
2068 end
= read_buffer
+ read_buffer_size
;
2073 c
= read_escape (readcharfun
, 1);
2075 /* C is -1 if \ newline has just been seen */
2078 if (p
== read_buffer
)
2083 /* If an escape specifies a non-ASCII single-byte character,
2084 this must be a unibyte string. */
2085 if (SINGLE_BYTE_CHAR_P ((c
& ~CHAR_MODIFIER_MASK
))
2086 && ! ASCII_BYTE_P ((c
& ~CHAR_MODIFIER_MASK
)))
2087 force_singlebyte
= 1;
2090 if (! SINGLE_BYTE_CHAR_P ((c
& ~CHAR_MODIFIER_MASK
)))
2092 /* Any modifiers for a multibyte character are invalid. */
2093 if (c
& CHAR_MODIFIER_MASK
)
2094 error ("Invalid modifier in string");
2095 p
+= CHAR_STRING (c
, p
);
2096 force_multibyte
= 1;
2100 /* Allow `\C- ' and `\C-?'. */
2101 if (c
== (CHAR_CTL
| ' '))
2103 else if (c
== (CHAR_CTL
| '?'))
2108 /* Shift modifier is valid only with [A-Za-z]. */
2109 if ((c
& 0377) >= 'A' && (c
& 0377) <= 'Z')
2111 else if ((c
& 0377) >= 'a' && (c
& 0377) <= 'z')
2112 c
= (c
& ~CHAR_SHIFT
) - ('a' - 'A');
2116 /* Move the meta bit to the right place for a string. */
2117 c
= (c
& ~CHAR_META
) | 0x80;
2119 error ("Invalid modifier in string");
2124 end_of_file_error ();
2126 /* If purifying, and string starts with \ newline,
2127 return zero instead. This is for doc strings
2128 that we are really going to find in etc/DOC.nn.nn */
2129 if (!NILP (Vpurify_flag
) && NILP (Vdoc_file_name
) && cancel
)
2130 return make_number (0);
2132 if (force_multibyte
)
2133 p
= read_buffer
+ str_as_multibyte (read_buffer
, end
- read_buffer
,
2134 p
- read_buffer
, &nchars
);
2135 else if (force_singlebyte
)
2136 nchars
= p
- read_buffer
;
2137 else if (load_convert_to_unibyte
)
2140 p
= read_buffer
+ str_as_multibyte (read_buffer
, end
- read_buffer
,
2141 p
- read_buffer
, &nchars
);
2142 if (p
- read_buffer
!= nchars
)
2144 string
= make_multibyte_string (read_buffer
, nchars
,
2146 return Fstring_make_unibyte (string
);
2149 else if (EQ (readcharfun
, Qget_file_char
)
2150 || EQ (readcharfun
, Qlambda
))
2151 /* Nowadays, reading directly from a file is used only for
2152 compiled Emacs Lisp files, and those always use the
2153 Emacs internal encoding. Meanwhile, Qlambda is used
2154 for reading dynamic byte code (compiled with
2155 byte-compile-dynamic = t). */
2156 p
= read_buffer
+ str_as_multibyte (read_buffer
, end
- read_buffer
,
2157 p
- read_buffer
, &nchars
);
2159 /* In all other cases, if we read these bytes as
2160 separate characters, treat them as separate characters now. */
2161 nchars
= p
- read_buffer
;
2164 return make_pure_string (read_buffer
, nchars
, p
- read_buffer
,
2166 || (p
- read_buffer
!= nchars
)));
2167 return make_specified_string (read_buffer
, nchars
, p
- read_buffer
,
2169 || (p
- read_buffer
!= nchars
)));
2174 int next_char
= READCHAR
;
2177 if (next_char
<= 040
2178 || index ("\"'`,(", next_char
))
2184 /* Otherwise, we fall through! Note that the atom-reading loop
2185 below will now loop at least once, assuring that we will not
2186 try to UNREAD two characters in a row. */
2190 if (c
<= 040) goto retry
;
2192 register char *p
= read_buffer
;
2196 register char *end
= read_buffer
+ read_buffer_size
;
2199 && !(c
== '\"' || c
== '\'' || c
== ';' || c
== '?'
2200 || c
== '(' || c
== ')'
2201 || c
== '[' || c
== ']' || c
== '#'
2204 if (end
- p
< MAX_MULTIBYTE_LENGTH
)
2206 register char *new = (char *) xrealloc (read_buffer
, read_buffer_size
*= 2);
2207 p
+= new - read_buffer
;
2208 read_buffer
+= new - read_buffer
;
2209 end
= read_buffer
+ read_buffer_size
;
2217 if (! SINGLE_BYTE_CHAR_P (c
))
2218 p
+= CHAR_STRING (c
, p
);
2227 char *new = (char *) xrealloc (read_buffer
, read_buffer_size
*= 2);
2228 p
+= new - read_buffer
;
2229 read_buffer
+= new - read_buffer
;
2230 /* end = read_buffer + read_buffer_size; */
2237 if (!quoted
&& !uninterned_symbol
)
2240 register Lisp_Object val
;
2242 if (*p1
== '+' || *p1
== '-') p1
++;
2243 /* Is it an integer? */
2246 while (p1
!= p
&& (c
= *p1
) >= '0' && c
<= '9') p1
++;
2247 /* Integers can have trailing decimal points. */
2248 if (p1
> read_buffer
&& p1
< p
&& *p1
== '.') p1
++;
2250 /* It is an integer. */
2254 if (sizeof (int) == sizeof (EMACS_INT
))
2255 XSETINT (val
, atoi (read_buffer
));
2256 else if (sizeof (long) == sizeof (EMACS_INT
))
2257 XSETINT (val
, atol (read_buffer
));
2263 if (isfloat_string (read_buffer
))
2265 /* Compute NaN and infinities using 0.0 in a variable,
2266 to cope with compilers that think they are smarter
2272 /* Negate the value ourselves. This treats 0, NaNs,
2273 and infinity properly on IEEE floating point hosts,
2274 and works around a common bug where atof ("-0.0")
2276 int negative
= read_buffer
[0] == '-';
2278 /* The only way p[-1] can be 'F' or 'N', after isfloat_string
2279 returns 1, is if the input ends in e+INF or e+NaN. */
2286 value
= zero
/ zero
;
2289 value
= atof (read_buffer
+ negative
);
2293 return make_float (negative
? - value
: value
);
2297 if (uninterned_symbol
)
2298 return make_symbol (read_buffer
);
2300 return intern (read_buffer
);
2306 /* List of nodes we've seen during substitute_object_in_subtree. */
2307 static Lisp_Object seen_list
;
2310 substitute_object_in_subtree (object
, placeholder
)
2312 Lisp_Object placeholder
;
2314 Lisp_Object check_object
;
2316 /* We haven't seen any objects when we start. */
2319 /* Make all the substitutions. */
2321 = substitute_object_recurse (object
, placeholder
, object
);
2323 /* Clear seen_list because we're done with it. */
2326 /* The returned object here is expected to always eq the
2328 if (!EQ (check_object
, object
))
2329 error ("Unexpected mutation error in reader");
2332 /* Feval doesn't get called from here, so no gc protection is needed. */
2333 #define SUBSTITUTE(get_val, set_val) \
2335 Lisp_Object old_value = get_val; \
2336 Lisp_Object true_value \
2337 = substitute_object_recurse (object, placeholder,\
2340 if (!EQ (old_value, true_value)) \
2347 substitute_object_recurse (object
, placeholder
, subtree
)
2349 Lisp_Object placeholder
;
2350 Lisp_Object subtree
;
2352 /* If we find the placeholder, return the target object. */
2353 if (EQ (placeholder
, subtree
))
2356 /* If we've been to this node before, don't explore it again. */
2357 if (!EQ (Qnil
, Fmemq (subtree
, seen_list
)))
2360 /* If this node can be the entry point to a cycle, remember that
2361 we've seen it. It can only be such an entry point if it was made
2362 by #n=, which means that we can find it as a value in
2364 if (!EQ (Qnil
, Frassq (subtree
, read_objects
)))
2365 seen_list
= Fcons (subtree
, seen_list
);
2367 /* Recurse according to subtree's type.
2368 Every branch must return a Lisp_Object. */
2369 switch (XTYPE (subtree
))
2371 case Lisp_Vectorlike
:
2374 int length
= XINT (Flength(subtree
));
2375 for (i
= 0; i
< length
; i
++)
2377 Lisp_Object idx
= make_number (i
);
2378 SUBSTITUTE (Faref (subtree
, idx
),
2379 Faset (subtree
, idx
, true_value
));
2386 SUBSTITUTE (Fcar_safe (subtree
),
2387 Fsetcar (subtree
, true_value
));
2388 SUBSTITUTE (Fcdr_safe (subtree
),
2389 Fsetcdr (subtree
, true_value
));
2395 /* Check for text properties in each interval.
2396 substitute_in_interval contains part of the logic. */
2398 INTERVAL root_interval
= XSTRING (subtree
)->intervals
;
2399 Lisp_Object arg
= Fcons (object
, placeholder
);
2401 traverse_intervals (root_interval
, 1, 0,
2402 &substitute_in_interval
, arg
);
2407 /* Other types don't recurse any further. */
2413 /* Helper function for substitute_object_recurse. */
2415 substitute_in_interval (interval
, arg
)
2419 Lisp_Object object
= Fcar (arg
);
2420 Lisp_Object placeholder
= Fcdr (arg
);
2422 SUBSTITUTE(interval
->plist
, interval
->plist
= true_value
);
2441 if (*cp
== '+' || *cp
== '-')
2444 if (*cp
>= '0' && *cp
<= '9')
2447 while (*cp
>= '0' && *cp
<= '9')
2455 if (*cp
>= '0' && *cp
<= '9')
2458 while (*cp
>= '0' && *cp
<= '9')
2461 if (*cp
== 'e' || *cp
== 'E')
2465 if (*cp
== '+' || *cp
== '-')
2469 if (*cp
>= '0' && *cp
<= '9')
2472 while (*cp
>= '0' && *cp
<= '9')
2475 else if (cp
== start
)
2477 else if (cp
[-1] == '+' && cp
[0] == 'I' && cp
[1] == 'N' && cp
[2] == 'F')
2482 else if (cp
[-1] == '+' && cp
[0] == 'N' && cp
[1] == 'a' && cp
[2] == 'N')
2488 return (((*cp
== 0) || (*cp
== ' ') || (*cp
== '\t') || (*cp
== '\n') || (*cp
== '\r') || (*cp
== '\f'))
2489 && (state
== (LEAD_INT
|DOT_CHAR
|TRAIL_INT
)
2490 || state
== (DOT_CHAR
|TRAIL_INT
)
2491 || state
== (LEAD_INT
|E_CHAR
|EXP_INT
)
2492 || state
== (LEAD_INT
|DOT_CHAR
|TRAIL_INT
|E_CHAR
|EXP_INT
)
2493 || state
== (DOT_CHAR
|TRAIL_INT
|E_CHAR
|EXP_INT
)));
2498 read_vector (readcharfun
, bytecodeflag
)
2499 Lisp_Object readcharfun
;
2504 register Lisp_Object
*ptr
;
2505 register Lisp_Object tem
, item
, vector
;
2506 register struct Lisp_Cons
*otem
;
2509 tem
= read_list (1, readcharfun
);
2510 len
= Flength (tem
);
2511 vector
= (read_pure
? make_pure_vector (XINT (len
)) : Fmake_vector (len
, Qnil
));
2513 size
= XVECTOR (vector
)->size
;
2514 ptr
= XVECTOR (vector
)->contents
;
2515 for (i
= 0; i
< size
; i
++)
2518 /* If `load-force-doc-strings' is t when reading a lazily-loaded
2519 bytecode object, the docstring containing the bytecode and
2520 constants values must be treated as unibyte and passed to
2521 Fread, to get the actual bytecode string and constants vector. */
2522 if (bytecodeflag
&& load_force_doc_strings
)
2524 if (i
== COMPILED_BYTECODE
)
2526 if (!STRINGP (item
))
2527 error ("invalid byte code");
2529 /* Delay handling the bytecode slot until we know whether
2530 it is lazily-loaded (we can tell by whether the
2531 constants slot is nil). */
2532 ptr
[COMPILED_CONSTANTS
] = item
;
2535 else if (i
== COMPILED_CONSTANTS
)
2537 Lisp_Object bytestr
= ptr
[COMPILED_CONSTANTS
];
2541 /* Coerce string to unibyte (like string-as-unibyte,
2542 but without generating extra garbage and
2543 guaranteeing no change in the contents). */
2544 XSTRING (bytestr
)->size
= STRING_BYTES (XSTRING (bytestr
));
2545 SET_STRING_BYTES (XSTRING (bytestr
), -1);
2547 item
= Fread (bytestr
);
2549 error ("invalid byte code");
2551 otem
= XCONS (item
);
2552 bytestr
= XCAR (item
);
2557 /* Now handle the bytecode slot. */
2558 ptr
[COMPILED_BYTECODE
] = read_pure
? Fpurecopy (bytestr
) : bytestr
;
2561 ptr
[i
] = read_pure
? Fpurecopy (item
) : item
;
2569 /* FLAG = 1 means check for ] to terminate rather than ) and .
2570 FLAG = -1 means check for starting with defun
2571 and make structure pure. */
2574 read_list (flag
, readcharfun
)
2576 register Lisp_Object readcharfun
;
2578 /* -1 means check next element for defun,
2579 0 means don't check,
2580 1 means already checked and found defun. */
2581 int defunflag
= flag
< 0 ? -1 : 0;
2582 Lisp_Object val
, tail
;
2583 register Lisp_Object elt
, tem
;
2584 struct gcpro gcpro1
, gcpro2
;
2585 /* 0 is the normal case.
2586 1 means this list is a doc reference; replace it with the number 0.
2587 2 means this list is a doc reference; replace it with the doc string. */
2588 int doc_reference
= 0;
2590 /* Initialize this to 1 if we are reading a list. */
2591 int first_in_list
= flag
<= 0;
2600 elt
= read1 (readcharfun
, &ch
, first_in_list
);
2605 /* While building, if the list starts with #$, treat it specially. */
2606 if (EQ (elt
, Vload_file_name
)
2608 && !NILP (Vpurify_flag
))
2610 if (NILP (Vdoc_file_name
))
2611 /* We have not yet called Snarf-documentation, so assume
2612 this file is described in the DOC-MM.NN file
2613 and Snarf-documentation will fill in the right value later.
2614 For now, replace the whole list with 0. */
2617 /* We have already called Snarf-documentation, so make a relative
2618 file name for this file, so it can be found properly
2619 in the installed Lisp directory.
2620 We don't use Fexpand_file_name because that would make
2621 the directory absolute now. */
2622 elt
= concat2 (build_string ("../lisp/"),
2623 Ffile_name_nondirectory (elt
));
2625 else if (EQ (elt
, Vload_file_name
)
2627 && load_force_doc_strings
)
2636 Fsignal (Qinvalid_read_syntax
,
2637 Fcons (make_string (") or . in a vector", 18), Qnil
));
2645 XCDR (tail
) = read0 (readcharfun
);
2647 val
= read0 (readcharfun
);
2648 read1 (readcharfun
, &ch
, 0);
2652 if (doc_reference
== 1)
2653 return make_number (0);
2654 if (doc_reference
== 2)
2656 /* Get a doc string from the file we are loading.
2657 If it's in saved_doc_string, get it from there. */
2658 int pos
= XINT (XCDR (val
));
2659 /* Position is negative for user variables. */
2660 if (pos
< 0) pos
= -pos
;
2661 if (pos
>= saved_doc_string_position
2662 && pos
< (saved_doc_string_position
2663 + saved_doc_string_length
))
2665 int start
= pos
- saved_doc_string_position
;
2668 /* Process quoting with ^A,
2669 and find the end of the string,
2670 which is marked with ^_ (037). */
2671 for (from
= start
, to
= start
;
2672 saved_doc_string
[from
] != 037;)
2674 int c
= saved_doc_string
[from
++];
2677 c
= saved_doc_string
[from
++];
2679 saved_doc_string
[to
++] = c
;
2681 saved_doc_string
[to
++] = 0;
2683 saved_doc_string
[to
++] = 037;
2686 saved_doc_string
[to
++] = c
;
2689 return make_string (saved_doc_string
+ start
,
2692 /* Look in prev_saved_doc_string the same way. */
2693 else if (pos
>= prev_saved_doc_string_position
2694 && pos
< (prev_saved_doc_string_position
2695 + prev_saved_doc_string_length
))
2697 int start
= pos
- prev_saved_doc_string_position
;
2700 /* Process quoting with ^A,
2701 and find the end of the string,
2702 which is marked with ^_ (037). */
2703 for (from
= start
, to
= start
;
2704 prev_saved_doc_string
[from
] != 037;)
2706 int c
= prev_saved_doc_string
[from
++];
2709 c
= prev_saved_doc_string
[from
++];
2711 prev_saved_doc_string
[to
++] = c
;
2713 prev_saved_doc_string
[to
++] = 0;
2715 prev_saved_doc_string
[to
++] = 037;
2718 prev_saved_doc_string
[to
++] = c
;
2721 return make_string (prev_saved_doc_string
+ start
,
2725 return get_doc_string (val
, 0, 0);
2730 return Fsignal (Qinvalid_read_syntax
, Fcons (make_string (". in wrong context", 18), Qnil
));
2732 return Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("] in a list", 11), Qnil
));
2734 tem
= (read_pure
&& flag
<= 0
2735 ? pure_cons (elt
, Qnil
)
2736 : Fcons (elt
, Qnil
));
2743 defunflag
= EQ (elt
, Qdefun
);
2744 else if (defunflag
> 0)
2749 Lisp_Object Vobarray
;
2750 Lisp_Object initial_obarray
;
2752 /* oblookup stores the bucket number here, for the sake of Funintern. */
2754 int oblookup_last_bucket_number
;
2756 static int hash_string ();
2757 Lisp_Object
oblookup ();
2759 /* Get an error if OBARRAY is not an obarray.
2760 If it is one, return it. */
2763 check_obarray (obarray
)
2764 Lisp_Object obarray
;
2766 while (!VECTORP (obarray
) || XVECTOR (obarray
)->size
== 0)
2768 /* If Vobarray is now invalid, force it to be valid. */
2769 if (EQ (Vobarray
, obarray
)) Vobarray
= initial_obarray
;
2771 obarray
= wrong_type_argument (Qvectorp
, obarray
);
2776 /* Intern the C string STR: return a symbol with that name,
2777 interned in the current obarray. */
2784 int len
= strlen (str
);
2785 Lisp_Object obarray
;
2788 if (!VECTORP (obarray
) || XVECTOR (obarray
)->size
== 0)
2789 obarray
= check_obarray (obarray
);
2790 tem
= oblookup (obarray
, str
, len
, len
);
2793 return Fintern (make_string (str
, len
), obarray
);
2796 /* Create an uninterned symbol with name STR. */
2802 int len
= strlen (str
);
2804 return Fmake_symbol ((!NILP (Vpurify_flag
)
2805 ? make_pure_string (str
, len
, len
, 0)
2806 : make_string (str
, len
)));
2809 DEFUN ("intern", Fintern
, Sintern
, 1, 2, 0,
2810 "Return the canonical symbol whose name is STRING.\n\
2811 If there is none, one is created by this function and returned.\n\
2812 A second optional argument specifies the obarray to use;\n\
2813 it defaults to the value of `obarray'.")
2815 Lisp_Object string
, obarray
;
2817 register Lisp_Object tem
, sym
, *ptr
;
2819 if (NILP (obarray
)) obarray
= Vobarray
;
2820 obarray
= check_obarray (obarray
);
2822 CHECK_STRING (string
, 0);
2824 tem
= oblookup (obarray
, XSTRING (string
)->data
,
2825 XSTRING (string
)->size
,
2826 STRING_BYTES (XSTRING (string
)));
2827 if (!INTEGERP (tem
))
2830 if (!NILP (Vpurify_flag
))
2831 string
= Fpurecopy (string
);
2832 sym
= Fmake_symbol (string
);
2833 XSYMBOL (sym
)->obarray
= obarray
;
2835 if ((XSTRING (string
)->data
[0] == ':')
2836 && EQ (obarray
, initial_obarray
))
2837 XSYMBOL (sym
)->value
= sym
;
2839 ptr
= &XVECTOR (obarray
)->contents
[XINT (tem
)];
2841 XSYMBOL (sym
)->next
= XSYMBOL (*ptr
);
2843 XSYMBOL (sym
)->next
= 0;
2848 DEFUN ("intern-soft", Fintern_soft
, Sintern_soft
, 1, 2, 0,
2849 "Return the canonical symbol named NAME, or nil if none exists.\n\
2850 NAME may be a string or a symbol. If it is a symbol, that exact\n\
2851 symbol is searched for.\n\
2852 A second optional argument specifies the obarray to use;\n\
2853 it defaults to the value of `obarray'.")
2855 Lisp_Object name
, obarray
;
2857 register Lisp_Object tem
;
2858 struct Lisp_String
*string
;
2860 if (NILP (obarray
)) obarray
= Vobarray
;
2861 obarray
= check_obarray (obarray
);
2863 if (!SYMBOLP (name
))
2865 CHECK_STRING (name
, 0);
2866 string
= XSTRING (name
);
2869 string
= XSYMBOL (name
)->name
;
2871 tem
= oblookup (obarray
, string
->data
, string
->size
, STRING_BYTES (string
));
2872 if (INTEGERP (tem
) || (SYMBOLP (name
) && !EQ (name
, tem
)))
2878 DEFUN ("unintern", Funintern
, Sunintern
, 1, 2, 0,
2879 "Delete the symbol named NAME, if any, from OBARRAY.\n\
2880 The value is t if a symbol was found and deleted, nil otherwise.\n\
2881 NAME may be a string or a symbol. If it is a symbol, that symbol\n\
2882 is deleted, if it belongs to OBARRAY--no other symbol is deleted.\n\
2883 OBARRAY defaults to the value of the variable `obarray'.")
2885 Lisp_Object name
, obarray
;
2887 register Lisp_Object string
, tem
;
2890 if (NILP (obarray
)) obarray
= Vobarray
;
2891 obarray
= check_obarray (obarray
);
2894 XSETSTRING (string
, XSYMBOL (name
)->name
);
2897 CHECK_STRING (name
, 0);
2901 tem
= oblookup (obarray
, XSTRING (string
)->data
,
2902 XSTRING (string
)->size
,
2903 STRING_BYTES (XSTRING (string
)));
2906 /* If arg was a symbol, don't delete anything but that symbol itself. */
2907 if (SYMBOLP (name
) && !EQ (name
, tem
))
2910 XSYMBOL (tem
)->obarray
= Qnil
;
2912 hash
= oblookup_last_bucket_number
;
2914 if (EQ (XVECTOR (obarray
)->contents
[hash
], tem
))
2916 if (XSYMBOL (tem
)->next
)
2917 XSETSYMBOL (XVECTOR (obarray
)->contents
[hash
], XSYMBOL (tem
)->next
);
2919 XSETINT (XVECTOR (obarray
)->contents
[hash
], 0);
2923 Lisp_Object tail
, following
;
2925 for (tail
= XVECTOR (obarray
)->contents
[hash
];
2926 XSYMBOL (tail
)->next
;
2929 XSETSYMBOL (following
, XSYMBOL (tail
)->next
);
2930 if (EQ (following
, tem
))
2932 XSYMBOL (tail
)->next
= XSYMBOL (following
)->next
;
2941 /* Return the symbol in OBARRAY whose names matches the string
2942 of SIZE characters (SIZE_BYTE bytes) at PTR.
2943 If there is no such symbol in OBARRAY, return nil.
2945 Also store the bucket number in oblookup_last_bucket_number. */
2948 oblookup (obarray
, ptr
, size
, size_byte
)
2949 Lisp_Object obarray
;
2951 int size
, size_byte
;
2955 register Lisp_Object tail
;
2956 Lisp_Object bucket
, tem
;
2958 if (!VECTORP (obarray
)
2959 || (obsize
= XVECTOR (obarray
)->size
) == 0)
2961 obarray
= check_obarray (obarray
);
2962 obsize
= XVECTOR (obarray
)->size
;
2964 /* This is sometimes needed in the middle of GC. */
2965 obsize
&= ~ARRAY_MARK_FLAG
;
2966 /* Combining next two lines breaks VMS C 2.3. */
2967 hash
= hash_string (ptr
, size_byte
);
2969 bucket
= XVECTOR (obarray
)->contents
[hash
];
2970 oblookup_last_bucket_number
= hash
;
2971 if (XFASTINT (bucket
) == 0)
2973 else if (!SYMBOLP (bucket
))
2974 error ("Bad data in guts of obarray"); /* Like CADR error message */
2976 for (tail
= bucket
; ; XSETSYMBOL (tail
, XSYMBOL (tail
)->next
))
2978 if (STRING_BYTES (XSYMBOL (tail
)->name
) == size_byte
2979 && XSYMBOL (tail
)->name
->size
== size
2980 && !bcmp (XSYMBOL (tail
)->name
->data
, ptr
, size_byte
))
2982 else if (XSYMBOL (tail
)->next
== 0)
2985 XSETINT (tem
, hash
);
2990 hash_string (ptr
, len
)
2994 register unsigned char *p
= ptr
;
2995 register unsigned char *end
= p
+ len
;
2996 register unsigned char c
;
2997 register int hash
= 0;
3002 if (c
>= 0140) c
-= 40;
3003 hash
= ((hash
<<3) + (hash
>>28) + c
);
3005 return hash
& 07777777777;
3009 map_obarray (obarray
, fn
, arg
)
3010 Lisp_Object obarray
;
3011 void (*fn
) P_ ((Lisp_Object
, Lisp_Object
));
3015 register Lisp_Object tail
;
3016 CHECK_VECTOR (obarray
, 1);
3017 for (i
= XVECTOR (obarray
)->size
- 1; i
>= 0; i
--)
3019 tail
= XVECTOR (obarray
)->contents
[i
];
3024 if (XSYMBOL (tail
)->next
== 0)
3026 XSETSYMBOL (tail
, XSYMBOL (tail
)->next
);
3032 mapatoms_1 (sym
, function
)
3033 Lisp_Object sym
, function
;
3035 call1 (function
, sym
);
3038 DEFUN ("mapatoms", Fmapatoms
, Smapatoms
, 1, 2, 0,
3039 "Call FUNCTION on every symbol in OBARRAY.\n\
3040 OBARRAY defaults to the value of `obarray'.")
3042 Lisp_Object function
, obarray
;
3044 if (NILP (obarray
)) obarray
= Vobarray
;
3045 obarray
= check_obarray (obarray
);
3047 map_obarray (obarray
, mapatoms_1
, function
);
3051 #define OBARRAY_SIZE 1511
3056 Lisp_Object oblength
;
3060 XSETFASTINT (oblength
, OBARRAY_SIZE
);
3062 Qnil
= Fmake_symbol (make_pure_string ("nil", 3, 3, 0));
3063 Vobarray
= Fmake_vector (oblength
, make_number (0));
3064 initial_obarray
= Vobarray
;
3065 staticpro (&initial_obarray
);
3066 /* Intern nil in the obarray */
3067 XSYMBOL (Qnil
)->obarray
= Vobarray
;
3068 /* These locals are to kludge around a pyramid compiler bug. */
3069 hash
= hash_string ("nil", 3);
3070 /* Separate statement here to avoid VAXC bug. */
3071 hash
%= OBARRAY_SIZE
;
3072 tem
= &XVECTOR (Vobarray
)->contents
[hash
];
3075 Qunbound
= Fmake_symbol (make_pure_string ("unbound", 7, 7, 0));
3076 XSYMBOL (Qnil
)->function
= Qunbound
;
3077 XSYMBOL (Qunbound
)->value
= Qunbound
;
3078 XSYMBOL (Qunbound
)->function
= Qunbound
;
3081 XSYMBOL (Qnil
)->value
= Qnil
;
3082 XSYMBOL (Qnil
)->plist
= Qnil
;
3083 XSYMBOL (Qt
)->value
= Qt
;
3085 /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */
3088 Qvariable_documentation
= intern ("variable-documentation");
3089 staticpro (&Qvariable_documentation
);
3091 read_buffer_size
= 100 + MAX_MULTIBYTE_LENGTH
;
3092 read_buffer
= (char *) xmalloc (read_buffer_size
);
3097 struct Lisp_Subr
*sname
;
3100 sym
= intern (sname
->symbol_name
);
3101 XSETSUBR (XSYMBOL (sym
)->function
, sname
);
3104 #ifdef NOTDEF /* use fset in subr.el now */
3106 defalias (sname
, string
)
3107 struct Lisp_Subr
*sname
;
3111 sym
= intern (string
);
3112 XSETSUBR (XSYMBOL (sym
)->function
, sname
);
3116 /* Define an "integer variable"; a symbol whose value is forwarded
3117 to a C variable of type int. Sample call: */
3118 /* DEFVAR_INT ("indent-tabs-mode", &indent_tabs_mode, "Documentation"); */
3120 defvar_int (namestring
, address
)
3124 Lisp_Object sym
, val
;
3125 sym
= intern (namestring
);
3126 val
= allocate_misc ();
3127 XMISCTYPE (val
) = Lisp_Misc_Intfwd
;
3128 XINTFWD (val
)->intvar
= address
;
3129 XSYMBOL (sym
)->value
= val
;
3132 /* Similar but define a variable whose value is T if address contains 1,
3133 NIL if address contains 0 */
3135 defvar_bool (namestring
, address
)
3139 Lisp_Object sym
, val
;
3140 sym
= intern (namestring
);
3141 val
= allocate_misc ();
3142 XMISCTYPE (val
) = Lisp_Misc_Boolfwd
;
3143 XBOOLFWD (val
)->boolvar
= address
;
3144 XSYMBOL (sym
)->value
= val
;
3145 Vbyte_boolean_vars
= Fcons (sym
, Vbyte_boolean_vars
);
3148 /* Similar but define a variable whose value is the Lisp Object stored
3149 at address. Two versions: with and without gc-marking of the C
3150 variable. The nopro version is used when that variable will be
3151 gc-marked for some other reason, since marking the same slot twice
3152 can cause trouble with strings. */
3154 defvar_lisp_nopro (namestring
, address
)
3156 Lisp_Object
*address
;
3158 Lisp_Object sym
, val
;
3159 sym
= intern (namestring
);
3160 val
= allocate_misc ();
3161 XMISCTYPE (val
) = Lisp_Misc_Objfwd
;
3162 XOBJFWD (val
)->objvar
= address
;
3163 XSYMBOL (sym
)->value
= val
;
3167 defvar_lisp (namestring
, address
)
3169 Lisp_Object
*address
;
3171 defvar_lisp_nopro (namestring
, address
);
3172 staticpro (address
);
3175 /* Similar but define a variable whose value is the Lisp Object stored in
3176 the current buffer. address is the address of the slot in the buffer
3177 that is current now. */
3180 defvar_per_buffer (namestring
, address
, type
, doc
)
3182 Lisp_Object
*address
;
3186 Lisp_Object sym
, val
;
3188 extern struct buffer buffer_local_symbols
;
3190 sym
= intern (namestring
);
3191 val
= allocate_misc ();
3192 offset
= (char *)address
- (char *)current_buffer
;
3194 XMISCTYPE (val
) = Lisp_Misc_Buffer_Objfwd
;
3195 XBUFFER_OBJFWD (val
)->offset
= offset
;
3196 XSYMBOL (sym
)->value
= val
;
3197 PER_BUFFER_SYMBOL (offset
) = sym
;
3198 PER_BUFFER_TYPE (offset
) = type
;
3200 if (PER_BUFFER_IDX (offset
) == 0)
3201 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
3202 slot of buffer_local_flags */
3207 /* Similar but define a variable whose value is the Lisp Object stored
3208 at a particular offset in the current kboard object. */
3211 defvar_kboard (namestring
, offset
)
3215 Lisp_Object sym
, val
;
3216 sym
= intern (namestring
);
3217 val
= allocate_misc ();
3218 XMISCTYPE (val
) = Lisp_Misc_Kboard_Objfwd
;
3219 XKBOARD_OBJFWD (val
)->offset
= offset
;
3220 XSYMBOL (sym
)->value
= val
;
3223 /* Record the value of load-path used at the start of dumping
3224 so we can see if the site changed it later during dumping. */
3225 static Lisp_Object dump_path
;
3231 int turn_off_warning
= 0;
3233 /* Compute the default load-path. */
3235 normal
= PATH_LOADSEARCH
;
3236 Vload_path
= decode_env_path (0, normal
);
3238 if (NILP (Vpurify_flag
))
3239 normal
= PATH_LOADSEARCH
;
3241 normal
= PATH_DUMPLOADSEARCH
;
3243 /* In a dumped Emacs, we normally have to reset the value of
3244 Vload_path from PATH_LOADSEARCH, since the value that was dumped
3245 uses ../lisp, instead of the path of the installed elisp
3246 libraries. However, if it appears that Vload_path was changed
3247 from the default before dumping, don't override that value. */
3250 if (! NILP (Fequal (dump_path
, Vload_path
)))
3252 Vload_path
= decode_env_path (0, normal
);
3253 if (!NILP (Vinstallation_directory
))
3255 /* Add to the path the lisp subdir of the
3256 installation dir, if it exists. */
3257 Lisp_Object tem
, tem1
;
3258 tem
= Fexpand_file_name (build_string ("lisp"),
3259 Vinstallation_directory
);
3260 tem1
= Ffile_exists_p (tem
);
3263 if (NILP (Fmember (tem
, Vload_path
)))
3265 turn_off_warning
= 1;
3266 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3270 /* That dir doesn't exist, so add the build-time
3271 Lisp dirs instead. */
3272 Vload_path
= nconc2 (Vload_path
, dump_path
);
3274 /* Add leim under the installation dir, if it exists. */
3275 tem
= Fexpand_file_name (build_string ("leim"),
3276 Vinstallation_directory
);
3277 tem1
= Ffile_exists_p (tem
);
3280 if (NILP (Fmember (tem
, Vload_path
)))
3281 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3284 /* Add site-list under the installation dir, if it exists. */
3285 tem
= Fexpand_file_name (build_string ("site-lisp"),
3286 Vinstallation_directory
);
3287 tem1
= Ffile_exists_p (tem
);
3290 if (NILP (Fmember (tem
, Vload_path
)))
3291 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3294 /* If Emacs was not built in the source directory,
3295 and it is run from where it was built, add to load-path
3296 the lisp, leim and site-lisp dirs under that directory. */
3298 if (NILP (Fequal (Vinstallation_directory
, Vsource_directory
)))
3302 tem
= Fexpand_file_name (build_string ("src/Makefile"),
3303 Vinstallation_directory
);
3304 tem1
= Ffile_exists_p (tem
);
3306 /* Don't be fooled if they moved the entire source tree
3307 AFTER dumping Emacs. If the build directory is indeed
3308 different from the source dir, src/Makefile.in and
3309 src/Makefile will not be found together. */
3310 tem
= Fexpand_file_name (build_string ("src/Makefile.in"),
3311 Vinstallation_directory
);
3312 tem2
= Ffile_exists_p (tem
);
3313 if (!NILP (tem1
) && NILP (tem2
))
3315 tem
= Fexpand_file_name (build_string ("lisp"),
3318 if (NILP (Fmember (tem
, Vload_path
)))
3319 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3321 tem
= Fexpand_file_name (build_string ("leim"),
3324 if (NILP (Fmember (tem
, Vload_path
)))
3325 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3327 tem
= Fexpand_file_name (build_string ("site-lisp"),
3330 if (NILP (Fmember (tem
, Vload_path
)))
3331 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3339 /* NORMAL refers to the lisp dir in the source directory. */
3340 /* We used to add ../lisp at the front here, but
3341 that caused trouble because it was copied from dump_path
3342 into Vload_path, aboe, when Vinstallation_directory was non-nil.
3343 It should be unnecessary. */
3344 Vload_path
= decode_env_path (0, normal
);
3345 dump_path
= Vload_path
;
3350 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
3351 almost never correct, thereby causing a warning to be printed out that
3352 confuses users. Since PATH_LOADSEARCH is always overridden by the
3353 EMACSLOADPATH environment variable below, disable the warning on NT. */
3355 /* Warn if dirs in the *standard* path don't exist. */
3356 if (!turn_off_warning
)
3358 Lisp_Object path_tail
;
3360 for (path_tail
= Vload_path
;
3362 path_tail
= XCDR (path_tail
))
3364 Lisp_Object dirfile
;
3365 dirfile
= Fcar (path_tail
);
3366 if (STRINGP (dirfile
))
3368 dirfile
= Fdirectory_file_name (dirfile
);
3369 if (access (XSTRING (dirfile
)->data
, 0) < 0)
3370 dir_warning ("Warning: Lisp directory `%s' does not exist.\n",
3375 #endif /* WINDOWSNT */
3377 /* If the EMACSLOADPATH environment variable is set, use its value.
3378 This doesn't apply if we're dumping. */
3380 if (NILP (Vpurify_flag
)
3381 && egetenv ("EMACSLOADPATH"))
3383 Vload_path
= decode_env_path ("EMACSLOADPATH", normal
);
3387 load_in_progress
= 0;
3388 Vload_file_name
= Qnil
;
3390 load_descriptor_list
= Qnil
;
3392 Vstandard_input
= Qt
;
3395 /* Print a warning, using format string FORMAT, that directory DIRNAME
3396 does not exist. Print it on stderr and put it in *Message*. */
3399 dir_warning (format
, dirname
)
3401 Lisp_Object dirname
;
3404 = (char *) alloca (XSTRING (dirname
)->size
+ strlen (format
) + 5);
3406 fprintf (stderr
, format
, XSTRING (dirname
)->data
);
3407 sprintf (buffer
, format
, XSTRING (dirname
)->data
);
3408 /* Don't log the warning before we've initialized!! */
3410 message_dolog (buffer
, strlen (buffer
), 0, STRING_MULTIBYTE (dirname
));
3417 defsubr (&Sread_from_string
);
3419 defsubr (&Sintern_soft
);
3420 defsubr (&Sunintern
);
3422 defsubr (&Seval_buffer
);
3423 defsubr (&Seval_region
);
3424 defsubr (&Sread_char
);
3425 defsubr (&Sread_char_exclusive
);
3426 defsubr (&Sread_event
);
3427 defsubr (&Sget_file_char
);
3428 defsubr (&Smapatoms
);
3430 DEFVAR_LISP ("obarray", &Vobarray
,
3431 "Symbol table for use by `intern' and `read'.\n\
3432 It is a vector whose length ought to be prime for best results.\n\
3433 The vector's contents don't make sense if examined from Lisp programs;\n\
3434 to find all the symbols in an obarray, use `mapatoms'.");
3436 DEFVAR_LISP ("values", &Vvalues
,
3437 "List of values of all expressions which were read, evaluated and printed.\n\
3438 Order is reverse chronological.");
3440 DEFVAR_LISP ("standard-input", &Vstandard_input
,
3441 "Stream for read to get input from.\n\
3442 See documentation of `read' for possible values.");
3443 Vstandard_input
= Qt
;
3445 DEFVAR_LISP ("load-path", &Vload_path
,
3446 "*List of directories to search for files to load.\n\
3447 Each element is a string (directory name) or nil (try default directory).\n\
3448 Initialized based on EMACSLOADPATH environment variable, if any,\n\
3449 otherwise to default specified by file `epaths.h' when Emacs was built.");
3451 DEFVAR_BOOL ("load-in-progress", &load_in_progress
,
3452 "Non-nil iff inside of `load'.");
3454 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist
,
3455 "An alist of expressions to be evalled when particular files are loaded.\n\
3456 Each element looks like (FILENAME FORMS...).\n\
3457 When `load' is run and the file-name argument is FILENAME,\n\
3458 the FORMS in the corresponding element are executed at the end of loading.\n\n\
3459 FILENAME must match exactly! Normally FILENAME is the name of a library,\n\
3460 with no directory specified, since that is how `load' is normally called.\n\
3461 An error in FORMS does not undo the load,\n\
3462 but does prevent execution of the rest of the FORMS.");
3463 Vafter_load_alist
= Qnil
;
3465 DEFVAR_LISP ("load-history", &Vload_history
,
3466 "Alist mapping source file names to symbols and features.\n\
3467 Each alist element is a list that starts with a file name,\n\
3468 except for one element (optional) that starts with nil and describes\n\
3469 definitions evaluated from buffers not visiting files.\n\
3470 The remaining elements of each list are symbols defined as functions\n\
3471 or variables, and cons cells `(provide . FEATURE)', `(require . FEATURE)',\n\
3472 and `(autoload . SYMBOL)'.");
3473 Vload_history
= Qnil
;
3475 DEFVAR_LISP ("load-file-name", &Vload_file_name
,
3476 "Full name of file being loaded by `load'.");
3477 Vload_file_name
= Qnil
;
3479 DEFVAR_LISP ("user-init-file", &Vuser_init_file
,
3480 "File name, including directory, of user's initialization file.\n\
3481 If the file loaded had extension `.elc' and there was a corresponding `.el'\n\
3482 file, this variable contains the name of the .el file, suitable for use\n\
3483 by functions like `custom-save-all' which edit the init file.");
3484 Vuser_init_file
= Qnil
;
3486 DEFVAR_LISP ("current-load-list", &Vcurrent_load_list
,
3487 "Used for internal purposes by `load'.");
3488 Vcurrent_load_list
= Qnil
;
3490 DEFVAR_LISP ("load-read-function", &Vload_read_function
,
3491 "Function used by `load' and `eval-region' for reading expressions.\n\
3492 The default is nil, which means use the function `read'.");
3493 Vload_read_function
= Qnil
;
3495 DEFVAR_LISP ("load-source-file-function", &Vload_source_file_function
,
3496 "Function called in `load' for loading an Emacs lisp source file.\n\
3497 This function is for doing code conversion before reading the source file.\n\
3498 If nil, loading is done without any code conversion.\n\
3499 Arguments are FULLNAME, FILE, NOERROR, NOMESSAGE, where\n\
3500 FULLNAME is the full name of FILE.\n\
3501 See `load' for the meaning of the remaining arguments.");
3502 Vload_source_file_function
= Qnil
;
3504 DEFVAR_BOOL ("load-force-doc-strings", &load_force_doc_strings
,
3505 "Non-nil means `load' should force-load all dynamic doc strings.\n\
3506 This is useful when the file being loaded is a temporary copy.");
3507 load_force_doc_strings
= 0;
3509 DEFVAR_BOOL ("load-convert-to-unibyte", &load_convert_to_unibyte
,
3510 "Non-nil means `read' converts strings to unibyte whenever possible.\n\
3511 This is normally bound by `load' and `eval-buffer' to control `read',\n\
3512 and is not meant for users to change.");
3513 load_convert_to_unibyte
= 0;
3515 DEFVAR_LISP ("source-directory", &Vsource_directory
,
3516 "Directory in which Emacs sources were found when Emacs was built.\n\
3517 You cannot count on them to still be there!");
3519 = Fexpand_file_name (build_string ("../"),
3520 Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH
)));
3522 DEFVAR_LISP ("preloaded-file-list", &Vpreloaded_file_list
,
3523 "List of files that were preloaded (when dumping Emacs).");
3524 Vpreloaded_file_list
= Qnil
;
3526 DEFVAR_LISP ("byte-boolean-vars", &Vbyte_boolean_vars
,
3527 "List of all DEFVAR_BOOL variables, used by the byte code optimizer.");
3528 Vbyte_boolean_vars
= Qnil
;
3530 DEFVAR_BOOL ("load-dangerous-libraries", &load_dangerous_libraries
,
3531 "Non-nil means load dangerous compiled Lisp files.\n\
3532 Some versions of XEmacs use different byte codes than Emacs. These\n\
3533 incompatible byte codes can make Emacs crash when it tries to execute\n\
3535 load_dangerous_libraries
= 0;
3537 Vbytecomp_version_regexp
= build_string ("^;;;.in Emacs version");
3538 staticpro (&Vbytecomp_version_regexp
);
3540 /* Vsource_directory was initialized in init_lread. */
3542 load_descriptor_list
= Qnil
;
3543 staticpro (&load_descriptor_list
);
3545 Qcurrent_load_list
= intern ("current-load-list");
3546 staticpro (&Qcurrent_load_list
);
3548 Qstandard_input
= intern ("standard-input");
3549 staticpro (&Qstandard_input
);
3551 Qread_char
= intern ("read-char");
3552 staticpro (&Qread_char
);
3554 Qget_file_char
= intern ("get-file-char");
3555 staticpro (&Qget_file_char
);
3557 Qbackquote
= intern ("`");
3558 staticpro (&Qbackquote
);
3559 Qcomma
= intern (",");
3560 staticpro (&Qcomma
);
3561 Qcomma_at
= intern (",@");
3562 staticpro (&Qcomma_at
);
3563 Qcomma_dot
= intern (",.");
3564 staticpro (&Qcomma_dot
);
3566 Qinhibit_file_name_operation
= intern ("inhibit-file-name-operation");
3567 staticpro (&Qinhibit_file_name_operation
);
3569 Qascii_character
= intern ("ascii-character");
3570 staticpro (&Qascii_character
);
3572 Qfunction
= intern ("function");
3573 staticpro (&Qfunction
);
3575 Qload
= intern ("load");
3578 Qload_file_name
= intern ("load-file-name");
3579 staticpro (&Qload_file_name
);
3581 staticpro (&dump_path
);
3583 staticpro (&read_objects
);
3584 read_objects
= Qnil
;
3585 staticpro (&seen_list
);