comparison src/lread.c @ 13146:6182d95acd14

(read1): Handle chartables and boolvectors.
author Richard M. Stallman <rms@gnu.org>
date Sat, 07 Oct 1995 22:01:39 +0000
parents cd0e7903d0a9
children 0f83b9eb5478
comparison
equal deleted inserted replaced
13145:4ce211a90724 13146:6182d95acd14
1178 return Qnil; 1178 return Qnil;
1179 } 1179 }
1180 1180
1181 case '#': 1181 case '#':
1182 c = READCHAR; 1182 c = READCHAR;
1183 if (c == '^')
1184 {
1185 c = READCHAR;
1186 if (c == '[')
1187 {
1188 Lisp_Object tmp;
1189 tmp = read_vector (readcharfun);
1190 if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS
1191 || XVECTOR (tmp)->size > CHAR_TABLE_STANDARD_SLOTS + 10)
1192 error ("Invalid size char-table");
1193 XSETCHAR_TABLE (tmp, XCHAR_TABLE (tmp));
1194 return tmp;
1195 }
1196 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#^", 2), Qnil));
1197 }
1198 if (c == '&')
1199 {
1200 Lisp_Object length;
1201 length = read1 (readcharfun, pch, first_in_list);
1202 c = READCHAR;
1203 if (c == '"')
1204 {
1205 Lisp_Object tmp, val;
1206 int bits_per_char = INTBITS / sizeof (int);
1207 int size_in_chars = ((XFASTINT (length) + bits_per_char)
1208 / bits_per_char);
1209
1210 UNREAD (c);
1211 tmp = read1 (readcharfun, pch, first_in_list);
1212 if (size_in_chars != XSTRING (tmp)->size)
1213 Fsignal (Qinvalid_read_syntax,
1214 Fcons (make_string ("#&", 2), Qnil));
1215
1216 val = Fmake_bool_vector (length, Qnil);
1217 bcopy (XSTRING (tmp)->data, XBOOL_VECTOR (val)->data,
1218 size_in_chars);
1219 return val;
1220 }
1221 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&", 2), Qnil));
1222 }
1183 if (c == '[') 1223 if (c == '[')
1184 { 1224 {
1185 /* Accept compiled functions at read-time so that we don't have to 1225 /* Accept compiled functions at read-time so that we don't have to
1186 build them using function calls. */ 1226 build them using function calls. */
1187 Lisp_Object tmp; 1227 Lisp_Object tmp;