diff options
| author | Stefan Monnier | 2011-03-21 12:42:16 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-03-21 12:42:16 -0400 |
| commit | cafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch) | |
| tree | 7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /src/lread.c | |
| parent | a08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff) | |
| parent | 4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff) | |
| download | emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip | |
Merge from trunk
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/src/lread.c b/src/lread.c index c8c07bed476..7a8d7cf9a6a 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -370,15 +370,15 @@ unreadchar (Lisp_Object readcharfun, int c) | |||
| 370 | else if (BUFFERP (readcharfun)) | 370 | else if (BUFFERP (readcharfun)) |
| 371 | { | 371 | { |
| 372 | struct buffer *b = XBUFFER (readcharfun); | 372 | struct buffer *b = XBUFFER (readcharfun); |
| 373 | EMACS_INT charpos = BUF_PT (b); | ||
| 373 | EMACS_INT bytepos = BUF_PT_BYTE (b); | 374 | EMACS_INT bytepos = BUF_PT_BYTE (b); |
| 374 | 375 | ||
| 375 | BUF_PT (b)--; | ||
| 376 | if (! NILP (BVAR (b, enable_multibyte_characters))) | 376 | if (! NILP (BVAR (b, enable_multibyte_characters))) |
| 377 | BUF_DEC_POS (b, bytepos); | 377 | BUF_DEC_POS (b, bytepos); |
| 378 | else | 378 | else |
| 379 | bytepos--; | 379 | bytepos--; |
| 380 | 380 | ||
| 381 | BUF_PT_BYTE (b) = bytepos; | 381 | SET_BUF_PT_BOTH (b, charpos - 1, bytepos); |
| 382 | } | 382 | } |
| 383 | else if (MARKERP (readcharfun)) | 383 | else if (MARKERP (readcharfun)) |
| 384 | { | 384 | { |
| @@ -1133,10 +1133,10 @@ Return t if the file exists and loads successfully. */) | |||
| 1133 | Also, just loading a file recursively is not always an error in | 1133 | Also, just loading a file recursively is not always an error in |
| 1134 | the general case; the second load may do something different. */ | 1134 | the general case; the second load may do something different. */ |
| 1135 | { | 1135 | { |
| 1136 | int count = 0; | 1136 | int load_count = 0; |
| 1137 | Lisp_Object tem; | 1137 | Lisp_Object tem; |
| 1138 | for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem)) | 1138 | for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem)) |
| 1139 | if (!NILP (Fequal (found, XCAR (tem))) && (++count > 3)) | 1139 | if (!NILP (Fequal (found, XCAR (tem))) && (++load_count > 3)) |
| 1140 | { | 1140 | { |
| 1141 | if (fd >= 0) | 1141 | if (fd >= 0) |
| 1142 | emacs_close (fd); | 1142 | emacs_close (fd); |
| @@ -1787,8 +1787,8 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1787 | to a different value when evaluated. */ | 1787 | to a different value when evaluated. */ |
| 1788 | if (BUFFERP (readcharfun)) | 1788 | if (BUFFERP (readcharfun)) |
| 1789 | { | 1789 | { |
| 1790 | struct buffer *b = XBUFFER (readcharfun); | 1790 | struct buffer *buf = XBUFFER (readcharfun); |
| 1791 | if (BUF_PT (b) == BUF_ZV (b)) | 1791 | if (BUF_PT (buf) == BUF_ZV (buf)) |
| 1792 | continue_reading_p = 0; | 1792 | continue_reading_p = 0; |
| 1793 | } | 1793 | } |
| 1794 | } | 1794 | } |
| @@ -2810,7 +2810,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2810 | { | 2810 | { |
| 2811 | char *p = read_buffer; | 2811 | char *p = read_buffer; |
| 2812 | char *end = read_buffer + read_buffer_size; | 2812 | char *end = read_buffer + read_buffer_size; |
| 2813 | register int c; | 2813 | register int ch; |
| 2814 | /* Nonzero if we saw an escape sequence specifying | 2814 | /* Nonzero if we saw an escape sequence specifying |
| 2815 | a multibyte character. */ | 2815 | a multibyte character. */ |
| 2816 | int force_multibyte = 0; | 2816 | int force_multibyte = 0; |
| @@ -2820,8 +2820,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2820 | int cancel = 0; | 2820 | int cancel = 0; |
| 2821 | int nchars = 0; | 2821 | int nchars = 0; |
| 2822 | 2822 | ||
| 2823 | while ((c = READCHAR) >= 0 | 2823 | while ((ch = READCHAR) >= 0 |
| 2824 | && c != '\"') | 2824 | && ch != '\"') |
| 2825 | { | 2825 | { |
| 2826 | if (end - p < MAX_MULTIBYTE_LENGTH) | 2826 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 2827 | { | 2827 | { |
| @@ -2832,44 +2832,44 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2832 | end = read_buffer + read_buffer_size; | 2832 | end = read_buffer + read_buffer_size; |
| 2833 | } | 2833 | } |
| 2834 | 2834 | ||
| 2835 | if (c == '\\') | 2835 | if (ch == '\\') |
| 2836 | { | 2836 | { |
| 2837 | int modifiers; | 2837 | int modifiers; |
| 2838 | 2838 | ||
| 2839 | c = read_escape (readcharfun, 1); | 2839 | ch = read_escape (readcharfun, 1); |
| 2840 | 2840 | ||
| 2841 | /* C is -1 if \ newline has just been seen */ | 2841 | /* CH is -1 if \ newline has just been seen */ |
| 2842 | if (c == -1) | 2842 | if (ch == -1) |
| 2843 | { | 2843 | { |
| 2844 | if (p == read_buffer) | 2844 | if (p == read_buffer) |
| 2845 | cancel = 1; | 2845 | cancel = 1; |
| 2846 | continue; | 2846 | continue; |
| 2847 | } | 2847 | } |
| 2848 | 2848 | ||
| 2849 | modifiers = c & CHAR_MODIFIER_MASK; | 2849 | modifiers = ch & CHAR_MODIFIER_MASK; |
| 2850 | c = c & ~CHAR_MODIFIER_MASK; | 2850 | ch = ch & ~CHAR_MODIFIER_MASK; |
| 2851 | 2851 | ||
| 2852 | if (CHAR_BYTE8_P (c)) | 2852 | if (CHAR_BYTE8_P (ch)) |
| 2853 | force_singlebyte = 1; | 2853 | force_singlebyte = 1; |
| 2854 | else if (! ASCII_CHAR_P (c)) | 2854 | else if (! ASCII_CHAR_P (ch)) |
| 2855 | force_multibyte = 1; | 2855 | force_multibyte = 1; |
| 2856 | else /* i.e. ASCII_CHAR_P (c) */ | 2856 | else /* i.e. ASCII_CHAR_P (ch) */ |
| 2857 | { | 2857 | { |
| 2858 | /* Allow `\C- ' and `\C-?'. */ | 2858 | /* Allow `\C- ' and `\C-?'. */ |
| 2859 | if (modifiers == CHAR_CTL) | 2859 | if (modifiers == CHAR_CTL) |
| 2860 | { | 2860 | { |
| 2861 | if (c == ' ') | 2861 | if (ch == ' ') |
| 2862 | c = 0, modifiers = 0; | 2862 | ch = 0, modifiers = 0; |
| 2863 | else if (c == '?') | 2863 | else if (ch == '?') |
| 2864 | c = 127, modifiers = 0; | 2864 | ch = 127, modifiers = 0; |
| 2865 | } | 2865 | } |
| 2866 | if (modifiers & CHAR_SHIFT) | 2866 | if (modifiers & CHAR_SHIFT) |
| 2867 | { | 2867 | { |
| 2868 | /* Shift modifier is valid only with [A-Za-z]. */ | 2868 | /* Shift modifier is valid only with [A-Za-z]. */ |
| 2869 | if (c >= 'A' && c <= 'Z') | 2869 | if (ch >= 'A' && ch <= 'Z') |
| 2870 | modifiers &= ~CHAR_SHIFT; | 2870 | modifiers &= ~CHAR_SHIFT; |
| 2871 | else if (c >= 'a' && c <= 'z') | 2871 | else if (ch >= 'a' && ch <= 'z') |
| 2872 | c -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; | 2872 | ch -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; |
| 2873 | } | 2873 | } |
| 2874 | 2874 | ||
| 2875 | if (modifiers & CHAR_META) | 2875 | if (modifiers & CHAR_META) |
| @@ -2877,7 +2877,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2877 | /* Move the meta bit to the right place for a | 2877 | /* Move the meta bit to the right place for a |
| 2878 | string. */ | 2878 | string. */ |
| 2879 | modifiers &= ~CHAR_META; | 2879 | modifiers &= ~CHAR_META; |
| 2880 | c = BYTE8_TO_CHAR (c | 0x80); | 2880 | ch = BYTE8_TO_CHAR (ch | 0x80); |
| 2881 | force_singlebyte = 1; | 2881 | force_singlebyte = 1; |
| 2882 | } | 2882 | } |
| 2883 | } | 2883 | } |
| @@ -2885,20 +2885,20 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2885 | /* Any modifiers remaining are invalid. */ | 2885 | /* Any modifiers remaining are invalid. */ |
| 2886 | if (modifiers) | 2886 | if (modifiers) |
| 2887 | error ("Invalid modifier in string"); | 2887 | error ("Invalid modifier in string"); |
| 2888 | p += CHAR_STRING (c, (unsigned char *) p); | 2888 | p += CHAR_STRING (ch, (unsigned char *) p); |
| 2889 | } | 2889 | } |
| 2890 | else | 2890 | else |
| 2891 | { | 2891 | { |
| 2892 | p += CHAR_STRING (c, (unsigned char *) p); | 2892 | p += CHAR_STRING (ch, (unsigned char *) p); |
| 2893 | if (CHAR_BYTE8_P (c)) | 2893 | if (CHAR_BYTE8_P (ch)) |
| 2894 | force_singlebyte = 1; | 2894 | force_singlebyte = 1; |
| 2895 | else if (! ASCII_CHAR_P (c)) | 2895 | else if (! ASCII_CHAR_P (ch)) |
| 2896 | force_multibyte = 1; | 2896 | force_multibyte = 1; |
| 2897 | } | 2897 | } |
| 2898 | nchars++; | 2898 | nchars++; |
| 2899 | } | 2899 | } |
| 2900 | 2900 | ||
| 2901 | if (c < 0) | 2901 | if (ch < 0) |
| 2902 | end_of_file_error (); | 2902 | end_of_file_error (); |
| 2903 | 2903 | ||
| 2904 | /* If purifying, and string starts with \ newline, | 2904 | /* If purifying, and string starts with \ newline, |
| @@ -2917,8 +2917,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2917 | p = read_buffer + nchars; | 2917 | p = read_buffer + nchars; |
| 2918 | } | 2918 | } |
| 2919 | else | 2919 | else |
| 2920 | /* Otherwise, READ_BUFFER contains only ASCII. */ | 2920 | { |
| 2921 | ; | 2921 | /* Otherwise, READ_BUFFER contains only ASCII. */ |
| 2922 | } | ||
| 2922 | 2923 | ||
| 2923 | /* We want readchar_count to be the number of characters, not | 2924 | /* We want readchar_count to be the number of characters, not |
| 2924 | bytes. Hence we adjust for multibyte characters in the | 2925 | bytes. Hence we adjust for multibyte characters in the |