diff options
| author | Eli Zaretskii | 2013-03-28 20:13:59 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-03-28 20:13:59 +0200 |
| commit | d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e (patch) | |
| tree | 04fa8bc7bd2058a316a7ee30f8741d25bfd0b060 /src/lread.c | |
| parent | 2ef26ceb192c7683754cf0b4aa3087f501254332 (diff) | |
| parent | e74aeda863cd6896e06e92586f87b45d63d67d15 (diff) | |
| download | emacs-d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e.tar.gz emacs-d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e.zip | |
Merge from trunk and resolve conflicts.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 191 |
1 files changed, 94 insertions, 97 deletions
diff --git a/src/lread.c b/src/lread.c index 6d0ff9f780e..d7a16f813c8 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Lisp parsing and input streams. | 1 | /* Lisp parsing and input streams. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2012 Free Software Foundation, Inc. | 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -95,11 +96,6 @@ static Lisp_Object Qload_in_progress; | |||
| 95 | It must be set to nil before all top-level calls to read0. */ | 96 | It must be set to nil before all top-level calls to read0. */ |
| 96 | static Lisp_Object read_objects; | 97 | static Lisp_Object read_objects; |
| 97 | 98 | ||
| 98 | /* True means READCHAR should read bytes one by one (not character) | ||
| 99 | when READCHARFUN is Qget_file_char or Qget_emacs_mule_file_char. | ||
| 100 | This is set by read1 temporarily while handling #@NUMBER. */ | ||
| 101 | static bool load_each_byte; | ||
| 102 | |||
| 103 | /* List of descriptors now open for Fload. */ | 99 | /* List of descriptors now open for Fload. */ |
| 104 | static Lisp_Object load_descriptor_list; | 100 | static Lisp_Object load_descriptor_list; |
| 105 | 101 | ||
| @@ -327,7 +323,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte) | |||
| 327 | return c; | 323 | return c; |
| 328 | } | 324 | } |
| 329 | c = (*readbyte) (-1, readcharfun); | 325 | c = (*readbyte) (-1, readcharfun); |
| 330 | if (c < 0 || load_each_byte) | 326 | if (c < 0) |
| 331 | return c; | 327 | return c; |
| 332 | if (multibyte) | 328 | if (multibyte) |
| 333 | *multibyte = 1; | 329 | *multibyte = 1; |
| @@ -352,6 +348,33 @@ readchar (Lisp_Object readcharfun, bool *multibyte) | |||
| 352 | return STRING_CHAR (buf); | 348 | return STRING_CHAR (buf); |
| 353 | } | 349 | } |
| 354 | 350 | ||
| 351 | #define FROM_FILE_P(readcharfun) \ | ||
| 352 | (EQ (readcharfun, Qget_file_char) \ | ||
| 353 | || EQ (readcharfun, Qget_emacs_mule_file_char)) | ||
| 354 | |||
| 355 | static void | ||
| 356 | skip_dyn_bytes (Lisp_Object readcharfun, ptrdiff_t n) | ||
| 357 | { | ||
| 358 | if (FROM_FILE_P (readcharfun)) | ||
| 359 | { | ||
| 360 | block_input (); /* FIXME: Not sure if it's needed. */ | ||
| 361 | fseek (instream, n, SEEK_CUR); | ||
| 362 | unblock_input (); | ||
| 363 | } | ||
| 364 | else | ||
| 365 | { /* We're not reading directly from a file. In that case, it's difficult | ||
| 366 | to reliably count bytes, since these are usually meant for the file's | ||
| 367 | encoding, whereas we're now typically in the internal encoding. | ||
| 368 | But luckily, skip_dyn_bytes is used to skip over a single | ||
| 369 | dynamic-docstring (or dynamic byte-code) which is always quoted such | ||
| 370 | that \037 is the final char. */ | ||
| 371 | int c; | ||
| 372 | do { | ||
| 373 | c = READCHAR; | ||
| 374 | } while (c >= 0 && c != '\037'); | ||
| 375 | } | ||
| 376 | } | ||
| 377 | |||
| 355 | /* Unread the character C in the way appropriate for the stream READCHARFUN. | 378 | /* Unread the character C in the way appropriate for the stream READCHARFUN. |
| 356 | If the stream is a user function, call it with the char as argument. */ | 379 | If the stream is a user function, call it with the char as argument. */ |
| 357 | 380 | ||
| @@ -403,17 +426,9 @@ unreadchar (Lisp_Object readcharfun, int c) | |||
| 403 | { | 426 | { |
| 404 | unread_char = c; | 427 | unread_char = c; |
| 405 | } | 428 | } |
| 406 | else if (EQ (readcharfun, Qget_file_char) | 429 | else if (FROM_FILE_P (readcharfun)) |
| 407 | || EQ (readcharfun, Qget_emacs_mule_file_char)) | ||
| 408 | { | 430 | { |
| 409 | if (load_each_byte) | 431 | unread_char = c; |
| 410 | { | ||
| 411 | block_input (); | ||
| 412 | ungetc (c, instream); | ||
| 413 | unblock_input (); | ||
| 414 | } | ||
| 415 | else | ||
| 416 | unread_char = c; | ||
| 417 | } | 432 | } |
| 418 | else | 433 | else |
| 419 | call1 (readcharfun, make_number (c)); | 434 | call1 (readcharfun, make_number (c)); |
| @@ -440,7 +455,6 @@ readbyte_from_file (int c, Lisp_Object readcharfun) | |||
| 440 | block_input (); | 455 | block_input (); |
| 441 | c = getc (instream); | 456 | c = getc (instream); |
| 442 | 457 | ||
| 443 | #ifdef EINTR | ||
| 444 | /* Interrupted reads have been observed while reading over the network. */ | 458 | /* Interrupted reads have been observed while reading over the network. */ |
| 445 | while (c == EOF && ferror (instream) && errno == EINTR) | 459 | while (c == EOF && ferror (instream) && errno == EINTR) |
| 446 | { | 460 | { |
| @@ -450,7 +464,6 @@ readbyte_from_file (int c, Lisp_Object readcharfun) | |||
| 450 | clearerr (instream); | 464 | clearerr (instream); |
| 451 | c = getc (instream); | 465 | c = getc (instream); |
| 452 | } | 466 | } |
| 453 | #endif | ||
| 454 | 467 | ||
| 455 | unblock_input (); | 468 | unblock_input (); |
| 456 | 469 | ||
| @@ -603,17 +616,17 @@ read_filtered_event (bool no_switch_frame, bool ascii_required, | |||
| 603 | end_time = add_emacs_time (current_emacs_time (), wait_time); | 616 | end_time = add_emacs_time (current_emacs_time (), wait_time); |
| 604 | } | 617 | } |
| 605 | 618 | ||
| 606 | /* Read until we get an acceptable event. */ | 619 | /* Read until we get an acceptable event. */ |
| 607 | retry: | 620 | retry: |
| 608 | do | 621 | do |
| 609 | val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0, | 622 | val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0, |
| 610 | NUMBERP (seconds) ? &end_time : NULL); | 623 | NUMBERP (seconds) ? &end_time : NULL); |
| 611 | while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ | 624 | while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ |
| 612 | 625 | ||
| 613 | if (BUFFERP (val)) | 626 | if (BUFFERP (val)) |
| 614 | goto retry; | 627 | goto retry; |
| 615 | 628 | ||
| 616 | /* switch-frame events are put off until after the next ASCII | 629 | /* `switch-frame' events are put off until after the next ASCII |
| 617 | character. This is better than signaling an error just because | 630 | character. This is better than signaling an error just because |
| 618 | the last characters were typed to a separate minibuffer frame, | 631 | the last characters were typed to a separate minibuffer frame, |
| 619 | for example. Eventually, some code which can deal with | 632 | for example. Eventually, some code which can deal with |
| @@ -1299,7 +1312,7 @@ Return t if the file exists and loads successfully. */) | |||
| 1299 | message_with_string ("Loading %s...", file, 1); | 1312 | message_with_string ("Loading %s...", file, 1); |
| 1300 | } | 1313 | } |
| 1301 | 1314 | ||
| 1302 | record_unwind_protect (load_unwind, make_save_value (stream, 0)); | 1315 | record_unwind_protect (load_unwind, make_save_pointer (stream)); |
| 1303 | record_unwind_protect (load_descriptor_unwind, load_descriptor_list); | 1316 | record_unwind_protect (load_descriptor_unwind, load_descriptor_list); |
| 1304 | specbind (Qload_file_name, found); | 1317 | specbind (Qload_file_name, found); |
| 1305 | specbind (Qinhibit_file_name_operation, Qnil); | 1318 | specbind (Qinhibit_file_name_operation, Qnil); |
| @@ -1358,7 +1371,7 @@ Return t if the file exists and loads successfully. */) | |||
| 1358 | static Lisp_Object | 1371 | static Lisp_Object |
| 1359 | load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */ | 1372 | load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */ |
| 1360 | { | 1373 | { |
| 1361 | FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; | 1374 | FILE *stream = XSAVE_POINTER (arg, 0); |
| 1362 | if (stream != NULL) | 1375 | if (stream != NULL) |
| 1363 | { | 1376 | { |
| 1364 | block_input (); | 1377 | block_input (); |
| @@ -1558,7 +1571,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto | |||
| 1558 | { | 1571 | { |
| 1559 | struct stat st; | 1572 | struct stat st; |
| 1560 | fd = emacs_open (pfn, O_RDONLY, 0); | 1573 | fd = emacs_open (pfn, O_RDONLY, 0); |
| 1561 | if (0 <= fd | 1574 | if (fd >= 0 |
| 1562 | && (fstat (fd, &st) != 0 || S_ISDIR (st.st_mode))) | 1575 | && (fstat (fd, &st) != 0 || S_ISDIR (st.st_mode))) |
| 1563 | { | 1576 | { |
| 1564 | emacs_close (fd); | 1577 | emacs_close (fd); |
| @@ -2346,7 +2359,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) | |||
| 2346 | while (c == '0'); | 2359 | while (c == '0'); |
| 2347 | } | 2360 | } |
| 2348 | 2361 | ||
| 2349 | while (-1 <= (digit = digit_to_number (c, radix))) | 2362 | while ((digit = digit_to_number (c, radix)) >= -1) |
| 2350 | { | 2363 | { |
| 2351 | if (digit == -1) | 2364 | if (digit == -1) |
| 2352 | valid = 0; | 2365 | valid = 0; |
| @@ -2389,7 +2402,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2389 | bool multibyte; | 2402 | bool multibyte; |
| 2390 | 2403 | ||
| 2391 | *pch = 0; | 2404 | *pch = 0; |
| 2392 | load_each_byte = 0; | ||
| 2393 | 2405 | ||
| 2394 | retry: | 2406 | retry: |
| 2395 | 2407 | ||
| @@ -2599,7 +2611,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2599 | return tmp; | 2611 | return tmp; |
| 2600 | } | 2612 | } |
| 2601 | 2613 | ||
| 2602 | /* #@NUMBER is used to skip NUMBER following characters. | 2614 | /* #@NUMBER is used to skip NUMBER following bytes. |
| 2603 | That's used in .elc files to skip over doc strings | 2615 | That's used in .elc files to skip over doc strings |
| 2604 | and function definitions. */ | 2616 | and function definitions. */ |
| 2605 | if (c == '@') | 2617 | if (c == '@') |
| @@ -2607,7 +2619,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2607 | enum { extra = 100 }; | 2619 | enum { extra = 100 }; |
| 2608 | ptrdiff_t i, nskip = 0; | 2620 | ptrdiff_t i, nskip = 0; |
| 2609 | 2621 | ||
| 2610 | load_each_byte = 1; | ||
| 2611 | /* Read a decimal integer. */ | 2622 | /* Read a decimal integer. */ |
| 2612 | while ((c = READCHAR) >= 0 | 2623 | while ((c = READCHAR) >= 0 |
| 2613 | && c >= '0' && c <= '9') | 2624 | && c >= '0' && c <= '9') |
| @@ -2617,11 +2628,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2617 | nskip *= 10; | 2628 | nskip *= 10; |
| 2618 | nskip += c - '0'; | 2629 | nskip += c - '0'; |
| 2619 | } | 2630 | } |
| 2620 | UNREAD (c); | 2631 | if (nskip > 0) |
| 2621 | 2632 | /* We can't use UNREAD here, because in the code below we side-step | |
| 2633 | READCHAR. Instead, assume the first char after #@NNN occupies | ||
| 2634 | a single byte, which is the case normally since it's just | ||
| 2635 | a space. */ | ||
| 2636 | nskip--; | ||
| 2637 | else | ||
| 2638 | UNREAD (c); | ||
| 2639 | |||
| 2622 | if (load_force_doc_strings | 2640 | if (load_force_doc_strings |
| 2623 | && (EQ (readcharfun, Qget_file_char) | 2641 | && (FROM_FILE_P (readcharfun))) |
| 2624 | || EQ (readcharfun, Qget_emacs_mule_file_char))) | ||
| 2625 | { | 2642 | { |
| 2626 | /* If we are supposed to force doc strings into core right now, | 2643 | /* If we are supposed to force doc strings into core right now, |
| 2627 | record the last string that we skipped, | 2644 | record the last string that we skipped, |
| @@ -2660,19 +2677,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2660 | saved_doc_string_position = file_tell (instream); | 2677 | saved_doc_string_position = file_tell (instream); |
| 2661 | 2678 | ||
| 2662 | /* Copy that many characters into saved_doc_string. */ | 2679 | /* Copy that many characters into saved_doc_string. */ |
| 2680 | block_input (); | ||
| 2663 | for (i = 0; i < nskip && c >= 0; i++) | 2681 | for (i = 0; i < nskip && c >= 0; i++) |
| 2664 | saved_doc_string[i] = c = READCHAR; | 2682 | saved_doc_string[i] = c = getc (instream); |
| 2683 | unblock_input (); | ||
| 2665 | 2684 | ||
| 2666 | saved_doc_string_length = i; | 2685 | saved_doc_string_length = i; |
| 2667 | } | 2686 | } |
| 2668 | else | 2687 | else |
| 2669 | { | 2688 | /* Skip that many bytes. */ |
| 2670 | /* Skip that many characters. */ | 2689 | skip_dyn_bytes (readcharfun, nskip); |
| 2671 | for (i = 0; i < nskip && c >= 0; i++) | ||
| 2672 | c = READCHAR; | ||
| 2673 | } | ||
| 2674 | 2690 | ||
| 2675 | load_each_byte = 0; | ||
| 2676 | goto retry; | 2691 | goto retry; |
| 2677 | } | 2692 | } |
| 2678 | if (c == '!') | 2693 | if (c == '!') |
| @@ -2716,8 +2731,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2716 | /* Read a non-negative integer. */ | 2731 | /* Read a non-negative integer. */ |
| 2717 | while (c >= '0' && c <= '9') | 2732 | while (c >= '0' && c <= '9') |
| 2718 | { | 2733 | { |
| 2719 | if (MOST_POSITIVE_FIXNUM / 10 < n | 2734 | if (n > MOST_POSITIVE_FIXNUM / 10 |
| 2720 | || MOST_POSITIVE_FIXNUM < n * 10 + c - '0') | 2735 | || n * 10 + c - '0' > MOST_POSITIVE_FIXNUM) |
| 2721 | n = MOST_POSITIVE_FIXNUM + 1; | 2736 | n = MOST_POSITIVE_FIXNUM + 1; |
| 2722 | else | 2737 | else |
| 2723 | n = n * 10 + c - '0'; | 2738 | n = n * 10 + c - '0'; |
| @@ -2915,7 +2930,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2915 | if (end - p < MAX_MULTIBYTE_LENGTH) | 2930 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 2916 | { | 2931 | { |
| 2917 | ptrdiff_t offset = p - read_buffer; | 2932 | ptrdiff_t offset = p - read_buffer; |
| 2918 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) | 2933 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) |
| 2919 | memory_full (SIZE_MAX); | 2934 | memory_full (SIZE_MAX); |
| 2920 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 2935 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 2921 | read_buffer_size *= 2; | 2936 | read_buffer_size *= 2; |
| @@ -3049,7 +3064,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3049 | if (end - p < MAX_MULTIBYTE_LENGTH) | 3064 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 3050 | { | 3065 | { |
| 3051 | ptrdiff_t offset = p - read_buffer; | 3066 | ptrdiff_t offset = p - read_buffer; |
| 3052 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) | 3067 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) |
| 3053 | memory_full (SIZE_MAX); | 3068 | memory_full (SIZE_MAX); |
| 3054 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 3069 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 3055 | read_buffer_size *= 2; | 3070 | read_buffer_size *= 2; |
| @@ -3079,7 +3094,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3079 | if (p == end) | 3094 | if (p == end) |
| 3080 | { | 3095 | { |
| 3081 | ptrdiff_t offset = p - read_buffer; | 3096 | ptrdiff_t offset = p - read_buffer; |
| 3082 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) | 3097 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) |
| 3083 | memory_full (SIZE_MAX); | 3098 | memory_full (SIZE_MAX); |
| 3084 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 3099 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 3085 | read_buffer_size *= 2; | 3100 | read_buffer_size *= 2; |
| @@ -3283,12 +3298,12 @@ string_to_number (char const *string, int base, bool ignore_trailing) | |||
| 3283 | state = 0; | 3298 | state = 0; |
| 3284 | 3299 | ||
| 3285 | leading_digit = digit_to_number (*cp, base); | 3300 | leading_digit = digit_to_number (*cp, base); |
| 3286 | if (0 <= leading_digit) | 3301 | if (leading_digit >= 0) |
| 3287 | { | 3302 | { |
| 3288 | state |= LEAD_INT; | 3303 | state |= LEAD_INT; |
| 3289 | do | 3304 | do |
| 3290 | ++cp; | 3305 | ++cp; |
| 3291 | while (0 <= digit_to_number (*cp, base)); | 3306 | while (digit_to_number (*cp, base) >= 0); |
| 3292 | } | 3307 | } |
| 3293 | if (*cp == '.') | 3308 | if (*cp == '.') |
| 3294 | { | 3309 | { |
| @@ -3365,7 +3380,7 @@ string_to_number (char const *string, int base, bool ignore_trailing) | |||
| 3365 | 3380 | ||
| 3366 | /* If the number uses integer and not float syntax, and is in C-language | 3381 | /* If the number uses integer and not float syntax, and is in C-language |
| 3367 | range, use its value, preferably as a fixnum. */ | 3382 | range, use its value, preferably as a fixnum. */ |
| 3368 | if (0 <= leading_digit && ! float_syntax) | 3383 | if (leading_digit >= 0 && ! float_syntax) |
| 3369 | { | 3384 | { |
| 3370 | uintmax_t n; | 3385 | uintmax_t n; |
| 3371 | 3386 | ||
| @@ -3559,8 +3574,10 @@ read_list (bool flag, Lisp_Object readcharfun) | |||
| 3559 | { | 3574 | { |
| 3560 | if (doc_reference == 1) | 3575 | if (doc_reference == 1) |
| 3561 | return make_number (0); | 3576 | return make_number (0); |
| 3562 | if (doc_reference == 2) | 3577 | if (doc_reference == 2 && INTEGERP (XCDR (val))) |
| 3563 | { | 3578 | { |
| 3579 | char *saved = NULL; | ||
| 3580 | file_offset saved_position; | ||
| 3564 | /* Get a doc string from the file we are loading. | 3581 | /* Get a doc string from the file we are loading. |
| 3565 | If it's in saved_doc_string, get it from there. | 3582 | If it's in saved_doc_string, get it from there. |
| 3566 | 3583 | ||
| @@ -3571,72 +3588,48 @@ read_list (bool flag, Lisp_Object readcharfun) | |||
| 3571 | doc string, caller must make it | 3588 | doc string, caller must make it |
| 3572 | multibyte. */ | 3589 | multibyte. */ |
| 3573 | 3590 | ||
| 3574 | EMACS_INT pos = XINT (XCDR (val)); | ||
| 3575 | /* Position is negative for user variables. */ | 3591 | /* Position is negative for user variables. */ |
| 3576 | if (pos < 0) pos = -pos; | 3592 | EMACS_INT pos = eabs (XINT (XCDR (val))); |
| 3577 | if (pos >= saved_doc_string_position | 3593 | if (pos >= saved_doc_string_position |
| 3578 | && pos < (saved_doc_string_position | 3594 | && pos < (saved_doc_string_position |
| 3579 | + saved_doc_string_length)) | 3595 | + saved_doc_string_length)) |
| 3580 | { | 3596 | { |
| 3581 | ptrdiff_t start = pos - saved_doc_string_position; | 3597 | saved = saved_doc_string; |
| 3582 | ptrdiff_t from, to; | 3598 | saved_position = saved_doc_string_position; |
| 3583 | |||
| 3584 | /* Process quoting with ^A, | ||
| 3585 | and find the end of the string, | ||
| 3586 | which is marked with ^_ (037). */ | ||
| 3587 | for (from = start, to = start; | ||
| 3588 | saved_doc_string[from] != 037;) | ||
| 3589 | { | ||
| 3590 | int c = saved_doc_string[from++]; | ||
| 3591 | if (c == 1) | ||
| 3592 | { | ||
| 3593 | c = saved_doc_string[from++]; | ||
| 3594 | if (c == 1) | ||
| 3595 | saved_doc_string[to++] = c; | ||
| 3596 | else if (c == '0') | ||
| 3597 | saved_doc_string[to++] = 0; | ||
| 3598 | else if (c == '_') | ||
| 3599 | saved_doc_string[to++] = 037; | ||
| 3600 | } | ||
| 3601 | else | ||
| 3602 | saved_doc_string[to++] = c; | ||
| 3603 | } | ||
| 3604 | |||
| 3605 | return make_unibyte_string (saved_doc_string + start, | ||
| 3606 | to - start); | ||
| 3607 | } | 3599 | } |
| 3608 | /* Look in prev_saved_doc_string the same way. */ | 3600 | /* Look in prev_saved_doc_string the same way. */ |
| 3609 | else if (pos >= prev_saved_doc_string_position | 3601 | else if (pos >= prev_saved_doc_string_position |
| 3610 | && pos < (prev_saved_doc_string_position | 3602 | && pos < (prev_saved_doc_string_position |
| 3611 | + prev_saved_doc_string_length)) | 3603 | + prev_saved_doc_string_length)) |
| 3612 | { | 3604 | { |
| 3613 | ptrdiff_t start = | 3605 | saved = prev_saved_doc_string; |
| 3614 | pos - prev_saved_doc_string_position; | 3606 | saved_position = prev_saved_doc_string_position; |
| 3607 | } | ||
| 3608 | if (saved) | ||
| 3609 | { | ||
| 3610 | ptrdiff_t start = pos - saved_position; | ||
| 3615 | ptrdiff_t from, to; | 3611 | ptrdiff_t from, to; |
| 3616 | 3612 | ||
| 3617 | /* Process quoting with ^A, | 3613 | /* Process quoting with ^A, |
| 3618 | and find the end of the string, | 3614 | and find the end of the string, |
| 3619 | which is marked with ^_ (037). */ | 3615 | which is marked with ^_ (037). */ |
| 3620 | for (from = start, to = start; | 3616 | for (from = start, to = start; |
| 3621 | prev_saved_doc_string[from] != 037;) | 3617 | saved[from] != 037;) |
| 3622 | { | 3618 | { |
| 3623 | int c = prev_saved_doc_string[from++]; | 3619 | int c = saved[from++]; |
| 3624 | if (c == 1) | 3620 | if (c == 1) |
| 3625 | { | 3621 | { |
| 3626 | c = prev_saved_doc_string[from++]; | 3622 | c = saved[from++]; |
| 3627 | if (c == 1) | 3623 | saved[to++] = (c == 1 ? c |
| 3628 | prev_saved_doc_string[to++] = c; | 3624 | : c == '0' ? 0 |
| 3629 | else if (c == '0') | 3625 | : c == '_' ? 037 |
| 3630 | prev_saved_doc_string[to++] = 0; | 3626 | : c); |
| 3631 | else if (c == '_') | ||
| 3632 | prev_saved_doc_string[to++] = 037; | ||
| 3633 | } | 3627 | } |
| 3634 | else | 3628 | else |
| 3635 | prev_saved_doc_string[to++] = c; | 3629 | saved[to++] = c; |
| 3636 | } | 3630 | } |
| 3637 | 3631 | ||
| 3638 | return make_unibyte_string (prev_saved_doc_string | 3632 | return make_unibyte_string (saved + start, |
| 3639 | + start, | ||
| 3640 | to - start); | 3633 | to - start); |
| 3641 | } | 3634 | } |
| 3642 | else | 3635 | else |
| @@ -4527,12 +4520,16 @@ The default is nil, which means use the function `read'. */); | |||
| 4527 | Vload_read_function = Qnil; | 4520 | Vload_read_function = Qnil; |
| 4528 | 4521 | ||
| 4529 | DEFVAR_LISP ("load-source-file-function", Vload_source_file_function, | 4522 | DEFVAR_LISP ("load-source-file-function", Vload_source_file_function, |
| 4530 | doc: /* Function called in `load' for loading an Emacs Lisp source file. | 4523 | doc: /* Function called in `load' to load an Emacs Lisp source file. |
| 4531 | This function is for doing code conversion before reading the source file. | 4524 | The value should be a function for doing code conversion before |
| 4532 | If nil, loading is done without any code conversion. | 4525 | reading a source file. It can also be nil, in which case loading is |
| 4533 | Arguments are FULLNAME, FILE, NOERROR, NOMESSAGE, where | 4526 | done without any code conversion. |
| 4534 | FULLNAME is the full name of FILE. | 4527 | |
| 4535 | See `load' for the meaning of the remaining arguments. */); | 4528 | If the value is a function, it is called with four arguments, |
| 4529 | FULLNAME, FILE, NOERROR, NOMESSAGE. FULLNAME is the absolute name of | ||
| 4530 | the file to load, FILE is the non-absolute name (for messages etc.), | ||
| 4531 | and NOERROR and NOMESSAGE are the corresponding arguments passed to | ||
| 4532 | `load'. The function should return t if the file was loaded. */); | ||
| 4536 | Vload_source_file_function = Qnil; | 4533 | Vload_source_file_function = Qnil; |
| 4537 | 4534 | ||
| 4538 | DEFVAR_BOOL ("load-force-doc-strings", load_force_doc_strings, | 4535 | DEFVAR_BOOL ("load-force-doc-strings", load_force_doc_strings, |