summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-10-07 22:01:39 +0000
committerRichard M. Stallman <rms@gnu.org>1995-10-07 22:01:39 +0000
commit9f3d3716d68fd209b868c9a13e2fc68caa1849a8 (patch)
tree36f1e399080cfc36c1ad3c7c18a04888d0f9033d /src/lread.c
parent212a0164d884796b0607ab49f57645896174b16f (diff)
downloademacs-9f3d3716d68fd209b868c9a13e2fc68caa1849a8.tar.gz
(read1): Handle chartables and boolvectors.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c
index 8a85d84159e..f281c92abab 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1180,6 +1180,46 @@ read1 (readcharfun, pch, first_in_list)
case '#':
c = READCHAR;
+ if (c == '^')
+ {
+ c = READCHAR;
+ if (c == '[')
+ {
+ Lisp_Object tmp;
+ tmp = read_vector (readcharfun);
+ if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS
+ || XVECTOR (tmp)->size > CHAR_TABLE_STANDARD_SLOTS + 10)
+ error ("Invalid size char-table");
+ XSETCHAR_TABLE (tmp, XCHAR_TABLE (tmp));
+ return tmp;
+ }
+ Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#^", 2), Qnil));
+ }
+ if (c == '&')
+ {
+ Lisp_Object length;
+ length = read1 (readcharfun, pch, first_in_list);
+ c = READCHAR;
+ if (c == '"')
+ {
+ Lisp_Object tmp, val;
+ int bits_per_char = INTBITS / sizeof (int);
+ int size_in_chars = ((XFASTINT (length) + bits_per_char)
+ / bits_per_char);
+
+ UNREAD (c);
+ tmp = read1 (readcharfun, pch, first_in_list);
+ if (size_in_chars != XSTRING (tmp)->size)
+ Fsignal (Qinvalid_read_syntax,
+ Fcons (make_string ("#&", 2), Qnil));
+
+ val = Fmake_bool_vector (length, Qnil);
+ bcopy (XSTRING (tmp)->data, XBOOL_VECTOR (val)->data,
+ size_in_chars);
+ return val;
+ }
+ Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&", 2), Qnil));
+ }
if (c == '[')
{
/* Accept compiled functions at read-time so that we don't have to