Commit 90165123 authored by Karl Heuer's avatar Karl Heuer
Browse files

(Fprogn, Finteractive_p, Fuser_variable_p, FletX, Flet, Fmacroexpand,

Fcommandp, Fautoload, Feval, Fapply, Ffuncall, funcall_lambda, specbind): Use
type test macros.
parent e9ebc175
...@@ -322,7 +322,7 @@ DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, ...@@ -322,7 +322,7 @@ DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0,
if (!EQ (Vmocklisp_arguments, Qt)) if (!EQ (Vmocklisp_arguments, Qt))
{ {
val = make_number (0); val = make_number (0);
while (!NILP (args) && (tem = Fcar (args), XTYPE (tem) == Lisp_Symbol)) while (!NILP (args) && (tem = Fcar (args), SYMBOLP (tem)))
{ {
QUIT; QUIT;
specbind (tem, val), args = Fcdr (args); specbind (tem, val), args = Fcdr (args);
...@@ -484,7 +484,7 @@ and input is currently coming from the keyboard (not in keyboard macro).") ...@@ -484,7 +484,7 @@ and input is currently coming from the keyboard (not in keyboard macro).")
/* If this isn't a byte-compiled function, there may be a frame at /* If this isn't a byte-compiled function, there may be a frame at
the top for Finteractive_p itself. If so, skip it. */ the top for Finteractive_p itself. If so, skip it. */
fun = Findirect_function (*btp->function); fun = Findirect_function (*btp->function);
if (XTYPE (fun) == Lisp_Subr if (SUBRP (fun)
&& (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p) && (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p)
btp = btp->next; btp = btp->next;
...@@ -507,7 +507,7 @@ and input is currently coming from the keyboard (not in keyboard macro).") ...@@ -507,7 +507,7 @@ and input is currently coming from the keyboard (not in keyboard macro).")
Fbytecode at the top. If this frame is for a built-in function Fbytecode at the top. If this frame is for a built-in function
(such as load or eval-region) return nil. */ (such as load or eval-region) return nil. */
fun = Findirect_function (*btp->function); fun = Findirect_function (*btp->function);
if (XTYPE (fun) == Lisp_Subr) if (SUBRP (fun))
return Qnil; return Qnil;
/* btp points to the frame of a Lisp function that called interactive-p. /* btp points to the frame of a Lisp function that called interactive-p.
Return t if that function was called interactively. */ Return t if that function was called interactively. */
...@@ -636,9 +636,9 @@ for the variable is \"*\"") ...@@ -636,9 +636,9 @@ for the variable is \"*\"")
Lisp_Object documentation; Lisp_Object documentation;
documentation = Fget (variable, Qvariable_documentation); documentation = Fget (variable, Qvariable_documentation);
if (XTYPE (documentation) == Lisp_Int && XINT (documentation) < 0) if (INTEGERP (documentation) && XINT (documentation) < 0)
return Qt; return Qt;
if ((XTYPE (documentation) == Lisp_String) && if ((STRINGP (documentation)) &&
((unsigned char) XSTRING (documentation)->data[0] == '*')) ((unsigned char) XSTRING (documentation)->data[0] == '*'))
return Qt; return Qt;
return Qnil; return Qnil;
...@@ -664,7 +664,7 @@ Each VALUEFORM can refer to the symbols already bound by this VARLIST.") ...@@ -664,7 +664,7 @@ Each VALUEFORM can refer to the symbols already bound by this VARLIST.")
{ {
QUIT; QUIT;
elt = Fcar (varlist); elt = Fcar (varlist);
if (XTYPE (elt) == Lisp_Symbol) if (SYMBOLP (elt))
specbind (elt, Qnil); specbind (elt, Qnil);
else if (! NILP (Fcdr (Fcdr (elt)))) else if (! NILP (Fcdr (Fcdr (elt))))
Fsignal (Qerror, Fsignal (Qerror,
...@@ -712,7 +712,7 @@ All the VALUEFORMs are evalled before any symbols are bound.") ...@@ -712,7 +712,7 @@ All the VALUEFORMs are evalled before any symbols are bound.")
{ {
QUIT; QUIT;
elt = Fcar (varlist); elt = Fcar (varlist);
if (XTYPE (elt) == Lisp_Symbol) if (SYMBOLP (elt))
temps [argnum++] = Qnil; temps [argnum++] = Qnil;
else if (! NILP (Fcdr (Fcdr (elt)))) else if (! NILP (Fcdr (Fcdr (elt))))
Fsignal (Qerror, Fsignal (Qerror,
...@@ -729,7 +729,7 @@ All the VALUEFORMs are evalled before any symbols are bound.") ...@@ -729,7 +729,7 @@ All the VALUEFORMs are evalled before any symbols are bound.")
{ {
elt = Fcar (varlist); elt = Fcar (varlist);
tem = temps[argnum++]; tem = temps[argnum++];
if (XTYPE (elt) == Lisp_Symbol) if (SYMBOLP (elt))
specbind (elt, tem); specbind (elt, tem);
else else
specbind (Fcar (elt), tem); specbind (Fcar (elt), tem);
...@@ -782,14 +782,14 @@ definitions to shadow the loaded ones for use in file byte-compilation.") ...@@ -782,14 +782,14 @@ definitions to shadow the loaded ones for use in file byte-compilation.")
{ {
/* Come back here each time we expand a macro call, /* Come back here each time we expand a macro call,
in case it expands into another macro call. */ in case it expands into another macro call. */
if (XTYPE (form) != Lisp_Cons) if (!CONSP (form))
break; break;
/* Set SYM, give DEF and TEM right values in case SYM is not a symbol. */ /* Set SYM, give DEF and TEM right values in case SYM is not a symbol. */
def = sym = XCONS (form)->car; def = sym = XCONS (form)->car;
tem = Qnil; tem = Qnil;
/* Trace symbols aliases to other symbols /* Trace symbols aliases to other symbols
until we get a symbol that is not an alias. */ until we get a symbol that is not an alias. */
while (XTYPE (def) == Lisp_Symbol) while (SYMBOLP (def))
{ {
QUIT; QUIT;
sym = def; sym = def;
...@@ -808,8 +808,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.") ...@@ -808,8 +808,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.")
{ {
/* SYM is not mentioned in ENV. /* SYM is not mentioned in ENV.
Look at its function definition. */ Look at its function definition. */
if (EQ (def, Qunbound) if (EQ (def, Qunbound) || !CONSP (def))
|| XTYPE (def) != Lisp_Cons)
/* Not defined or definition not suitable */ /* Not defined or definition not suitable */
break; break;
if (EQ (XCONS (def)->car, Qautoload)) if (EQ (XCONS (def)->car, Qautoload))
...@@ -1375,7 +1374,7 @@ Also, a symbol satisfies `commandp' if its function definition does so.") ...@@ -1375,7 +1374,7 @@ Also, a symbol satisfies `commandp' if its function definition does so.")
/* Emacs primitives are interactive if their DEFUN specifies an /* Emacs primitives are interactive if their DEFUN specifies an
interactive spec. */ interactive spec. */
if (XTYPE (fun) == Lisp_Subr) if (SUBRP (fun))
{ {
if (XSUBR (fun)->prompt) if (XSUBR (fun)->prompt)
return Qt; return Qt;
...@@ -1386,20 +1385,19 @@ Also, a symbol satisfies `commandp' if its function definition does so.") ...@@ -1386,20 +1385,19 @@ Also, a symbol satisfies `commandp' if its function definition does so.")
/* Bytecode objects are interactive if they are long enough to /* Bytecode objects are interactive if they are long enough to
have an element whose index is COMPILED_INTERACTIVE, which is have an element whose index is COMPILED_INTERACTIVE, which is
where the interactive spec is stored. */ where the interactive spec is stored. */
else if (XTYPE (fun) == Lisp_Compiled) else if (COMPILEDP (fun))
return (XVECTOR (fun)->size > COMPILED_INTERACTIVE return (XVECTOR (fun)->size > COMPILED_INTERACTIVE
? Qt : Qnil); ? Qt : Qnil);
/* Strings and vectors are keyboard macros. */ /* Strings and vectors are keyboard macros. */
if (XTYPE (fun) == Lisp_String if (STRINGP (fun) || VECTORP (fun))
|| XTYPE (fun) == Lisp_Vector)
return Qt; return Qt;
/* Lists may represent commands. */ /* Lists may represent commands. */
if (!CONSP (fun)) if (!CONSP (fun))
return Qnil; return Qnil;
funcar = Fcar (fun); funcar = Fcar (fun);
if (XTYPE (funcar) != Lisp_Symbol) if (!SYMBOLP (funcar))
return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
if (EQ (funcar, Qlambda)) if (EQ (funcar, Qlambda))
return Fassq (Qinteractive, Fcdr (Fcdr (fun))); return Fassq (Qinteractive, Fcdr (Fcdr (fun)));
...@@ -1437,7 +1435,7 @@ this does nothing and returns nil.") ...@@ -1437,7 +1435,7 @@ this does nothing and returns nil.")
/* If function is defined and not as an autoload, don't override */ /* If function is defined and not as an autoload, don't override */
if (!EQ (XSYMBOL (function)->function, Qunbound) if (!EQ (XSYMBOL (function)->function, Qunbound)
&& !(XTYPE (XSYMBOL (function)->function) == Lisp_Cons && !(CONSP (XSYMBOL (function)->function)
&& EQ (XCONS (XSYMBOL (function)->function)->car, Qautoload))) && EQ (XCONS (XSYMBOL (function)->function)->car, Qautoload)))
return Qnil; return Qnil;
...@@ -1529,7 +1527,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, ...@@ -1529,7 +1527,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
struct backtrace backtrace; struct backtrace backtrace;
struct gcpro gcpro1, gcpro2, gcpro3; struct gcpro gcpro1, gcpro2, gcpro3;
if (XTYPE (form) == Lisp_Symbol) if (SYMBOLP (form))
{ {
if (EQ (Vmocklisp_arguments, Qt)) if (EQ (Vmocklisp_arguments, Qt))
return Fsymbol_value (form); return Fsymbol_value (form);
...@@ -1578,7 +1576,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, ...@@ -1578,7 +1576,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
retry: retry:
fun = Findirect_function (original_fun); fun = Findirect_function (original_fun);
if (XTYPE (fun) == Lisp_Subr) if (SUBRP (fun))
{ {
Lisp_Object numargs; Lisp_Object numargs;
Lisp_Object argvals[7]; Lisp_Object argvals[7];
...@@ -1683,14 +1681,14 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, ...@@ -1683,14 +1681,14 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
abort (); abort ();
} }
} }
if (XTYPE (fun) == Lisp_Compiled) if (COMPILEDP (fun))
val = apply_lambda (fun, original_args, 1); val = apply_lambda (fun, original_args, 1);
else else
{ {
if (!CONSP (fun)) if (!CONSP (fun))
return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
funcar = Fcar (fun); funcar = Fcar (fun);
if (XTYPE (funcar) != Lisp_Symbol) if (!SYMBOLP (funcar))
return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
if (EQ (funcar, Qautoload)) if (EQ (funcar, Qautoload))
{ {
...@@ -1759,7 +1757,7 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10.") ...@@ -1759,7 +1757,7 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10.")
goto funcall; goto funcall;
} }
if (XTYPE (fun) == Lisp_Subr) if (SUBRP (fun))
{ {
if (numargs < XSUBR (fun)->min_args if (numargs < XSUBR (fun)->min_args
|| (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
...@@ -2022,7 +2020,7 @@ Thus, (funcall 'cons 'x 'y) returns (x . y).") ...@@ -2022,7 +2020,7 @@ Thus, (funcall 'cons 'x 'y) returns (x . y).")
fun = Findirect_function (fun); fun = Findirect_function (fun);
if (XTYPE (fun) == Lisp_Subr) if (SUBRP (fun))
{ {
if (numargs < XSUBR (fun)->min_args if (numargs < XSUBR (fun)->min_args
|| (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
...@@ -2095,14 +2093,14 @@ Thus, (funcall 'cons 'x 'y) returns (x . y).") ...@@ -2095,14 +2093,14 @@ Thus, (funcall 'cons 'x 'y) returns (x . y).")
abort (); abort ();
} }
} }
if (XTYPE (fun) == Lisp_Compiled) if (COMPILEDP (fun))
val = funcall_lambda (fun, numargs, args + 1); val = funcall_lambda (fun, numargs, args + 1);
else else
{ {
if (!CONSP (fun)) if (!CONSP (fun))
return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
funcar = Fcar (fun); funcar = Fcar (fun);
if (XTYPE (funcar) != Lisp_Symbol) if (!SYMBOLP (funcar))
return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
if (EQ (funcar, Qlambda)) if (EQ (funcar, Qlambda))
val = funcall_lambda (fun, numargs, args + 1); val = funcall_lambda (fun, numargs, args + 1);
...@@ -2191,9 +2189,9 @@ funcall_lambda (fun, nargs, arg_vector) ...@@ -2191,9 +2189,9 @@ funcall_lambda (fun, nargs, arg_vector)
XFASTINT (numargs) = nargs; XFASTINT (numargs) = nargs;
if (XTYPE (fun) == Lisp_Cons) if (CONSP (fun))
syms_left = Fcar (Fcdr (fun)); syms_left = Fcar (Fcdr (fun));
else if (XTYPE (fun) == Lisp_Compiled) else if (COMPILEDP (fun))
syms_left = XVECTOR (fun)->contents[COMPILED_ARGLIST]; syms_left = XVECTOR (fun)->contents[COMPILED_ARGLIST];
else abort (); else abort ();
...@@ -2202,7 +2200,7 @@ funcall_lambda (fun, nargs, arg_vector) ...@@ -2202,7 +2200,7 @@ funcall_lambda (fun, nargs, arg_vector)
{ {
QUIT; QUIT;
next = Fcar (syms_left); next = Fcar (syms_left);
while (XTYPE (next) != Lisp_Symbol) while (!SYMBOLP (next))
next = Fsignal (Qinvalid_function, Fcons (fun, Qnil)); next = Fsignal (Qinvalid_function, Fcons (fun, Qnil));
if (EQ (next, Qand_rest)) if (EQ (next, Qand_rest))
rest = 1; rest = 1;
...@@ -2227,7 +2225,7 @@ funcall_lambda (fun, nargs, arg_vector) ...@@ -2227,7 +2225,7 @@ funcall_lambda (fun, nargs, arg_vector)
if (i < nargs) if (i < nargs)
return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil))); return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil)));
if (XTYPE (fun) == Lisp_Cons) if (CONSP (fun))
val = Fprogn (Fcdr (Fcdr (fun))); val = Fprogn (Fcdr (Fcdr (fun)));
else else
val = Fbyte_code (XVECTOR (fun)->contents[COMPILED_BYTECODE], val = Fbyte_code (XVECTOR (fun)->contents[COMPILED_BYTECODE],
...@@ -2275,7 +2273,7 @@ specbind (symbol, value) ...@@ -2275,7 +2273,7 @@ specbind (symbol, value)
specpdl_ptr->func = 0; specpdl_ptr->func = 0;
specpdl_ptr->old_value = ovalue = find_symbol_value (symbol); specpdl_ptr->old_value = ovalue = find_symbol_value (symbol);
specpdl_ptr++; specpdl_ptr++;
if (XTYPE (ovalue) == Lisp_Buffer_Objfwd) if (BUFFER_OBJFWDP (ovalue))
store_symval_forwarding (symbol, ovalue, value); store_symval_forwarding (symbol, ovalue, value);
else else
Fset (symbol, value); Fset (symbol, value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment