diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2015-08-30 15:51:36 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2015-08-30 15:51:36 +0200 |
commit | 47b70267213517f95283fd6b71e51ab0fef7454e (patch) | |
tree | c8443e49e24d2ddb2514af41e275ae606cc42967 | |
parent | f2749ce71a82be28a4035d2aae41180f39ce23b5 (diff) | |
download | emacs-scratch/dbusbind-type.tar.gz |
* doc/misc/dbus.texi (Type Conversion): Check for subfeature.scratch/dbusbind-type
* src/dbusbind.c (syms_of_dbusbind):
* lisp/net/dbus.el (top): Provide proper subfeature.
-rw-r--r-- | doc/misc/dbus.texi | 16 | ||||
-rw-r--r-- | lisp/net/dbus.el | 3 | ||||
-rw-r--r-- | src/dbusbind.c | 8 |
3 files changed, 18 insertions, 9 deletions
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index e0b2f2c462d..863b7b05ffe 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -1034,14 +1034,20 @@ D-Bus compound type rules. If those elements have a type different from the default type, they need to be prefixed with a type symbol. @lisp -(dbus-call-method @dots{} :array '(:int32 @var{NAT-NUMBER} :int32 @var{NAT-NUMBER})) +(dbus-call-method @dots{} '(:array :int32 @var{NAT-NUMBER} :int32 @var{NAT-NUMBER})) @end lisp There is an alternative form to specify a compound D-Bus type. The keyword @code{:type}, followed by a type specifier, denotes a compound -type as a list of type symbols. For example, a type specifier -@code{(:array :int32)} stands for an array of @code{DBUS_TYPE_INT32} -elements. +type as a list of type symbols.@footnote{This alternative form is +available only if the subfeature @code{:type} exists. Check it with + +@lisp +(featurep 'dbus :type) +@end lisp +} +For example, a type specifier @code{(:array :int32)} stands for an +array of @code{DBUS_TYPE_INT32} elements. The above example is equivalent to: @@ -1049,6 +1055,8 @@ The above example is equivalent to: (dbus-call-method @dots{} :type '(:array :int32) '(@var{NAT-NUMBER} @var{NAT-NUMBER})) @end lisp +The D-Bus compound type rules are: + @itemize @item An array must contain only elements of the same D-Bus type. It can be empty. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 8f7754137cb..811c63d4aa8 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -1813,7 +1813,8 @@ this connection to those buses." (dbus-ignore-errors (dbus-init-bus :session))) -(provide 'dbus) +;; Propagate subfeatures, like `:type'. +(provide 'dbus (get 'dbusbind 'subfeatures)) ;;; TODO: diff --git a/src/dbusbind.c b/src/dbusbind.c index 46b8b04d15d..badf6b587d6 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define DBUS_NUM_MESSAGE_TYPES 5 #endif - /* Some platforms define the symbol "interface", but we want to use it * as a variable name below. */ @@ -709,6 +708,7 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter) if (XD_BASIC_DBUS_TYPE (dtype)) xd_append_basic_arg (dtype, object, iter); + else /* Compound types. */ { @@ -809,6 +809,7 @@ xd_type_spec_to_signature (char *signature, Lisp_Object spec) wrong_type_argument (intern ("D-Bus"), spec); sprintf (signature, "%c", dtype); } + else /* Compound types. */ { char *subsig; @@ -881,6 +882,7 @@ xd_append_arg_with_type_spec (Lisp_Object spec, Lisp_Object object, wrong_type_argument (intern ("D-Bus"), spec); xd_append_basic_arg (dtype, object, iter); } + else /* Compound types. */ { char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; @@ -2005,9 +2007,7 @@ be called when the D-Bus reply message arrives. */); staticpro (&xd_registered_buses); /* Add subfeature `:type'. */ - subfeatures = pure_cons (pure_cons (QCdbus_type_type, pure_cons (Qt, Qnil)), - subfeatures); - + subfeatures = Fcons (QCdbus_type_type, subfeatures); Fprovide (intern_c_string ("dbusbind"), subfeatures); } |