summaryrefslogtreecommitdiff
path: root/src/data.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2015-11-16 00:42:14 +0100
committerTed Zlatanov <tzz@lifelogs.com>2015-11-18 14:24:06 -0500
commitf69cd6bfa114ea02f3d10ddb2fe809a26eafb9a4 (patch)
tree05788868cfcc5fda30d37a83e18de6aab8b1735b /src/data.c
parent435cf35bcc28ab4220764dff7874f477310d9a48 (diff)
downloademacs-f69cd6bfa114ea02f3d10ddb2fe809a26eafb9a4.tar.gz
Add new User Pointer (User_Ptr) type
* src/lisp.h: Add new Lisp_Misc_User_Ptr type. (XUSER_PTR): New User_Ptr accessor. * src/alloc.c (make_user_ptr): New function. (mark_object, sweep_misc): Handle Lisp_Misc_User_Ptr. * src/data.c (Ftype_of): Return 'user-ptr' for user pointer. (Fuser-ptrp): New user pointer type predicate function. (syms_of_data): New 'user-ptrp', 'user-ptr' symbol. New 'user-ptrp' subr. * src/print.c (print_object): Add printer for User_Ptr type.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c
index 51546044c68..1e9cc814f00 100644
--- a/src/data.c
+++ b/src/data.c
@@ -223,6 +223,10 @@ for example, (type-of 1) returns `integer'. */)
return Qfloat;
case Lisp_Misc_Finalizer:
return Qfinalizer;
+#ifdef HAVE_MODULES
+ case Lisp_Misc_User_Ptr:
+ return Quser_ptr;
+#endif
default:
emacs_abort ();
}
@@ -424,6 +428,17 @@ DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0,
return Qnil;
}
+#ifdef HAVE_MODULES
+DEFUN ("user-ptrp", Fuser_ptrp, Suser_ptrp, 1, 1, 0,
+ doc: /* Return t if OBJECT is a module user pointer. */)
+ (Lisp_Object object)
+{
+ if (USER_PTRP (object))
+ return Qt;
+ return Qnil;
+}
+#endif
+
DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0,
doc: /* Return t if OBJECT is a built-in function. */)
(Lisp_Object object)
@@ -3478,6 +3493,9 @@ syms_of_data (void)
DEFSYM (Qbool_vector_p, "bool-vector-p");
DEFSYM (Qchar_or_string_p, "char-or-string-p");
DEFSYM (Qmarkerp, "markerp");
+#ifdef HAVE_MODULES
+ DEFSYM (Quser_ptrp, "user-ptrp");
+#endif
DEFSYM (Qbuffer_or_string_p, "buffer-or-string-p");
DEFSYM (Qinteger_or_marker_p, "integer-or-marker-p");
DEFSYM (Qfboundp, "fboundp");
@@ -3569,6 +3587,9 @@ syms_of_data (void)
DEFSYM (Qmarker, "marker");
DEFSYM (Qoverlay, "overlay");
DEFSYM (Qfinalizer, "finalizer");
+#ifdef HAVE_MODULES
+ DEFSYM (Quser_ptr, "user-ptr");
+#endif
DEFSYM (Qfloat, "float");
DEFSYM (Qwindow_configuration, "window-configuration");
DEFSYM (Qprocess, "process");
@@ -3683,6 +3704,9 @@ syms_of_data (void)
defsubr (&Sbyteorder);
defsubr (&Ssubr_arity);
defsubr (&Ssubr_name);
+#ifdef HAVE_MODULES
+ defsubr (&Suser_ptrp);
+#endif
defsubr (&Sbool_vector_exclusive_or);
defsubr (&Sbool_vector_union);