comparison src/fns.c @ 90533:8a8e69664178

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 343-356) - Update from CVS - Update for ERC 5.1.3. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 113-115) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-90
author Miles Bader <miles@gnu.org>
date Wed, 19 Jul 2006 00:42:56 +0000
parents a8190f7e546e dd7e7d68e3b0
children 858cb33ae39d
comparison
equal deleted inserted replaced
90532:e22cf6d2400c 90533:8a8e69664178
145 register Lisp_Object sequence; 145 register Lisp_Object sequence;
146 { 146 {
147 register Lisp_Object val; 147 register Lisp_Object val;
148 register int i; 148 register int i;
149 149
150 retry:
151 if (STRINGP (sequence)) 150 if (STRINGP (sequence))
152 XSETFASTINT (val, SCHARS (sequence)); 151 XSETFASTINT (val, SCHARS (sequence));
153 else if (VECTORP (sequence)) 152 else if (VECTORP (sequence))
154 XSETFASTINT (val, XVECTOR (sequence)->size); 153 XSETFASTINT (val, XVECTOR (sequence)->size);
155 else if (CHAR_TABLE_P (sequence)) 154 else if (CHAR_TABLE_P (sequence))
172 sequence = XCDR (sequence); 171 sequence = XCDR (sequence);
173 ++i; 172 ++i;
174 QUIT; 173 QUIT;
175 } 174 }
176 175
177 if (!NILP (sequence)) 176 CHECK_LIST_END (sequence, sequence);
178 wrong_type_argument (Qlistp, sequence);
179 177
180 val = make_number (i); 178 val = make_number (i);
181 } 179 }
182 else if (NILP (sequence)) 180 else if (NILP (sequence))
183 XSETFASTINT (val, 0); 181 XSETFASTINT (val, 0);
184 else 182 else
185 { 183 wrong_type_argument (Qsequencep, sequence);
186 sequence = wrong_type_argument (Qsequencep, sequence); 184
187 goto retry;
188 }
189 return val; 185 return val;
190 } 186 }
191 187
192 /* This does not check for quits. That is safe since it must terminate. */ 188 /* This does not check for quits. That is safe since it must terminate. */
193 189
486 size_in_chars); 482 size_in_chars);
487 return val; 483 return val;
488 } 484 }
489 485
490 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg)) 486 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg))
491 arg = wrong_type_argument (Qsequencep, arg); 487 wrong_type_argument (Qsequencep, arg);
488
492 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); 489 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0);
493 } 490 }
494 491
495 /* This structure holds information of an argument of `concat' that is 492 /* This structure holds information of an argument of `concat' that is
496 a string and has text properties to be copied. */ 493 a string and has text properties to be copied. */
538 last_tail = args[nargs]; 535 last_tail = args[nargs];
539 } 536 }
540 else 537 else
541 last_tail = Qnil; 538 last_tail = Qnil;
542 539
543 /* Canonicalize each argument. */ 540 /* Check each argument. */
544 for (argnum = 0; argnum < nargs; argnum++) 541 for (argnum = 0; argnum < nargs; argnum++)
545 { 542 {
546 this = args[argnum]; 543 this = args[argnum];
547 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this) 544 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this)
548 || COMPILEDP (this) || BOOL_VECTOR_P (this))) 545 || COMPILEDP (this) || BOOL_VECTOR_P (this)))
549 { 546 wrong_type_argument (Qsequencep, this);
550 args[argnum] = wrong_type_argument (Qsequencep, this);
551 }
552 } 547 }
553 548
554 /* Compute total length in chars of arguments in RESULT_LEN. 549 /* Compute total length in chars of arguments in RESULT_LEN.
555 If desired output is a string, also compute length in bytes 550 If desired output is a string, also compute length in bytes
556 in RESULT_LEN_BYTE, and determine in SOME_MULTIBYTE 551 in RESULT_LEN_BYTE, and determine in SOME_MULTIBYTE
573 568
574 if (VECTORP (this)) 569 if (VECTORP (this))
575 for (i = 0; i < len; i++) 570 for (i = 0; i < len; i++)
576 { 571 {
577 ch = XVECTOR (this)->contents[i]; 572 ch = XVECTOR (this)->contents[i];
578 if (! CHARACTERP (ch)) 573 CHECK_CHARACTER (ch);
579 wrong_type_argument (Qcharacterp, ch);
580 this_len_byte = CHAR_BYTES (XINT (ch)); 574 this_len_byte = CHAR_BYTES (XINT (ch));
581 result_len_byte += this_len_byte; 575 result_len_byte += this_len_byte;
582 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch))) 576 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch)))
583 some_multibyte = 1; 577 some_multibyte = 1;
584 } 578 }
586 wrong_type_argument (Qintegerp, Faref (this, make_number (0))); 580 wrong_type_argument (Qintegerp, Faref (this, make_number (0)));
587 else if (CONSP (this)) 581 else if (CONSP (this))
588 for (; CONSP (this); this = XCDR (this)) 582 for (; CONSP (this); this = XCDR (this))
589 { 583 {
590 ch = XCAR (this); 584 ch = XCAR (this);
591 if (! CHARACTERP (ch)) 585 CHECK_CHARACTER (ch);
592 wrong_type_argument (Qcharacterp, ch);
593 this_len_byte = CHAR_BYTES (XINT (ch)); 586 this_len_byte = CHAR_BYTES (XINT (ch));
594 result_len_byte += this_len_byte; 587 result_len_byte += this_len_byte;
595 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch))) 588 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch)))
596 some_multibyte = 1; 589 some_multibyte = 1;
597 } 590 }
1169 int size; 1162 int size;
1170 int size_byte = 0; 1163 int size_byte = 0;
1171 int from_char, to_char; 1164 int from_char, to_char;
1172 int from_byte = 0, to_byte = 0; 1165 int from_byte = 0, to_byte = 0;
1173 1166
1174 if (! (STRINGP (string) || VECTORP (string))) 1167 CHECK_VECTOR_OR_STRING (string);
1175 wrong_type_argument (Qarrayp, string);
1176
1177 CHECK_NUMBER (from); 1168 CHECK_NUMBER (from);
1178 1169
1179 if (STRINGP (string)) 1170 if (STRINGP (string))
1180 { 1171 {
1181 size = SCHARS (string); 1172 size = SCHARS (string);
1295 { 1286 {
1296 Lisp_Object res; 1287 Lisp_Object res;
1297 int size; 1288 int size;
1298 int size_byte; 1289 int size_byte;
1299 1290
1300 if (! (STRINGP (string) || VECTORP (string))) 1291 CHECK_VECTOR_OR_STRING (string);
1301 wrong_type_argument (Qarrayp, string);
1302 1292
1303 if (STRINGP (string)) 1293 if (STRINGP (string))
1304 { 1294 {
1305 size = SCHARS (string); 1295 size = SCHARS (string);
1306 size_byte = SBYTES (string); 1296 size_byte = SBYTES (string);
1336 CHECK_NUMBER (n); 1326 CHECK_NUMBER (n);
1337 num = XINT (n); 1327 num = XINT (n);
1338 for (i = 0; i < num && !NILP (list); i++) 1328 for (i = 0; i < num && !NILP (list); i++)
1339 { 1329 {
1340 QUIT; 1330 QUIT;
1341 if (! CONSP (list)) 1331 CHECK_LIST_CONS (list, list);
1342 wrong_type_argument (Qlistp, list);
1343 list = XCDR (list); 1332 list = XCDR (list);
1344 } 1333 }
1345 return list; 1334 return list;
1346 } 1335 }
1347 1336
1358 doc: /* Return element of SEQUENCE at index N. */) 1347 doc: /* Return element of SEQUENCE at index N. */)
1359 (sequence, n) 1348 (sequence, n)
1360 register Lisp_Object sequence, n; 1349 register Lisp_Object sequence, n;
1361 { 1350 {
1362 CHECK_NUMBER (n); 1351 CHECK_NUMBER (n);
1363 while (1) 1352 if (CONSP (sequence) || NILP (sequence))
1364 { 1353 return Fcar (Fnthcdr (n, sequence));
1365 if (CONSP (sequence) || NILP (sequence)) 1354
1366 return Fcar (Fnthcdr (n, sequence)); 1355 /* Faref signals a "not array" error, so check here. */
1367 else if (STRINGP (sequence) || VECTORP (sequence) 1356 CHECK_ARRAY (sequence, Qsequencep);
1368 || BOOL_VECTOR_P (sequence) || CHAR_TABLE_P (sequence)) 1357 return Faref (sequence, n);
1369 return Faref (sequence, n);
1370 else
1371 sequence = wrong_type_argument (Qsequencep, sequence);
1372 }
1373 } 1358 }
1374 1359
1375 DEFUN ("member", Fmember, Smember, 2, 2, 0, 1360 DEFUN ("member", Fmember, Smember, 2, 2, 0,
1376 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `equal'. 1361 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `equal'.
1377 The value is actually the tail of LIST whose car is ELT. */) 1362 The value is actually the tail of LIST whose car is ELT. */)
1381 { 1366 {
1382 register Lisp_Object tail; 1367 register Lisp_Object tail;
1383 for (tail = list; !NILP (tail); tail = XCDR (tail)) 1368 for (tail = list; !NILP (tail); tail = XCDR (tail))
1384 { 1369 {
1385 register Lisp_Object tem; 1370 register Lisp_Object tem;
1386 if (! CONSP (tail)) 1371 CHECK_LIST_CONS (tail, list);
1387 wrong_type_argument (Qlistp, list);
1388 tem = XCAR (tail); 1372 tem = XCAR (tail);
1389 if (! NILP (Fequal (elt, tem))) 1373 if (! NILP (Fequal (elt, tem)))
1390 return tail; 1374 return tail;
1391 QUIT; 1375 QUIT;
1392 } 1376 }
1415 1399
1416 list = XCDR (list); 1400 list = XCDR (list);
1417 QUIT; 1401 QUIT;
1418 } 1402 }
1419 1403
1420 if (!CONSP (list) && !NILP (list)) 1404 CHECK_LIST (list);
1421 list = wrong_type_argument (Qlistp, list);
1422
1423 return list; 1405 return list;
1424 } 1406 }
1425 1407
1426 DEFUN ("assq", Fassq, Sassq, 2, 2, 0, 1408 DEFUN ("assq", Fassq, Sassq, 2, 2, 0,
1427 doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST. 1409 doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST.
1428 The value is actually the first element of LIST whose car is KEY. 1410 The value is actually the first element of LIST whose car is KEY.
1429 Elements of LIST that are not conses are ignored. */) 1411 Elements of LIST that are not conses are ignored. */)
1430 (key, list) 1412 (key, list)
1431 Lisp_Object key, list; 1413 Lisp_Object key, list;
1432 { 1414 {
1433 Lisp_Object result;
1434
1435 while (1) 1415 while (1)
1436 { 1416 {
1437 if (!CONSP (list) 1417 if (!CONSP (list)
1438 || (CONSP (XCAR (list)) 1418 || (CONSP (XCAR (list))
1439 && EQ (XCAR (XCAR (list)), key))) 1419 && EQ (XCAR (XCAR (list)), key)))
1453 1433
1454 list = XCDR (list); 1434 list = XCDR (list);
1455 QUIT; 1435 QUIT;
1456 } 1436 }
1457 1437
1458 if (CONSP (list)) 1438 return CAR (list);
1459 result = XCAR (list);
1460 else if (NILP (list))
1461 result = Qnil;
1462 else
1463 result = wrong_type_argument (Qlistp, list);
1464
1465 return result;
1466 } 1439 }
1467 1440
1468 /* Like Fassq but never report an error and do not allow quits. 1441 /* Like Fassq but never report an error and do not allow quits.
1469 Use only on lists known never to be circular. */ 1442 Use only on lists known never to be circular. */
1470 1443
1475 while (CONSP (list) 1448 while (CONSP (list)
1476 && (!CONSP (XCAR (list)) 1449 && (!CONSP (XCAR (list))
1477 || !EQ (XCAR (XCAR (list)), key))) 1450 || !EQ (XCAR (XCAR (list)), key)))
1478 list = XCDR (list); 1451 list = XCDR (list);
1479 1452
1480 return CONSP (list) ? XCAR (list) : Qnil; 1453 return CAR_SAFE (list);
1481 } 1454 }
1482 1455
1483 DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0, 1456 DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0,
1484 doc: /* Return non-nil if KEY is `equal' to the car of an element of LIST. 1457 doc: /* Return non-nil if KEY is `equal' to the car of an element of LIST.
1485 The value is actually the first element of LIST whose car equals KEY. */) 1458 The value is actually the first element of LIST whose car equals KEY. */)
1486 (key, list) 1459 (key, list)
1487 Lisp_Object key, list; 1460 Lisp_Object key, list;
1488 { 1461 {
1489 Lisp_Object result, car; 1462 Lisp_Object car;
1490 1463
1491 while (1) 1464 while (1)
1492 { 1465 {
1493 if (!CONSP (list) 1466 if (!CONSP (list)
1494 || (CONSP (XCAR (list)) 1467 || (CONSP (XCAR (list))
1512 1485
1513 list = XCDR (list); 1486 list = XCDR (list);
1514 QUIT; 1487 QUIT;
1515 } 1488 }
1516 1489
1517 if (CONSP (list)) 1490 return CAR (list);
1518 result = XCAR (list);
1519 else if (NILP (list))
1520 result = Qnil;
1521 else
1522 result = wrong_type_argument (Qlistp, list);
1523
1524 return result;
1525 } 1491 }
1526 1492
1527 /* Like Fassoc but never report an error and do not allow quits. 1493 /* Like Fassoc but never report an error and do not allow quits.
1528 Use only on lists known never to be circular. */ 1494 Use only on lists known never to be circular. */
1529 1495
1545 The value is actually the first element of LIST whose cdr is KEY. */) 1511 The value is actually the first element of LIST whose cdr is KEY. */)
1546 (key, list) 1512 (key, list)
1547 register Lisp_Object key; 1513 register Lisp_Object key;
1548 Lisp_Object list; 1514 Lisp_Object list;
1549 { 1515 {
1550 Lisp_Object result;
1551
1552 while (1) 1516 while (1)
1553 { 1517 {
1554 if (!CONSP (list) 1518 if (!CONSP (list)
1555 || (CONSP (XCAR (list)) 1519 || (CONSP (XCAR (list))
1556 && EQ (XCDR (XCAR (list)), key))) 1520 && EQ (XCDR (XCAR (list)), key)))
1570 1534
1571 list = XCDR (list); 1535 list = XCDR (list);
1572 QUIT; 1536 QUIT;
1573 } 1537 }
1574 1538
1575 if (NILP (list)) 1539 return CAR (list);
1576 result = Qnil;
1577 else if (CONSP (list))
1578 result = XCAR (list);
1579 else
1580 result = wrong_type_argument (Qlistp, list);
1581
1582 return result;
1583 } 1540 }
1584 1541
1585 DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0, 1542 DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0,
1586 doc: /* Return non-nil if KEY is `equal' to the cdr of an element of LIST. 1543 doc: /* Return non-nil if KEY is `equal' to the cdr of an element of LIST.
1587 The value is actually the first element of LIST whose cdr equals KEY. */) 1544 The value is actually the first element of LIST whose cdr equals KEY. */)
1588 (key, list) 1545 (key, list)
1589 Lisp_Object key, list; 1546 Lisp_Object key, list;
1590 { 1547 {
1591 Lisp_Object result, cdr; 1548 Lisp_Object cdr;
1592 1549
1593 while (1) 1550 while (1)
1594 { 1551 {
1595 if (!CONSP (list) 1552 if (!CONSP (list)
1596 || (CONSP (XCAR (list)) 1553 || (CONSP (XCAR (list))
1614 1571
1615 list = XCDR (list); 1572 list = XCDR (list);
1616 QUIT; 1573 QUIT;
1617 } 1574 }
1618 1575
1619 if (CONSP (list)) 1576 return CAR (list);
1620 result = XCAR (list);
1621 else if (NILP (list))
1622 result = Qnil;
1623 else
1624 result = wrong_type_argument (Qlistp, list);
1625
1626 return result;
1627 } 1577 }
1628 1578
1629 DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0, 1579 DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0,
1630 doc: /* Delete by side effect any occurrences of ELT as a member of LIST. 1580 doc: /* Delete by side effect any occurrences of ELT as a member of LIST.
1631 The modified LIST is returned. Comparison is done with `eq'. 1581 The modified LIST is returned. Comparison is done with `eq'.
1641 1591
1642 tail = list; 1592 tail = list;
1643 prev = Qnil; 1593 prev = Qnil;
1644 while (!NILP (tail)) 1594 while (!NILP (tail))
1645 { 1595 {
1646 if (! CONSP (tail)) 1596 CHECK_LIST_CONS (tail, list);
1647 wrong_type_argument (Qlistp, list);
1648 tem = XCAR (tail); 1597 tem = XCAR (tail);
1649 if (EQ (elt, tem)) 1598 if (EQ (elt, tem))
1650 { 1599 {
1651 if (NILP (prev)) 1600 if (NILP (prev))
1652 list = XCDR (tail); 1601 list = XCDR (tail);
1764 { 1713 {
1765 Lisp_Object tail, prev; 1714 Lisp_Object tail, prev;
1766 1715
1767 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail)) 1716 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail))
1768 { 1717 {
1769 if (!CONSP (tail)) 1718 CHECK_LIST_CONS (tail, seq);
1770 wrong_type_argument (Qlistp, seq);
1771 1719
1772 if (!NILP (Fequal (elt, XCAR (tail)))) 1720 if (!NILP (Fequal (elt, XCAR (tail))))
1773 { 1721 {
1774 if (NILP (prev)) 1722 if (NILP (prev))
1775 seq = XCDR (tail); 1723 seq = XCDR (tail);
1797 prev = Qnil; 1745 prev = Qnil;
1798 tail = list; 1746 tail = list;
1799 while (!NILP (tail)) 1747 while (!NILP (tail))
1800 { 1748 {
1801 QUIT; 1749 QUIT;
1802 if (! CONSP (tail)) 1750 CHECK_LIST_CONS (tail, list);
1803 wrong_type_argument (Qlistp, list);
1804 next = XCDR (tail); 1751 next = XCDR (tail);
1805 Fsetcdr (tail, prev); 1752 Fsetcdr (tail, prev);
1806 prev = tail; 1753 prev = tail;
1807 tail = next; 1754 tail = next;
1808 } 1755 }
1820 for (new = Qnil; CONSP (list); list = XCDR (list)) 1767 for (new = Qnil; CONSP (list); list = XCDR (list))
1821 { 1768 {
1822 QUIT; 1769 QUIT;
1823 new = Fcons (XCAR (list), new); 1770 new = Fcons (XCAR (list), new);
1824 } 1771 }
1825 if (!NILP (list)) 1772 CHECK_LIST_END (list, list);
1826 wrong_type_argument (Qconsp, list);
1827 return new; 1773 return new;
1828 } 1774 }
1829 1775
1830 Lisp_Object merge (); 1776 Lisp_Object merge ();
1831 1777
1945 (setup_coding_system). Don't QUIT in that case. */ 1891 (setup_coding_system). Don't QUIT in that case. */
1946 if (!interrupt_input_blocked) 1892 if (!interrupt_input_blocked)
1947 QUIT; 1893 QUIT;
1948 } 1894 }
1949 1895
1950 if (!NILP (tail)) 1896 CHECK_LIST_END (tail, prop);
1951 wrong_type_argument (Qlistp, prop);
1952 1897
1953 return Qnil; 1898 return Qnil;
1954 } 1899 }
1955 #endif 1900 #endif
1956 1901
2062 return XCAR (XCDR (tail)); 2007 return XCAR (XCDR (tail));
2063 2008
2064 QUIT; 2009 QUIT;
2065 } 2010 }
2066 2011
2067 if (!NILP (tail)) 2012 CHECK_LIST_END (tail, prop);
2068 wrong_type_argument (Qlistp, prop);
2069 2013
2070 return Qnil; 2014 return Qnil;
2071 } 2015 }
2072 2016
2073 DEFUN ("lax-plist-put", Flax_plist_put, Slax_plist_put, 3, 3, 0, 2017 DEFUN ("lax-plist-put", Flax_plist_put, Slax_plist_put, 3, 3, 0,
2278 ARRAY is a vector, string, char-table, or bool-vector. */) 2222 ARRAY is a vector, string, char-table, or bool-vector. */)
2279 (array, item) 2223 (array, item)
2280 Lisp_Object array, item; 2224 Lisp_Object array, item;
2281 { 2225 {
2282 register int size, index, charval; 2226 register int size, index, charval;
2283 retry:
2284 if (VECTORP (array)) 2227 if (VECTORP (array))
2285 { 2228 {
2286 register Lisp_Object *p = XVECTOR (array)->contents; 2229 register Lisp_Object *p = XVECTOR (array)->contents;
2287 size = XVECTOR (array)->size; 2230 size = XVECTOR (array)->size;
2288 for (index = 0; index < size; index++) 2231 for (index = 0; index < size; index++)
2342 charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; 2285 charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
2343 p[index] = charval; 2286 p[index] = charval;
2344 } 2287 }
2345 } 2288 }
2346 else 2289 else
2347 { 2290 wrong_type_argument (Qarrayp, array);
2348 array = wrong_type_argument (Qarrayp, array);
2349 goto retry;
2350 }
2351 return array; 2291 return array;
2352 } 2292 }
2353 2293
2354 DEFUN ("clear-string", Fclear_string, Sclear_string, 2294 DEFUN ("clear-string", Fclear_string, Sclear_string,
2355 1, 1, 0, 2295 1, 1, 0,
2403 if (NILP (val)) 2343 if (NILP (val))
2404 val = tem; 2344 val = tem;
2405 2345
2406 if (argnum + 1 == nargs) break; 2346 if (argnum + 1 == nargs) break;
2407 2347
2408 if (!CONSP (tem)) 2348 CHECK_LIST_CONS (tem, tem);
2409 tem = wrong_type_argument (Qlistp, tem);
2410 2349
2411 while (CONSP (tem)) 2350 while (CONSP (tem))
2412 { 2351 {
2413 tail = tem; 2352 tail = tem;
2414 tem = XCDR (tail); 2353 tem = XCDR (tail);
3921 3860
3922 args[0] = h->user_hash_function; 3861 args[0] = h->user_hash_function;
3923 args[1] = key; 3862 args[1] = key;
3924 hash = Ffuncall (2, args); 3863 hash = Ffuncall (2, args);
3925 if (!INTEGERP (hash)) 3864 if (!INTEGERP (hash))
3926 Fsignal (Qerror, 3865 signal_error ("Invalid hash code returned from user-supplied hash function", hash);
3927 list2 (build_string ("Invalid hash code returned from \
3928 user-supplied hash function"),
3929 hash));
3930 return XUINT (hash); 3866 return XUINT (hash);
3931 } 3867 }
3932 3868
3933 3869
3934 /* Create and initialize a new hash table. 3870 /* Create and initialize a new hash table.
4680 /* See if it is a user-defined test. */ 4616 /* See if it is a user-defined test. */
4681 Lisp_Object prop; 4617 Lisp_Object prop;
4682 4618
4683 prop = Fget (test, Qhash_table_test); 4619 prop = Fget (test, Qhash_table_test);
4684 if (!CONSP (prop) || !CONSP (XCDR (prop))) 4620 if (!CONSP (prop) || !CONSP (XCDR (prop)))
4685 Fsignal (Qerror, list2 (build_string ("Invalid hash table test"), 4621 signal_error ("Invalid hash table test", test);
4686 test));
4687 user_test = XCAR (prop); 4622 user_test = XCAR (prop);
4688 user_hash = XCAR (XCDR (prop)); 4623 user_hash = XCAR (XCDR (prop));
4689 } 4624 }
4690 else 4625 else
4691 user_test = user_hash = Qnil; 4626 user_test = user_hash = Qnil;
4694 i = get_key_arg (QCsize, nargs, args, used); 4629 i = get_key_arg (QCsize, nargs, args, used);
4695 size = i < 0 ? Qnil : args[i]; 4630 size = i < 0 ? Qnil : args[i];
4696 if (NILP (size)) 4631 if (NILP (size))
4697 size = make_number (DEFAULT_HASH_SIZE); 4632 size = make_number (DEFAULT_HASH_SIZE);
4698 else if (!INTEGERP (size) || XINT (size) < 0) 4633 else if (!INTEGERP (size) || XINT (size) < 0)
4699 Fsignal (Qerror, 4634 signal_error ("Invalid hash table size", size);
4700 list2 (build_string ("Invalid hash table size"),
4701 size));
4702 4635
4703 /* Look for `:rehash-size SIZE'. */ 4636 /* Look for `:rehash-size SIZE'. */
4704 i = get_key_arg (QCrehash_size, nargs, args, used); 4637 i = get_key_arg (QCrehash_size, nargs, args, used);
4705 rehash_size = i < 0 ? make_float (DEFAULT_REHASH_SIZE) : args[i]; 4638 rehash_size = i < 0 ? make_float (DEFAULT_REHASH_SIZE) : args[i];
4706 if (!NUMBERP (rehash_size) 4639 if (!NUMBERP (rehash_size)
4707 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) 4640 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0)
4708 || XFLOATINT (rehash_size) <= 1.0) 4641 || XFLOATINT (rehash_size) <= 1.0)
4709 Fsignal (Qerror, 4642 signal_error ("Invalid hash table rehash size", rehash_size);
4710 list2 (build_string ("Invalid hash table rehash size"),
4711 rehash_size));
4712 4643
4713 /* Look for `:rehash-threshold THRESHOLD'. */ 4644 /* Look for `:rehash-threshold THRESHOLD'. */
4714 i = get_key_arg (QCrehash_threshold, nargs, args, used); 4645 i = get_key_arg (QCrehash_threshold, nargs, args, used);
4715 rehash_threshold = i < 0 ? make_float (DEFAULT_REHASH_THRESHOLD) : args[i]; 4646 rehash_threshold = i < 0 ? make_float (DEFAULT_REHASH_THRESHOLD) : args[i];
4716 if (!FLOATP (rehash_threshold) 4647 if (!FLOATP (rehash_threshold)
4717 || XFLOATINT (rehash_threshold) <= 0.0 4648 || XFLOATINT (rehash_threshold) <= 0.0
4718 || XFLOATINT (rehash_threshold) > 1.0) 4649 || XFLOATINT (rehash_threshold) > 1.0)
4719 Fsignal (Qerror, 4650 signal_error ("Invalid hash table rehash threshold", rehash_threshold);
4720 list2 (build_string ("Invalid hash table rehash threshold"),
4721 rehash_threshold));
4722 4651
4723 /* Look for `:weakness WEAK'. */ 4652 /* Look for `:weakness WEAK'. */
4724 i = get_key_arg (QCweakness, nargs, args, used); 4653 i = get_key_arg (QCweakness, nargs, args, used);
4725 weak = i < 0 ? Qnil : args[i]; 4654 weak = i < 0 ? Qnil : args[i];
4726 if (EQ (weak, Qt)) 4655 if (EQ (weak, Qt))
4728 if (!NILP (weak) 4657 if (!NILP (weak)
4729 && !EQ (weak, Qkey) 4658 && !EQ (weak, Qkey)
4730 && !EQ (weak, Qvalue) 4659 && !EQ (weak, Qvalue)
4731 && !EQ (weak, Qkey_or_value) 4660 && !EQ (weak, Qkey_or_value)
4732 && !EQ (weak, Qkey_and_value)) 4661 && !EQ (weak, Qkey_and_value))
4733 Fsignal (Qerror, list2 (build_string ("Invalid hash table weakness"), 4662 signal_error ("Invalid hash table weakness", weak);
4734 weak));
4735 4663
4736 /* Now, all args should have been used up, or there's a problem. */ 4664 /* Now, all args should have been used up, or there's a problem. */
4737 for (i = 0; i < nargs; ++i) 4665 for (i = 0; i < nargs; ++i)
4738 if (!used[i]) 4666 if (!used[i])
4739 Fsignal (Qerror, 4667 signal_error ("Invalid argument list", args[i]);
4740 list2 (build_string ("Invalid argument list"), args[i]));
4741 4668
4742 return make_hash_table (test, size, rehash_size, rehash_threshold, weak, 4669 return make_hash_table (test, size, rehash_size, rehash_threshold, weak,
4743 user_test, user_hash); 4670 user_test, user_hash);
4744 } 4671 }
4745 4672
4985 /* Invalid coding system. */ 4912 /* Invalid coding system. */
4986 4913
4987 if (!NILP (noerror)) 4914 if (!NILP (noerror))
4988 coding_system = Qraw_text; 4915 coding_system = Qraw_text;
4989 else 4916 else
4990 while (1) 4917 xsignal1 (Qcoding_system_error, coding_system);
4991 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
4992 } 4918 }
4993 4919
4994 if (STRING_MULTIBYTE (object)) 4920 if (STRING_MULTIBYTE (object))
4995 object = code_convert_string (object, coding_system, Qnil, 1, 0, 1); 4921 object = code_convert_string (object, coding_system, Qnil, 1, 0, 1);
4996 4922
5120 /* Invalid coding system. */ 5046 /* Invalid coding system. */
5121 5047
5122 if (!NILP (noerror)) 5048 if (!NILP (noerror))
5123 coding_system = Qraw_text; 5049 coding_system = Qraw_text;
5124 else 5050 else
5125 while (1) 5051 xsignal1 (Qcoding_system_error, coding_system);
5126 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
5127 } 5052 }
5128 } 5053 }
5129 5054
5130 object = make_buffer_string (b, e, 0); 5055 object = make_buffer_string (b, e, 0);
5131 if (prev != current_buffer) 5056 if (prev != current_buffer)