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
P_ ((Lisp_Object
, FILE*, Lisp_Object
,
534 Lisp_Object (*) (), int,
535 Lisp_Object
, Lisp_Object
));
536 static Lisp_Object load_unwind
P_ ((Lisp_Object
));
537 static Lisp_Object load_descriptor_unwind
P_ ((Lisp_Object
));
539 /* Non-zero means load dangerous compiled Lisp files. */
541 int load_dangerous_libraries
;
543 /* A regular expression used to detect files compiled with Emacs. */
545 static Lisp_Object Vbytecomp_version_regexp
;
548 /* Value is non-zero if the file asswociated with file descriptor FD
549 is a compiled Lisp file that's safe to load. Only files compiled
550 with Emacs are safe to load. Files compiled with XEmacs can lead
551 to a crash in Fbyte_code because of an incompatible change in the
562 /* Read the first few bytes from the file, and look for a line
563 specifying the byte compiler version used. */
564 nbytes
= emacs_read (fd
, buf
, sizeof buf
- 1);
569 /* Skip to the next newline, skipping over the initial `ELC'
570 with NUL bytes following it. */
571 for (i
= 0; i
< nbytes
&& buf
[i
] != '\n'; ++i
)
575 && fast_c_string_match_ignore_case (Vbytecomp_version_regexp
,
580 lseek (fd
, 0, SEEK_SET
);
585 DEFUN ("load", Fload
, Sload
, 1, 5, 0,
586 "Execute a file of Lisp code named FILE.\n\
587 First try FILE with `.elc' appended, then try with `.el',\n\
588 then try FILE unmodified.\n\
589 This function searches the directories in `load-path'.\n\
590 If optional second arg NOERROR is non-nil,\n\
591 report no error if FILE doesn't exist.\n\
592 Print messages at start and end of loading unless\n\
593 optional third arg NOMESSAGE is non-nil.\n\
594 If optional fourth arg NOSUFFIX is non-nil, don't try adding\n\
595 suffixes `.elc' or `.el' to the specified name FILE.\n\
596 If optional fifth arg MUST-SUFFIX is non-nil, insist on\n\
597 the suffix `.elc' or `.el'; don't accept just FILE unless\n\
598 it ends in one of those suffixes or includes a directory name.\n\
599 Return t if file exists.")
600 (file
, noerror
, nomessage
, nosuffix
, must_suffix
)
601 Lisp_Object file
, noerror
, nomessage
, nosuffix
, must_suffix
;
603 register FILE *stream
;
604 register int fd
= -1;
605 register Lisp_Object lispstream
;
606 int count
= specpdl_ptr
- specpdl
;
610 /* 1 means we printed the ".el is newer" message. */
612 /* 1 means we are loading a compiled file. */
621 CHECK_STRING (file
, 0);
623 /* If file name is magic, call the handler. */
624 handler
= Ffind_file_name_handler (file
, Qload
);
626 return call5 (handler
, Qload
, file
, noerror
, nomessage
, nosuffix
);
628 /* Do this after the handler to avoid
629 the need to gcpro noerror, nomessage and nosuffix.
630 (Below here, we care only whether they are nil or not.) */
631 file
= Fsubstitute_in_file_name (file
);
633 /* Avoid weird lossage with null string as arg,
634 since it would try to load a directory as a Lisp file */
635 if (XSTRING (file
)->size
> 0)
637 int size
= STRING_BYTES (XSTRING (file
));
641 if (! NILP (must_suffix
))
643 /* Don't insist on adding a suffix if FILE already ends with one. */
645 && !strcmp (XSTRING (file
)->data
+ size
- 3, ".el"))
648 && !strcmp (XSTRING (file
)->data
+ size
- 4, ".elc"))
650 /* Don't insist on adding a suffix
651 if the argument includes a directory name. */
652 else if (! NILP (Ffile_name_directory (file
)))
656 fd
= openp (Vload_path
, file
,
657 (!NILP (nosuffix
) ? ""
658 : ! NILP (must_suffix
) ? ".elc.gz:.elc:.el.gz:.el"
659 : ".elc:.elc.gz:.el.gz:.el:"),
668 Fsignal (Qfile_error
, Fcons (build_string ("Cannot open load file"),
669 Fcons (file
, Qnil
)));
674 /* Tell startup.el whether or not we found the user's init file. */
675 if (EQ (Qt
, Vuser_init_file
))
676 Vuser_init_file
= found
;
678 /* If FD is 0, that means openp found a magic file. */
681 if (NILP (Fequal (found
, file
)))
682 /* If FOUND is a different file name from FILE,
683 find its handler even if we have already inhibited
684 the `load' operation on FILE. */
685 handler
= Ffind_file_name_handler (found
, Qt
);
687 handler
= Ffind_file_name_handler (found
, Qload
);
688 if (! NILP (handler
))
689 return call5 (handler
, Qload
, found
, noerror
, nomessage
, Qt
);
692 /* Load .elc files directly, but not when they are
693 remote and have no handler! */
694 if (!bcmp (&(XSTRING (found
)->data
[STRING_BYTES (XSTRING (found
)) - 4]),
701 if (!safe_to_load_p (fd
))
704 if (!load_dangerous_libraries
)
705 error ("File `%s' was not compiled in Emacs",
706 XSTRING (found
)->data
);
707 else if (!NILP (nomessage
))
708 message_with_string ("File `%s' not compiled in Emacs", found
, 1);
716 stat ((char *)XSTRING (found
)->data
, &s1
);
717 XSTRING (found
)->data
[STRING_BYTES (XSTRING (found
)) - 1] = 0;
718 result
= stat ((char *)XSTRING (found
)->data
, &s2
);
719 if (result
>= 0 && (unsigned) s1
.st_mtime
< (unsigned) s2
.st_mtime
)
721 /* Make the progress messages mention that source is newer. */
724 /* If we won't print another message, mention this anyway. */
725 if (! NILP (nomessage
))
726 message_with_string ("Source file `%s' newer than byte-compiled file",
729 XSTRING (found
)->data
[STRING_BYTES (XSTRING (found
)) - 1] = 'c';
735 /* We are loading a source file (*.el). */
736 if (!NILP (Vload_source_file_function
))
740 return call4 (Vload_source_file_function
, found
, file
,
741 NILP (noerror
) ? Qnil
: Qt
,
742 NILP (nomessage
) ? Qnil
: Qt
);
748 stream
= fopen ((char *) XSTRING (found
)->data
, fmode
);
749 #else /* not WINDOWSNT */
750 stream
= fdopen (fd
, fmode
);
751 #endif /* not WINDOWSNT */
755 error ("Failure to create stdio stream for %s", XSTRING (file
)->data
);
758 if (! NILP (Vpurify_flag
))
759 Vpreloaded_file_list
= Fcons (file
, Vpreloaded_file_list
);
761 if (NILP (nomessage
))
764 message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...",
767 message_with_string ("Loading %s (source)...", file
, 1);
769 message_with_string ("Loading %s (compiled; note, source file is newer)...",
771 else /* The typical case; compiled file newer than source file. */
772 message_with_string ("Loading %s...", file
, 1);
776 lispstream
= Fcons (Qnil
, Qnil
);
777 XSETFASTINT (XCAR (lispstream
), (EMACS_UINT
)stream
>> 16);
778 XSETFASTINT (XCDR (lispstream
), (EMACS_UINT
)stream
& 0xffff);
779 record_unwind_protect (load_unwind
, lispstream
);
780 record_unwind_protect (load_descriptor_unwind
, load_descriptor_list
);
781 specbind (Qload_file_name
, found
);
782 specbind (Qinhibit_file_name_operation
, Qnil
);
784 = Fcons (make_number (fileno (stream
)), load_descriptor_list
);
786 readevalloop (Qget_file_char
, stream
, file
, Feval
, 0, Qnil
, Qnil
);
787 unbind_to (count
, Qnil
);
789 /* Run any load-hooks for this file. */
790 temp
= Fassoc (file
, Vafter_load_alist
);
792 Fprogn (Fcdr (temp
));
795 if (saved_doc_string
)
796 free (saved_doc_string
);
797 saved_doc_string
= 0;
798 saved_doc_string_size
= 0;
800 if (prev_saved_doc_string
)
801 xfree (prev_saved_doc_string
);
802 prev_saved_doc_string
= 0;
803 prev_saved_doc_string_size
= 0;
805 if (!noninteractive
&& NILP (nomessage
))
808 message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...done",
811 message_with_string ("Loading %s (source)...done", file
, 1);
813 message_with_string ("Loading %s (compiled; note, source file is newer)...done",
815 else /* The typical case; compiled file newer than source file. */
816 message_with_string ("Loading %s...done", file
, 1);
822 load_unwind (stream
) /* used as unwind-protect function in load */
825 fclose ((FILE *) (XFASTINT (XCAR (stream
)) << 16
826 | XFASTINT (XCDR (stream
))));
827 if (--load_in_progress
< 0) load_in_progress
= 0;
832 load_descriptor_unwind (oldlist
)
835 load_descriptor_list
= oldlist
;
839 /* Close all descriptors in use for Floads.
840 This is used when starting a subprocess. */
847 for (tail
= load_descriptor_list
; !NILP (tail
); tail
= XCDR (tail
))
848 emacs_close (XFASTINT (XCAR (tail
)));
853 complete_filename_p (pathname
)
854 Lisp_Object pathname
;
856 register unsigned char *s
= XSTRING (pathname
)->data
;
857 return (IS_DIRECTORY_SEP (s
[0])
858 || (XSTRING (pathname
)->size
> 2
859 && IS_DEVICE_SEP (s
[1]) && IS_DIRECTORY_SEP (s
[2]))
869 /* Search for a file whose name is STR, looking in directories
870 in the Lisp list PATH, and trying suffixes from SUFFIX.
871 SUFFIX is a string containing possible suffixes separated by colons.
872 On success, returns a file descriptor. On failure, returns -1.
874 EXEC_ONLY nonzero means don't open the files,
875 just look for one that is executable. In this case,
876 returns 1 on success.
878 If STOREPTR is nonzero, it points to a slot where the name of
879 the file actually found should be stored as a Lisp string.
880 nil is stored there on failure.
882 If the file we find is remote, return 0
883 but store the found remote file name in *STOREPTR.
884 We do not check for remote files if EXEC_ONLY is nonzero. */
887 openp (path
, str
, suffix
, storeptr
, exec_only
)
888 Lisp_Object path
, str
;
890 Lisp_Object
*storeptr
;
896 register char *fn
= buf
;
899 Lisp_Object filename
;
907 if (complete_filename_p (str
))
910 for (; !NILP (path
); path
= Fcdr (path
))
914 filename
= Fexpand_file_name (str
, Fcar (path
));
915 if (!complete_filename_p (filename
))
916 /* If there are non-absolute elts in PATH (eg ".") */
917 /* Of course, this could conceivably lose if luser sets
918 default-directory to be something non-absolute... */
920 filename
= Fexpand_file_name (filename
, current_buffer
->directory
);
921 if (!complete_filename_p (filename
))
922 /* Give up on this path element! */
926 /* Calculate maximum size of any filename made from
927 this path element/specified file name and any possible suffix. */
928 want_size
= strlen (suffix
) + STRING_BYTES (XSTRING (filename
)) + 1;
929 if (fn_size
< want_size
)
930 fn
= (char *) alloca (fn_size
= 100 + want_size
);
934 /* Loop over suffixes. */
937 char *esuffix
= (char *) index (nsuffix
, ':');
938 int lsuffix
= esuffix
? esuffix
- nsuffix
: strlen (nsuffix
);
941 /* Concatenate path element/specified name with the suffix.
942 If the directory starts with /:, remove that. */
943 if (XSTRING (filename
)->size
> 2
944 && XSTRING (filename
)->data
[0] == '/'
945 && XSTRING (filename
)->data
[1] == ':')
947 strncpy (fn
, XSTRING (filename
)->data
+ 2,
948 STRING_BYTES (XSTRING (filename
)) - 2);
949 fn
[STRING_BYTES (XSTRING (filename
)) - 2] = 0;
953 strncpy (fn
, XSTRING (filename
)->data
,
954 STRING_BYTES (XSTRING (filename
)));
955 fn
[STRING_BYTES (XSTRING (filename
))] = 0;
958 if (lsuffix
!= 0) /* Bug happens on CCI if lsuffix is 0. */
959 strncat (fn
, nsuffix
, lsuffix
);
961 /* Check that the file exists and is not a directory. */
965 handler
= Ffind_file_name_handler (filename
, Qfile_exists_p
);
966 if (! NILP (handler
) && ! exec_only
)
971 string
= build_string (fn
);
972 exists
= ! NILP (exec_only
? Ffile_executable_p (string
)
973 : Ffile_readable_p (string
));
975 && ! NILP (Ffile_directory_p (build_string (fn
))))
980 /* We succeeded; return this descriptor and filename. */
982 *storeptr
= build_string (fn
);
989 int exists
= (stat (fn
, &st
) >= 0
990 && (st
.st_mode
& S_IFMT
) != S_IFDIR
);
993 /* Check that we can access or open it. */
995 fd
= (access (fn
, X_OK
) == 0) ? 1 : -1;
997 fd
= emacs_open (fn
, O_RDONLY
, 0);
1001 /* We succeeded; return this descriptor and filename. */
1003 *storeptr
= build_string (fn
);
1010 /* Advance to next suffix. */
1013 nsuffix
+= lsuffix
+ 1;
1024 /* Merge the list we've accumulated of globals from the current input source
1025 into the load_history variable. The details depend on whether
1026 the source has an associated file name or not. */
1029 build_load_history (stream
, source
)
1033 register Lisp_Object tail
, prev
, newelt
;
1034 register Lisp_Object tem
, tem2
;
1035 register int foundit
, loading
;
1037 loading
= stream
|| !NARROWED
;
1039 tail
= Vload_history
;
1042 while (!NILP (tail
))
1046 /* Find the feature's previous assoc list... */
1047 if (!NILP (Fequal (source
, Fcar (tem
))))
1051 /* If we're loading, remove it. */
1055 Vload_history
= Fcdr (tail
);
1057 Fsetcdr (prev
, Fcdr (tail
));
1060 /* Otherwise, cons on new symbols that are not already members. */
1063 tem2
= Vcurrent_load_list
;
1065 while (CONSP (tem2
))
1067 newelt
= Fcar (tem2
);
1069 if (NILP (Fmemq (newelt
, tem
)))
1070 Fsetcar (tail
, Fcons (Fcar (tem
),
1071 Fcons (newelt
, Fcdr (tem
))));
1084 /* If we're loading, cons the new assoc onto the front of load-history,
1085 the most-recently-loaded position. Also do this if we didn't find
1086 an existing member for the current source. */
1087 if (loading
|| !foundit
)
1088 Vload_history
= Fcons (Fnreverse (Vcurrent_load_list
),
1093 unreadpure (junk
) /* Used as unwind-protect function in readevalloop */
1101 readevalloop_1 (old
)
1104 load_convert_to_unibyte
= ! NILP (old
);
1108 /* Signal an `end-of-file' error, if possible with file name
1112 end_of_file_error ()
1116 if (STRINGP (Vload_file_name
))
1117 data
= Fcons (Vload_file_name
, Qnil
);
1121 Fsignal (Qend_of_file
, data
);
1124 /* UNIBYTE specifies how to set load_convert_to_unibyte
1125 for this invocation.
1126 READFUN, if non-nil, is used instead of `read'. */
1129 readevalloop (readcharfun
, stream
, sourcename
, evalfun
, printflag
, unibyte
, readfun
)
1130 Lisp_Object readcharfun
;
1132 Lisp_Object sourcename
;
1133 Lisp_Object (*evalfun
) ();
1135 Lisp_Object unibyte
, readfun
;
1138 register Lisp_Object val
;
1139 int count
= specpdl_ptr
- specpdl
;
1140 struct gcpro gcpro1
;
1141 struct buffer
*b
= 0;
1142 int continue_reading_p
;
1144 if (BUFFERP (readcharfun
))
1145 b
= XBUFFER (readcharfun
);
1146 else if (MARKERP (readcharfun
))
1147 b
= XMARKER (readcharfun
)->buffer
;
1149 specbind (Qstandard_input
, readcharfun
);
1150 specbind (Qcurrent_load_list
, Qnil
);
1151 record_unwind_protect (readevalloop_1
, load_convert_to_unibyte
? Qt
: Qnil
);
1152 load_convert_to_unibyte
= !NILP (unibyte
);
1154 readchar_backlog
= -1;
1156 GCPRO1 (sourcename
);
1158 LOADHIST_ATTACH (sourcename
);
1160 continue_reading_p
= 1;
1161 while (continue_reading_p
)
1163 if (b
!= 0 && NILP (b
->name
))
1164 error ("Reading from killed buffer");
1170 while ((c
= READCHAR
) != '\n' && c
!= -1);
1175 /* Ignore whitespace here, so we can detect eof. */
1176 if (c
== ' ' || c
== '\t' || c
== '\n' || c
== '\f' || c
== '\r')
1179 if (!NILP (Vpurify_flag
) && c
== '(')
1181 int count1
= specpdl_ptr
- specpdl
;
1182 record_unwind_protect (unreadpure
, Qnil
);
1183 val
= read_list (-1, readcharfun
);
1184 unbind_to (count1
, Qnil
);
1189 read_objects
= Qnil
;
1190 if (!NILP (readfun
))
1192 val
= call1 (readfun
, readcharfun
);
1194 /* If READCHARFUN has set point to ZV, we should
1195 stop reading, even if the form read sets point
1196 to a different value when evaluated. */
1197 if (BUFFERP (readcharfun
))
1199 struct buffer
*b
= XBUFFER (readcharfun
);
1200 if (BUF_PT (b
) == BUF_ZV (b
))
1201 continue_reading_p
= 0;
1204 else if (! NILP (Vload_read_function
))
1205 val
= call1 (Vload_read_function
, readcharfun
);
1207 val
= read0 (readcharfun
);
1210 val
= (*evalfun
) (val
);
1214 Vvalues
= Fcons (val
, Vvalues
);
1215 if (EQ (Vstandard_output
, Qt
))
1222 build_load_history (stream
, sourcename
);
1225 unbind_to (count
, Qnil
);
1228 DEFUN ("eval-buffer", Feval_buffer
, Seval_buffer
, 0, 5, "",
1229 "Execute the current buffer as Lisp code.\n\
1230 Programs can pass two arguments, BUFFER and PRINTFLAG.\n\
1231 BUFFER is the buffer to evaluate (nil means use current buffer).\n\
1232 PRINTFLAG controls printing of output:\n\
1233 nil means discard it; anything else is stream for print.\n\
1235 If the optional third argument FILENAME is non-nil,\n\
1236 it specifies the file name to use for `load-history'.\n\
1237 The optional fourth argument UNIBYTE specifies `load-convert-to-unibyte'\n\
1238 for this invocation.\n\
1240 The optional fifth argument DO-ALLOW-PRINT, if not-nil, specifies that\n\
1241 `print' and related functions should work normally even if PRINTFLAG is nil.\n\
1243 This function preserves the position of point.")
1244 (buffer
, printflag
, filename
, unibyte
, do_allow_print
)
1245 Lisp_Object buffer
, printflag
, filename
, unibyte
, do_allow_print
;
1247 int count
= specpdl_ptr
- specpdl
;
1248 Lisp_Object tem
, buf
;
1251 buf
= Fcurrent_buffer ();
1253 buf
= Fget_buffer (buffer
);
1255 error ("No such buffer");
1257 if (NILP (printflag
) && NILP (do_allow_print
))
1262 if (NILP (filename
))
1263 filename
= XBUFFER (buf
)->filename
;
1265 specbind (Qstandard_output
, tem
);
1266 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
1267 BUF_SET_PT (XBUFFER (buf
), BUF_BEGV (XBUFFER (buf
)));
1268 readevalloop (buf
, 0, filename
, Feval
, !NILP (printflag
), unibyte
, Qnil
);
1269 unbind_to (count
, Qnil
);
1275 XDEFUN ("eval-current-buffer", Feval_current_buffer
, Seval_current_buffer
, 0, 1, "",
1276 "Execute the current buffer as Lisp code.\n\
1277 Programs can pass argument PRINTFLAG which controls printing of output:\n\
1278 nil means discard it; anything else is stream for print.\n\
1280 If there is no error, point does not move. If there is an error,\n\
1281 point remains at the end of the last character read from the buffer.")
1283 Lisp_Object printflag
;
1285 int count
= specpdl_ptr
- specpdl
;
1286 Lisp_Object tem
, cbuf
;
1288 cbuf
= Fcurrent_buffer ()
1290 if (NILP (printflag
))
1294 specbind (Qstandard_output
, tem
);
1295 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
1297 readevalloop (cbuf
, 0, XBUFFER (cbuf
)->filename
, Feval
,
1298 !NILP (printflag
), Qnil
, Qnil
);
1299 return unbind_to (count
, Qnil
);
1303 DEFUN ("eval-region", Feval_region
, Seval_region
, 2, 4, "r",
1304 "Execute the region as Lisp code.\n\
1305 When called from programs, expects two arguments,\n\
1306 giving starting and ending indices in the current buffer\n\
1307 of the text to be executed.\n\
1308 Programs can pass third argument PRINTFLAG which controls output:\n\
1309 nil means discard it; anything else is stream for printing it.\n\
1310 Also the fourth argument READ-FUNCTION, if non-nil, is used\n\
1311 instead of `read' to read each expression. It gets one argument\n\
1312 which is the input stream for reading characters.\n\
1314 This function does not move point.")
1315 (start
, end
, printflag
, read_function
)
1316 Lisp_Object start
, end
, printflag
, read_function
;
1318 int count
= specpdl_ptr
- specpdl
;
1319 Lisp_Object tem
, cbuf
;
1321 cbuf
= Fcurrent_buffer ();
1323 if (NILP (printflag
))
1327 specbind (Qstandard_output
, tem
);
1329 if (NILP (printflag
))
1330 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
1331 record_unwind_protect (save_restriction_restore
, save_restriction_save ());
1333 /* This both uses start and checks its type. */
1335 Fnarrow_to_region (make_number (BEGV
), end
);
1336 readevalloop (cbuf
, 0, XBUFFER (cbuf
)->filename
, Feval
,
1337 !NILP (printflag
), Qnil
, read_function
);
1339 return unbind_to (count
, Qnil
);
1343 DEFUN ("read", Fread
, Sread
, 0, 1, 0,
1344 "Read one Lisp expression as text from STREAM, return as Lisp object.\n\
1345 If STREAM is nil, use the value of `standard-input' (which see).\n\
1346 STREAM or the value of `standard-input' may be:\n\
1347 a buffer (read from point and advance it)\n\
1348 a marker (read from where it points and advance it)\n\
1349 a function (call it with no arguments for each character,\n\
1350 call it with a char as argument to push a char back)\n\
1351 a string (takes text from string, starting at the beginning)\n\
1352 t (read text line using minibuffer and use it).")
1356 extern Lisp_Object
Fread_minibuffer ();
1359 stream
= Vstandard_input
;
1360 if (EQ (stream
, Qt
))
1361 stream
= Qread_char
;
1363 readchar_backlog
= -1;
1364 new_backquote_flag
= 0;
1365 read_objects
= Qnil
;
1367 if (EQ (stream
, Qread_char
))
1368 return Fread_minibuffer (build_string ("Lisp expression: "), Qnil
);
1370 if (STRINGP (stream
))
1371 return Fcar (Fread_from_string (stream
, Qnil
, Qnil
));
1373 return read0 (stream
);
1376 DEFUN ("read-from-string", Fread_from_string
, Sread_from_string
, 1, 3, 0,
1377 "Read one Lisp expression which is represented as text by STRING.\n\
1378 Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).\n\
1379 START and END optionally delimit a substring of STRING from which to read;\n\
1380 they default to 0 and (length STRING) respectively.")
1381 (string
, start
, end
)
1382 Lisp_Object string
, start
, end
;
1384 int startval
, endval
;
1387 CHECK_STRING (string
,0);
1390 endval
= XSTRING (string
)->size
;
1393 CHECK_NUMBER (end
, 2);
1394 endval
= XINT (end
);
1395 if (endval
< 0 || endval
> XSTRING (string
)->size
)
1396 args_out_of_range (string
, end
);
1403 CHECK_NUMBER (start
, 1);
1404 startval
= XINT (start
);
1405 if (startval
< 0 || startval
> endval
)
1406 args_out_of_range (string
, start
);
1409 read_from_string_index
= startval
;
1410 read_from_string_index_byte
= string_char_to_byte (string
, startval
);
1411 read_from_string_limit
= endval
;
1413 new_backquote_flag
= 0;
1414 read_objects
= Qnil
;
1416 tem
= read0 (string
);
1417 return Fcons (tem
, make_number (read_from_string_index
));
1420 /* Use this for recursive reads, in contexts where internal tokens
1425 Lisp_Object readcharfun
;
1427 register Lisp_Object val
;
1430 val
= read1 (readcharfun
, &c
, 0);
1432 Fsignal (Qinvalid_read_syntax
, Fcons (Fmake_string (make_number (1),
1439 static int read_buffer_size
;
1440 static char *read_buffer
;
1442 /* Read multibyte form and return it as a character. C is a first
1443 byte of multibyte form, and rest of them are read from
1447 read_multibyte (c
, readcharfun
)
1449 Lisp_Object readcharfun
;
1451 /* We need the actual character code of this multibyte
1453 unsigned char str
[MAX_MULTIBYTE_LENGTH
];
1457 while ((c
= READCHAR
) >= 0xA0
1458 && len
< MAX_MULTIBYTE_LENGTH
)
1461 return STRING_CHAR (str
, len
);
1464 /* Read a \-escape sequence, assuming we already read the `\'. */
1467 read_escape (readcharfun
, stringp
)
1468 Lisp_Object readcharfun
;
1471 register int c
= READCHAR
;
1475 error ("End of file");
1505 error ("Invalid escape character syntax");
1508 c
= read_escape (readcharfun
, 0);
1509 return c
| meta_modifier
;
1514 error ("Invalid escape character syntax");
1517 c
= read_escape (readcharfun
, 0);
1518 return c
| shift_modifier
;
1523 error ("Invalid escape character syntax");
1526 c
= read_escape (readcharfun
, 0);
1527 return c
| hyper_modifier
;
1532 error ("Invalid escape character syntax");
1535 c
= read_escape (readcharfun
, 0);
1536 return c
| alt_modifier
;
1541 error ("Invalid escape character syntax");
1544 c
= read_escape (readcharfun
, 0);
1545 return c
| super_modifier
;
1550 error ("Invalid escape character syntax");
1554 c
= read_escape (readcharfun
, 0);
1555 if ((c
& ~CHAR_MODIFIER_MASK
) == '?')
1556 return 0177 | (c
& CHAR_MODIFIER_MASK
);
1557 else if (! SINGLE_BYTE_CHAR_P ((c
& ~CHAR_MODIFIER_MASK
)))
1558 return c
| ctrl_modifier
;
1559 /* ASCII control chars are made from letters (both cases),
1560 as well as the non-letters within 0100...0137. */
1561 else if ((c
& 0137) >= 0101 && (c
& 0137) <= 0132)
1562 return (c
& (037 | ~0177));
1563 else if ((c
& 0177) >= 0100 && (c
& 0177) <= 0137)
1564 return (c
& (037 | ~0177));
1566 return c
| ctrl_modifier
;
1576 /* An octal escape, as in ANSI C. */
1578 register int i
= c
- '0';
1579 register int count
= 0;
1582 if ((c
= READCHAR
) >= '0' && c
<= '7')
1597 /* A hex escape, as in ANSI C. */
1603 if (c
>= '0' && c
<= '9')
1608 else if ((c
>= 'a' && c
<= 'f')
1609 || (c
>= 'A' && c
<= 'F'))
1612 if (c
>= 'a' && c
<= 'f')
1627 if (BASE_LEADING_CODE_P (c
))
1628 c
= read_multibyte (c
, readcharfun
);
1634 /* Read an integer in radix RADIX using READCHARFUN to read
1635 characters. RADIX must be in the interval [2..36]; if it isn't, a
1636 read error is signaled . Value is the integer read. Signals an
1637 error if encountering invalid read syntax or if RADIX is out of
1641 read_integer (readcharfun
, radix
)
1642 Lisp_Object readcharfun
;
1645 int number
, ndigits
, invalid_p
, c
, sign
;
1647 if (radix
< 2 || radix
> 36)
1651 number
= ndigits
= invalid_p
= 0;
1667 if (c
>= '0' && c
<= '9')
1669 else if (c
>= 'a' && c
<= 'z')
1670 digit
= c
- 'a' + 10;
1671 else if (c
>= 'A' && c
<= 'Z')
1672 digit
= c
- 'A' + 10;
1679 if (digit
< 0 || digit
>= radix
)
1682 number
= radix
* number
+ digit
;
1688 if (ndigits
== 0 || invalid_p
)
1691 sprintf (buf
, "integer, radix %d", radix
);
1692 Fsignal (Qinvalid_read_syntax
, Fcons (build_string (buf
), Qnil
));
1695 return make_number (sign
* number
);
1699 /* If the next token is ')' or ']' or '.', we store that character
1700 in *PCH and the return value is not interesting. Else, we store
1701 zero in *PCH and we read and return one lisp object.
1703 FIRST_IN_LIST is nonzero if this is the first element of a list. */
1706 read1 (readcharfun
, pch
, first_in_list
)
1707 register Lisp_Object readcharfun
;
1712 int uninterned_symbol
= 0;
1720 end_of_file_error ();
1725 return read_list (0, readcharfun
);
1728 return read_vector (readcharfun
, 0);
1745 tmp
= read_vector (readcharfun
, 0);
1746 if (XVECTOR (tmp
)->size
< CHAR_TABLE_STANDARD_SLOTS
1747 || XVECTOR (tmp
)->size
> CHAR_TABLE_STANDARD_SLOTS
+ 10)
1748 error ("Invalid size char-table");
1749 XSETCHAR_TABLE (tmp
, XCHAR_TABLE (tmp
));
1750 XCHAR_TABLE (tmp
)->top
= Qt
;
1759 tmp
= read_vector (readcharfun
, 0);
1760 if (XVECTOR (tmp
)->size
!= SUB_CHAR_TABLE_STANDARD_SLOTS
)
1761 error ("Invalid size char-table");
1762 XSETCHAR_TABLE (tmp
, XCHAR_TABLE (tmp
));
1763 XCHAR_TABLE (tmp
)->top
= Qnil
;
1766 Fsignal (Qinvalid_read_syntax
,
1767 Fcons (make_string ("#^^", 3), Qnil
));
1769 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#^", 2), Qnil
));
1774 length
= read1 (readcharfun
, pch
, first_in_list
);
1778 Lisp_Object tmp
, val
;
1779 int size_in_chars
= ((XFASTINT (length
) + BITS_PER_CHAR
- 1)
1783 tmp
= read1 (readcharfun
, pch
, first_in_list
);
1784 if (size_in_chars
!= XSTRING (tmp
)->size
1785 /* We used to print 1 char too many
1786 when the number of bits was a multiple of 8.
1787 Accept such input in case it came from an old version. */
1788 && ! (XFASTINT (length
)
1789 == (XSTRING (tmp
)->size
- 1) * BITS_PER_CHAR
))
1790 Fsignal (Qinvalid_read_syntax
,
1791 Fcons (make_string ("#&...", 5), Qnil
));
1793 val
= Fmake_bool_vector (length
, Qnil
);
1794 bcopy (XSTRING (tmp
)->data
, XBOOL_VECTOR (val
)->data
,
1796 /* Clear the extraneous bits in the last byte. */
1797 if (XINT (length
) != size_in_chars
* BITS_PER_CHAR
)
1798 XBOOL_VECTOR (val
)->data
[size_in_chars
- 1]
1799 &= (1 << (XINT (length
) % BITS_PER_CHAR
)) - 1;
1802 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#&...", 5),
1807 /* Accept compiled functions at read-time so that we don't have to
1808 build them using function calls. */
1810 tmp
= read_vector (readcharfun
, 1);
1811 return Fmake_byte_code (XVECTOR (tmp
)->size
,
1812 XVECTOR (tmp
)->contents
);
1817 struct gcpro gcpro1
;
1820 /* Read the string itself. */
1821 tmp
= read1 (readcharfun
, &ch
, 0);
1822 if (ch
!= 0 || !STRINGP (tmp
))
1823 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#", 1), Qnil
));
1825 /* Read the intervals and their properties. */
1828 Lisp_Object beg
, end
, plist
;
1830 beg
= read1 (readcharfun
, &ch
, 0);
1834 end
= read1 (readcharfun
, &ch
, 0);
1836 plist
= read1 (readcharfun
, &ch
, 0);
1838 Fsignal (Qinvalid_read_syntax
,
1839 Fcons (build_string ("invalid string property list"),
1841 Fset_text_properties (beg
, end
, plist
, tmp
);
1847 /* #@NUMBER is used to skip NUMBER following characters.
1848 That's used in .elc files to skip over doc strings
1849 and function definitions. */
1854 /* Read a decimal integer. */
1855 while ((c
= READCHAR
) >= 0
1856 && c
>= '0' && c
<= '9')
1864 if (load_force_doc_strings
&& EQ (readcharfun
, Qget_file_char
))
1866 /* If we are supposed to force doc strings into core right now,
1867 record the last string that we skipped,
1868 and record where in the file it comes from. */
1870 /* But first exchange saved_doc_string
1871 with prev_saved_doc_string, so we save two strings. */
1873 char *temp
= saved_doc_string
;
1874 int temp_size
= saved_doc_string_size
;
1875 file_offset temp_pos
= saved_doc_string_position
;
1876 int temp_len
= saved_doc_string_length
;
1878 saved_doc_string
= prev_saved_doc_string
;
1879 saved_doc_string_size
= prev_saved_doc_string_size
;
1880 saved_doc_string_position
= prev_saved_doc_string_position
;
1881 saved_doc_string_length
= prev_saved_doc_string_length
;
1883 prev_saved_doc_string
= temp
;
1884 prev_saved_doc_string_size
= temp_size
;
1885 prev_saved_doc_string_position
= temp_pos
;
1886 prev_saved_doc_string_length
= temp_len
;
1889 if (saved_doc_string_size
== 0)
1891 saved_doc_string_size
= nskip
+ 100;
1892 saved_doc_string
= (char *) xmalloc (saved_doc_string_size
);
1894 if (nskip
> saved_doc_string_size
)
1896 saved_doc_string_size
= nskip
+ 100;
1897 saved_doc_string
= (char *) xrealloc (saved_doc_string
,
1898 saved_doc_string_size
);
1901 saved_doc_string_position
= file_tell (instream
);
1903 /* Copy that many characters into saved_doc_string. */
1904 for (i
= 0; i
< nskip
&& c
>= 0; i
++)
1905 saved_doc_string
[i
] = c
= READCHAR
;
1907 saved_doc_string_length
= i
;
1911 /* Skip that many characters. */
1912 for (i
= 0; i
< nskip
&& c
>= 0; i
++)
1919 return Vload_file_name
;
1921 return Fcons (Qfunction
, Fcons (read0 (readcharfun
), Qnil
));
1922 /* #:foo is the uninterned symbol named foo. */
1925 uninterned_symbol
= 1;
1929 /* Reader forms that can reuse previously read objects. */
1930 if (c
>= '0' && c
<= '9')
1935 /* Read a non-negative integer. */
1936 while (c
>= '0' && c
<= '9')
1942 /* #n=object returns object, but associates it with n for #n#. */
1945 /* Make a placeholder for #n# to use temporarily */
1946 Lisp_Object placeholder
;
1949 placeholder
= Fcons(Qnil
, Qnil
);
1950 cell
= Fcons (make_number (n
), placeholder
);
1951 read_objects
= Fcons (cell
, read_objects
);
1953 /* Read the object itself. */
1954 tem
= read0 (readcharfun
);
1956 /* Now put it everywhere the placeholder was... */
1957 substitute_object_in_subtree (tem
, placeholder
);
1959 /* ...and #n# will use the real value from now on. */
1960 Fsetcdr (cell
, tem
);
1964 /* #n# returns a previously read object. */
1967 tem
= Fassq (make_number (n
), read_objects
);
1970 /* Fall through to error message. */
1972 else if (c
== 'r' || c
== 'R')
1973 return read_integer (readcharfun
, n
);
1975 /* Fall through to error message. */
1977 else if (c
== 'x' || c
== 'X')
1978 return read_integer (readcharfun
, 16);
1979 else if (c
== 'o' || c
== 'O')
1980 return read_integer (readcharfun
, 8);
1981 else if (c
== 'b' || c
== 'B')
1982 return read_integer (readcharfun
, 2);
1985 Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("#", 1), Qnil
));
1988 while ((c
= READCHAR
) >= 0 && c
!= '\n');
1993 return Fcons (Qquote
, Fcons (read0 (readcharfun
), Qnil
));
2003 new_backquote_flag
= 1;
2004 value
= read0 (readcharfun
);
2005 new_backquote_flag
= 0;
2007 return Fcons (Qbackquote
, Fcons (value
, Qnil
));
2011 if (new_backquote_flag
)
2013 Lisp_Object comma_type
= Qnil
;
2018 comma_type
= Qcomma_at
;
2020 comma_type
= Qcomma_dot
;
2023 if (ch
>= 0) UNREAD (ch
);
2024 comma_type
= Qcomma
;
2027 new_backquote_flag
= 0;
2028 value
= read0 (readcharfun
);
2029 new_backquote_flag
= 1;
2030 return Fcons (comma_type
, Fcons (value
, Qnil
));
2039 end_of_file_error ();
2042 c
= read_escape (readcharfun
, 0);
2043 else if (BASE_LEADING_CODE_P (c
))
2044 c
= read_multibyte (c
, readcharfun
);
2046 return make_number (c
);
2051 register char *p
= read_buffer
;
2052 register char *end
= read_buffer
+ read_buffer_size
;
2054 /* Nonzero if we saw an escape sequence specifying
2055 a multibyte character. */
2056 int force_multibyte
= 0;
2057 /* Nonzero if we saw an escape sequence specifying
2058 a single-byte character. */
2059 int force_singlebyte
= 0;
2063 while ((c
= READCHAR
) >= 0
2066 if (end
- p
< MAX_MULTIBYTE_LENGTH
)
2068 char *new = (char *) xrealloc (read_buffer
, read_buffer_size
*= 2);
2069 p
+= new - read_buffer
;
2070 read_buffer
+= new - read_buffer
;
2071 end
= read_buffer
+ read_buffer_size
;
2076 c
= read_escape (readcharfun
, 1);
2078 /* C is -1 if \ newline has just been seen */
2081 if (p
== read_buffer
)
2086 /* If an escape specifies a non-ASCII single-byte character,
2087 this must be a unibyte string. */
2088 if (SINGLE_BYTE_CHAR_P ((c
& ~CHAR_MODIFIER_MASK
))
2089 && ! ASCII_BYTE_P ((c
& ~CHAR_MODIFIER_MASK
)))
2090 force_singlebyte
= 1;
2093 if (! SINGLE_BYTE_CHAR_P ((c
& ~CHAR_MODIFIER_MASK
)))
2095 /* Any modifiers for a multibyte character are invalid. */
2096 if (c
& CHAR_MODIFIER_MASK
)
2097 error ("Invalid modifier in string");
2098 p
+= CHAR_STRING (c
, p
);
2099 force_multibyte
= 1;
2103 /* Allow `\C- ' and `\C-?'. */
2104 if (c
== (CHAR_CTL
| ' '))
2106 else if (c
== (CHAR_CTL
| '?'))
2111 /* Shift modifier is valid only with [A-Za-z]. */
2112 if ((c
& 0377) >= 'A' && (c
& 0377) <= 'Z')
2114 else if ((c
& 0377) >= 'a' && (c
& 0377) <= 'z')
2115 c
= (c
& ~CHAR_SHIFT
) - ('a' - 'A');
2119 /* Move the meta bit to the right place for a string. */
2120 c
= (c
& ~CHAR_META
) | 0x80;
2122 error ("Invalid modifier in string");
2127 end_of_file_error ();
2129 /* If purifying, and string starts with \ newline,
2130 return zero instead. This is for doc strings
2131 that we are really going to find in etc/DOC.nn.nn */
2132 if (!NILP (Vpurify_flag
) && NILP (Vdoc_file_name
) && cancel
)
2133 return make_number (0);
2135 if (force_multibyte
)
2136 p
= read_buffer
+ str_as_multibyte (read_buffer
, end
- read_buffer
,
2137 p
- read_buffer
, &nchars
);
2138 else if (force_singlebyte
)
2139 nchars
= p
- read_buffer
;
2140 else if (load_convert_to_unibyte
)
2143 p
= read_buffer
+ str_as_multibyte (read_buffer
, end
- read_buffer
,
2144 p
- read_buffer
, &nchars
);
2145 if (p
- read_buffer
!= nchars
)
2147 string
= make_multibyte_string (read_buffer
, nchars
,
2149 return Fstring_make_unibyte (string
);
2152 else if (EQ (readcharfun
, Qget_file_char
)
2153 || EQ (readcharfun
, Qlambda
))
2154 /* Nowadays, reading directly from a file is used only for
2155 compiled Emacs Lisp files, and those always use the
2156 Emacs internal encoding. Meanwhile, Qlambda is used
2157 for reading dynamic byte code (compiled with
2158 byte-compile-dynamic = t). */
2159 p
= read_buffer
+ str_as_multibyte (read_buffer
, end
- read_buffer
,
2160 p
- read_buffer
, &nchars
);
2162 /* In all other cases, if we read these bytes as
2163 separate characters, treat them as separate characters now. */
2164 nchars
= p
- read_buffer
;
2167 return make_pure_string (read_buffer
, nchars
, p
- read_buffer
,
2169 || (p
- read_buffer
!= nchars
)));
2170 return make_specified_string (read_buffer
, nchars
, p
- read_buffer
,
2172 || (p
- read_buffer
!= nchars
)));
2177 int next_char
= READCHAR
;
2180 if (next_char
<= 040
2181 || index ("\"'`,(", next_char
))
2187 /* Otherwise, we fall through! Note that the atom-reading loop
2188 below will now loop at least once, assuring that we will not
2189 try to UNREAD two characters in a row. */
2193 if (c
<= 040) goto retry
;
2195 register char *p
= read_buffer
;
2199 register char *end
= read_buffer
+ read_buffer_size
;
2202 && !(c
== '\"' || c
== '\'' || c
== ';' || c
== '?'
2203 || c
== '(' || c
== ')'
2204 || c
== '[' || c
== ']' || c
== '#'
2207 if (end
- p
< MAX_MULTIBYTE_LENGTH
)
2209 register char *new = (char *) xrealloc (read_buffer
, read_buffer_size
*= 2);
2210 p
+= new - read_buffer
;
2211 read_buffer
+= new - read_buffer
;
2212 end
= read_buffer
+ read_buffer_size
;
2220 if (! SINGLE_BYTE_CHAR_P (c
))
2221 p
+= CHAR_STRING (c
, p
);
2230 char *new = (char *) xrealloc (read_buffer
, read_buffer_size
*= 2);
2231 p
+= new - read_buffer
;
2232 read_buffer
+= new - read_buffer
;
2233 /* end = read_buffer + read_buffer_size; */
2240 if (!quoted
&& !uninterned_symbol
)
2243 register Lisp_Object val
;
2245 if (*p1
== '+' || *p1
== '-') p1
++;
2246 /* Is it an integer? */
2249 while (p1
!= p
&& (c
= *p1
) >= '0' && c
<= '9') p1
++;
2250 /* Integers can have trailing decimal points. */
2251 if (p1
> read_buffer
&& p1
< p
&& *p1
== '.') p1
++;
2253 /* It is an integer. */
2257 if (sizeof (int) == sizeof (EMACS_INT
))
2258 XSETINT (val
, atoi (read_buffer
));
2259 else if (sizeof (long) == sizeof (EMACS_INT
))
2260 XSETINT (val
, atol (read_buffer
));
2266 if (isfloat_string (read_buffer
))
2268 /* Compute NaN and infinities using 0.0 in a variable,
2269 to cope with compilers that think they are smarter
2275 /* Negate the value ourselves. This treats 0, NaNs,
2276 and infinity properly on IEEE floating point hosts,
2277 and works around a common bug where atof ("-0.0")
2279 int negative
= read_buffer
[0] == '-';
2281 /* The only way p[-1] can be 'F' or 'N', after isfloat_string
2282 returns 1, is if the input ends in e+INF or e+NaN. */
2289 value
= zero
/ zero
;
2292 value
= atof (read_buffer
+ negative
);
2296 return make_float (negative
? - value
: value
);
2300 if (uninterned_symbol
)
2301 return make_symbol (read_buffer
);
2303 return intern (read_buffer
);
2309 /* List of nodes we've seen during substitute_object_in_subtree. */
2310 static Lisp_Object seen_list
;
2313 substitute_object_in_subtree (object
, placeholder
)
2315 Lisp_Object placeholder
;
2317 Lisp_Object check_object
;
2319 /* We haven't seen any objects when we start. */
2322 /* Make all the substitutions. */
2324 = substitute_object_recurse (object
, placeholder
, object
);
2326 /* Clear seen_list because we're done with it. */
2329 /* The returned object here is expected to always eq the
2331 if (!EQ (check_object
, object
))
2332 error ("Unexpected mutation error in reader");
2335 /* Feval doesn't get called from here, so no gc protection is needed. */
2336 #define SUBSTITUTE(get_val, set_val) \
2338 Lisp_Object old_value = get_val; \
2339 Lisp_Object true_value \
2340 = substitute_object_recurse (object, placeholder,\
2343 if (!EQ (old_value, true_value)) \
2350 substitute_object_recurse (object
, placeholder
, subtree
)
2352 Lisp_Object placeholder
;
2353 Lisp_Object subtree
;
2355 /* If we find the placeholder, return the target object. */
2356 if (EQ (placeholder
, subtree
))
2359 /* If we've been to this node before, don't explore it again. */
2360 if (!EQ (Qnil
, Fmemq (subtree
, seen_list
)))
2363 /* If this node can be the entry point to a cycle, remember that
2364 we've seen it. It can only be such an entry point if it was made
2365 by #n=, which means that we can find it as a value in
2367 if (!EQ (Qnil
, Frassq (subtree
, read_objects
)))
2368 seen_list
= Fcons (subtree
, seen_list
);
2370 /* Recurse according to subtree's type.
2371 Every branch must return a Lisp_Object. */
2372 switch (XTYPE (subtree
))
2374 case Lisp_Vectorlike
:
2377 int length
= XINT (Flength(subtree
));
2378 for (i
= 0; i
< length
; i
++)
2380 Lisp_Object idx
= make_number (i
);
2381 SUBSTITUTE (Faref (subtree
, idx
),
2382 Faset (subtree
, idx
, true_value
));
2389 SUBSTITUTE (Fcar_safe (subtree
),
2390 Fsetcar (subtree
, true_value
));
2391 SUBSTITUTE (Fcdr_safe (subtree
),
2392 Fsetcdr (subtree
, true_value
));
2398 /* Check for text properties in each interval.
2399 substitute_in_interval contains part of the logic. */
2401 INTERVAL root_interval
= XSTRING (subtree
)->intervals
;
2402 Lisp_Object arg
= Fcons (object
, placeholder
);
2404 traverse_intervals (root_interval
, 1, 0,
2405 &substitute_in_interval
, arg
);
2410 /* Other types don't recurse any further. */
2416 /* Helper function for substitute_object_recurse. */
2418 substitute_in_interval (interval
, arg
)
2422 Lisp_Object object
= Fcar (arg
);
2423 Lisp_Object placeholder
= Fcdr (arg
);
2425 SUBSTITUTE(interval
->plist
, interval
->plist
= true_value
);
2444 if (*cp
== '+' || *cp
== '-')
2447 if (*cp
>= '0' && *cp
<= '9')
2450 while (*cp
>= '0' && *cp
<= '9')
2458 if (*cp
>= '0' && *cp
<= '9')
2461 while (*cp
>= '0' && *cp
<= '9')
2464 if (*cp
== 'e' || *cp
== 'E')
2468 if (*cp
== '+' || *cp
== '-')
2472 if (*cp
>= '0' && *cp
<= '9')
2475 while (*cp
>= '0' && *cp
<= '9')
2478 else if (cp
== start
)
2480 else if (cp
[-1] == '+' && cp
[0] == 'I' && cp
[1] == 'N' && cp
[2] == 'F')
2485 else if (cp
[-1] == '+' && cp
[0] == 'N' && cp
[1] == 'a' && cp
[2] == 'N')
2491 return (((*cp
== 0) || (*cp
== ' ') || (*cp
== '\t') || (*cp
== '\n') || (*cp
== '\r') || (*cp
== '\f'))
2492 && (state
== (LEAD_INT
|DOT_CHAR
|TRAIL_INT
)
2493 || state
== (DOT_CHAR
|TRAIL_INT
)
2494 || state
== (LEAD_INT
|E_CHAR
|EXP_INT
)
2495 || state
== (LEAD_INT
|DOT_CHAR
|TRAIL_INT
|E_CHAR
|EXP_INT
)
2496 || state
== (DOT_CHAR
|TRAIL_INT
|E_CHAR
|EXP_INT
)));
2501 read_vector (readcharfun
, bytecodeflag
)
2502 Lisp_Object readcharfun
;
2507 register Lisp_Object
*ptr
;
2508 register Lisp_Object tem
, item
, vector
;
2509 register struct Lisp_Cons
*otem
;
2512 tem
= read_list (1, readcharfun
);
2513 len
= Flength (tem
);
2514 vector
= (read_pure
? make_pure_vector (XINT (len
)) : Fmake_vector (len
, Qnil
));
2516 size
= XVECTOR (vector
)->size
;
2517 ptr
= XVECTOR (vector
)->contents
;
2518 for (i
= 0; i
< size
; i
++)
2521 /* If `load-force-doc-strings' is t when reading a lazily-loaded
2522 bytecode object, the docstring containing the bytecode and
2523 constants values must be treated as unibyte and passed to
2524 Fread, to get the actual bytecode string and constants vector. */
2525 if (bytecodeflag
&& load_force_doc_strings
)
2527 if (i
== COMPILED_BYTECODE
)
2529 if (!STRINGP (item
))
2530 error ("invalid byte code");
2532 /* Delay handling the bytecode slot until we know whether
2533 it is lazily-loaded (we can tell by whether the
2534 constants slot is nil). */
2535 ptr
[COMPILED_CONSTANTS
] = item
;
2538 else if (i
== COMPILED_CONSTANTS
)
2540 Lisp_Object bytestr
= ptr
[COMPILED_CONSTANTS
];
2544 /* Coerce string to unibyte (like string-as-unibyte,
2545 but without generating extra garbage and
2546 guaranteeing no change in the contents). */
2547 XSTRING (bytestr
)->size
= STRING_BYTES (XSTRING (bytestr
));
2548 SET_STRING_BYTES (XSTRING (bytestr
), -1);
2550 item
= Fread (bytestr
);
2552 error ("invalid byte code");
2554 otem
= XCONS (item
);
2555 bytestr
= XCAR (item
);
2560 /* Now handle the bytecode slot. */
2561 ptr
[COMPILED_BYTECODE
] = read_pure
? Fpurecopy (bytestr
) : bytestr
;
2564 ptr
[i
] = read_pure
? Fpurecopy (item
) : item
;
2572 /* FLAG = 1 means check for ] to terminate rather than ) and .
2573 FLAG = -1 means check for starting with defun
2574 and make structure pure. */
2577 read_list (flag
, readcharfun
)
2579 register Lisp_Object readcharfun
;
2581 /* -1 means check next element for defun,
2582 0 means don't check,
2583 1 means already checked and found defun. */
2584 int defunflag
= flag
< 0 ? -1 : 0;
2585 Lisp_Object val
, tail
;
2586 register Lisp_Object elt
, tem
;
2587 struct gcpro gcpro1
, gcpro2
;
2588 /* 0 is the normal case.
2589 1 means this list is a doc reference; replace it with the number 0.
2590 2 means this list is a doc reference; replace it with the doc string. */
2591 int doc_reference
= 0;
2593 /* Initialize this to 1 if we are reading a list. */
2594 int first_in_list
= flag
<= 0;
2603 elt
= read1 (readcharfun
, &ch
, first_in_list
);
2608 /* While building, if the list starts with #$, treat it specially. */
2609 if (EQ (elt
, Vload_file_name
)
2611 && !NILP (Vpurify_flag
))
2613 if (NILP (Vdoc_file_name
))
2614 /* We have not yet called Snarf-documentation, so assume
2615 this file is described in the DOC-MM.NN file
2616 and Snarf-documentation will fill in the right value later.
2617 For now, replace the whole list with 0. */
2620 /* We have already called Snarf-documentation, so make a relative
2621 file name for this file, so it can be found properly
2622 in the installed Lisp directory.
2623 We don't use Fexpand_file_name because that would make
2624 the directory absolute now. */
2625 elt
= concat2 (build_string ("../lisp/"),
2626 Ffile_name_nondirectory (elt
));
2628 else if (EQ (elt
, Vload_file_name
)
2630 && load_force_doc_strings
)
2639 Fsignal (Qinvalid_read_syntax
,
2640 Fcons (make_string (") or . in a vector", 18), Qnil
));
2648 XCDR (tail
) = read0 (readcharfun
);
2650 val
= read0 (readcharfun
);
2651 read1 (readcharfun
, &ch
, 0);
2655 if (doc_reference
== 1)
2656 return make_number (0);
2657 if (doc_reference
== 2)
2659 /* Get a doc string from the file we are loading.
2660 If it's in saved_doc_string, get it from there. */
2661 int pos
= XINT (XCDR (val
));
2662 /* Position is negative for user variables. */
2663 if (pos
< 0) pos
= -pos
;
2664 if (pos
>= saved_doc_string_position
2665 && pos
< (saved_doc_string_position
2666 + saved_doc_string_length
))
2668 int start
= pos
- saved_doc_string_position
;
2671 /* Process quoting with ^A,
2672 and find the end of the string,
2673 which is marked with ^_ (037). */
2674 for (from
= start
, to
= start
;
2675 saved_doc_string
[from
] != 037;)
2677 int c
= saved_doc_string
[from
++];
2680 c
= saved_doc_string
[from
++];
2682 saved_doc_string
[to
++] = c
;
2684 saved_doc_string
[to
++] = 0;
2686 saved_doc_string
[to
++] = 037;
2689 saved_doc_string
[to
++] = c
;
2692 return make_string (saved_doc_string
+ start
,
2695 /* Look in prev_saved_doc_string the same way. */
2696 else if (pos
>= prev_saved_doc_string_position
2697 && pos
< (prev_saved_doc_string_position
2698 + prev_saved_doc_string_length
))
2700 int start
= pos
- prev_saved_doc_string_position
;
2703 /* Process quoting with ^A,
2704 and find the end of the string,
2705 which is marked with ^_ (037). */
2706 for (from
= start
, to
= start
;
2707 prev_saved_doc_string
[from
] != 037;)
2709 int c
= prev_saved_doc_string
[from
++];
2712 c
= prev_saved_doc_string
[from
++];
2714 prev_saved_doc_string
[to
++] = c
;
2716 prev_saved_doc_string
[to
++] = 0;
2718 prev_saved_doc_string
[to
++] = 037;
2721 prev_saved_doc_string
[to
++] = c
;
2724 return make_string (prev_saved_doc_string
+ start
,
2728 return get_doc_string (val
, 0, 0);
2733 return Fsignal (Qinvalid_read_syntax
, Fcons (make_string (". in wrong context", 18), Qnil
));
2735 return Fsignal (Qinvalid_read_syntax
, Fcons (make_string ("] in a list", 11), Qnil
));
2737 tem
= (read_pure
&& flag
<= 0
2738 ? pure_cons (elt
, Qnil
)
2739 : Fcons (elt
, Qnil
));
2746 defunflag
= EQ (elt
, Qdefun
);
2747 else if (defunflag
> 0)
2752 Lisp_Object Vobarray
;
2753 Lisp_Object initial_obarray
;
2755 /* oblookup stores the bucket number here, for the sake of Funintern. */
2757 int oblookup_last_bucket_number
;
2759 static int hash_string ();
2760 Lisp_Object
oblookup ();
2762 /* Get an error if OBARRAY is not an obarray.
2763 If it is one, return it. */
2766 check_obarray (obarray
)
2767 Lisp_Object obarray
;
2769 while (!VECTORP (obarray
) || XVECTOR (obarray
)->size
== 0)
2771 /* If Vobarray is now invalid, force it to be valid. */
2772 if (EQ (Vobarray
, obarray
)) Vobarray
= initial_obarray
;
2774 obarray
= wrong_type_argument (Qvectorp
, obarray
);
2779 /* Intern the C string STR: return a symbol with that name,
2780 interned in the current obarray. */
2787 int len
= strlen (str
);
2788 Lisp_Object obarray
;
2791 if (!VECTORP (obarray
) || XVECTOR (obarray
)->size
== 0)
2792 obarray
= check_obarray (obarray
);
2793 tem
= oblookup (obarray
, str
, len
, len
);
2796 return Fintern (make_string (str
, len
), obarray
);
2799 /* Create an uninterned symbol with name STR. */
2805 int len
= strlen (str
);
2807 return Fmake_symbol ((!NILP (Vpurify_flag
)
2808 ? make_pure_string (str
, len
, len
, 0)
2809 : make_string (str
, len
)));
2812 DEFUN ("intern", Fintern
, Sintern
, 1, 2, 0,
2813 "Return the canonical symbol whose name is STRING.\n\
2814 If there is none, one is created by this function and returned.\n\
2815 A second optional argument specifies the obarray to use;\n\
2816 it defaults to the value of `obarray'.")
2818 Lisp_Object string
, obarray
;
2820 register Lisp_Object tem
, sym
, *ptr
;
2822 if (NILP (obarray
)) obarray
= Vobarray
;
2823 obarray
= check_obarray (obarray
);
2825 CHECK_STRING (string
, 0);
2827 tem
= oblookup (obarray
, XSTRING (string
)->data
,
2828 XSTRING (string
)->size
,
2829 STRING_BYTES (XSTRING (string
)));
2830 if (!INTEGERP (tem
))
2833 if (!NILP (Vpurify_flag
))
2834 string
= Fpurecopy (string
);
2835 sym
= Fmake_symbol (string
);
2836 XSYMBOL (sym
)->obarray
= obarray
;
2838 if ((XSTRING (string
)->data
[0] == ':')
2839 && EQ (obarray
, initial_obarray
))
2840 XSYMBOL (sym
)->value
= sym
;
2842 ptr
= &XVECTOR (obarray
)->contents
[XINT (tem
)];
2844 XSYMBOL (sym
)->next
= XSYMBOL (*ptr
);
2846 XSYMBOL (sym
)->next
= 0;
2851 DEFUN ("intern-soft", Fintern_soft
, Sintern_soft
, 1, 2, 0,
2852 "Return the canonical symbol named NAME, or nil if none exists.\n\
2853 NAME may be a string or a symbol. If it is a symbol, that exact\n\
2854 symbol is searched for.\n\
2855 A second optional argument specifies the obarray to use;\n\
2856 it defaults to the value of `obarray'.")
2858 Lisp_Object name
, obarray
;
2860 register Lisp_Object tem
;
2861 struct Lisp_String
*string
;
2863 if (NILP (obarray
)) obarray
= Vobarray
;
2864 obarray
= check_obarray (obarray
);
2866 if (!SYMBOLP (name
))
2868 CHECK_STRING (name
, 0);
2869 string
= XSTRING (name
);
2872 string
= XSYMBOL (name
)->name
;
2874 tem
= oblookup (obarray
, string
->data
, string
->size
, STRING_BYTES (string
));
2875 if (INTEGERP (tem
) || (SYMBOLP (name
) && !EQ (name
, tem
)))
2881 DEFUN ("unintern", Funintern
, Sunintern
, 1, 2, 0,
2882 "Delete the symbol named NAME, if any, from OBARRAY.\n\
2883 The value is t if a symbol was found and deleted, nil otherwise.\n\
2884 NAME may be a string or a symbol. If it is a symbol, that symbol\n\
2885 is deleted, if it belongs to OBARRAY--no other symbol is deleted.\n\
2886 OBARRAY defaults to the value of the variable `obarray'.")
2888 Lisp_Object name
, obarray
;
2890 register Lisp_Object string
, tem
;
2893 if (NILP (obarray
)) obarray
= Vobarray
;
2894 obarray
= check_obarray (obarray
);
2897 XSETSTRING (string
, XSYMBOL (name
)->name
);
2900 CHECK_STRING (name
, 0);
2904 tem
= oblookup (obarray
, XSTRING (string
)->data
,
2905 XSTRING (string
)->size
,
2906 STRING_BYTES (XSTRING (string
)));
2909 /* If arg was a symbol, don't delete anything but that symbol itself. */
2910 if (SYMBOLP (name
) && !EQ (name
, tem
))
2913 XSYMBOL (tem
)->obarray
= Qnil
;
2915 hash
= oblookup_last_bucket_number
;
2917 if (EQ (XVECTOR (obarray
)->contents
[hash
], tem
))
2919 if (XSYMBOL (tem
)->next
)
2920 XSETSYMBOL (XVECTOR (obarray
)->contents
[hash
], XSYMBOL (tem
)->next
);
2922 XSETINT (XVECTOR (obarray
)->contents
[hash
], 0);
2926 Lisp_Object tail
, following
;
2928 for (tail
= XVECTOR (obarray
)->contents
[hash
];
2929 XSYMBOL (tail
)->next
;
2932 XSETSYMBOL (following
, XSYMBOL (tail
)->next
);
2933 if (EQ (following
, tem
))
2935 XSYMBOL (tail
)->next
= XSYMBOL (following
)->next
;
2944 /* Return the symbol in OBARRAY whose names matches the string
2945 of SIZE characters (SIZE_BYTE bytes) at PTR.
2946 If there is no such symbol in OBARRAY, return nil.
2948 Also store the bucket number in oblookup_last_bucket_number. */
2951 oblookup (obarray
, ptr
, size
, size_byte
)
2952 Lisp_Object obarray
;
2954 int size
, size_byte
;
2958 register Lisp_Object tail
;
2959 Lisp_Object bucket
, tem
;
2961 if (!VECTORP (obarray
)
2962 || (obsize
= XVECTOR (obarray
)->size
) == 0)
2964 obarray
= check_obarray (obarray
);
2965 obsize
= XVECTOR (obarray
)->size
;
2967 /* This is sometimes needed in the middle of GC. */
2968 obsize
&= ~ARRAY_MARK_FLAG
;
2969 /* Combining next two lines breaks VMS C 2.3. */
2970 hash
= hash_string (ptr
, size_byte
);
2972 bucket
= XVECTOR (obarray
)->contents
[hash
];
2973 oblookup_last_bucket_number
= hash
;
2974 if (XFASTINT (bucket
) == 0)
2976 else if (!SYMBOLP (bucket
))
2977 error ("Bad data in guts of obarray"); /* Like CADR error message */
2979 for (tail
= bucket
; ; XSETSYMBOL (tail
, XSYMBOL (tail
)->next
))
2981 if (STRING_BYTES (XSYMBOL (tail
)->name
) == size_byte
2982 && XSYMBOL (tail
)->name
->size
== size
2983 && !bcmp (XSYMBOL (tail
)->name
->data
, ptr
, size_byte
))
2985 else if (XSYMBOL (tail
)->next
== 0)
2988 XSETINT (tem
, hash
);
2993 hash_string (ptr
, len
)
2997 register unsigned char *p
= ptr
;
2998 register unsigned char *end
= p
+ len
;
2999 register unsigned char c
;
3000 register int hash
= 0;
3005 if (c
>= 0140) c
-= 40;
3006 hash
= ((hash
<<3) + (hash
>>28) + c
);
3008 return hash
& 07777777777;
3012 map_obarray (obarray
, fn
, arg
)
3013 Lisp_Object obarray
;
3014 void (*fn
) P_ ((Lisp_Object
, Lisp_Object
));
3018 register Lisp_Object tail
;
3019 CHECK_VECTOR (obarray
, 1);
3020 for (i
= XVECTOR (obarray
)->size
- 1; i
>= 0; i
--)
3022 tail
= XVECTOR (obarray
)->contents
[i
];
3027 if (XSYMBOL (tail
)->next
== 0)
3029 XSETSYMBOL (tail
, XSYMBOL (tail
)->next
);
3035 mapatoms_1 (sym
, function
)
3036 Lisp_Object sym
, function
;
3038 call1 (function
, sym
);
3041 DEFUN ("mapatoms", Fmapatoms
, Smapatoms
, 1, 2, 0,
3042 "Call FUNCTION on every symbol in OBARRAY.\n\
3043 OBARRAY defaults to the value of `obarray'.")
3045 Lisp_Object function
, obarray
;
3047 if (NILP (obarray
)) obarray
= Vobarray
;
3048 obarray
= check_obarray (obarray
);
3050 map_obarray (obarray
, mapatoms_1
, function
);
3054 #define OBARRAY_SIZE 1511
3059 Lisp_Object oblength
;
3063 XSETFASTINT (oblength
, OBARRAY_SIZE
);
3065 Qnil
= Fmake_symbol (make_pure_string ("nil", 3, 3, 0));
3066 Vobarray
= Fmake_vector (oblength
, make_number (0));
3067 initial_obarray
= Vobarray
;
3068 staticpro (&initial_obarray
);
3069 /* Intern nil in the obarray */
3070 XSYMBOL (Qnil
)->obarray
= Vobarray
;
3071 /* These locals are to kludge around a pyramid compiler bug. */
3072 hash
= hash_string ("nil", 3);
3073 /* Separate statement here to avoid VAXC bug. */
3074 hash
%= OBARRAY_SIZE
;
3075 tem
= &XVECTOR (Vobarray
)->contents
[hash
];
3078 Qunbound
= Fmake_symbol (make_pure_string ("unbound", 7, 7, 0));
3079 XSYMBOL (Qnil
)->function
= Qunbound
;
3080 XSYMBOL (Qunbound
)->value
= Qunbound
;
3081 XSYMBOL (Qunbound
)->function
= Qunbound
;
3084 XSYMBOL (Qnil
)->value
= Qnil
;
3085 XSYMBOL (Qnil
)->plist
= Qnil
;
3086 XSYMBOL (Qt
)->value
= Qt
;
3088 /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */
3091 Qvariable_documentation
= intern ("variable-documentation");
3092 staticpro (&Qvariable_documentation
);
3094 read_buffer_size
= 100 + MAX_MULTIBYTE_LENGTH
;
3095 read_buffer
= (char *) xmalloc (read_buffer_size
);
3100 struct Lisp_Subr
*sname
;
3103 sym
= intern (sname
->symbol_name
);
3104 XSETSUBR (XSYMBOL (sym
)->function
, sname
);
3107 #ifdef NOTDEF /* use fset in subr.el now */
3109 defalias (sname
, string
)
3110 struct Lisp_Subr
*sname
;
3114 sym
= intern (string
);
3115 XSETSUBR (XSYMBOL (sym
)->function
, sname
);
3119 /* Define an "integer variable"; a symbol whose value is forwarded
3120 to a C variable of type int. Sample call: */
3121 /* DEFVAR_INT ("indent-tabs-mode", &indent_tabs_mode, "Documentation"); */
3123 defvar_int (namestring
, address
)
3127 Lisp_Object sym
, val
;
3128 sym
= intern (namestring
);
3129 val
= allocate_misc ();
3130 XMISCTYPE (val
) = Lisp_Misc_Intfwd
;
3131 XINTFWD (val
)->intvar
= address
;
3132 XSYMBOL (sym
)->value
= val
;
3135 /* Similar but define a variable whose value is T if address contains 1,
3136 NIL if address contains 0 */
3138 defvar_bool (namestring
, address
)
3142 Lisp_Object sym
, val
;
3143 sym
= intern (namestring
);
3144 val
= allocate_misc ();
3145 XMISCTYPE (val
) = Lisp_Misc_Boolfwd
;
3146 XBOOLFWD (val
)->boolvar
= address
;
3147 XSYMBOL (sym
)->value
= val
;
3148 Vbyte_boolean_vars
= Fcons (sym
, Vbyte_boolean_vars
);
3151 /* Similar but define a variable whose value is the Lisp Object stored
3152 at address. Two versions: with and without gc-marking of the C
3153 variable. The nopro version is used when that variable will be
3154 gc-marked for some other reason, since marking the same slot twice
3155 can cause trouble with strings. */
3157 defvar_lisp_nopro (namestring
, address
)
3159 Lisp_Object
*address
;
3161 Lisp_Object sym
, val
;
3162 sym
= intern (namestring
);
3163 val
= allocate_misc ();
3164 XMISCTYPE (val
) = Lisp_Misc_Objfwd
;
3165 XOBJFWD (val
)->objvar
= address
;
3166 XSYMBOL (sym
)->value
= val
;
3170 defvar_lisp (namestring
, address
)
3172 Lisp_Object
*address
;
3174 defvar_lisp_nopro (namestring
, address
);
3175 staticpro (address
);
3178 /* Similar but define a variable whose value is the Lisp Object stored in
3179 the current buffer. address is the address of the slot in the buffer
3180 that is current now. */
3183 defvar_per_buffer (namestring
, address
, type
, doc
)
3185 Lisp_Object
*address
;
3189 Lisp_Object sym
, val
;
3191 extern struct buffer buffer_local_symbols
;
3193 sym
= intern (namestring
);
3194 val
= allocate_misc ();
3195 offset
= (char *)address
- (char *)current_buffer
;
3197 XMISCTYPE (val
) = Lisp_Misc_Buffer_Objfwd
;
3198 XBUFFER_OBJFWD (val
)->offset
= offset
;
3199 XSYMBOL (sym
)->value
= val
;
3200 PER_BUFFER_SYMBOL (offset
) = sym
;
3201 PER_BUFFER_TYPE (offset
) = type
;
3203 if (PER_BUFFER_IDX (offset
) == 0)
3204 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
3205 slot of buffer_local_flags */
3210 /* Similar but define a variable whose value is the Lisp Object stored
3211 at a particular offset in the current kboard object. */
3214 defvar_kboard (namestring
, offset
)
3218 Lisp_Object sym
, val
;
3219 sym
= intern (namestring
);
3220 val
= allocate_misc ();
3221 XMISCTYPE (val
) = Lisp_Misc_Kboard_Objfwd
;
3222 XKBOARD_OBJFWD (val
)->offset
= offset
;
3223 XSYMBOL (sym
)->value
= val
;
3226 /* Record the value of load-path used at the start of dumping
3227 so we can see if the site changed it later during dumping. */
3228 static Lisp_Object dump_path
;
3234 int turn_off_warning
= 0;
3236 /* Compute the default load-path. */
3238 normal
= PATH_LOADSEARCH
;
3239 Vload_path
= decode_env_path (0, normal
);
3241 if (NILP (Vpurify_flag
))
3242 normal
= PATH_LOADSEARCH
;
3244 normal
= PATH_DUMPLOADSEARCH
;
3246 /* In a dumped Emacs, we normally have to reset the value of
3247 Vload_path from PATH_LOADSEARCH, since the value that was dumped
3248 uses ../lisp, instead of the path of the installed elisp
3249 libraries. However, if it appears that Vload_path was changed
3250 from the default before dumping, don't override that value. */
3253 if (! NILP (Fequal (dump_path
, Vload_path
)))
3255 Vload_path
= decode_env_path (0, normal
);
3256 if (!NILP (Vinstallation_directory
))
3258 /* Add to the path the lisp subdir of the
3259 installation dir, if it exists. */
3260 Lisp_Object tem
, tem1
;
3261 tem
= Fexpand_file_name (build_string ("lisp"),
3262 Vinstallation_directory
);
3263 tem1
= Ffile_exists_p (tem
);
3266 if (NILP (Fmember (tem
, Vload_path
)))
3268 turn_off_warning
= 1;
3269 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3273 /* That dir doesn't exist, so add the build-time
3274 Lisp dirs instead. */
3275 Vload_path
= nconc2 (Vload_path
, dump_path
);
3277 /* Add leim under the installation dir, if it exists. */
3278 tem
= Fexpand_file_name (build_string ("leim"),
3279 Vinstallation_directory
);
3280 tem1
= Ffile_exists_p (tem
);
3283 if (NILP (Fmember (tem
, Vload_path
)))
3284 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3287 /* Add site-list under the installation dir, if it exists. */
3288 tem
= Fexpand_file_name (build_string ("site-lisp"),
3289 Vinstallation_directory
);
3290 tem1
= Ffile_exists_p (tem
);
3293 if (NILP (Fmember (tem
, Vload_path
)))
3294 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3297 /* If Emacs was not built in the source directory,
3298 and it is run from where it was built, add to load-path
3299 the lisp, leim and site-lisp dirs under that directory. */
3301 if (NILP (Fequal (Vinstallation_directory
, Vsource_directory
)))
3305 tem
= Fexpand_file_name (build_string ("src/Makefile"),
3306 Vinstallation_directory
);
3307 tem1
= Ffile_exists_p (tem
);
3309 /* Don't be fooled if they moved the entire source tree
3310 AFTER dumping Emacs. If the build directory is indeed
3311 different from the source dir, src/Makefile.in and
3312 src/Makefile will not be found together. */
3313 tem
= Fexpand_file_name (build_string ("src/Makefile.in"),
3314 Vinstallation_directory
);
3315 tem2
= Ffile_exists_p (tem
);
3316 if (!NILP (tem1
) && NILP (tem2
))
3318 tem
= Fexpand_file_name (build_string ("lisp"),
3321 if (NILP (Fmember (tem
, Vload_path
)))
3322 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3324 tem
= Fexpand_file_name (build_string ("leim"),
3327 if (NILP (Fmember (tem
, Vload_path
)))
3328 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3330 tem
= Fexpand_file_name (build_string ("site-lisp"),
3333 if (NILP (Fmember (tem
, Vload_path
)))
3334 Vload_path
= nconc2 (Vload_path
, Fcons (tem
, Qnil
));
3342 /* NORMAL refers to the lisp dir in the source directory. */
3343 /* We used to add ../lisp at the front here, but
3344 that caused trouble because it was copied from dump_path
3345 into Vload_path, aboe, when Vinstallation_directory was non-nil.
3346 It should be unnecessary. */
3347 Vload_path
= decode_env_path (0, normal
);
3348 dump_path
= Vload_path
;
3353 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
3354 almost never correct, thereby causing a warning to be printed out that
3355 confuses users. Since PATH_LOADSEARCH is always overridden by the
3356 EMACSLOADPATH environment variable below, disable the warning on NT. */
3358 /* Warn if dirs in the *standard* path don't exist. */
3359 if (!turn_off_warning
)
3361 Lisp_Object path_tail
;
3363 for (path_tail
= Vload_path
;
3365 path_tail
= XCDR (path_tail
))
3367 Lisp_Object dirfile
;
3368 dirfile
= Fcar (path_tail
);
3369 if (STRINGP (dirfile
))
3371 dirfile
= Fdirectory_file_name (dirfile
);
3372 if (access (XSTRING (dirfile
)->data
, 0) < 0)
3373 dir_warning ("Warning: Lisp directory `%s' does not exist.\n",
3378 #endif /* WINDOWSNT */
3380 /* If the EMACSLOADPATH environment variable is set, use its value.
3381 This doesn't apply if we're dumping. */
3383 if (NILP (Vpurify_flag
)
3384 && egetenv ("EMACSLOADPATH"))
3386 Vload_path
= decode_env_path ("EMACSLOADPATH", normal
);
3390 load_in_progress
= 0;
3391 Vload_file_name
= Qnil
;
3393 load_descriptor_list
= Qnil
;
3395 Vstandard_input
= Qt
;
3398 /* Print a warning, using format string FORMAT, that directory DIRNAME
3399 does not exist. Print it on stderr and put it in *Message*. */
3402 dir_warning (format
, dirname
)
3404 Lisp_Object dirname
;
3407 = (char *) alloca (XSTRING (dirname
)->size
+ strlen (format
) + 5);
3409 fprintf (stderr
, format
, XSTRING (dirname
)->data
);
3410 sprintf (buffer
, format
, XSTRING (dirname
)->data
);
3411 /* Don't log the warning before we've initialized!! */
3413 message_dolog (buffer
, strlen (buffer
), 0, STRING_MULTIBYTE (dirname
));
3420 defsubr (&Sread_from_string
);
3422 defsubr (&Sintern_soft
);
3423 defsubr (&Sunintern
);
3425 defsubr (&Seval_buffer
);
3426 defsubr (&Seval_region
);
3427 defsubr (&Sread_char
);
3428 defsubr (&Sread_char_exclusive
);
3429 defsubr (&Sread_event
);
3430 defsubr (&Sget_file_char
);
3431 defsubr (&Smapatoms
);
3433 DEFVAR_LISP ("obarray", &Vobarray
,
3434 "Symbol table for use by `intern' and `read'.\n\
3435 It is a vector whose length ought to be prime for best results.\n\
3436 The vector's contents don't make sense if examined from Lisp programs;\n\
3437 to find all the symbols in an obarray, use `mapatoms'.");
3439 DEFVAR_LISP ("values", &Vvalues
,
3440 "List of values of all expressions which were read, evaluated and printed.\n\
3441 Order is reverse chronological.");
3443 DEFVAR_LISP ("standard-input", &Vstandard_input
,
3444 "Stream for read to get input from.\n\
3445 See documentation of `read' for possible values.");
3446 Vstandard_input
= Qt
;
3448 DEFVAR_LISP ("load-path", &Vload_path
,
3449 "*List of directories to search for files to load.\n\
3450 Each element is a string (directory name) or nil (try default directory).\n\
3451 Initialized based on EMACSLOADPATH environment variable, if any,\n\
3452 otherwise to default specified by file `epaths.h' when Emacs was built.");
3454 DEFVAR_BOOL ("load-in-progress", &load_in_progress
,
3455 "Non-nil iff inside of `load'.");
3457 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist
,
3458 "An alist of expressions to be evalled when particular files are loaded.\n\
3459 Each element looks like (FILENAME FORMS...).\n\
3460 When `load' is run and the file-name argument is FILENAME,\n\
3461 the FORMS in the corresponding element are executed at the end of loading.\n\n\
3462 FILENAME must match exactly! Normally FILENAME is the name of a library,\n\
3463 with no directory specified, since that is how `load' is normally called.\n\
3464 An error in FORMS does not undo the load,\n\
3465 but does prevent execution of the rest of the FORMS.");
3466 Vafter_load_alist
= Qnil
;
3468 DEFVAR_LISP ("load-history", &Vload_history
,
3469 "Alist mapping source file names to symbols and features.\n\
3470 Each alist element is a list that starts with a file name,\n\
3471 except for one element (optional) that starts with nil and describes\n\
3472 definitions evaluated from buffers not visiting files.\n\
3473 The remaining elements of each list are symbols defined as functions\n\
3474 or variables, and cons cells `(provide . FEATURE)', `(require . FEATURE)',\n\
3475 and `(autoload . SYMBOL)'.");
3476 Vload_history
= Qnil
;
3478 DEFVAR_LISP ("load-file-name", &Vload_file_name
,
3479 "Full name of file being loaded by `load'.");
3480 Vload_file_name
= Qnil
;
3482 DEFVAR_LISP ("user-init-file", &Vuser_init_file
,
3483 "File name, including directory, of user's initialization file.\n\
3484 If the file loaded had extension `.elc' and there was a corresponding `.el'\n\
3485 file, this variable contains the name of the .el file, suitable for use\n\
3486 by functions like `custom-save-all' which edit the init file.");
3487 Vuser_init_file
= Qnil
;
3489 DEFVAR_LISP ("current-load-list", &Vcurrent_load_list
,
3490 "Used for internal purposes by `load'.");
3491 Vcurrent_load_list
= Qnil
;
3493 DEFVAR_LISP ("load-read-function", &Vload_read_function
,
3494 "Function used by `load' and `eval-region' for reading expressions.\n\
3495 The default is nil, which means use the function `read'.");
3496 Vload_read_function
= Qnil
;
3498 DEFVAR_LISP ("load-source-file-function", &Vload_source_file_function
,
3499 "Function called in `load' for loading an Emacs lisp source file.\n\
3500 This function is for doing code conversion before reading the source file.\n\
3501 If nil, loading is done without any code conversion.\n\
3502 Arguments are FULLNAME, FILE, NOERROR, NOMESSAGE, where\n\
3503 FULLNAME is the full name of FILE.\n\
3504 See `load' for the meaning of the remaining arguments.");
3505 Vload_source_file_function
= Qnil
;
3507 DEFVAR_BOOL ("load-force-doc-strings", &load_force_doc_strings
,
3508 "Non-nil means `load' should force-load all dynamic doc strings.\n\
3509 This is useful when the file being loaded is a temporary copy.");
3510 load_force_doc_strings
= 0;
3512 DEFVAR_BOOL ("load-convert-to-unibyte", &load_convert_to_unibyte
,
3513 "Non-nil means `read' converts strings to unibyte whenever possible.\n\
3514 This is normally bound by `load' and `eval-buffer' to control `read',\n\
3515 and is not meant for users to change.");
3516 load_convert_to_unibyte
= 0;
3518 DEFVAR_LISP ("source-directory", &Vsource_directory
,
3519 "Directory in which Emacs sources were found when Emacs was built.\n\
3520 You cannot count on them to still be there!");
3522 = Fexpand_file_name (build_string ("../"),
3523 Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH
)));
3525 DEFVAR_LISP ("preloaded-file-list", &Vpreloaded_file_list
,
3526 "List of files that were preloaded (when dumping Emacs).");
3527 Vpreloaded_file_list
= Qnil
;
3529 DEFVAR_LISP ("byte-boolean-vars", &Vbyte_boolean_vars
,
3530 "List of all DEFVAR_BOOL variables, used by the byte code optimizer.");
3531 Vbyte_boolean_vars
= Qnil
;
3533 DEFVAR_BOOL ("load-dangerous-libraries", &load_dangerous_libraries
,
3534 "Non-nil means load dangerous compiled Lisp files.\n\
3535 Some versions of XEmacs use different byte codes than Emacs. These\n\
3536 incompatible byte codes can make Emacs crash when it tries to execute\n\
3538 load_dangerous_libraries
= 0;
3540 Vbytecomp_version_regexp
= build_string ("^;;;.in Emacs version");
3541 staticpro (&Vbytecomp_version_regexp
);
3543 /* Vsource_directory was initialized in init_lread. */
3545 load_descriptor_list
= Qnil
;
3546 staticpro (&load_descriptor_list
);
3548 Qcurrent_load_list
= intern ("current-load-list");
3549 staticpro (&Qcurrent_load_list
);
3551 Qstandard_input
= intern ("standard-input");
3552 staticpro (&Qstandard_input
);
3554 Qread_char
= intern ("read-char");
3555 staticpro (&Qread_char
);
3557 Qget_file_char
= intern ("get-file-char");
3558 staticpro (&Qget_file_char
);
3560 Qbackquote
= intern ("`");
3561 staticpro (&Qbackquote
);
3562 Qcomma
= intern (",");
3563 staticpro (&Qcomma
);
3564 Qcomma_at
= intern (",@");
3565 staticpro (&Qcomma_at
);
3566 Qcomma_dot
= intern (",.");
3567 staticpro (&Qcomma_dot
);
3569 Qinhibit_file_name_operation
= intern ("inhibit-file-name-operation");
3570 staticpro (&Qinhibit_file_name_operation
);
3572 Qascii_character
= intern ("ascii-character");
3573 staticpro (&Qascii_character
);
3575 Qfunction
= intern ("function");
3576 staticpro (&Qfunction
);
3578 Qload
= intern ("load");
3581 Qload_file_name
= intern ("load-file-name");
3582 staticpro (&Qload_file_name
);
3584 staticpro (&dump_path
);
3586 staticpro (&read_objects
);
3587 read_objects
= Qnil
;
3588 staticpro (&seen_list
);