+ if (c == 's')
+ {
+ c = READCHAR;
+ if (c == '(')
+ {
+ /* Accept extended format for hashtables (extensible to
+ other types), e.g.
+ #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
+ Lisp_Object tmp = read_list (0, readcharfun);
+ Lisp_Object head = CAR_SAFE (tmp);
+ Lisp_Object data = Qnil;
+ Lisp_Object val = Qnil;
+ /* The size is 2 * number of allowed keywords to
+ make-hash-table. */
+ Lisp_Object params[10];
+ Lisp_Object ht;
+ Lisp_Object key = Qnil;
+ int param_count = 0;
+
+ if (!EQ (head, Qhash_table))
+ error ("Invalid extended read marker at head of #s list "
+ "(only hash-table allowed)");
+
+ tmp = CDR_SAFE (tmp);
+
+ /* This is repetitive but fast and simple. */
+ params[param_count] = QCsize;
+ params[param_count+1] = Fplist_get (tmp, Qsize);
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
+
+ params[param_count] = QCtest;
+ params[param_count+1] = Fplist_get (tmp, Qtest);
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
+
+ params[param_count] = QCweakness;
+ params[param_count+1] = Fplist_get (tmp, Qweakness);
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
+
+ params[param_count] = QCrehash_size;
+ params[param_count+1] = Fplist_get (tmp, Qrehash_size);
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
+
+ params[param_count] = QCrehash_threshold;
+ params[param_count+1] = Fplist_get (tmp, Qrehash_threshold);
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
+
+ /* This is the hashtable data. */
+ data = Fplist_get (tmp, Qdata);
+
+ /* Now use params to make a new hashtable and fill it. */
+ ht = Fmake_hash_table (param_count, params);
+
+ while (CONSP (data))
+ {
+ key = XCAR (data);
+ data = XCDR (data);
+ if (!CONSP (data))
+ error ("Odd number of elements in hashtable data");
+ val = XCAR (data);
+ data = XCDR (data);
+ Fputhash (key, val, ht);
+ }
+
+ return ht;
+ }
+ UNREAD (c);
+ invalid_syntax ("#", 1);
+ }