aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorMiles Bader2006-07-19 00:42:56 +0000
committerMiles Bader2006-07-19 00:42:56 +0000
commit63db3c1b3ffa669435b10aa362115ef664990ab2 (patch)
treea62f68b147d4265ce993136af897d4f348570594 /src/data.c
parent2988d6b36d310ba98ea1fed570142f436804fc18 (diff)
parent83676aa2e399363120942ef5ea19f8af6b75e8e8 (diff)
downloademacs-63db3c1b3ffa669435b10aa362115ef664990ab2.tar.gz
emacs-63db3c1b3ffa669435b10aa362115ef664990ab2.zip
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
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c146
1 files changed, 52 insertions, 94 deletions
diff --git a/src/data.c b/src/data.c
index ec9a176f078..4a846207073 100644
--- a/src/data.c
+++ b/src/data.c
@@ -105,7 +105,7 @@ void
105circular_list_error (list) 105circular_list_error (list)
106 Lisp_Object list; 106 Lisp_Object list;
107{ 107{
108 Fsignal (Qcircular_list, list); 108 xsignal (Qcircular_list, list);
109} 109}
110 110
111 111
@@ -113,26 +113,12 @@ Lisp_Object
113wrong_type_argument (predicate, value) 113wrong_type_argument (predicate, value)
114 register Lisp_Object predicate, value; 114 register Lisp_Object predicate, value;
115{ 115{
116 register Lisp_Object tem; 116 /* If VALUE is not even a valid Lisp object, abort here
117 do 117 where we can get a backtrace showing where it came from. */
118 { 118 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
119 /* If VALUE is not even a valid Lisp object, abort here 119 abort ();
120 where we can get a backtrace showing where it came from. */
121 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
122 abort ();
123 120
124 value = Fsignal (Qwrong_type_argument, Fcons (predicate, Fcons (value, Qnil))); 121 xsignal2 (Qwrong_type_argument, predicate, value);
125 tem = call1 (predicate, value);
126 }
127 while (NILP (tem));
128 /* This function is marked as NO_RETURN, gcc would warn if it has a
129 return statement or if falls off the function. Other compilers
130 warn if no return statement is present. */
131#ifndef __GNUC__
132 return value;
133#else
134 abort ();
135#endif
136} 122}
137 123
138void 124void
@@ -145,16 +131,14 @@ void
145args_out_of_range (a1, a2) 131args_out_of_range (a1, a2)
146 Lisp_Object a1, a2; 132 Lisp_Object a1, a2;
147{ 133{
148 while (1) 134 xsignal2 (Qargs_out_of_range, a1, a2);
149 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Qnil)));
150} 135}
151 136
152void 137void
153args_out_of_range_3 (a1, a2, a3) 138args_out_of_range_3 (a1, a2, a3)
154 Lisp_Object a1, a2, a3; 139 Lisp_Object a1, a2, a3;
155{ 140{
156 while (1) 141 xsignal3 (Qargs_out_of_range, a1, a2, a3);
157 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Fcons (a3, Qnil))));
158} 142}
159 143
160/* On some machines, XINT needs a temporary location. 144/* On some machines, XINT needs a temporary location.
@@ -394,8 +378,7 @@ DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
394 (object) 378 (object)
395 Lisp_Object object; 379 Lisp_Object object;
396{ 380{
397 if (VECTORP (object) || STRINGP (object) 381 if (ARRAYP (object))
398 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
399 return Qt; 382 return Qt;
400 return Qnil; 383 return Qnil;
401} 384}
@@ -405,8 +388,7 @@ DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
405 (object) 388 (object)
406 register Lisp_Object object; 389 register Lisp_Object object;
407{ 390{
408 if (CONSP (object) || NILP (object) || VECTORP (object) || STRINGP (object) 391 if (CONSP (object) || NILP (object) || ARRAYP (object))
409 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
410 return Qt; 392 return Qt;
411 return Qnil; 393 return Qnil;
412} 394}
@@ -536,15 +518,7 @@ Lisp concepts such as car, cdr, cons cell and list. */)
536 (list) 518 (list)
537 register Lisp_Object list; 519 register Lisp_Object list;
538{ 520{
539 while (1) 521 return CAR (list);
540 {
541 if (CONSP (list))
542 return XCAR (list);
543 else if (EQ (list, Qnil))
544 return Qnil;
545 else
546 list = wrong_type_argument (Qlistp, list);
547 }
548} 522}
549 523
550DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0, 524DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
@@ -552,10 +526,7 @@ DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
552 (object) 526 (object)
553 Lisp_Object object; 527 Lisp_Object object;
554{ 528{
555 if (CONSP (object)) 529 return CAR_SAFE (object);
556 return XCAR (object);
557 else
558 return Qnil;
559} 530}
560 531
561DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0, 532DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0,
@@ -567,15 +538,7 @@ Lisp concepts such as cdr, car, cons cell and list. */)
567 (list) 538 (list)
568 register Lisp_Object list; 539 register Lisp_Object list;
569{ 540{
570 while (1) 541 return CDR (list);
571 {
572 if (CONSP (list))
573 return XCDR (list);
574 else if (EQ (list, Qnil))
575 return Qnil;
576 else
577 list = wrong_type_argument (Qlistp, list);
578 }
579} 542}
580 543
581DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0, 544DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
@@ -583,10 +546,7 @@ DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
583 (object) 546 (object)
584 Lisp_Object object; 547 Lisp_Object object;
585{ 548{
586 if (CONSP (object)) 549 return CDR_SAFE (object);
587 return XCDR (object);
588 else
589 return Qnil;
590} 550}
591 551
592DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0, 552DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
@@ -594,9 +554,7 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
594 (cell, newcar) 554 (cell, newcar)
595 register Lisp_Object cell, newcar; 555 register Lisp_Object cell, newcar;
596{ 556{
597 if (!CONSP (cell)) 557 CHECK_CONS (cell);
598 cell = wrong_type_argument (Qconsp, cell);
599
600 CHECK_IMPURE (cell); 558 CHECK_IMPURE (cell);
601 XSETCAR (cell, newcar); 559 XSETCAR (cell, newcar);
602 return newcar; 560 return newcar;
@@ -607,9 +565,7 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
607 (cell, newcdr) 565 (cell, newcdr)
608 register Lisp_Object cell, newcdr; 566 register Lisp_Object cell, newcdr;
609{ 567{
610 if (!CONSP (cell)) 568 CHECK_CONS (cell);
611 cell = wrong_type_argument (Qconsp, cell);
612
613 CHECK_IMPURE (cell); 569 CHECK_IMPURE (cell);
614 XSETCDR (cell, newcdr); 570 XSETCDR (cell, newcdr);
615 return newcdr; 571 return newcdr;
@@ -651,7 +607,7 @@ Return SYMBOL. */)
651{ 607{
652 CHECK_SYMBOL (symbol); 608 CHECK_SYMBOL (symbol);
653 if (XSYMBOL (symbol)->constant) 609 if (XSYMBOL (symbol)->constant)
654 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 610 xsignal1 (Qsetting_constant, symbol);
655 Fset (symbol, Qunbound); 611 Fset (symbol, Qunbound);
656 return symbol; 612 return symbol;
657} 613}
@@ -664,7 +620,7 @@ Return SYMBOL. */)
664{ 620{
665 CHECK_SYMBOL (symbol); 621 CHECK_SYMBOL (symbol);
666 if (NILP (symbol) || EQ (symbol, Qt)) 622 if (NILP (symbol) || EQ (symbol, Qt))
667 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 623 xsignal1 (Qsetting_constant, symbol);
668 XSYMBOL (symbol)->function = Qunbound; 624 XSYMBOL (symbol)->function = Qunbound;
669 return symbol; 625 return symbol;
670} 626}
@@ -675,9 +631,9 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
675 register Lisp_Object symbol; 631 register Lisp_Object symbol;
676{ 632{
677 CHECK_SYMBOL (symbol); 633 CHECK_SYMBOL (symbol);
678 if (EQ (XSYMBOL (symbol)->function, Qunbound)) 634 if (!EQ (XSYMBOL (symbol)->function, Qunbound))
679 return Fsignal (Qvoid_function, Fcons (symbol, Qnil)); 635 return XSYMBOL (symbol)->function;
680 return XSYMBOL (symbol)->function; 636 xsignal1 (Qvoid_function, symbol);
681} 637}
682 638
683DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, 639DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
@@ -708,7 +664,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
708{ 664{
709 CHECK_SYMBOL (symbol); 665 CHECK_SYMBOL (symbol);
710 if (NILP (symbol) || EQ (symbol, Qt)) 666 if (NILP (symbol) || EQ (symbol, Qt))
711 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 667 xsignal1 (Qsetting_constant, symbol);
712 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound)) 668 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound))
713 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function), 669 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function),
714 Vautoload_queue); 670 Vautoload_queue);
@@ -764,8 +720,7 @@ function with `&rest' args, or `unevalled' for a special form. */)
764 Lisp_Object subr; 720 Lisp_Object subr;
765{ 721{
766 short minargs, maxargs; 722 short minargs, maxargs;
767 if (!SUBRP (subr)) 723 CHECK_SUBR (subr);
768 wrong_type_argument (Qsubrp, subr);
769 minargs = XSUBR (subr)->min_args; 724 minargs = XSUBR (subr)->min_args;
770 maxargs = XSUBR (subr)->max_args; 725 maxargs = XSUBR (subr)->max_args;
771 if (maxargs == MANY) 726 if (maxargs == MANY)
@@ -783,8 +738,7 @@ SUBR must be a built-in function. */)
783 Lisp_Object subr; 738 Lisp_Object subr;
784{ 739{
785 const char *name; 740 const char *name;
786 if (!SUBRP (subr)) 741 CHECK_SUBR (subr);
787 wrong_type_argument (Qsubrp, subr);
788 name = XSUBR (subr)->symbol_name; 742 name = XSUBR (subr)->symbol_name;
789 return make_string (name, strlen (name)); 743 return make_string (name, strlen (name));
790} 744}
@@ -852,7 +806,7 @@ indirect_variable (symbol)
852 tortoise = XSYMBOL (tortoise)->value; 806 tortoise = XSYMBOL (tortoise)->value;
853 807
854 if (EQ (hare, tortoise)) 808 if (EQ (hare, tortoise))
855 Fsignal (Qcyclic_variable_indirection, Fcons (symbol, Qnil)); 809 xsignal1 (Qcyclic_variable_indirection, symbol);
856 } 810 }
857 811
858 return hare; 812 return hare;
@@ -1153,10 +1107,10 @@ DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
1153 Lisp_Object val; 1107 Lisp_Object val;
1154 1108
1155 val = find_symbol_value (symbol); 1109 val = find_symbol_value (symbol);
1156 if (EQ (val, Qunbound)) 1110 if (!EQ (val, Qunbound))
1157 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil));
1158 else
1159 return val; 1111 return val;
1112
1113 xsignal1 (Qvoid_variable, symbol);
1160} 1114}
1161 1115
1162DEFUN ("set", Fset, Sset, 2, 2, 0, 1116DEFUN ("set", Fset, Sset, 2, 2, 0,
@@ -1220,7 +1174,7 @@ set_internal (symbol, newval, buf, bindflag)
1220 if (SYMBOL_CONSTANT_P (symbol) 1174 if (SYMBOL_CONSTANT_P (symbol)
1221 && (NILP (Fkeywordp (symbol)) 1175 && (NILP (Fkeywordp (symbol))
1222 || !EQ (newval, SYMBOL_VALUE (symbol)))) 1176 || !EQ (newval, SYMBOL_VALUE (symbol))))
1223 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 1177 xsignal1 (Qsetting_constant, symbol);
1224 1178
1225 innercontents = valcontents = SYMBOL_VALUE (symbol); 1179 innercontents = valcontents = SYMBOL_VALUE (symbol);
1226 1180
@@ -1414,9 +1368,10 @@ local bindings in certain buffers. */)
1414 register Lisp_Object value; 1368 register Lisp_Object value;
1415 1369
1416 value = default_value (symbol); 1370 value = default_value (symbol);
1417 if (EQ (value, Qunbound)) 1371 if (!EQ (value, Qunbound))
1418 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); 1372 return value;
1419 return value; 1373
1374 xsignal1 (Qvoid_variable, symbol);
1420} 1375}
1421 1376
1422DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, 1377DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0,
@@ -1928,7 +1883,7 @@ indirect_function (object)
1928 tortoise = XSYMBOL (tortoise)->function; 1883 tortoise = XSYMBOL (tortoise)->function;
1929 1884
1930 if (EQ (hare, tortoise)) 1885 if (EQ (hare, tortoise))
1931 Fsignal (Qcyclic_function_indirection, Fcons (object, Qnil)); 1886 xsignal1 (Qcyclic_function_indirection, object);
1932 } 1887 }
1933 1888
1934 return hare; 1889 return hare;
@@ -1948,13 +1903,18 @@ function chain of symbols. */)
1948{ 1903{
1949 Lisp_Object result; 1904 Lisp_Object result;
1950 1905
1951 result = indirect_function (object); 1906 /* Optimize for no indirection. */
1907 result = object;
1908 if (SYMBOLP (result) && !EQ (result, Qunbound)
1909 && (result = XSYMBOL (result)->function, SYMBOLP (result)))
1910 result = indirect_function (result);
1911 if (!EQ (result, Qunbound))
1912 return result;
1913
1914 if (NILP (noerror))
1915 xsignal1 (Qvoid_function, object);
1952 1916
1953 if (EQ (result, Qunbound)) 1917 return Qnil;
1954 return (NILP (noerror)
1955 ? Fsignal (Qvoid_function, Fcons (object, Qnil))
1956 : Qnil);
1957 return result;
1958} 1918}
1959 1919
1960/* Extract and set vector and string elements */ 1920/* Extract and set vector and string elements */
@@ -2028,9 +1988,7 @@ bool-vector. IDX starts at 0. */)
2028 1988
2029 CHECK_NUMBER (idx); 1989 CHECK_NUMBER (idx);
2030 idxval = XINT (idx); 1990 idxval = XINT (idx);
2031 if (!VECTORP (array) && !STRINGP (array) && !BOOL_VECTOR_P (array) 1991 CHECK_ARRAY (array, Qarrayp);
2032 && ! CHAR_TABLE_P (array))
2033 array = wrong_type_argument (Qarrayp, array);
2034 CHECK_IMPURE (array); 1992 CHECK_IMPURE (array);
2035 1993
2036 if (VECTORP (array)) 1994 if (VECTORP (array))
@@ -2340,7 +2298,7 @@ If the base used is not 10, floating point is not recognized. */)
2340 CHECK_NUMBER (base); 2298 CHECK_NUMBER (base);
2341 b = XINT (base); 2299 b = XINT (base);
2342 if (b < 2 || b > 16) 2300 if (b < 2 || b > 16)
2343 Fsignal (Qargs_out_of_range, Fcons (base, Qnil)); 2301 xsignal1 (Qargs_out_of_range, base);
2344 } 2302 }
2345 2303
2346 /* Skip any whitespace at the front of the number. Some versions of 2304 /* Skip any whitespace at the front of the number. Some versions of
@@ -2452,7 +2410,7 @@ arith_driver (code, nargs, args)
2452 else 2410 else
2453 { 2411 {
2454 if (next == 0) 2412 if (next == 0)
2455 Fsignal (Qarith_error, Qnil); 2413 xsignal0 (Qarith_error);
2456 accum /= next; 2414 accum /= next;
2457 } 2415 }
2458 break; 2416 break;
@@ -2525,7 +2483,7 @@ float_arith_driver (accum, argnum, code, nargs, args)
2525 else 2483 else
2526 { 2484 {
2527 if (! IEEE_FLOATING_POINT && next == 0) 2485 if (! IEEE_FLOATING_POINT && next == 0)
2528 Fsignal (Qarith_error, Qnil); 2486 xsignal0 (Qarith_error);
2529 accum /= next; 2487 accum /= next;
2530 } 2488 }
2531 break; 2489 break;
@@ -2607,7 +2565,7 @@ Both must be integers or markers. */)
2607 CHECK_NUMBER_COERCE_MARKER (y); 2565 CHECK_NUMBER_COERCE_MARKER (y);
2608 2566
2609 if (XFASTINT (y) == 0) 2567 if (XFASTINT (y) == 0)
2610 Fsignal (Qarith_error, Qnil); 2568 xsignal0 (Qarith_error);
2611 2569
2612 XSETINT (val, XINT (x) % XINT (y)); 2570 XSETINT (val, XINT (x) % XINT (y));
2613 return val; 2571 return val;
@@ -2656,7 +2614,7 @@ Both X and Y must be numbers or markers. */)
2656 i2 = XINT (y); 2614 i2 = XINT (y);
2657 2615
2658 if (i2 == 0) 2616 if (i2 == 0)
2659 Fsignal (Qarith_error, Qnil); 2617 xsignal0 (Qarith_error);
2660 2618
2661 i1 %= i2; 2619 i1 %= i2;
2662 2620
@@ -3260,7 +3218,7 @@ arith_error (signo)
3260#endif /* not BSD4_1 */ 3218#endif /* not BSD4_1 */
3261 3219
3262 SIGNAL_THREAD_CHECK (signo); 3220 SIGNAL_THREAD_CHECK (signo);
3263 Fsignal (Qarith_error, Qnil); 3221 xsignal0 (Qarith_error);
3264} 3222}
3265 3223
3266void 3224void