comparison src/eval.c @ 648:70b112526394

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 18 May 1992 08:14:41 +0000
parents 63a8e7b3c547
children bd574e49bfac
comparison
equal deleted inserted replaced
647:529171c8b71c 648:70b112526394
463 463
464 /* btp now points at the frame of the innermost function 464 /* btp now points at the frame of the innermost function
465 that DOES eval its args. 465 that DOES eval its args.
466 If it is a built-in function (such as load or eval-region) 466 If it is a built-in function (such as load or eval-region)
467 return nil. */ 467 return nil. */
468 fun = *btp->function; 468 fun = Findirect_function (*btp->function);
469 while (XTYPE (fun) == Lisp_Symbol)
470 {
471 QUIT;
472 fun = Fsymbol_function (fun);
473 }
474 if (XTYPE (fun) == Lisp_Subr) 469 if (XTYPE (fun) == Lisp_Subr)
475 return Qnil; 470 return Qnil;
476 /* btp points to the frame of a Lisp function that called interactive-p. 471 /* btp points to the frame of a Lisp function that called interactive-p.
477 Return t if that function was called interactively. */ 472 Return t if that function was called interactively. */
478 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) 473 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively))
1204 register Lisp_Object tem; 1199 register Lisp_Object tem;
1205 register int i = 0; 1200 register int i = 0;
1206 1201
1207 fun = function; 1202 fun = function;
1208 1203
1209 /* Dereference symbols, but avoid infinte loops. Eech. */ 1204 fun = indirect_function (fun);
1210 while (XTYPE (fun) == Lisp_Symbol) 1205 if (EQ (fun, Qunbound))
1211 { 1206 return Qnil;
1212 if (++i > 10) return Qnil;
1213 tem = Ffboundp (fun);
1214 if (NILP (tem)) return Qnil;
1215 fun = Fsymbol_function (fun);
1216 }
1217 1207
1218 /* Emacs primitives are interactive if their DEFUN specifies an 1208 /* Emacs primitives are interactive if their DEFUN specifies an
1219 interactive spec. */ 1209 interactive spec. */
1220 if (XTYPE (fun) == Lisp_Subr) 1210 if (XTYPE (fun) == Lisp_Subr)
1221 { 1211 {
1331 Fload (Fcar (Fcdr (fundef)), Qnil, noninteractive ? Qt : Qnil, Qnil); 1321 Fload (Fcar (Fcdr (fundef)), Qnil, noninteractive ? Qt : Qnil, Qnil);
1332 /* Once loading finishes, don't undo it. */ 1322 /* Once loading finishes, don't undo it. */
1333 Vautoload_queue = Qt; 1323 Vautoload_queue = Qt;
1334 unbind_to (count, Qnil); 1324 unbind_to (count, Qnil);
1335 1325
1336 while (XTYPE (fun) == Lisp_Symbol) 1326 fun = Findirect_function (fun);
1337 { 1327
1338 QUIT;
1339 val = XSYMBOL (fun)->function;
1340 if (EQ (val, Qunbound))
1341 Fsymbol_function (fun); /* Get the right kind of error! */
1342 fun = val;
1343 }
1344 if (XTYPE (fun) == Lisp_Cons 1328 if (XTYPE (fun) == Lisp_Cons
1345 && EQ (XCONS (fun)->car, Qautoload)) 1329 && EQ (XCONS (fun)->car, Qautoload))
1346 error ("Autoloading failed to define function %s", 1330 error ("Autoloading failed to define function %s",
1347 XSYMBOL (funname)->name->data); 1331 XSYMBOL (funname)->name->data);
1348 } 1332 }
1402 do_debug_on_call (Qt); 1386 do_debug_on_call (Qt);
1403 1387
1404 /* At this point, only original_fun and original_args 1388 /* At this point, only original_fun and original_args
1405 have values that will be used below */ 1389 have values that will be used below */
1406 retry: 1390 retry:
1407 fun = original_fun; 1391 fun = Findirect_function (original_fun);
1408 while (XTYPE (fun) == Lisp_Symbol)
1409 {
1410 QUIT;
1411 val = XSYMBOL (fun)->function;
1412 if (EQ (val, Qunbound))
1413 Fsymbol_function (fun); /* Get the right kind of error! */
1414 fun = val;
1415 }
1416 1392
1417 if (XTYPE (fun) == Lisp_Subr) 1393 if (XTYPE (fun) == Lisp_Subr)
1418 { 1394 {
1419 Lisp_Object numargs; 1395 Lisp_Object numargs;
1420 Lisp_Object argvals[7]; 1396 Lisp_Object argvals[7];
1580 return Ffuncall (nargs, args); 1556 return Ffuncall (nargs, args);
1581 } 1557 }
1582 1558
1583 numargs += nargs - 2; 1559 numargs += nargs - 2;
1584 1560
1585 while (XTYPE (fun) == Lisp_Symbol) 1561 fun = indirect_function (fun);
1586 { 1562 if (EQ (fun, Qunbound))
1587 QUIT; 1563 {
1588 fun = XSYMBOL (fun)->function; 1564 /* Let funcall get the error */
1589 if (EQ (fun, Qunbound)) 1565 fun = args[0];
1590 { 1566 goto funcall;
1591 /* Let funcall get the error */
1592 fun = args[0];
1593 goto funcall;
1594 }
1595 } 1567 }
1596 1568
1597 if (XTYPE (fun) == Lisp_Subr) 1569 if (XTYPE (fun) == Lisp_Subr)
1598 { 1570 {
1599 if (numargs < XSUBR (fun)->min_args 1571 if (numargs < XSUBR (fun)->min_args
1777 do_debug_on_call (Qlambda); 1749 do_debug_on_call (Qlambda);
1778 1750
1779 retry: 1751 retry:
1780 1752
1781 fun = args[0]; 1753 fun = args[0];
1782 while (XTYPE (fun) == Lisp_Symbol) 1754
1783 { 1755 fun = Findirect_function (fun);
1784 QUIT;
1785 val = XSYMBOL (fun)->function;
1786 if (EQ (val, Qunbound))
1787 Fsymbol_function (fun); /* Get the right kind of error! */
1788 fun = val;
1789 }
1790 1756
1791 if (XTYPE (fun) == Lisp_Subr) 1757 if (XTYPE (fun) == Lisp_Subr)
1792 { 1758 {
1793 if (numargs < XSUBR (fun)->min_args 1759 if (numargs < XSUBR (fun)->min_args
1794 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 1760 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))