aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorKarl Heuer1994-09-27 04:03:15 +0000
committerKarl Heuer1994-09-27 04:03:15 +0000
commit90165123fc58546a8dcdbafed638fcf72ba50cb8 (patch)
tree7ddcb2e3feac5ce96853deb2583449a2debb6708 /src/eval.c
parente9ebc175bf5a877fa3fbe41efa5eee0e5fb88546 (diff)
downloademacs-90165123fc58546a8dcdbafed638fcf72ba50cb8.tar.gz
emacs-90165123fc58546a8dcdbafed638fcf72ba50cb8.zip
(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,
Fcommandp, Fautoload, Feval, Fapply, Ffuncall, funcall_lambda, specbind): Use type test macros.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/src/eval.c b/src/eval.c
index f5631c3979f..ab488edc16e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -322,7 +322,7 @@ DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0,
322 if (!EQ (Vmocklisp_arguments, Qt)) 322 if (!EQ (Vmocklisp_arguments, Qt))
323 { 323 {
324 val = make_number (0); 324 val = make_number (0);
325 while (!NILP (args) && (tem = Fcar (args), XTYPE (tem) == Lisp_Symbol)) 325 while (!NILP (args) && (tem = Fcar (args), SYMBOLP (tem)))
326 { 326 {
327 QUIT; 327 QUIT;
328 specbind (tem, val), args = Fcdr (args); 328 specbind (tem, val), args = Fcdr (args);
@@ -484,7 +484,7 @@ and input is currently coming from the keyboard (not in keyboard macro).")
484 /* If this isn't a byte-compiled function, there may be a frame at 484 /* If this isn't a byte-compiled function, there may be a frame at
485 the top for Finteractive_p itself. If so, skip it. */ 485 the top for Finteractive_p itself. If so, skip it. */
486 fun = Findirect_function (*btp->function); 486 fun = Findirect_function (*btp->function);
487 if (XTYPE (fun) == Lisp_Subr 487 if (SUBRP (fun)
488 && (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p) 488 && (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p)
489 btp = btp->next; 489 btp = btp->next;
490 490
@@ -507,7 +507,7 @@ and input is currently coming from the keyboard (not in keyboard macro).")
507 Fbytecode at the top. If this frame is for a built-in function 507 Fbytecode at the top. If this frame is for a built-in function
508 (such as load or eval-region) return nil. */ 508 (such as load or eval-region) return nil. */
509 fun = Findirect_function (*btp->function); 509 fun = Findirect_function (*btp->function);
510 if (XTYPE (fun) == Lisp_Subr) 510 if (SUBRP (fun))
511 return Qnil; 511 return Qnil;
512 /* btp points to the frame of a Lisp function that called interactive-p. 512 /* btp points to the frame of a Lisp function that called interactive-p.
513 Return t if that function was called interactively. */ 513 Return t if that function was called interactively. */
@@ -636,9 +636,9 @@ for the variable is \"*\"")
636 Lisp_Object documentation; 636 Lisp_Object documentation;
637 637
638 documentation = Fget (variable, Qvariable_documentation); 638 documentation = Fget (variable, Qvariable_documentation);
639 if (XTYPE (documentation) == Lisp_Int && XINT (documentation) < 0) 639 if (INTEGERP (documentation) && XINT (documentation) < 0)
640 return Qt; 640 return Qt;
641 if ((XTYPE (documentation) == Lisp_String) && 641 if ((STRINGP (documentation)) &&
642 ((unsigned char) XSTRING (documentation)->data[0] == '*')) 642 ((unsigned char) XSTRING (documentation)->data[0] == '*'))
643 return Qt; 643 return Qt;
644 return Qnil; 644 return Qnil;
@@ -664,7 +664,7 @@ Each VALUEFORM can refer to the symbols already bound by this VARLIST.")
664 { 664 {
665 QUIT; 665 QUIT;
666 elt = Fcar (varlist); 666 elt = Fcar (varlist);
667 if (XTYPE (elt) == Lisp_Symbol) 667 if (SYMBOLP (elt))
668 specbind (elt, Qnil); 668 specbind (elt, Qnil);
669 else if (! NILP (Fcdr (Fcdr (elt)))) 669 else if (! NILP (Fcdr (Fcdr (elt))))
670 Fsignal (Qerror, 670 Fsignal (Qerror,
@@ -712,7 +712,7 @@ All the VALUEFORMs are evalled before any symbols are bound.")
712 { 712 {
713 QUIT; 713 QUIT;
714 elt = Fcar (varlist); 714 elt = Fcar (varlist);
715 if (XTYPE (elt) == Lisp_Symbol) 715 if (SYMBOLP (elt))
716 temps [argnum++] = Qnil; 716 temps [argnum++] = Qnil;
717 else if (! NILP (Fcdr (Fcdr (elt)))) 717 else if (! NILP (Fcdr (Fcdr (elt))))
718 Fsignal (Qerror, 718 Fsignal (Qerror,
@@ -729,7 +729,7 @@ All the VALUEFORMs are evalled before any symbols are bound.")
729 { 729 {
730 elt = Fcar (varlist); 730 elt = Fcar (varlist);
731 tem = temps[argnum++]; 731 tem = temps[argnum++];
732 if (XTYPE (elt) == Lisp_Symbol) 732 if (SYMBOLP (elt))
733 specbind (elt, tem); 733 specbind (elt, tem);
734 else 734 else
735 specbind (Fcar (elt), tem); 735 specbind (Fcar (elt), tem);
@@ -782,14 +782,14 @@ definitions to shadow the loaded ones for use in file byte-compilation.")
782 { 782 {
783 /* Come back here each time we expand a macro call, 783 /* Come back here each time we expand a macro call,
784 in case it expands into another macro call. */ 784 in case it expands into another macro call. */
785 if (XTYPE (form) != Lisp_Cons) 785 if (!CONSP (form))
786 break; 786 break;
787 /* Set SYM, give DEF and TEM right values in case SYM is not a symbol. */ 787 /* Set SYM, give DEF and TEM right values in case SYM is not a symbol. */
788 def = sym = XCONS (form)->car; 788 def = sym = XCONS (form)->car;
789 tem = Qnil; 789 tem = Qnil;
790 /* Trace symbols aliases to other symbols 790 /* Trace symbols aliases to other symbols
791 until we get a symbol that is not an alias. */ 791 until we get a symbol that is not an alias. */
792 while (XTYPE (def) == Lisp_Symbol) 792 while (SYMBOLP (def))
793 { 793 {
794 QUIT; 794 QUIT;
795 sym = def; 795 sym = def;
@@ -808,8 +808,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.")
808 { 808 {
809 /* SYM is not mentioned in ENV. 809 /* SYM is not mentioned in ENV.
810 Look at its function definition. */ 810 Look at its function definition. */
811 if (EQ (def, Qunbound) 811 if (EQ (def, Qunbound) || !CONSP (def))
812 || XTYPE (def) != Lisp_Cons)
813 /* Not defined or definition not suitable */ 812 /* Not defined or definition not suitable */
814 break; 813 break;
815 if (EQ (XCONS (def)->car, Qautoload)) 814 if (EQ (XCONS (def)->car, Qautoload))
@@ -1375,7 +1374,7 @@ Also, a symbol satisfies `commandp' if its function definition does so.")
1375 1374
1376 /* Emacs primitives are interactive if their DEFUN specifies an 1375 /* Emacs primitives are interactive if their DEFUN specifies an
1377 interactive spec. */ 1376 interactive spec. */
1378 if (XTYPE (fun) == Lisp_Subr) 1377 if (SUBRP (fun))
1379 { 1378 {
1380 if (XSUBR (fun)->prompt) 1379 if (XSUBR (fun)->prompt)
1381 return Qt; 1380 return Qt;
@@ -1386,20 +1385,19 @@ Also, a symbol satisfies `commandp' if its function definition does so.")
1386 /* Bytecode objects are interactive if they are long enough to 1385 /* Bytecode objects are interactive if they are long enough to
1387 have an element whose index is COMPILED_INTERACTIVE, which is 1386 have an element whose index is COMPILED_INTERACTIVE, which is
1388 where the interactive spec is stored. */ 1387 where the interactive spec is stored. */
1389 else if (XTYPE (fun) == Lisp_Compiled) 1388 else if (COMPILEDP (fun))
1390 return (XVECTOR (fun)->size > COMPILED_INTERACTIVE 1389 return (XVECTOR (fun)->size > COMPILED_INTERACTIVE
1391 ? Qt : Qnil); 1390 ? Qt : Qnil);
1392 1391
1393 /* Strings and vectors are keyboard macros. */ 1392 /* Strings and vectors are keyboard macros. */
1394 if (XTYPE (fun) == Lisp_String 1393 if (STRINGP (fun) || VECTORP (fun))
1395 || XTYPE (fun) == Lisp_Vector)
1396 return Qt; 1394 return Qt;
1397 1395
1398 /* Lists may represent commands. */ 1396 /* Lists may represent commands. */
1399 if (!CONSP (fun)) 1397 if (!CONSP (fun))
1400 return Qnil; 1398 return Qnil;
1401 funcar = Fcar (fun); 1399 funcar = Fcar (fun);
1402 if (XTYPE (funcar) != Lisp_Symbol) 1400 if (!SYMBOLP (funcar))
1403 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 1401 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
1404 if (EQ (funcar, Qlambda)) 1402 if (EQ (funcar, Qlambda))
1405 return Fassq (Qinteractive, Fcdr (Fcdr (fun))); 1403 return Fassq (Qinteractive, Fcdr (Fcdr (fun)));
@@ -1437,7 +1435,7 @@ this does nothing and returns nil.")
1437 1435
1438 /* If function is defined and not as an autoload, don't override */ 1436 /* If function is defined and not as an autoload, don't override */
1439 if (!EQ (XSYMBOL (function)->function, Qunbound) 1437 if (!EQ (XSYMBOL (function)->function, Qunbound)
1440 && !(XTYPE (XSYMBOL (function)->function) == Lisp_Cons 1438 && !(CONSP (XSYMBOL (function)->function)
1441 && EQ (XCONS (XSYMBOL (function)->function)->car, Qautoload))) 1439 && EQ (XCONS (XSYMBOL (function)->function)->car, Qautoload)))
1442 return Qnil; 1440 return Qnil;
1443 1441
@@ -1529,7 +1527,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1529 struct backtrace backtrace; 1527 struct backtrace backtrace;
1530 struct gcpro gcpro1, gcpro2, gcpro3; 1528 struct gcpro gcpro1, gcpro2, gcpro3;
1531 1529
1532 if (XTYPE (form) == Lisp_Symbol) 1530 if (SYMBOLP (form))
1533 { 1531 {
1534 if (EQ (Vmocklisp_arguments, Qt)) 1532 if (EQ (Vmocklisp_arguments, Qt))
1535 return Fsymbol_value (form); 1533 return Fsymbol_value (form);
@@ -1578,7 +1576,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1578 retry: 1576 retry:
1579 fun = Findirect_function (original_fun); 1577 fun = Findirect_function (original_fun);
1580 1578
1581 if (XTYPE (fun) == Lisp_Subr) 1579 if (SUBRP (fun))
1582 { 1580 {
1583 Lisp_Object numargs; 1581 Lisp_Object numargs;
1584 Lisp_Object argvals[7]; 1582 Lisp_Object argvals[7];
@@ -1683,14 +1681,14 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1683 abort (); 1681 abort ();
1684 } 1682 }
1685 } 1683 }
1686 if (XTYPE (fun) == Lisp_Compiled) 1684 if (COMPILEDP (fun))
1687 val = apply_lambda (fun, original_args, 1); 1685 val = apply_lambda (fun, original_args, 1);
1688 else 1686 else
1689 { 1687 {
1690 if (!CONSP (fun)) 1688 if (!CONSP (fun))
1691 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 1689 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
1692 funcar = Fcar (fun); 1690 funcar = Fcar (fun);
1693 if (XTYPE (funcar) != Lisp_Symbol) 1691 if (!SYMBOLP (funcar))
1694 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 1692 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
1695 if (EQ (funcar, Qautoload)) 1693 if (EQ (funcar, Qautoload))
1696 { 1694 {
@@ -1759,7 +1757,7 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10.")
1759 goto funcall; 1757 goto funcall;
1760 } 1758 }
1761 1759
1762 if (XTYPE (fun) == Lisp_Subr) 1760 if (SUBRP (fun))
1763 { 1761 {
1764 if (numargs < XSUBR (fun)->min_args 1762 if (numargs < XSUBR (fun)->min_args
1765 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 1763 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
@@ -2022,7 +2020,7 @@ Thus, (funcall 'cons 'x 'y) returns (x . y).")
2022 2020
2023 fun = Findirect_function (fun); 2021 fun = Findirect_function (fun);
2024 2022
2025 if (XTYPE (fun) == Lisp_Subr) 2023 if (SUBRP (fun))
2026 { 2024 {
2027 if (numargs < XSUBR (fun)->min_args 2025 if (numargs < XSUBR (fun)->min_args
2028 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 2026 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
@@ -2095,14 +2093,14 @@ Thus, (funcall 'cons 'x 'y) returns (x . y).")
2095 abort (); 2093 abort ();
2096 } 2094 }
2097 } 2095 }
2098 if (XTYPE (fun) == Lisp_Compiled) 2096 if (COMPILEDP (fun))
2099 val = funcall_lambda (fun, numargs, args + 1); 2097 val = funcall_lambda (fun, numargs, args + 1);
2100 else 2098 else
2101 { 2099 {
2102 if (!CONSP (fun)) 2100 if (!CONSP (fun))
2103 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2101 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
2104 funcar = Fcar (fun); 2102 funcar = Fcar (fun);
2105 if (XTYPE (funcar) != Lisp_Symbol) 2103 if (!SYMBOLP (funcar))
2106 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2104 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
2107 if (EQ (funcar, Qlambda)) 2105 if (EQ (funcar, Qlambda))
2108 val = funcall_lambda (fun, numargs, args + 1); 2106 val = funcall_lambda (fun, numargs, args + 1);
@@ -2191,9 +2189,9 @@ funcall_lambda (fun, nargs, arg_vector)
2191 2189
2192 XFASTINT (numargs) = nargs; 2190 XFASTINT (numargs) = nargs;
2193 2191
2194 if (XTYPE (fun) == Lisp_Cons) 2192 if (CONSP (fun))
2195 syms_left = Fcar (Fcdr (fun)); 2193 syms_left = Fcar (Fcdr (fun));
2196 else if (XTYPE (fun) == Lisp_Compiled) 2194 else if (COMPILEDP (fun))
2197 syms_left = XVECTOR (fun)->contents[COMPILED_ARGLIST]; 2195 syms_left = XVECTOR (fun)->contents[COMPILED_ARGLIST];
2198 else abort (); 2196 else abort ();
2199 2197
@@ -2202,7 +2200,7 @@ funcall_lambda (fun, nargs, arg_vector)
2202 { 2200 {
2203 QUIT; 2201 QUIT;
2204 next = Fcar (syms_left); 2202 next = Fcar (syms_left);
2205 while (XTYPE (next) != Lisp_Symbol) 2203 while (!SYMBOLP (next))
2206 next = Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2204 next = Fsignal (Qinvalid_function, Fcons (fun, Qnil));
2207 if (EQ (next, Qand_rest)) 2205 if (EQ (next, Qand_rest))
2208 rest = 1; 2206 rest = 1;
@@ -2227,7 +2225,7 @@ funcall_lambda (fun, nargs, arg_vector)
2227 if (i < nargs) 2225 if (i < nargs)
2228 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil))); 2226 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil)));
2229 2227
2230 if (XTYPE (fun) == Lisp_Cons) 2228 if (CONSP (fun))
2231 val = Fprogn (Fcdr (Fcdr (fun))); 2229 val = Fprogn (Fcdr (Fcdr (fun)));
2232 else 2230 else
2233 val = Fbyte_code (XVECTOR (fun)->contents[COMPILED_BYTECODE], 2231 val = Fbyte_code (XVECTOR (fun)->contents[COMPILED_BYTECODE],
@@ -2275,7 +2273,7 @@ specbind (symbol, value)
2275 specpdl_ptr->func = 0; 2273 specpdl_ptr->func = 0;
2276 specpdl_ptr->old_value = ovalue = find_symbol_value (symbol); 2274 specpdl_ptr->old_value = ovalue = find_symbol_value (symbol);
2277 specpdl_ptr++; 2275 specpdl_ptr++;
2278 if (XTYPE (ovalue) == Lisp_Buffer_Objfwd) 2276 if (BUFFER_OBJFWDP (ovalue))
2279 store_symval_forwarding (symbol, ovalue, value); 2277 store_symval_forwarding (symbol, ovalue, value);
2280 else 2278 else
2281 Fset (symbol, value); 2279 Fset (symbol, value);