{
Lisp_Object handler = POP;
/* Support for a function here is new in 24.4. */
- record_unwind_protect ((NILP (Ffunctionp (handler))
- ? unwind_body : bcall0),
+ record_unwind_protect (FUNCTIONP (handler) ? bcall0 : unwind_body,
handler);
NEXT;
}
XD_DBUS_VALIDATE_PATH (path);
XD_DBUS_VALIDATE_INTERFACE (interface);
XD_DBUS_VALIDATE_MEMBER (member);
- if (!NILP (handler) && (!FUNCTIONP (handler)))
+ if (!NILP (handler) && !FUNCTIONP (handler))
wrong_type_argument (Qinvalid_function, handler);
}
return Qnil;
}
+bool
+FUNCTIONP (Lisp_Object object)
+{
+ if (SYMBOLP (object) && !NILP (Ffboundp (object)))
+ {
+ object = Findirect_function (object, Qt);
+
+ if (CONSP (object) && EQ (XCAR (object), Qautoload))
+ {
+ /* Autoloaded symbols are functions, except if they load
+ macros or keymaps. */
+ for (int i = 0; i < 4 && CONSP (object); i++)
+ object = XCDR (object);
+
+ return ! (CONSP (object) && !NILP (XCAR (object)));
+ }
+ }
+
+ if (SUBRP (object))
+ return XSUBR (object)->max_args != UNEVALLED;
+ else if (COMPILEDP (object))
+ return true;
+ else if (CONSP (object))
+ {
+ Lisp_Object car = XCAR (object);
+ return EQ (car, Qlambda) || EQ (car, Qclosure);
+ }
+ else
+ return false;
+}
+
DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
doc: /* Call first argument as a function, passing remaining arguments to it.
Return the value that function returns.
case IMAGE_FUNCTION_VALUE:
value = indirect_function (value);
- if (!NILP (Ffunctionp (value)))
+ if (FUNCTIONP (value))
break;
return 0;
INLINE Lisp_Object CHAR_TABLE_REF_ASCII (Lisp_Object, ptrdiff_t);
INLINE bool (CONSP) (Lisp_Object);
INLINE bool (FLOATP) (Lisp_Object);
-INLINE bool functionp (Lisp_Object);
INLINE bool (INTEGERP) (Lisp_Object);
INLINE bool (MARKERP) (Lisp_Object);
INLINE bool (MISCP) (Lisp_Object);
Lisp_Object fnname
#endif
-/* True if OBJ is a Lisp function. */
-INLINE bool
-FUNCTIONP (Lisp_Object obj)
-{
- return functionp (obj);
-}
-
/* defsubr (Sname);
is how we define the symbol for function `name' at start-up time. */
extern void defsubr (struct Lisp_Subr *);
extern _Noreturn void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object);
extern _Noreturn void signal_error (const char *, Lisp_Object);
+extern bool FUNCTIONP (Lisp_Object);
extern Lisp_Object funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *arg_vector);
extern Lisp_Object eval_sub (Lisp_Object form);
extern Lisp_Object apply1 (Lisp_Object, Lisp_Object);
Fgarbage_collect ();
}
-INLINE bool
-functionp (Lisp_Object object)
-{
- if (SYMBOLP (object) && !NILP (Ffboundp (object)))
- {
- object = Findirect_function (object, Qt);
-
- if (CONSP (object) && EQ (XCAR (object), Qautoload))
- {
- /* Autoloaded symbols are functions, except if they load
- macros or keymaps. */
- int i;
- for (i = 0; i < 4 && CONSP (object); i++)
- object = XCDR (object);
-
- return ! (CONSP (object) && !NILP (XCAR (object)));
- }
- }
-
- if (SUBRP (object))
- return XSUBR (object)->max_args != UNEVALLED;
- else if (COMPILEDP (object))
- return true;
- else if (CONSP (object))
- {
- Lisp_Object car = XCAR (object);
- return EQ (car, Qlambda) || EQ (car, Qclosure);
- }
- else
- return false;
-}
-
INLINE_HEADER_END
#endif /* EMACS_LISP_H */
{
WEBKIT_FN_INIT ();
CHECK_STRING (script);
- if (!NILP (fun) && (!FUNCTIONP (fun)))
+ if (!NILP (fun) && !FUNCTIONP (fun))
wrong_type_argument (Qinvalid_function, fun);
void *callback = (FUNCTIONP (fun)) ?