diff options
| author | Michael Albinus | 2015-08-30 15:51:36 +0200 |
|---|---|---|
| committer | Michael Albinus | 2015-08-30 15:51:36 +0200 |
| commit | 47b70267213517f95283fd6b71e51ab0fef7454e (patch) | |
| tree | c8443e49e24d2ddb2514af41e275ae606cc42967 | |
| parent | f2749ce71a82be28a4035d2aae41180f39ce23b5 (diff) | |
| download | emacs-47b70267213517f95283fd6b71e51ab0fef7454e.tar.gz emacs-47b70267213517f95283fd6b71e51ab0fef7454e.zip | |
* 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 | |||
| 1034 | from the default type, they need to be prefixed with a type symbol. | 1034 | from the default type, they need to be prefixed with a type symbol. |
| 1035 | 1035 | ||
| 1036 | @lisp | 1036 | @lisp |
| 1037 | (dbus-call-method @dots{} :array '(:int32 @var{NAT-NUMBER} :int32 @var{NAT-NUMBER})) | 1037 | (dbus-call-method @dots{} '(:array :int32 @var{NAT-NUMBER} :int32 @var{NAT-NUMBER})) |
| 1038 | @end lisp | 1038 | @end lisp |
| 1039 | 1039 | ||
| 1040 | There is an alternative form to specify a compound D-Bus type. The | 1040 | There is an alternative form to specify a compound D-Bus type. The |
| 1041 | keyword @code{:type}, followed by a type specifier, denotes a compound | 1041 | keyword @code{:type}, followed by a type specifier, denotes a compound |
| 1042 | type as a list of type symbols. For example, a type specifier | 1042 | type as a list of type symbols.@footnote{This alternative form is |
| 1043 | @code{(:array :int32)} stands for an array of @code{DBUS_TYPE_INT32} | 1043 | available only if the subfeature @code{:type} exists. Check it with |
| 1044 | elements. | 1044 | |
| 1045 | @lisp | ||
| 1046 | (featurep 'dbus :type) | ||
| 1047 | @end lisp | ||
| 1048 | } | ||
| 1049 | For example, a type specifier @code{(:array :int32)} stands for an | ||
| 1050 | array of @code{DBUS_TYPE_INT32} elements. | ||
| 1045 | 1051 | ||
| 1046 | The above example is equivalent to: | 1052 | The above example is equivalent to: |
| 1047 | 1053 | ||
| @@ -1049,6 +1055,8 @@ The above example is equivalent to: | |||
| 1049 | (dbus-call-method @dots{} :type '(:array :int32) '(@var{NAT-NUMBER} @var{NAT-NUMBER})) | 1055 | (dbus-call-method @dots{} :type '(:array :int32) '(@var{NAT-NUMBER} @var{NAT-NUMBER})) |
| 1050 | @end lisp | 1056 | @end lisp |
| 1051 | 1057 | ||
| 1058 | The D-Bus compound type rules are: | ||
| 1059 | |||
| 1052 | @itemize | 1060 | @itemize |
| 1053 | @item An array must contain only elements of the same D-Bus type. It | 1061 | @item An array must contain only elements of the same D-Bus type. It |
| 1054 | can be empty. | 1062 | 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." | |||
| 1813 | (dbus-ignore-errors | 1813 | (dbus-ignore-errors |
| 1814 | (dbus-init-bus :session))) | 1814 | (dbus-init-bus :session))) |
| 1815 | 1815 | ||
| 1816 | (provide 'dbus) | 1816 | ;; Propagate subfeatures, like `:type'. |
| 1817 | (provide 'dbus (get 'dbusbind 'subfeatures)) | ||
| 1817 | 1818 | ||
| 1818 | ;;; TODO: | 1819 | ;;; TODO: |
| 1819 | 1820 | ||
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/>. */ | |||
| 32 | #define DBUS_NUM_MESSAGE_TYPES 5 | 32 | #define DBUS_NUM_MESSAGE_TYPES 5 |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | |||
| 36 | /* Some platforms define the symbol "interface", but we want to use it | 35 | /* Some platforms define the symbol "interface", but we want to use it |
| 37 | * as a variable name below. */ | 36 | * as a variable name below. */ |
| 38 | 37 | ||
| @@ -709,6 +708,7 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 709 | 708 | ||
| 710 | if (XD_BASIC_DBUS_TYPE (dtype)) | 709 | if (XD_BASIC_DBUS_TYPE (dtype)) |
| 711 | xd_append_basic_arg (dtype, object, iter); | 710 | xd_append_basic_arg (dtype, object, iter); |
| 711 | |||
| 712 | else /* Compound types. */ | 712 | else /* Compound types. */ |
| 713 | { | 713 | { |
| 714 | 714 | ||
| @@ -809,6 +809,7 @@ xd_type_spec_to_signature (char *signature, Lisp_Object spec) | |||
| 809 | wrong_type_argument (intern ("D-Bus"), spec); | 809 | wrong_type_argument (intern ("D-Bus"), spec); |
| 810 | sprintf (signature, "%c", dtype); | 810 | sprintf (signature, "%c", dtype); |
| 811 | } | 811 | } |
| 812 | |||
| 812 | else /* Compound types. */ | 813 | else /* Compound types. */ |
| 813 | { | 814 | { |
| 814 | char *subsig; | 815 | char *subsig; |
| @@ -881,6 +882,7 @@ xd_append_arg_with_type_spec (Lisp_Object spec, Lisp_Object object, | |||
| 881 | wrong_type_argument (intern ("D-Bus"), spec); | 882 | wrong_type_argument (intern ("D-Bus"), spec); |
| 882 | xd_append_basic_arg (dtype, object, iter); | 883 | xd_append_basic_arg (dtype, object, iter); |
| 883 | } | 884 | } |
| 885 | |||
| 884 | else /* Compound types. */ | 886 | else /* Compound types. */ |
| 885 | { | 887 | { |
| 886 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 888 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| @@ -2005,9 +2007,7 @@ be called when the D-Bus reply message arrives. */); | |||
| 2005 | staticpro (&xd_registered_buses); | 2007 | staticpro (&xd_registered_buses); |
| 2006 | 2008 | ||
| 2007 | /* Add subfeature `:type'. */ | 2009 | /* Add subfeature `:type'. */ |
| 2008 | subfeatures = pure_cons (pure_cons (QCdbus_type_type, pure_cons (Qt, Qnil)), | 2010 | subfeatures = Fcons (QCdbus_type_type, subfeatures); |
| 2009 | subfeatures); | ||
| 2010 | |||
| 2011 | Fprovide (intern_c_string ("dbusbind"), subfeatures); | 2011 | Fprovide (intern_c_string ("dbusbind"), subfeatures); |
| 2012 | 2012 | ||
| 2013 | } | 2013 | } |