diff options
| author | Michael Albinus | 2010-11-10 09:48:18 +0100 |
|---|---|---|
| committer | Michael Albinus | 2010-11-10 09:48:18 +0100 |
| commit | da1fec2bc11a790e56d3473228f25c3dcfd59e59 (patch) | |
| tree | baa9935e8b24e8e568ab7a322ef13a6ac8da0f84 /src/dbusbind.c | |
| parent | 6f8fc60c41b69cfbf1ff4340978ca3a9ce43e551 (diff) | |
| download | emacs-da1fec2bc11a790e56d3473228f25c3dcfd59e59.tar.gz emacs-da1fec2bc11a790e56d3473228f25c3dcfd59e59.zip | |
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
(XD_BASIC_DBUS_TYPE, xd_symbol_to_dbus_type, xd_signature)
(xd_append_arg, xd_retrieve_arg): Support DBUS_TYPE_UNIX_FD.
(Fdbus_call_method): Add DBUS_TYPE_UNIX_FD type mapping to doc string.
(syms_of_dbusbind): Initialize QCdbus_type_unix_fd).
Diffstat (limited to 'src/dbusbind.c')
| -rw-r--r-- | src/dbusbind.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c index 683b7cb583b..ec7a3ff7217 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -57,6 +57,9 @@ Lisp_Object QCdbus_type_int32, QCdbus_type_uint32; | |||
| 57 | Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; | 57 | Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; |
| 58 | Lisp_Object QCdbus_type_double, QCdbus_type_string; | 58 | Lisp_Object QCdbus_type_double, QCdbus_type_string; |
| 59 | Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; | 59 | Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; |
| 60 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 61 | Lisp_Object QCdbus_type_unix_fd; | ||
| 62 | #endif | ||
| 60 | Lisp_Object QCdbus_type_array, QCdbus_type_variant; | 63 | Lisp_Object QCdbus_type_array, QCdbus_type_variant; |
| 61 | Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; | 64 | Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; |
| 62 | 65 | ||
| @@ -147,6 +150,22 @@ int xd_in_read_queued_messages = 0; | |||
| 147 | #endif | 150 | #endif |
| 148 | 151 | ||
| 149 | /* Check whether TYPE is a basic DBusType. */ | 152 | /* Check whether TYPE is a basic DBusType. */ |
| 153 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 154 | #define XD_BASIC_DBUS_TYPE(type) \ | ||
| 155 | ((type == DBUS_TYPE_BYTE) \ | ||
| 156 | || (type == DBUS_TYPE_BOOLEAN) \ | ||
| 157 | || (type == DBUS_TYPE_INT16) \ | ||
| 158 | || (type == DBUS_TYPE_UINT16) \ | ||
| 159 | || (type == DBUS_TYPE_INT32) \ | ||
| 160 | || (type == DBUS_TYPE_UINT32) \ | ||
| 161 | || (type == DBUS_TYPE_INT64) \ | ||
| 162 | || (type == DBUS_TYPE_UINT64) \ | ||
| 163 | || (type == DBUS_TYPE_DOUBLE) \ | ||
| 164 | || (type == DBUS_TYPE_STRING) \ | ||
| 165 | || (type == DBUS_TYPE_OBJECT_PATH) \ | ||
| 166 | || (type == DBUS_TYPE_SIGNATURE \ | ||
| 167 | || (type == DBUS_TYPE_UNIX_FD)) | ||
| 168 | #else | ||
| 150 | #define XD_BASIC_DBUS_TYPE(type) \ | 169 | #define XD_BASIC_DBUS_TYPE(type) \ |
| 151 | ((type == DBUS_TYPE_BYTE) \ | 170 | ((type == DBUS_TYPE_BYTE) \ |
| 152 | || (type == DBUS_TYPE_BOOLEAN) \ | 171 | || (type == DBUS_TYPE_BOOLEAN) \ |
| @@ -160,6 +179,7 @@ int xd_in_read_queued_messages = 0; | |||
| 160 | || (type == DBUS_TYPE_STRING) \ | 179 | || (type == DBUS_TYPE_STRING) \ |
| 161 | || (type == DBUS_TYPE_OBJECT_PATH) \ | 180 | || (type == DBUS_TYPE_OBJECT_PATH) \ |
| 162 | || (type == DBUS_TYPE_SIGNATURE)) | 181 | || (type == DBUS_TYPE_SIGNATURE)) |
| 182 | #endif | ||
| 163 | 183 | ||
| 164 | /* This was a macro. On Solaris 2.11 it was said to compile for | 184 | /* This was a macro. On Solaris 2.11 it was said to compile for |
| 165 | hours, when optimzation is enabled. So we have transferred it into | 185 | hours, when optimzation is enabled. So we have transferred it into |
| @@ -182,6 +202,9 @@ xd_symbol_to_dbus_type (Lisp_Object object) | |||
| 182 | : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING | 202 | : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING |
| 183 | : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH | 203 | : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH |
| 184 | : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE | 204 | : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE |
| 205 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 206 | : (EQ (object, QCdbus_type_unix_fd)) ? DBUS_TYPE_UNIX_FD | ||
| 207 | #endif | ||
| 185 | : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY | 208 | : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY |
| 186 | : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT | 209 | : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT |
| 187 | : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT | 210 | : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT |
| @@ -238,6 +261,9 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis | |||
| 238 | case DBUS_TYPE_UINT16: | 261 | case DBUS_TYPE_UINT16: |
| 239 | case DBUS_TYPE_UINT32: | 262 | case DBUS_TYPE_UINT32: |
| 240 | case DBUS_TYPE_UINT64: | 263 | case DBUS_TYPE_UINT64: |
| 264 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 265 | case DBUS_TYPE_UNIX_FD: | ||
| 266 | #endif | ||
| 241 | CHECK_NATNUM (object); | 267 | CHECK_NATNUM (object); |
| 242 | sprintf (signature, "%c", dtype); | 268 | sprintf (signature, "%c", dtype); |
| 243 | break; | 269 | break; |
| @@ -451,6 +477,9 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 451 | } | 477 | } |
| 452 | 478 | ||
| 453 | case DBUS_TYPE_UINT32: | 479 | case DBUS_TYPE_UINT32: |
| 480 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 481 | case DBUS_TYPE_UNIX_FD: | ||
| 482 | #endif | ||
| 454 | CHECK_NUMBER (object); | 483 | CHECK_NUMBER (object); |
| 455 | { | 484 | { |
| 456 | dbus_uint32_t val = XUINT (object); | 485 | dbus_uint32_t val = XUINT (object); |
| @@ -648,6 +677,9 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) | |||
| 648 | } | 677 | } |
| 649 | 678 | ||
| 650 | case DBUS_TYPE_UINT32: | 679 | case DBUS_TYPE_UINT32: |
| 680 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 681 | case DBUS_TYPE_UNIX_FD: | ||
| 682 | #endif | ||
| 651 | { | 683 | { |
| 652 | dbus_uint32_t val; | 684 | dbus_uint32_t val; |
| 653 | dbus_message_iter_get_basic (iter, &val); | 685 | dbus_message_iter_get_basic (iter, &val); |
| @@ -983,6 +1015,7 @@ input arguments. It follows the mapping rules: | |||
| 983 | DBUS_TYPE_UINT16 => number | 1015 | DBUS_TYPE_UINT16 => number |
| 984 | DBUS_TYPE_INT16 => integer | 1016 | DBUS_TYPE_INT16 => integer |
| 985 | DBUS_TYPE_UINT32 => number or float | 1017 | DBUS_TYPE_UINT32 => number or float |
| 1018 | DBUS_TYPE_UNIX_FD => number or float | ||
| 986 | DBUS_TYPE_INT32 => integer or float | 1019 | DBUS_TYPE_INT32 => integer or float |
| 987 | DBUS_TYPE_UINT64 => number or float | 1020 | DBUS_TYPE_UINT64 => number or float |
| 988 | DBUS_TYPE_INT64 => integer or float | 1021 | DBUS_TYPE_INT64 => integer or float |
| @@ -2104,6 +2137,11 @@ syms_of_dbusbind (void) | |||
| 2104 | QCdbus_type_signature = intern_c_string (":signature"); | 2137 | QCdbus_type_signature = intern_c_string (":signature"); |
| 2105 | staticpro (&QCdbus_type_signature); | 2138 | staticpro (&QCdbus_type_signature); |
| 2106 | 2139 | ||
| 2140 | #ifdef DBUS_TYPE_UNIX_FD | ||
| 2141 | QCdbus_type_unix_fd = intern_c_string (":unix-fd"); | ||
| 2142 | staticpro (&QCdbus_type_unix_fd); | ||
| 2143 | #endif | ||
| 2144 | |||
| 2107 | QCdbus_type_array = intern_c_string (":array"); | 2145 | QCdbus_type_array = intern_c_string (":array"); |
| 2108 | staticpro (&QCdbus_type_array); | 2146 | staticpro (&QCdbus_type_array); |
| 2109 | 2147 | ||