diff options
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 76 |
1 files changed, 30 insertions, 46 deletions
diff --git a/src/lread.c b/src/lread.c index 66b13916465..ada20810c3a 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1537,7 +1537,7 @@ Return t if the file exists and loads successfully. */) | |||
| 1537 | } | 1537 | } |
| 1538 | 1538 | ||
| 1539 | if (! NILP (Vpurify_flag)) | 1539 | if (! NILP (Vpurify_flag)) |
| 1540 | Vpreloaded_file_list = Fcons (Fpurecopy (file), Vpreloaded_file_list); | 1540 | Vpreloaded_file_list = Fcons (file, Vpreloaded_file_list); |
| 1541 | 1541 | ||
| 1542 | if (NILP (nomessage) || force_load_messages) | 1542 | if (NILP (nomessage) || force_load_messages) |
| 1543 | { | 1543 | { |
| @@ -2288,36 +2288,32 @@ readevalloop (Lisp_Object readcharfun, | |||
| 2288 | read_objects_map | 2288 | read_objects_map |
| 2289 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, | 2289 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, |
| 2290 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, | 2290 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 2291 | Qnil, false); | 2291 | Qnil); |
| 2292 | if (! HASH_TABLE_P (read_objects_completed) | 2292 | if (! HASH_TABLE_P (read_objects_completed) |
| 2293 | || XHASH_TABLE (read_objects_completed)->count) | 2293 | || XHASH_TABLE (read_objects_completed)->count) |
| 2294 | read_objects_completed | 2294 | read_objects_completed |
| 2295 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, | 2295 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, |
| 2296 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, | 2296 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 2297 | Qnil, false); | 2297 | Qnil); |
| 2298 | if (!NILP (Vpurify_flag) && c == '(') | 2298 | if (!NILP (readfun)) |
| 2299 | val = read0 (readcharfun, false); | ||
| 2300 | else | ||
| 2301 | { | 2299 | { |
| 2302 | if (!NILP (readfun)) | 2300 | val = call1 (readfun, readcharfun); |
| 2303 | { | ||
| 2304 | val = call1 (readfun, readcharfun); | ||
| 2305 | 2301 | ||
| 2306 | /* If READCHARFUN has set point to ZV, we should | 2302 | /* If READCHARFUN has set point to ZV, we should |
| 2307 | stop reading, even if the form read sets point | 2303 | stop reading, even if the form read sets point |
| 2308 | to a different value when evaluated. */ | 2304 | to a different value when evaluated. */ |
| 2309 | if (BUFFERP (readcharfun)) | 2305 | if (BUFFERP (readcharfun)) |
| 2310 | { | 2306 | { |
| 2311 | struct buffer *buf = XBUFFER (readcharfun); | 2307 | struct buffer *buf = XBUFFER (readcharfun); |
| 2312 | if (BUF_PT (buf) == BUF_ZV (buf)) | 2308 | if (BUF_PT (buf) == BUF_ZV (buf)) |
| 2313 | continue_reading_p = 0; | 2309 | continue_reading_p = 0; |
| 2314 | } | ||
| 2315 | } | 2310 | } |
| 2316 | else if (! NILP (Vload_read_function)) | ||
| 2317 | val = call1 (Vload_read_function, readcharfun); | ||
| 2318 | else | ||
| 2319 | val = read_internal_start (readcharfun, Qnil, Qnil, false); | ||
| 2320 | } | 2311 | } |
| 2312 | else if (! NILP (Vload_read_function)) | ||
| 2313 | val = call1 (Vload_read_function, readcharfun); | ||
| 2314 | else | ||
| 2315 | val = read_internal_start (readcharfun, Qnil, Qnil, false); | ||
| 2316 | |||
| 2321 | /* Empty hashes can be reused; otherwise, reset on next call. */ | 2317 | /* Empty hashes can be reused; otherwise, reset on next call. */ |
| 2322 | if (HASH_TABLE_P (read_objects_map) | 2318 | if (HASH_TABLE_P (read_objects_map) |
| 2323 | && XHASH_TABLE (read_objects_map)->count > 0) | 2319 | && XHASH_TABLE (read_objects_map)->count > 0) |
| @@ -2539,12 +2535,12 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end, | |||
| 2539 | || XHASH_TABLE (read_objects_map)->count) | 2535 | || XHASH_TABLE (read_objects_map)->count) |
| 2540 | read_objects_map | 2536 | read_objects_map |
| 2541 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, | 2537 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, |
| 2542 | DEFAULT_REHASH_THRESHOLD, Qnil, false); | 2538 | DEFAULT_REHASH_THRESHOLD, Qnil); |
| 2543 | if (! HASH_TABLE_P (read_objects_completed) | 2539 | if (! HASH_TABLE_P (read_objects_completed) |
| 2544 | || XHASH_TABLE (read_objects_completed)->count) | 2540 | || XHASH_TABLE (read_objects_completed)->count) |
| 2545 | read_objects_completed | 2541 | read_objects_completed |
| 2546 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, | 2542 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, |
| 2547 | DEFAULT_REHASH_THRESHOLD, Qnil, false); | 2543 | DEFAULT_REHASH_THRESHOLD, Qnil); |
| 2548 | 2544 | ||
| 2549 | if (STRINGP (stream) | 2545 | if (STRINGP (stream) |
| 2550 | || ((CONSP (stream) && STRINGP (XCAR (stream))))) | 2546 | || ((CONSP (stream) && STRINGP (XCAR (stream))))) |
| @@ -4150,10 +4146,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms) | |||
| 4150 | if (uninterned_symbol) | 4146 | if (uninterned_symbol) |
| 4151 | { | 4147 | { |
| 4152 | Lisp_Object name | 4148 | Lisp_Object name |
| 4153 | = (!NILP (Vpurify_flag) | 4149 | = make_specified_string (read_buffer, nchars, nbytes, multibyte); |
| 4154 | ? make_pure_string (read_buffer, nchars, nbytes, multibyte) | ||
| 4155 | : make_specified_string (read_buffer, nchars, nbytes, | ||
| 4156 | multibyte)); | ||
| 4157 | result = Fmake_symbol (name); | 4150 | result = Fmake_symbol (name); |
| 4158 | } | 4151 | } |
| 4159 | else | 4152 | else |
| @@ -4645,16 +4638,8 @@ intern_c_string_1 (const char *str, ptrdiff_t len) | |||
| 4645 | Lisp_Object tem = oblookup (obarray, str, len, len); | 4638 | Lisp_Object tem = oblookup (obarray, str, len, len); |
| 4646 | 4639 | ||
| 4647 | if (!SYMBOLP (tem)) | 4640 | if (!SYMBOLP (tem)) |
| 4648 | { | 4641 | tem = intern_driver (make_string (str, len), obarray, tem); |
| 4649 | Lisp_Object string; | ||
| 4650 | 4642 | ||
| 4651 | if (NILP (Vpurify_flag)) | ||
| 4652 | string = make_string (str, len); | ||
| 4653 | else | ||
| 4654 | string = make_pure_c_string (str, len); | ||
| 4655 | |||
| 4656 | tem = intern_driver (string, obarray, tem); | ||
| 4657 | } | ||
| 4658 | return tem; | 4643 | return tem; |
| 4659 | } | 4644 | } |
| 4660 | 4645 | ||
| @@ -4662,7 +4647,7 @@ static void | |||
| 4662 | define_symbol (Lisp_Object sym, char const *str) | 4647 | define_symbol (Lisp_Object sym, char const *str) |
| 4663 | { | 4648 | { |
| 4664 | ptrdiff_t len = strlen (str); | 4649 | ptrdiff_t len = strlen (str); |
| 4665 | Lisp_Object string = make_pure_c_string (str, len); | 4650 | Lisp_Object string = make_string (str, len); |
| 4666 | init_symbol (sym, string); | 4651 | init_symbol (sym, string); |
| 4667 | 4652 | ||
| 4668 | /* Qunbound is uninterned, so that it's not confused with any symbol | 4653 | /* Qunbound is uninterned, so that it's not confused with any symbol |
| @@ -4706,8 +4691,7 @@ it defaults to the value of `obarray'. */) | |||
| 4706 | xfree (longhand); | 4691 | xfree (longhand); |
| 4707 | } | 4692 | } |
| 4708 | else | 4693 | else |
| 4709 | tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), | 4694 | tem = intern_driver (string, obarray, tem); |
| 4710 | obarray, tem); | ||
| 4711 | } | 4695 | } |
| 4712 | return tem; | 4696 | return tem; |
| 4713 | } | 4697 | } |
| @@ -5002,7 +4986,7 @@ init_obarray_once (void) | |||
| 5002 | XSYMBOL (Qt)->u.s.declared_special = true; | 4986 | XSYMBOL (Qt)->u.s.declared_special = true; |
| 5003 | 4987 | ||
| 5004 | /* Qt is correct even if not dumping. loadup.el will set to nil at end. */ | 4988 | /* Qt is correct even if not dumping. loadup.el will set to nil at end. */ |
| 5005 | Vpurify_flag = Qt; | 4989 | Vpurify_flag = Qt; /* FIXME: Redundant with setting in alloc.c. */ |
| 5006 | 4990 | ||
| 5007 | DEFSYM (Qvariable_documentation, "variable-documentation"); | 4991 | DEFSYM (Qvariable_documentation, "variable-documentation"); |
| 5008 | } | 4992 | } |
| @@ -5019,7 +5003,7 @@ defsubr (union Aligned_Lisp_Subr *aname) | |||
| 5019 | set_symbol_function (sym, tem); | 5003 | set_symbol_function (sym, tem); |
| 5020 | #ifdef HAVE_NATIVE_COMP | 5004 | #ifdef HAVE_NATIVE_COMP |
| 5021 | eassert (NILP (Vcomp_abi_hash)); | 5005 | eassert (NILP (Vcomp_abi_hash)); |
| 5022 | Vcomp_subr_list = Fpurecopy (Fcons (tem, Vcomp_subr_list)); | 5006 | Vcomp_subr_list = Fcons (tem, Vcomp_subr_list); |
| 5023 | #endif | 5007 | #endif |
| 5024 | } | 5008 | } |
| 5025 | 5009 | ||
| @@ -5412,20 +5396,20 @@ This list includes suffixes for both compiled and source Emacs Lisp files. | |||
| 5412 | This list should not include the empty string. | 5396 | This list should not include the empty string. |
| 5413 | `load' and related functions try to append these suffixes, in order, | 5397 | `load' and related functions try to append these suffixes, in order, |
| 5414 | to the specified file name if a suffix is allowed or required. */); | 5398 | to the specified file name if a suffix is allowed or required. */); |
| 5415 | Vload_suffixes = list2 (build_pure_c_string (".elc"), | 5399 | Vload_suffixes = list2 (build_string (".elc"), |
| 5416 | build_pure_c_string (".el")); | 5400 | build_string (".el")); |
| 5417 | #ifdef HAVE_MODULES | 5401 | #ifdef HAVE_MODULES |
| 5418 | Vload_suffixes = Fcons (build_pure_c_string (MODULES_SUFFIX), Vload_suffixes); | 5402 | Vload_suffixes = Fcons (build_string (MODULES_SUFFIX), Vload_suffixes); |
| 5419 | #ifdef MODULES_SECONDARY_SUFFIX | 5403 | #ifdef MODULES_SECONDARY_SUFFIX |
| 5420 | Vload_suffixes = | 5404 | Vload_suffixes = |
| 5421 | Fcons (build_pure_c_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes); | 5405 | Fcons (build_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes); |
| 5422 | #endif | 5406 | #endif |
| 5423 | 5407 | ||
| 5424 | #endif | 5408 | #endif |
| 5425 | DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix, | 5409 | DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix, |
| 5426 | doc: /* Suffix of loadable module file, or nil if modules are not supported. */); | 5410 | doc: /* Suffix of loadable module file, or nil if modules are not supported. */); |
| 5427 | #ifdef HAVE_MODULES | 5411 | #ifdef HAVE_MODULES |
| 5428 | Vmodule_file_suffix = build_pure_c_string (MODULES_SUFFIX); | 5412 | Vmodule_file_suffix = build_string (MODULES_SUFFIX); |
| 5429 | #else | 5413 | #else |
| 5430 | Vmodule_file_suffix = Qnil; | 5414 | Vmodule_file_suffix = Qnil; |
| 5431 | #endif | 5415 | #endif |
| @@ -5575,7 +5559,7 @@ from the file, and matches them against this regular expression. | |||
| 5575 | When the regular expression matches, the file is considered to be safe | 5559 | When the regular expression matches, the file is considered to be safe |
| 5576 | to load. */); | 5560 | to load. */); |
| 5577 | Vbytecomp_version_regexp | 5561 | Vbytecomp_version_regexp |
| 5578 | = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); | 5562 | = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); |
| 5579 | 5563 | ||
| 5580 | DEFSYM (Qlexical_binding, "lexical-binding"); | 5564 | DEFSYM (Qlexical_binding, "lexical-binding"); |
| 5581 | DEFVAR_LISP ("lexical-binding", Vlexical_binding, | 5565 | DEFVAR_LISP ("lexical-binding", Vlexical_binding, |