comparison src/lread.c @ 90478:65a8f4ffdbca

(read_escape): Fix the code synched with HEAD.
author Kenichi Handa <handa@m17n.org>
date Mon, 19 Jun 2006 01:54:37 +0000
parents 138027c8c982
children 138ce2701550
comparison
equal deleted inserted replaced
90477:c5d9875473a9 90478:65a8f4ffdbca
2101 /* A Unicode escape. We only permit them in strings and characters, 2101 /* A Unicode escape. We only permit them in strings and characters,
2102 not arbitrarily in the source code, as in some other languages. */ 2102 not arbitrarily in the source code, as in some other languages. */
2103 { 2103 {
2104 int i = 0; 2104 int i = 0;
2105 int count = 0; 2105 int count = 0;
2106 Lisp_Object lisp_char;
2107 struct gcpro gcpro1;
2108 2106
2109 while (++count <= unicode_hex_count) 2107 while (++count <= unicode_hex_count)
2110 { 2108 {
2111 c = READCHAR; 2109 c = READCHAR;
2112 /* isdigit(), isalpha() may be locale-specific, which we don't 2110 /* isdigit(), isalpha() may be locale-specific, which we don't
2119 error ("Non-hex digit used for Unicode escape"); 2117 error ("Non-hex digit used for Unicode escape");
2120 break; 2118 break;
2121 } 2119 }
2122 } 2120 }
2123 2121
2124 GCPRO1 (readcharfun); 2122 return i;
2125 lisp_char = call2(intern("decode-char"), intern("ucs"),
2126 make_number(i));
2127 UNGCPRO;
2128
2129 if (EQ(Qnil, lisp_char))
2130 {
2131 /* This is ugly and horrible and trashes the user's data. */
2132 XSETFASTINT (i, MAKE_CHAR (charset_katakana_jisx0201,
2133 34 + 128, 46 + 128));
2134 return i;
2135 }
2136 else
2137 {
2138 return XFASTINT (lisp_char);
2139 }
2140 } 2123 }
2141 2124
2142 default: 2125 default:
2143 return c; 2126 return c;
2144 } 2127 }