From: Miles Bader Date: Sat, 17 Jun 2006 20:57:37 +0000 (+0000) Subject: Merge from emacs--devo--0 X-Git-Tag: emacs-pretest-23.0.90~8295^2~878 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=10c1758c0b2d29b3e1fb8e3ffe5c5dc262f25217;p=emacs.git Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 300-313) - Update from CVS - Update from CVS: lispref/display.texi (Forcing Redisplay): Fix typo. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 105-106) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-74 --- 10c1758c0b2d29b3e1fb8e3ffe5c5dc262f25217 diff --cc lisp/term/mac-win.el index b5dc01ff9bf,7ab9ac9481f..9843d984e34 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el @@@ -1319,8 -1272,8 +1322,8 @@@ correspoinding TextEncodingBase value. (if (string-match "[\xa0\xfd-\xff]" str) (setq str nil) ;; ASCII-only? - (unless (string-match "\\`[[:ascii:]]*\\'" str) + (unless (mac-code-convert-string data nil mac-text-encoding-ascii) - (subst-char-in-string ?\x5c ?\(J\(B str t) + (subst-char-in-string ?\x5c ?\Â¥ str t) (subst-char-in-string ?\x80 ?\\ str t))))) (or str (decode-coding-string data diff --cc src/lread.c index d8abde1c458,a0d4ad825dd..6ea92d1aebf --- a/src/lread.c +++ b/src/lread.c @@@ -1915,16 -1717,59 +1915,19 @@@ read0 (readcharfun static int read_buffer_size; static char *read_buffer; -/* Read multibyte form and return it as a character. C is a first - byte of multibyte form, and rest of them are read from - READCHARFUN. */ - -static int -read_multibyte (c, readcharfun) - register int c; - Lisp_Object readcharfun; -{ - /* We need the actual character code of this multibyte - characters. */ - unsigned char str[MAX_MULTIBYTE_LENGTH]; - int len = 0; - int bytes; - - if (c < 0) - return c; - - str[len++] = c; - while ((c = READCHAR) >= 0xA0 - && len < MAX_MULTIBYTE_LENGTH) - { - str[len++] = c; - readchar_count--; - } - UNREAD (c); - if (UNIBYTE_STR_AS_MULTIBYTE_P (str, len, bytes)) - return STRING_CHAR (str, len); - /* The byte sequence is not valid as multibyte. Unread all bytes - but the first one, and return the first byte. */ - while (--len > 0) - UNREAD (str[len]); - return str[0]; -} - /* Read a \-escape sequence, assuming we already read the `\'. - If the escape sequence forces unibyte, store 1 into *BYTEREP. - If the escape sequence forces multibyte, store 2 into *BYTEREP. - Otherwise store 0 into *BYTEREP. */ + If the escape sequence forces unibyte, return eight-bit char. */ static int -read_escape (readcharfun, stringp, byterep) +read_escape (readcharfun, stringp) Lisp_Object readcharfun; int stringp; - int *byterep; { register int c = READCHAR; + /* \u allows up to four hex digits, \U up to eight. Default to the + behaviour for \u, and change this value in the case that \U is seen. */ + int unicode_hex_count = 4; - *byterep = 0; - switch (c) { case -1: @@@ -2090,7 -1931,55 +2093,53 @@@ return i; } + case 'U': + /* Post-Unicode-2.0: Up to eight hex chars. */ + unicode_hex_count = 8; + case 'u': + + /* A Unicode escape. We only permit them in strings and characters, + not arbitrarily in the source code, as in some other languages. */ + { + int i = 0; + int count = 0; + Lisp_Object lisp_char; + struct gcpro gcpro1; + + while (++count <= unicode_hex_count) + { + c = READCHAR; + /* isdigit(), isalpha() may be locale-specific, which we don't + want. */ + if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); + else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; + else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; + else + { + error ("Non-hex digit used for Unicode escape"); + break; + } + } + + GCPRO1 (readcharfun); + lisp_char = call2(intern("decode-char"), intern("ucs"), + make_number(i)); + UNGCPRO; + + if (EQ(Qnil, lisp_char)) + { + /* This is ugly and horrible and trashes the user's data. */ + XSETFASTINT (i, MAKE_CHAR (charset_katakana_jisx0201, + 34 + 128, 46 + 128)); + return i; + } + else + { + return XFASTINT (lisp_char); + } + } + default: - if (BASE_LEADING_CODE_P (c)) - c = read_multibyte (c, readcharfun); return c; } }