Mercurial > emacs
annotate src/dbusbind.c @ 112429:6e50030da731
Some copyright.el updates.
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): New function,
split out from copyright-update-year.
(copyright-update): Don't mess with the GPL version if we don't own the
copyright. Update license regexp, and remove no longer needed
Esperanto stuff.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 22 Jan 2011 14:09:09 -0800 |
parents | 42e22c4f06b7 |
children |
rev | line source |
---|---|
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1 /* Elisp bindings for D-Bus. |
112113
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2 Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4 This file is part of GNU Emacs. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5 |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94057
diff
changeset
|
6 GNU Emacs is free software: you can redistribute it and/or modify |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94057
diff
changeset
|
8 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94057
diff
changeset
|
9 (at your option) any later version. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
10 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
15 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94057
diff
changeset
|
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
18 |
108861
ad09f2bfce51
Fix config.h includes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
19 #include <config.h> |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
20 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
21 #ifdef HAVE_DBUS |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
22 #include <stdio.h> |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
23 #include <dbus/dbus.h> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105575
diff
changeset
|
24 #include <setjmp.h> |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
25 #include "lisp.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
26 #include "frame.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
27 #include "termhooks.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
28 #include "keyboard.h" |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
29 #include "process.h" |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
30 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
31 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
32 /* Subroutines. */ |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
33 Lisp_Object Qdbus_init_bus; |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
34 Lisp_Object Qdbus_close_bus; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
35 Lisp_Object Qdbus_get_unique_name; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
36 Lisp_Object Qdbus_call_method; |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
37 Lisp_Object Qdbus_call_method_asynchronously; |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
38 Lisp_Object Qdbus_method_return_internal; |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
39 Lisp_Object Qdbus_method_error_internal; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
40 Lisp_Object Qdbus_send_signal; |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
41 Lisp_Object Qdbus_register_service; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
42 Lisp_Object Qdbus_register_signal; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
43 Lisp_Object Qdbus_register_method; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
44 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
45 /* D-Bus error symbol. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
46 Lisp_Object Qdbus_error; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
47 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
48 /* Lisp symbols of the system and session buses. */ |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
49 Lisp_Object QCdbus_system_bus, QCdbus_session_bus; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
50 |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
51 /* Lisp symbol for method call timeout. */ |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
52 Lisp_Object QCdbus_timeout; |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
53 |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
54 /* Lisp symbols for name request flags. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
55 Lisp_Object QCdbus_request_name_allow_replacement; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
56 Lisp_Object QCdbus_request_name_replace_existing; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
57 Lisp_Object QCdbus_request_name_do_not_queue; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
58 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
59 /* Lisp symbols for name request replies. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
60 Lisp_Object QCdbus_request_name_reply_primary_owner; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
61 Lisp_Object QCdbus_request_name_reply_in_queue; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
62 Lisp_Object QCdbus_request_name_reply_exists; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
63 Lisp_Object QCdbus_request_name_reply_already_owner; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
64 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
65 /* Lisp symbols of D-Bus types. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
66 Lisp_Object QCdbus_type_byte, QCdbus_type_boolean; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
67 Lisp_Object QCdbus_type_int16, QCdbus_type_uint16; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
68 Lisp_Object QCdbus_type_int32, QCdbus_type_uint32; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
69 Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
70 Lisp_Object QCdbus_type_double, QCdbus_type_string; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
71 Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
72 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
73 Lisp_Object QCdbus_type_unix_fd; |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
74 #endif |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
75 Lisp_Object QCdbus_type_array, QCdbus_type_variant; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
76 Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
77 |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
78 /* Whether we are reading a D-Bus event. */ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
79 int xd_in_read_queued_messages = 0; |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
80 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
81 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
82 /* We use "xd_" and "XD_" as prefix for all internal symbols, because |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
83 we don't want to poison other namespaces with "dbus_". */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
84 |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
85 /* Raise a signal. If we are reading events, we cannot signal; we |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
86 throw to xd_read_queued_messages then. */ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
87 #define XD_SIGNAL1(arg) \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
88 do { \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
89 if (xd_in_read_queued_messages) \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
90 Fthrow (Qdbus_error, Qnil); \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
91 else \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
92 xsignal1 (Qdbus_error, arg); \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
93 } while (0) |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
94 |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
95 #define XD_SIGNAL2(arg1, arg2) \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
96 do { \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
97 if (xd_in_read_queued_messages) \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
98 Fthrow (Qdbus_error, Qnil); \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
99 else \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
100 xsignal2 (Qdbus_error, arg1, arg2); \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
101 } while (0) |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
102 |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
103 #define XD_SIGNAL3(arg1, arg2, arg3) \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
104 do { \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
105 if (xd_in_read_queued_messages) \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
106 Fthrow (Qdbus_error, Qnil); \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
107 else \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
108 xsignal3 (Qdbus_error, arg1, arg2, arg3); \ |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
109 } while (0) |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
110 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
111 /* Raise a Lisp error from a D-Bus ERROR. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
112 #define XD_ERROR(error) \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
113 do { \ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
114 char s[1024]; \ |
97797
14fccbb34a16
* dbusbind.c (XD_ERROR, XD_DEBUG_MESSAGE): Use strncpy and
Michael Albinus <michael.albinus@gmx.de>
parents:
97211
diff
changeset
|
115 strncpy (s, error.message, 1023); \ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
116 dbus_error_free (&error); \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
117 /* Remove the trailing newline. */ \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
118 if (strchr (s, '\n') != NULL) \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
119 s[strlen (s) - 1] = '\0'; \ |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
120 XD_SIGNAL1 (build_string (s)); \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
121 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
122 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
123 /* Macros for debugging. In order to enable them, build with |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
124 "MYCPPFLAGS='-DDBUS_DEBUG -Wall' make". */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
125 #ifdef DBUS_DEBUG |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
126 #define XD_DEBUG_MESSAGE(...) \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
127 do { \ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
128 char s[1024]; \ |
97797
14fccbb34a16
* dbusbind.c (XD_ERROR, XD_DEBUG_MESSAGE): Use strncpy and
Michael Albinus <michael.albinus@gmx.de>
parents:
97211
diff
changeset
|
129 snprintf (s, 1023, __VA_ARGS__); \ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
130 printf ("%s: %s\n", __func__, s); \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
131 message ("%s: %s", __func__, s); \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
132 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
133 #define XD_DEBUG_VALID_LISP_OBJECT_P(object) \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
134 do { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
135 if (!valid_lisp_object_p (object)) \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
136 { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
137 XD_DEBUG_MESSAGE ("%d Assertion failure", __LINE__); \ |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
138 XD_SIGNAL1 (build_string ("Assertion failure")); \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
139 } \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
140 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
141 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
142 #else /* !DBUS_DEBUG */ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
143 #define XD_DEBUG_MESSAGE(...) \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
144 do { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
145 if (!NILP (Vdbus_debug)) \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
146 { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
147 char s[1024]; \ |
97797
14fccbb34a16
* dbusbind.c (XD_ERROR, XD_DEBUG_MESSAGE): Use strncpy and
Michael Albinus <michael.albinus@gmx.de>
parents:
97211
diff
changeset
|
148 snprintf (s, 1023, __VA_ARGS__); \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
149 message ("%s: %s", __func__, s); \ |
87493
42bd83957313
*** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents:
87490
diff
changeset
|
150 } \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
151 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
152 #define XD_DEBUG_VALID_LISP_OBJECT_P(object) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
153 #endif |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
154 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
155 /* Check whether TYPE is a basic DBusType. */ |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
156 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
157 #define XD_BASIC_DBUS_TYPE(type) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
158 ((type == DBUS_TYPE_BYTE) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
159 || (type == DBUS_TYPE_BOOLEAN) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
160 || (type == DBUS_TYPE_INT16) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
161 || (type == DBUS_TYPE_UINT16) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
162 || (type == DBUS_TYPE_INT32) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
163 || (type == DBUS_TYPE_UINT32) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
164 || (type == DBUS_TYPE_INT64) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
165 || (type == DBUS_TYPE_UINT64) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
166 || (type == DBUS_TYPE_DOUBLE) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
167 || (type == DBUS_TYPE_STRING) \ |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
168 || (type == DBUS_TYPE_OBJECT_PATH) \ |
111474
143e567b63bc
Fix syntax error in previous commit.
Michael Albinus <michael.albinus@gmx.de>
parents:
111472
diff
changeset
|
169 || (type == DBUS_TYPE_SIGNATURE) \ |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
170 || (type == DBUS_TYPE_UNIX_FD)) |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
171 #else |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
172 #define XD_BASIC_DBUS_TYPE(type) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
173 ((type == DBUS_TYPE_BYTE) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
174 || (type == DBUS_TYPE_BOOLEAN) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
175 || (type == DBUS_TYPE_INT16) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
176 || (type == DBUS_TYPE_UINT16) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
177 || (type == DBUS_TYPE_INT32) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
178 || (type == DBUS_TYPE_UINT32) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
179 || (type == DBUS_TYPE_INT64) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
180 || (type == DBUS_TYPE_UINT64) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
181 || (type == DBUS_TYPE_DOUBLE) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
182 || (type == DBUS_TYPE_STRING) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
183 || (type == DBUS_TYPE_OBJECT_PATH) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
184 || (type == DBUS_TYPE_SIGNATURE)) |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
185 #endif |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
186 |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
187 /* This was a macro. On Solaris 2.11 it was said to compile for |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
188 hours, when optimzation is enabled. So we have transferred it into |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
189 a function. */ |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
190 /* Determine the DBusType of a given Lisp symbol. OBJECT must be one |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
191 of the predefined D-Bus type symbols. */ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
192 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
193 xd_symbol_to_dbus_type (Lisp_Object object) |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
194 { |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
195 return |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
196 ((EQ (object, QCdbus_type_byte)) ? DBUS_TYPE_BYTE |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
197 : (EQ (object, QCdbus_type_boolean)) ? DBUS_TYPE_BOOLEAN |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
198 : (EQ (object, QCdbus_type_int16)) ? DBUS_TYPE_INT16 |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
199 : (EQ (object, QCdbus_type_uint16)) ? DBUS_TYPE_UINT16 |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
200 : (EQ (object, QCdbus_type_int32)) ? DBUS_TYPE_INT32 |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
201 : (EQ (object, QCdbus_type_uint32)) ? DBUS_TYPE_UINT32 |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
202 : (EQ (object, QCdbus_type_int64)) ? DBUS_TYPE_INT64 |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
203 : (EQ (object, QCdbus_type_uint64)) ? DBUS_TYPE_UINT64 |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
204 : (EQ (object, QCdbus_type_double)) ? DBUS_TYPE_DOUBLE |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
205 : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
206 : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
207 : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
208 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
209 : (EQ (object, QCdbus_type_unix_fd)) ? DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
210 #endif |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
211 : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
212 : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
213 : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
214 : (EQ (object, QCdbus_type_dict_entry)) ? DBUS_TYPE_DICT_ENTRY |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
215 : DBUS_TYPE_INVALID); |
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
216 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
217 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
218 /* Check whether a Lisp symbol is a predefined D-Bus type symbol. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
219 #define XD_DBUS_TYPE_P(object) \ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
220 (SYMBOLP (object) && ((xd_symbol_to_dbus_type (object) != DBUS_TYPE_INVALID))) |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
221 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
222 /* Determine the DBusType of a given Lisp OBJECT. It is used to |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
223 convert Lisp objects, being arguments of `dbus-call-method' or |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
224 `dbus-send-signal', into corresponding C values appended as |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
225 arguments to a D-Bus message. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
226 #define XD_OBJECT_TO_DBUS_TYPE(object) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
227 ((EQ (object, Qt) || EQ (object, Qnil)) ? DBUS_TYPE_BOOLEAN \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
228 : (NATNUMP (object)) ? DBUS_TYPE_UINT32 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
229 : (INTEGERP (object)) ? DBUS_TYPE_INT32 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
230 : (FLOATP (object)) ? DBUS_TYPE_DOUBLE \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
231 : (STRINGP (object)) ? DBUS_TYPE_STRING \ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
232 : (XD_DBUS_TYPE_P (object)) ? xd_symbol_to_dbus_type (object) \ |
98901
f98d4eaeba07
* dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Handle simple type symbols
Michael Albinus <michael.albinus@gmx.de>
parents:
98783
diff
changeset
|
233 : (CONSP (object)) \ |
f98d4eaeba07
* dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Handle simple type symbols
Michael Albinus <michael.albinus@gmx.de>
parents:
98783
diff
changeset
|
234 ? ((XD_DBUS_TYPE_P (CAR_SAFE (object))) \ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
235 ? ((XD_BASIC_DBUS_TYPE (xd_symbol_to_dbus_type (CAR_SAFE (object)))) \ |
98901
f98d4eaeba07
* dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Handle simple type symbols
Michael Albinus <michael.albinus@gmx.de>
parents:
98783
diff
changeset
|
236 ? DBUS_TYPE_ARRAY \ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
237 : xd_symbol_to_dbus_type (CAR_SAFE (object))) \ |
98901
f98d4eaeba07
* dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Handle simple type symbols
Michael Albinus <michael.albinus@gmx.de>
parents:
98783
diff
changeset
|
238 : DBUS_TYPE_ARRAY) \ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
239 : DBUS_TYPE_INVALID) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
240 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
241 /* Return a list pointer which does not have a Lisp symbol as car. */ |
93156
3ef12fa772f2
* dbusbind.c (xd_read_message): Removed extra copying of message
Michael Albinus <michael.albinus@gmx.de>
parents:
87972
diff
changeset
|
242 #define XD_NEXT_VALUE(object) \ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
243 ((XD_DBUS_TYPE_P (CAR_SAFE (object))) ? CDR_SAFE (object) : object) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
244 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
245 /* Compute SIGNATURE of OBJECT. It must have a form that it can be |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
246 used in dbus_message_iter_open_container. DTYPE is the DBusType |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
247 the object is related to. It is passed as argument, because it |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
248 cannot be detected in basic type objects, when they are preceded by |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
249 a type symbol. PARENT_TYPE is the DBusType of a container this |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
250 signature is embedded, or DBUS_TYPE_INVALID. It is needed for the |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
251 check that DBUS_TYPE_DICT_ENTRY occurs only as array element. */ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
252 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
253 xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lisp_Object object) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
254 { |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
255 unsigned int subtype; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
256 Lisp_Object elt; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
257 char x[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
258 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
259 elt = object; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
260 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
261 switch (dtype) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
262 { |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
263 case DBUS_TYPE_BYTE: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
264 case DBUS_TYPE_UINT16: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
265 case DBUS_TYPE_UINT32: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
266 case DBUS_TYPE_UINT64: |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
267 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
268 case DBUS_TYPE_UNIX_FD: |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
269 #endif |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
270 CHECK_NATNUM (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
271 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
272 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
273 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
274 case DBUS_TYPE_BOOLEAN: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
275 if (!EQ (object, Qt) && !EQ (object, Qnil)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
276 wrong_type_argument (intern ("booleanp"), object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
277 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
278 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
279 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
280 case DBUS_TYPE_INT16: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
281 case DBUS_TYPE_INT32: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
282 case DBUS_TYPE_INT64: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
283 CHECK_NUMBER (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
284 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
285 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
286 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
287 case DBUS_TYPE_DOUBLE: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
288 CHECK_FLOAT (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
289 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
290 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
291 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
292 case DBUS_TYPE_STRING: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
293 case DBUS_TYPE_OBJECT_PATH: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
294 case DBUS_TYPE_SIGNATURE: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
295 CHECK_STRING (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
296 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
297 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
298 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
299 case DBUS_TYPE_ARRAY: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
300 /* Check that all list elements have the same D-Bus type. For |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
301 complex element types, we just check the container type, not |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
302 the whole element's signature. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
303 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
304 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
305 /* Type symbol is optional. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
306 if (EQ (QCdbus_type_array, CAR_SAFE (elt))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
307 elt = XD_NEXT_VALUE (elt); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
308 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
309 /* If the array is empty, DBUS_TYPE_STRING is the default |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
310 element type. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
311 if (NILP (elt)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
312 { |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
313 subtype = DBUS_TYPE_STRING; |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
314 strcpy (x, DBUS_TYPE_STRING_AS_STRING); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
315 } |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
316 else |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
317 { |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
318 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
319 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
320 } |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
321 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
322 /* If the element type is DBUS_TYPE_SIGNATURE, and this is the |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
323 only element, the value of this element is used as he array's |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
324 element signature. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
325 if ((subtype == DBUS_TYPE_SIGNATURE) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
326 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
327 && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
328 strcpy (x, SDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
329 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
330 while (!NILP (elt)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
331 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
332 if (subtype != XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
333 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
334 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
335 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
336 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
337 sprintf (signature, "%c%s", dtype, x); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
338 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
339 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
340 case DBUS_TYPE_VARIANT: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
341 /* Check that there is exactly one list element. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
342 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
343 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
344 elt = XD_NEXT_VALUE (elt); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
345 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
346 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
347 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
348 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
349 wrong_type_argument (intern ("D-Bus"), |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
350 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
351 |
87497
1d88fa50b198
* dbusbind.c (xd_signature): Signature of variant is just "v".
Magnus Henoch <mange@freemail.hu>
parents:
87493
diff
changeset
|
352 sprintf (signature, "%c", dtype); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
353 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
354 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
355 case DBUS_TYPE_STRUCT: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
356 /* A struct list might contain any number of elements with |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
357 different types. No further check needed. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
358 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
359 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
360 elt = XD_NEXT_VALUE (elt); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
361 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
362 /* Compose the signature from the elements. It is enclosed by |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
363 parentheses. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
364 sprintf (signature, "%c", DBUS_STRUCT_BEGIN_CHAR ); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
365 while (!NILP (elt)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
366 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
367 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
368 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
369 strcat (signature, x); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
370 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
371 } |
98434
e5f33aa05b97
* dbusbind.c (xd_signature): Use strcat instead of sprintf.
Michael Albinus <michael.albinus@gmx.de>
parents:
97797
diff
changeset
|
372 strcat (signature, DBUS_STRUCT_END_CHAR_AS_STRING); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
373 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
374 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
375 case DBUS_TYPE_DICT_ENTRY: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
376 /* Check that there are exactly two list elements, and the first |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
377 one is of basic type. The dictionary entry itself must be an |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
378 element of an array. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
379 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
380 |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
381 /* Check the parent object type. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
382 if (parent_type != DBUS_TYPE_ARRAY) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
383 wrong_type_argument (intern ("D-Bus"), object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
384 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
385 /* Compose the signature from the elements. It is enclosed by |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
386 curly braces. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
387 sprintf (signature, "%c", DBUS_DICT_ENTRY_BEGIN_CHAR); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
388 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
389 /* First element. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
390 elt = XD_NEXT_VALUE (elt); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
391 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
392 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
393 strcat (signature, x); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
394 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
395 if (!XD_BASIC_DBUS_TYPE (subtype)) |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
396 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
397 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
398 /* Second element. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
399 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
400 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
401 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
402 strcat (signature, x); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
403 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
404 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
405 wrong_type_argument (intern ("D-Bus"), |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
406 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
407 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
408 /* Closing signature. */ |
98434
e5f33aa05b97
* dbusbind.c (xd_signature): Use strcat instead of sprintf.
Michael Albinus <michael.albinus@gmx.de>
parents:
97797
diff
changeset
|
409 strcat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
410 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
411 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
412 default: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
413 wrong_type_argument (intern ("D-Bus"), object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
414 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
415 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
416 XD_DEBUG_MESSAGE ("%s", signature); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
417 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
418 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
419 /* Append C value, extracted from Lisp OBJECT, to iteration ITER. |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
420 DTYPE must be a valid DBusType. It is used to convert Lisp |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
421 objects, being arguments of `dbus-call-method' or |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
422 `dbus-send-signal', into corresponding C values appended as |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
423 arguments to a D-Bus message. */ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
424 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
425 xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
426 { |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
427 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
428 DBusMessageIter subiter; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
429 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
430 if (XD_BASIC_DBUS_TYPE (dtype)) |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
431 switch (dtype) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
432 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
433 case DBUS_TYPE_BYTE: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
434 CHECK_NUMBER (object); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
435 { |
87533
d24ee3180427
* dbusbind.c (xd_append_arg): Use unsigned char instead of
Magnus Henoch <mange@freemail.hu>
parents:
87501
diff
changeset
|
436 unsigned char val = XUINT (object) & 0xFF; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
437 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
438 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
439 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
440 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
441 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
442 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
443 case DBUS_TYPE_BOOLEAN: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
444 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
445 dbus_bool_t val = (NILP (object)) ? FALSE : TRUE; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
446 XD_DEBUG_MESSAGE ("%c %s", dtype, (val == FALSE) ? "false" : "true"); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
447 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
448 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
449 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
450 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
451 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
452 case DBUS_TYPE_INT16: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
453 CHECK_NUMBER (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
454 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
455 dbus_int16_t val = XINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
456 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
457 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
458 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
459 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
460 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
461 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
462 case DBUS_TYPE_UINT16: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
463 CHECK_NUMBER (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
464 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
465 dbus_uint16_t val = XUINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
466 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
467 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
468 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
469 return; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
470 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
471 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
472 case DBUS_TYPE_INT32: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
473 CHECK_NUMBER (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
474 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
475 dbus_int32_t val = XINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
476 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
477 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
478 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
479 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
480 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
481 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
482 case DBUS_TYPE_UINT32: |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
483 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
484 case DBUS_TYPE_UNIX_FD: |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
485 #endif |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
486 CHECK_NUMBER (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
487 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
488 dbus_uint32_t val = XUINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
489 XD_DEBUG_MESSAGE ("%c %u", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
490 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
491 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
492 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
493 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
494 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
495 case DBUS_TYPE_INT64: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
496 CHECK_NUMBER (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
497 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
498 dbus_int64_t val = XINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
499 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
500 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
501 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
502 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
503 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
504 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
505 case DBUS_TYPE_UINT64: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
506 CHECK_NUMBER (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
507 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
508 dbus_uint64_t val = XUINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
509 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
510 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
511 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
512 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
513 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
514 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
515 case DBUS_TYPE_DOUBLE: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
516 CHECK_FLOAT (object); |
104313
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
517 { |
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
518 double val = XFLOAT_DATA (object); |
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
519 XD_DEBUG_MESSAGE ("%c %f", dtype, val); |
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
520 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
521 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
522 return; |
73f76307d49b
* lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.
Ken Raeburn <raeburn@raeburn.org>
parents:
104305
diff
changeset
|
523 } |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
524 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
525 case DBUS_TYPE_STRING: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
526 case DBUS_TYPE_OBJECT_PATH: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
527 case DBUS_TYPE_SIGNATURE: |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
528 CHECK_STRING (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
529 { |
108945
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
530 /* We need to send a valid UTF-8 string. We could encode `object' |
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
531 but by not encoding it, we guarantee it's valid utf-8, even if |
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
532 it contains eight-bit-bytes. Of course, you can still send |
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
533 manually-crafted junk by passing a unibyte string. */ |
998fccafba7a
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
534 char *val = SDATA (object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
535 XD_DEBUG_MESSAGE ("%c %s", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
536 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
537 XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
538 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
539 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
540 } |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
541 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
542 else /* Compound types. */ |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
543 { |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
544 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
545 /* All compound types except array have a type symbol. For |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
546 array, it is optional. Skip it. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
547 if (!XD_BASIC_DBUS_TYPE (XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
548 object = XD_NEXT_VALUE (object); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
549 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
550 /* Open new subiteration. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
551 switch (dtype) |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
552 { |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
553 case DBUS_TYPE_ARRAY: |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
554 /* An array has only elements of the same type. So it is |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
555 sufficient to check the first element's signature |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
556 only. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
557 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
558 if (NILP (object)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
559 /* If the array is empty, DBUS_TYPE_STRING is the default |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
560 element type. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
561 strcpy (signature, DBUS_TYPE_STRING_AS_STRING); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
562 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
563 else |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
564 /* If the element type is DBUS_TYPE_SIGNATURE, and this is |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
565 the only element, the value of this element is used as |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
566 the array's element signature. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
567 if ((XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
568 == DBUS_TYPE_SIGNATURE) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
569 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
570 && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
571 { |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
572 strcpy (signature, SDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
573 object = CDR_SAFE (XD_NEXT_VALUE (object)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
574 } |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
575 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
576 else |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
577 xd_signature (signature, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
578 XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
579 dtype, CAR_SAFE (XD_NEXT_VALUE (object))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
580 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
581 XD_DEBUG_MESSAGE ("%c %s %s", dtype, signature, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
582 SDATA (format2 ("%s", object, Qnil))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
583 if (!dbus_message_iter_open_container (iter, dtype, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
584 signature, &subiter)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
585 XD_SIGNAL3 (build_string ("Cannot open container"), |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
586 make_number (dtype), build_string (signature)); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
587 break; |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
588 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
589 case DBUS_TYPE_VARIANT: |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
590 /* A variant has just one element. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
591 xd_signature (signature, XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
592 dtype, CAR_SAFE (XD_NEXT_VALUE (object))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
593 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
594 XD_DEBUG_MESSAGE ("%c %s %s", dtype, signature, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
595 SDATA (format2 ("%s", object, Qnil))); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
596 if (!dbus_message_iter_open_container (iter, dtype, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
597 signature, &subiter)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
598 XD_SIGNAL3 (build_string ("Cannot open container"), |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
599 make_number (dtype), build_string (signature)); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
600 break; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
601 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
602 case DBUS_TYPE_STRUCT: |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
603 case DBUS_TYPE_DICT_ENTRY: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
604 /* These containers do not require a signature. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
605 XD_DEBUG_MESSAGE ("%c %s", dtype, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
606 SDATA (format2 ("%s", object, Qnil))); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
607 if (!dbus_message_iter_open_container (iter, dtype, NULL, &subiter)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
608 XD_SIGNAL2 (build_string ("Cannot open container"), |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
609 make_number (dtype)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
610 break; |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
611 } |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
612 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
613 /* Loop over list elements. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
614 while (!NILP (object)) |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
615 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
616 dtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
617 object = XD_NEXT_VALUE (object); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
618 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
619 xd_append_arg (dtype, CAR_SAFE (object), &subiter); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
620 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
621 object = CDR_SAFE (object); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
622 } |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
623 |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
624 /* Close the subiteration. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
625 if (!dbus_message_iter_close_container (iter, &subiter)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
626 XD_SIGNAL2 (build_string ("Cannot close container"), |
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
627 make_number (dtype)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
628 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
629 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
630 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
631 /* Retrieve C value from a DBusMessageIter structure ITER, and return |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
632 a converted Lisp object. The type DTYPE of the argument of the |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
633 D-Bus message must be a valid DBusType. Compound D-Bus types |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
634 result always in a Lisp list. */ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
635 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
636 xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
637 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
638 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
639 switch (dtype) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
640 { |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
641 case DBUS_TYPE_BYTE: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
642 { |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
643 unsigned int val; |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
644 dbus_message_iter_get_basic (iter, &val); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
645 val = val & 0xFF; |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
646 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
647 return make_number (val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
648 } |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
649 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
650 case DBUS_TYPE_BOOLEAN: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
651 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
652 dbus_bool_t val; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
653 dbus_message_iter_get_basic (iter, &val); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
654 XD_DEBUG_MESSAGE ("%c %s", dtype, (val == FALSE) ? "false" : "true"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
655 return (val == FALSE) ? Qnil : Qt; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
656 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
657 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
658 case DBUS_TYPE_INT16: |
105749
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
659 { |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
660 dbus_int16_t val; |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
661 dbus_message_iter_get_basic (iter, &val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
662 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
663 return make_number (val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
664 } |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
665 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
666 case DBUS_TYPE_UINT16: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
667 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
668 dbus_uint16_t val; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
669 dbus_message_iter_get_basic (iter, &val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
670 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
671 return make_number (val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
672 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
673 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
674 case DBUS_TYPE_INT32: |
105749
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
675 { |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
676 dbus_int32_t val; |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
677 dbus_message_iter_get_basic (iter, &val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
678 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
679 return make_fixnum_or_float (val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
680 } |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
681 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
682 case DBUS_TYPE_UINT32: |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
683 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
684 case DBUS_TYPE_UNIX_FD: |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
685 #endif |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
686 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
687 dbus_uint32_t val; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
688 dbus_message_iter_get_basic (iter, &val); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
689 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
105749
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
690 return make_fixnum_or_float (val); |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
691 } |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
692 |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
693 case DBUS_TYPE_INT64: |
105749
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
694 { |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
695 dbus_int64_t val; |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
696 dbus_message_iter_get_basic (iter, &val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
697 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
698 return make_fixnum_or_float (val); |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
699 } |
f955480a1d92
(xd_retrieve_arg): Handle DBUS_TYPE_INTnn and
Andreas Schwab <schwab@linux-m68k.org>
parents:
105669
diff
changeset
|
700 |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
701 case DBUS_TYPE_UINT64: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
702 { |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
703 dbus_uint64_t val; |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
704 dbus_message_iter_get_basic (iter, &val); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
705 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
706 return make_fixnum_or_float (val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
707 } |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
708 |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
709 case DBUS_TYPE_DOUBLE: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
710 { |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
711 double val; |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
712 dbus_message_iter_get_basic (iter, &val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
713 XD_DEBUG_MESSAGE ("%c %f", dtype, val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
714 return make_float (val); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
715 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
716 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
717 case DBUS_TYPE_STRING: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
718 case DBUS_TYPE_OBJECT_PATH: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
719 case DBUS_TYPE_SIGNATURE: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
720 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
721 char *val; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
722 dbus_message_iter_get_basic (iter, &val); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
723 XD_DEBUG_MESSAGE ("%c %s", dtype, val); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
724 return build_string (val); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
725 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
726 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
727 case DBUS_TYPE_ARRAY: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
728 case DBUS_TYPE_VARIANT: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
729 case DBUS_TYPE_STRUCT: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
730 case DBUS_TYPE_DICT_ENTRY: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
731 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
732 Lisp_Object result; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
733 struct gcpro gcpro1; |
106596
cf8766d3e8ed
* dbusbind.c (xd_retrieve_arg): Reorder declarations in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
105989
diff
changeset
|
734 DBusMessageIter subiter; |
cf8766d3e8ed
* dbusbind.c (xd_retrieve_arg): Reorder declarations in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
105989
diff
changeset
|
735 int subtype; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
736 result = Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
737 GCPRO1 (result); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
738 dbus_message_iter_recurse (iter, &subiter); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
739 while ((subtype = dbus_message_iter_get_arg_type (&subiter)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
740 != DBUS_TYPE_INVALID) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
741 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
742 result = Fcons (xd_retrieve_arg (subtype, &subiter), result); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
743 dbus_message_iter_next (&subiter); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
744 } |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
745 XD_DEBUG_MESSAGE ("%c %s", dtype, SDATA (format2 ("%s", result, Qnil))); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
746 RETURN_UNGCPRO (Fnreverse (result)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
747 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
748 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
749 default: |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
750 XD_DEBUG_MESSAGE ("DBusType '%c' not supported", dtype); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
751 return Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
752 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
753 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
754 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
755 /* Initialize D-Bus connection. BUS is either a Lisp symbol, :system |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
756 or :session, or a string denoting the bus address. It tells which |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
757 D-Bus to initialize. If RAISE_ERROR is non-zero, signal an error |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
758 when the connection cannot be initialized. */ |
103612
25fc47c9b012
* dbusbind.c (XD_SYMBOL_TO_DBUS_TYPE): Convert macro into function
Michael Albinus <michael.albinus@gmx.de>
parents:
101276
diff
changeset
|
759 static DBusConnection * |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
760 xd_initialize (Lisp_Object bus, int raise_error) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
761 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
762 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
763 DBusError derror; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
764 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
765 /* Parameter check. */ |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
766 if (!STRINGP (bus)) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
767 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
768 CHECK_SYMBOL (bus); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
769 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
770 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
771 if (raise_error) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
772 XD_SIGNAL2 (build_string ("Wrong bus name"), bus); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
773 else |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
774 return NULL; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
775 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
776 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
777 /* We do not want to have an autolaunch for the session bus. */ |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
778 if (EQ (bus, QCdbus_session_bus) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
779 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
780 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
781 if (raise_error) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
782 XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
783 else |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
784 return NULL; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
785 } |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
786 } |
104375
cb9bcec90aa8
* dbusbind.c (XD_WITH_DBUS_WATCH_GET_UNIX_FD): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
104339
diff
changeset
|
787 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
788 /* Open a connection to the bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
789 dbus_error_init (&derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
790 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
791 if (STRINGP (bus)) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
792 connection = dbus_connection_open (SDATA (bus), &derror); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
793 else |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
794 if (EQ (bus, QCdbus_system_bus)) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
795 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
796 else |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
797 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
798 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
799 if (dbus_error_is_set (&derror)) |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
800 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
801 if (raise_error) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
802 XD_ERROR (derror); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
803 else |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
804 connection = NULL; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
805 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
806 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
807 /* If it is not the system or session bus, we must register |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
808 ourselves. Otherwise, we have called dbus_bus_get, which has |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
809 configured us to exit if the connection closes - we undo this |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
810 setting. */ |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
811 if (connection != NULL) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
812 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
813 if (STRINGP (bus)) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
814 dbus_bus_register (connection, &derror); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
815 else |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
816 dbus_connection_set_exit_on_disconnect (connection, FALSE); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
817 } |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
818 |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
819 if (dbus_error_is_set (&derror)) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
820 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
821 if (raise_error) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
822 XD_ERROR (derror); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
823 else |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
824 connection = NULL; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
825 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
826 |
109371
bf0e558ade02
* dbusbind.c (xd_initialize): Don't compare boolean with a constant.
Andreas Schwab <schwab@linux-m68k.org>
parents:
109183
diff
changeset
|
827 if (connection == NULL && raise_error) |
104375
cb9bcec90aa8
* dbusbind.c (XD_WITH_DBUS_WATCH_GET_UNIX_FD): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
104339
diff
changeset
|
828 XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
829 |
103785
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
830 /* Cleanup. */ |
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
831 dbus_error_free (&derror); |
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
832 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
833 /* Return the result. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
834 return connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
835 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
836 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
837 /* Return the file descriptor for WATCH, -1 if not found. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
838 static int |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
839 xd_find_watch_fd (DBusWatch *watch) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
840 { |
104533
b466eba29a01
* dbusbind.c (XD_WITH_DBUS_WATCH_GET_UNIX_FD): Remove. It was
Michael Albinus <michael.albinus@gmx.de>
parents:
104375
diff
changeset
|
841 #if HAVE_DBUS_WATCH_GET_UNIX_FD |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
842 /* TODO: Reverse these on Win32, which prefers the opposite. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
843 int fd = dbus_watch_get_unix_fd (watch); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
844 if (fd == -1) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
845 fd = dbus_watch_get_socket (watch); |
104375
cb9bcec90aa8
* dbusbind.c (XD_WITH_DBUS_WATCH_GET_UNIX_FD): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
104339
diff
changeset
|
846 #else |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
847 int fd = dbus_watch_get_fd (watch); |
104375
cb9bcec90aa8
* dbusbind.c (XD_WITH_DBUS_WATCH_GET_UNIX_FD): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
104339
diff
changeset
|
848 #endif |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
849 return fd; |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
850 } |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
851 |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
852 /* Prototype. */ |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
853 static void |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
854 xd_read_queued_messages (int fd, void *data, int for_read); |
104375
cb9bcec90aa8
* dbusbind.c (XD_WITH_DBUS_WATCH_GET_UNIX_FD): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
104339
diff
changeset
|
855 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
856 /* Start monitoring WATCH for possible I/O. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
857 static dbus_bool_t |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
858 xd_add_watch (DBusWatch *watch, void *data) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
859 { |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
860 unsigned int flags = dbus_watch_get_flags (watch); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
861 int fd = xd_find_watch_fd (watch); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
862 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
863 XD_DEBUG_MESSAGE ("fd %d, write %d, enabled %d", |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
864 fd, flags & DBUS_WATCH_WRITABLE, |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
865 dbus_watch_get_enabled (watch)); |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
866 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
867 if (fd == -1) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
868 return FALSE; |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
869 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
870 if (dbus_watch_get_enabled (watch)) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
871 { |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
872 if (flags & DBUS_WATCH_WRITABLE) |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
873 add_write_fd (fd, xd_read_queued_messages, data); |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
874 if (flags & DBUS_WATCH_READABLE) |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
875 add_read_fd (fd, xd_read_queued_messages, data); |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
876 } |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
877 return TRUE; |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
878 } |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
879 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
880 /* Stop monitoring WATCH for possible I/O. |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
881 DATA is the used bus, either a string or QCdbus_system_bus or |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
882 QCdbus_session_bus. */ |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
883 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
884 xd_remove_watch (DBusWatch *watch, void *data) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
885 { |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
886 unsigned int flags = dbus_watch_get_flags (watch); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
887 int fd = xd_find_watch_fd (watch); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
888 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
889 XD_DEBUG_MESSAGE ("fd %d", fd); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
890 |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
891 if (fd == -1) |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
892 return; |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
893 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
894 /* Unset session environment. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
895 if (data != NULL && data == (void*) XHASH (QCdbus_session_bus)) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
896 { |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
897 XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS"); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
898 unsetenv ("DBUS_SESSION_BUS_ADDRESS"); |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
899 } |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
900 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
901 if (flags & DBUS_WATCH_WRITABLE) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
902 delete_write_fd (fd); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
903 if (flags & DBUS_WATCH_READABLE) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
904 delete_read_fd (fd); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
905 } |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
906 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
907 /* Toggle monitoring WATCH for possible I/O. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
908 static void |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
909 xd_toggle_watch (DBusWatch *watch, void *data) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
910 { |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
911 if (dbus_watch_get_enabled (watch)) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
912 xd_add_watch (watch, data); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
913 else |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
914 xd_remove_watch (watch, data); |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
915 } |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
916 |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
917 DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
918 doc: /* Initialize connection to D-Bus BUS. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
919 (Lisp_Object bus) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
920 { |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
921 DBusConnection *connection; |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
922 |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
923 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
924 connection = xd_initialize (bus, TRUE); |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
925 |
106722
d27fa5359486
* dbusbind.c (xd_add_watch): Improve debug message.
Michael Albinus <michael.albinus@gmx.de>
parents:
106596
diff
changeset
|
926 /* Add the watch functions. We pass also the bus as data, in order |
d27fa5359486
* dbusbind.c (xd_add_watch): Improve debug message.
Michael Albinus <michael.albinus@gmx.de>
parents:
106596
diff
changeset
|
927 to distinguish between the busses in xd_remove_watch. */ |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
928 if (!dbus_connection_set_watch_functions (connection, |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
929 xd_add_watch, |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
930 xd_remove_watch, |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
931 xd_toggle_watch, |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
932 (void*) XHASH (bus), NULL)) |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
933 XD_SIGNAL1 (build_string ("Cannot add watch functions")); |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
934 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
935 /* Add bus to list of registered buses. */ |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
936 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
937 |
110840
eb0cb131cf06
* dbusbind.c (syms_of_dbusbind): Move putenv call ...
Michael Albinus <michael.albinus@gmx.de>
parents:
110823
diff
changeset
|
938 /* We do not want to abort. */ |
eb0cb131cf06
* dbusbind.c (syms_of_dbusbind): Move putenv call ...
Michael Albinus <michael.albinus@gmx.de>
parents:
110823
diff
changeset
|
939 putenv ("DBUS_FATAL_WARNINGS=0"); |
eb0cb131cf06
* dbusbind.c (syms_of_dbusbind): Move putenv call ...
Michael Albinus <michael.albinus@gmx.de>
parents:
110823
diff
changeset
|
940 |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
941 /* Return. */ |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
942 return Qnil; |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
943 } |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
944 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
945 DEFUN ("dbus-close-bus", Fdbus_close_bus, Sdbus_close_bus, 1, 1, 0, |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
946 doc: /* Close connection to D-Bus BUS. */) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
947 (Lisp_Object bus) |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
948 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
949 DBusConnection *connection; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
950 |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
951 /* Open a connection to the bus. */ |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
952 connection = xd_initialize (bus, TRUE); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
953 |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
954 /* Decrement reference count to the bus. */ |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
955 dbus_connection_unref (connection); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
956 |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
957 /* Remove bus from list of registered buses. */ |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
958 Vdbus_registered_buses = Fdelete (bus, Vdbus_registered_buses); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
959 |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
960 /* Return. */ |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
961 return Qnil; |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
962 } |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
963 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
964 DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
965 1, 1, 0, |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
966 doc: /* Return the unique name of Emacs registered at D-Bus BUS. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
967 (Lisp_Object bus) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
968 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
969 DBusConnection *connection; |
94057
a5a4ff3b6cc3
* dbusbind.c (dbus-get-unique-name): Remove extra copying of name string.
Michael Albinus <michael.albinus@gmx.de>
parents:
93420
diff
changeset
|
970 const char *name; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
971 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
972 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
973 connection = xd_initialize (bus, TRUE); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
974 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
975 /* Request the name. */ |
94057
a5a4ff3b6cc3
* dbusbind.c (dbus-get-unique-name): Remove extra copying of name string.
Michael Albinus <michael.albinus@gmx.de>
parents:
93420
diff
changeset
|
976 name = dbus_bus_get_unique_name (connection); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
977 if (name == NULL) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
978 XD_SIGNAL1 (build_string ("No unique name available")); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
979 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
980 /* Return. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
981 return build_string (name); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
982 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
983 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
984 DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
985 doc: /* Call METHOD on the D-Bus BUS. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
986 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
987 BUS is either a Lisp symbol, `:system' or `:session', or a string |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
988 denoting the bus address. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
989 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
990 SERVICE is the D-Bus service name to be used. PATH is the D-Bus |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
991 object path SERVICE is registered at. INTERFACE is an interface |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
992 offered by SERVICE. It must provide METHOD. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
993 |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
994 If the parameter `:timeout' is given, the following integer TIMEOUT |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
995 specifies the maximum number of milliseconds the method call must |
104605
109ea433850d
* dbusbind.c (Fdbus_call_method)
Michael Albinus <michael.albinus@gmx.de>
parents:
104533
diff
changeset
|
996 return. The default value is 25,000. If the method call doesn't |
94057
a5a4ff3b6cc3
* dbusbind.c (dbus-get-unique-name): Remove extra copying of name string.
Michael Albinus <michael.albinus@gmx.de>
parents:
93420
diff
changeset
|
997 return in time, a D-Bus error is raised. |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
998 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
999 All other arguments ARGS are passed to METHOD as arguments. They are |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1000 converted into D-Bus types via the following rules: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1001 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1002 t and nil => DBUS_TYPE_BOOLEAN |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1003 number => DBUS_TYPE_UINT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1004 integer => DBUS_TYPE_INT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1005 float => DBUS_TYPE_DOUBLE |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1006 string => DBUS_TYPE_STRING |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1007 list => DBUS_TYPE_ARRAY |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1008 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1009 All arguments can be preceded by a type symbol. For details about |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1010 type symbols, see Info node `(dbus)Type Conversion'. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1011 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1012 `dbus-call-method' returns the resulting values of METHOD as a list of |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1013 Lisp objects. The type conversion happens the other direction as for |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1014 input arguments. It follows the mapping rules: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1015 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1016 DBUS_TYPE_BOOLEAN => t or nil |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1017 DBUS_TYPE_BYTE => number |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1018 DBUS_TYPE_UINT16 => number |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1019 DBUS_TYPE_INT16 => integer |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
1020 DBUS_TYPE_UINT32 => number or float |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
1021 DBUS_TYPE_UNIX_FD => number or float |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
1022 DBUS_TYPE_INT32 => integer or float |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
1023 DBUS_TYPE_UINT64 => number or float |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
1024 DBUS_TYPE_INT64 => integer or float |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1025 DBUS_TYPE_DOUBLE => float |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1026 DBUS_TYPE_STRING => string |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1027 DBUS_TYPE_OBJECT_PATH => string |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1028 DBUS_TYPE_SIGNATURE => string |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1029 DBUS_TYPE_ARRAY => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1030 DBUS_TYPE_VARIANT => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1031 DBUS_TYPE_STRUCT => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1032 DBUS_TYPE_DICT_ENTRY => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1033 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1034 Example: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1035 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1036 \(dbus-call-method |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1037 :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1038 "org.gnome.seahorse.Keys" "GetKeyField" |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1039 "openpgp:657984B8C7A966DD" "simple-name") |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1040 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1041 => (t ("Philip R. Zimmermann")) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1042 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1043 If the result of the METHOD call is just one value, the converted Lisp |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1044 object is returned instead of a list containing this single Lisp object. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1045 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1046 \(dbus-call-method |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1047 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/devices/computer" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1048 "org.freedesktop.Hal.Device" "GetPropertyString" |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1049 "system.kernel.machine") |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1050 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1051 => "i686" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1052 |
98783
9ae4dbce33ae
* dbusbind.c (Fdbus_call_method): Unbreak usage line.
Magnus Henoch <mange@freemail.hu>
parents:
98434
diff
changeset
|
1053 usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1054 (int nargs, register Lisp_Object *args) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1055 { |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1056 Lisp_Object bus, service, path, interface, method; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1057 Lisp_Object result; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1058 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1059 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1060 DBusMessage *dmessage; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1061 DBusMessage *reply; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1062 DBusMessageIter iter; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1063 DBusError derror; |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1064 unsigned int dtype; |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1065 int timeout = -1; |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1066 int i = 5; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1067 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1068 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1069 /* Check parameters. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1070 bus = args[0]; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1071 service = args[1]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1072 path = args[2]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1073 interface = args[3]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1074 method = args[4]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1075 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1076 CHECK_STRING (service); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1077 CHECK_STRING (path); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1078 CHECK_STRING (interface); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1079 CHECK_STRING (method); |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1080 GCPRO5 (bus, service, path, interface, method); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1081 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1082 XD_DEBUG_MESSAGE ("%s %s %s %s", |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1083 SDATA (service), |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1084 SDATA (path), |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1085 SDATA (interface), |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1086 SDATA (method)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1087 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1088 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
1089 connection = xd_initialize (bus, TRUE); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1090 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1091 /* Create the message. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1092 dmessage = dbus_message_new_method_call (SDATA (service), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1093 SDATA (path), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1094 SDATA (interface), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1095 SDATA (method)); |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1096 UNGCPRO; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1097 if (dmessage == NULL) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1098 XD_SIGNAL1 (build_string ("Unable to create a new message")); |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1099 |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1100 /* Check for timeout parameter. */ |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1101 if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout))) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1102 { |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1103 CHECK_NATNUM (args[i+1]); |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1104 timeout = XUINT (args[i+1]); |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1105 i = i+2; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1106 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1107 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1108 /* Initialize parameter list of message. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1109 dbus_message_iter_init_append (dmessage, &iter); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1110 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1111 /* Append parameters to the message. */ |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1112 for (; i < nargs; ++i) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1113 { |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1114 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1115 if (XD_DBUS_TYPE_P (args[i])) |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1116 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1117 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1118 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1119 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1120 SDATA (format2 ("%s", args[i], Qnil)), |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1121 SDATA (format2 ("%s", args[i+1], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1122 ++i; |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1123 } |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1124 else |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1125 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1126 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1127 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1128 SDATA (format2 ("%s", args[i], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1129 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1130 |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1131 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1132 indication that there is no parent type. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1133 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1134 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1135 xd_append_arg (dtype, args[i], &iter); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1136 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1137 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1138 /* Send the message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1139 dbus_error_init (&derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1140 reply = dbus_connection_send_with_reply_and_block (connection, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1141 dmessage, |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1142 timeout, |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1143 &derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1144 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1145 if (dbus_error_is_set (&derror)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1146 XD_ERROR (derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1147 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1148 if (reply == NULL) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1149 XD_SIGNAL1 (build_string ("No reply")); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1150 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1151 XD_DEBUG_MESSAGE ("Message sent"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1152 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1153 /* Collect the results. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1154 result = Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1155 GCPRO1 (result); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1156 |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1157 if (dbus_message_iter_init (reply, &iter)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1158 { |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1159 /* Loop over the parameters of the D-Bus reply message. Construct a |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1160 Lisp list, which is returned by `dbus-call-method'. */ |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1161 while ((dtype = dbus_message_iter_get_arg_type (&iter)) |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1162 != DBUS_TYPE_INVALID) |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1163 { |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1164 result = Fcons (xd_retrieve_arg (dtype, &iter), result); |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1165 dbus_message_iter_next (&iter); |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1166 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1167 } |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
1168 else |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1169 { |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1170 /* No arguments: just return nil. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1171 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1172 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1173 /* Cleanup. */ |
103785
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
1174 dbus_error_free (&derror); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1175 dbus_message_unref (dmessage); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1176 dbus_message_unref (reply); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1177 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1178 /* Return the result. If there is only one single Lisp object, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1179 return it as-it-is, otherwise return the reversed list. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1180 if (XUINT (Flength (result)) == 1) |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1181 RETURN_UNGCPRO (CAR_SAFE (result)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1182 else |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1183 RETURN_UNGCPRO (Fnreverse (result)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1184 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1185 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1186 DEFUN ("dbus-call-method-asynchronously", Fdbus_call_method_asynchronously, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1187 Sdbus_call_method_asynchronously, 6, MANY, 0, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1188 doc: /* Call METHOD on the D-Bus BUS asynchronously. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1189 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1190 BUS is either a Lisp symbol, `:system' or `:session', or a string |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1191 denoting the bus address. |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1192 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1193 SERVICE is the D-Bus service name to be used. PATH is the D-Bus |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1194 object path SERVICE is registered at. INTERFACE is an interface |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1195 offered by SERVICE. It must provide METHOD. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1196 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1197 HANDLER is a Lisp function, which is called when the corresponding |
104305
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1198 return message has arrived. If HANDLER is nil, no return message will |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1199 be expected. |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1200 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1201 If the parameter `:timeout' is given, the following integer TIMEOUT |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1202 specifies the maximum number of milliseconds the method call must |
104605
109ea433850d
* dbusbind.c (Fdbus_call_method)
Michael Albinus <michael.albinus@gmx.de>
parents:
104533
diff
changeset
|
1203 return. The default value is 25,000. If the method call doesn't |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1204 return in time, a D-Bus error is raised. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1205 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1206 All other arguments ARGS are passed to METHOD as arguments. They are |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1207 converted into D-Bus types via the following rules: |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1208 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1209 t and nil => DBUS_TYPE_BOOLEAN |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1210 number => DBUS_TYPE_UINT32 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1211 integer => DBUS_TYPE_INT32 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1212 float => DBUS_TYPE_DOUBLE |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1213 string => DBUS_TYPE_STRING |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1214 list => DBUS_TYPE_ARRAY |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1215 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1216 All arguments can be preceded by a type symbol. For details about |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1217 type symbols, see Info node `(dbus)Type Conversion'. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1218 |
104305
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1219 Unless HANDLER is nil, the function returns a key into the hash table |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1220 `dbus-registered-objects-table'. The corresponding entry in the hash |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1221 table is removed, when the return message has been arrived, and |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1222 HANDLER is called. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1223 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1224 Example: |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1225 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1226 \(dbus-call-method-asynchronously |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1227 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/devices/computer" |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1228 "org.freedesktop.Hal.Device" "GetPropertyString" 'message |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1229 "system.kernel.machine") |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1230 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1231 => (:system 2) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1232 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1233 -| i686 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1234 |
98783
9ae4dbce33ae
* dbusbind.c (Fdbus_call_method): Unbreak usage line.
Magnus Henoch <mange@freemail.hu>
parents:
98434
diff
changeset
|
1235 usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1236 (int nargs, register Lisp_Object *args) |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1237 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1238 Lisp_Object bus, service, path, interface, method, handler; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1239 Lisp_Object result; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1240 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1241 DBusConnection *connection; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1242 DBusMessage *dmessage; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1243 DBusMessageIter iter; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1244 unsigned int dtype; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1245 int timeout = -1; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1246 int i = 6; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1247 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1248 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1249 /* Check parameters. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1250 bus = args[0]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1251 service = args[1]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1252 path = args[2]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1253 interface = args[3]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1254 method = args[4]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1255 handler = args[5]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1256 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1257 CHECK_STRING (service); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1258 CHECK_STRING (path); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1259 CHECK_STRING (interface); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1260 CHECK_STRING (method); |
104305
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1261 if (!NILP (handler) && !FUNCTIONP (handler)) |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1262 wrong_type_argument (intern ("functionp"), handler); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1263 GCPRO6 (bus, service, path, interface, method, handler); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1264 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1265 XD_DEBUG_MESSAGE ("%s %s %s %s", |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1266 SDATA (service), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1267 SDATA (path), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1268 SDATA (interface), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1269 SDATA (method)); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1270 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1271 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
1272 connection = xd_initialize (bus, TRUE); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1273 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1274 /* Create the message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1275 dmessage = dbus_message_new_method_call (SDATA (service), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1276 SDATA (path), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1277 SDATA (interface), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1278 SDATA (method)); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1279 if (dmessage == NULL) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1280 XD_SIGNAL1 (build_string ("Unable to create a new message")); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1281 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1282 /* Check for timeout parameter. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1283 if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1284 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1285 CHECK_NATNUM (args[i+1]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1286 timeout = XUINT (args[i+1]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1287 i = i+2; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1288 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1289 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1290 /* Initialize parameter list of message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1291 dbus_message_iter_init_append (dmessage, &iter); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1292 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1293 /* Append parameters to the message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1294 for (; i < nargs; ++i) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1295 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1296 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1297 if (XD_DBUS_TYPE_P (args[i])) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1298 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1299 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1300 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1301 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1302 SDATA (format2 ("%s", args[i], Qnil)), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1303 SDATA (format2 ("%s", args[i+1], Qnil))); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1304 ++i; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1305 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1306 else |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1307 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1308 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1309 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1310 SDATA (format2 ("%s", args[i], Qnil))); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1311 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1312 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1313 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1314 indication that there is no parent type. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1315 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1316 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1317 xd_append_arg (dtype, args[i], &iter); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1318 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1319 |
104305
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1320 if (!NILP (handler)) |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1321 { |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1322 /* Send the message. The message is just added to the outgoing |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1323 message queue. */ |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1324 if (!dbus_connection_send_with_reply (connection, dmessage, |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1325 NULL, timeout)) |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1326 XD_SIGNAL1 (build_string ("Cannot send message")); |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1327 |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1328 /* The result is the key in Vdbus_registered_objects_table. */ |
104305
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1329 result = (list2 (bus, make_number (dbus_message_get_serial (dmessage)))); |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1330 |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1331 /* Create a hash table entry. */ |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1332 Fputhash (result, handler, Vdbus_registered_objects_table); |
104305
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1333 } |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1334 else |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1335 { |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1336 /* Send the message. The message is just added to the outgoing |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1337 message queue. */ |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1338 if (!dbus_connection_send (connection, dmessage, NULL)) |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1339 XD_SIGNAL1 (build_string ("Cannot send message")); |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1340 |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1341 result = Qnil; |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1342 } |
52ea0b8b565e
* dbusbind.c (Fdbus_call_method_asynchronously): Allow nil HANDLER.
Michael Albinus <michael.albinus@gmx.de>
parents:
104296
diff
changeset
|
1343 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1344 XD_DEBUG_MESSAGE ("Message sent"); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1345 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1346 /* Cleanup. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1347 dbus_message_unref (dmessage); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1348 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1349 /* Return the result. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1350 RETURN_UNGCPRO (result); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1351 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1352 |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1353 DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1354 Sdbus_method_return_internal, |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1355 3, MANY, 0, |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1356 doc: /* Return for message SERIAL on the D-Bus BUS. |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1357 This is an internal function, it shall not be used outside dbus.el. |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1358 |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1359 usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1360 (int nargs, register Lisp_Object *args) |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1361 { |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1362 Lisp_Object bus, serial, service; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1363 struct gcpro gcpro1, gcpro2, gcpro3; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1364 DBusConnection *connection; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1365 DBusMessage *dmessage; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1366 DBusMessageIter iter; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1367 unsigned int dtype; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1368 int i; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1369 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1370 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1371 /* Check parameters. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1372 bus = args[0]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1373 serial = args[1]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1374 service = args[2]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1375 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1376 CHECK_NUMBER (serial); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1377 CHECK_STRING (service); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1378 GCPRO3 (bus, serial, service); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1379 |
105575
474fc7c0fe88
(dbus-method-return-internal, dbus-method-error-internal): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104605
diff
changeset
|
1380 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1381 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1382 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
1383 connection = xd_initialize (bus, TRUE); |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1384 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1385 /* Create the message. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1386 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1387 if ((dmessage == NULL) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1388 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1389 || (!dbus_message_set_destination (dmessage, SDATA (service)))) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1390 { |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1391 UNGCPRO; |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1392 XD_SIGNAL1 (build_string ("Unable to create a return message")); |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1393 } |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1394 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1395 UNGCPRO; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1396 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1397 /* Initialize parameter list of message. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1398 dbus_message_iter_init_append (dmessage, &iter); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1399 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1400 /* Append parameters to the message. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1401 for (i = 3; i < nargs; ++i) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1402 { |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1403 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1404 if (XD_DBUS_TYPE_P (args[i])) |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1405 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1406 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1407 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1408 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1409 SDATA (format2 ("%s", args[i], Qnil)), |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1410 SDATA (format2 ("%s", args[i+1], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1411 ++i; |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1412 } |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1413 else |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1414 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1415 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1416 XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1417 SDATA (format2 ("%s", args[i], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1418 } |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1419 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1420 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1421 indication that there is no parent type. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1422 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1423 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1424 xd_append_arg (dtype, args[i], &iter); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1425 } |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1426 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1427 /* Send the message. The message is just added to the outgoing |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1428 message queue. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1429 if (!dbus_connection_send (connection, dmessage, NULL)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1430 XD_SIGNAL1 (build_string ("Cannot send message")); |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1431 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1432 XD_DEBUG_MESSAGE ("Message sent"); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1433 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1434 /* Cleanup. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1435 dbus_message_unref (dmessage); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1436 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1437 /* Return. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1438 return Qt; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1439 } |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1440 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1441 DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1442 Sdbus_method_error_internal, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1443 3, MANY, 0, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1444 doc: /* Return error message for message SERIAL on the D-Bus BUS. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1445 This is an internal function, it shall not be used outside dbus.el. |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1446 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1447 usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1448 (int nargs, register Lisp_Object *args) |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1449 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1450 Lisp_Object bus, serial, service; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1451 struct gcpro gcpro1, gcpro2, gcpro3; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1452 DBusConnection *connection; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1453 DBusMessage *dmessage; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1454 DBusMessageIter iter; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1455 unsigned int dtype; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1456 int i; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1457 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1458 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1459 /* Check parameters. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1460 bus = args[0]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1461 serial = args[1]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1462 service = args[2]; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1463 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1464 CHECK_NUMBER (serial); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1465 CHECK_STRING (service); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1466 GCPRO3 (bus, serial, service); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1467 |
105575
474fc7c0fe88
(dbus-method-return-internal, dbus-method-error-internal): Use long format in printf, and cast argument.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
104605
diff
changeset
|
1468 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1469 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1470 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
1471 connection = xd_initialize (bus, TRUE); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1472 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1473 /* Create the message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1474 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1475 if ((dmessage == NULL) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1476 || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1477 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1478 || (!dbus_message_set_destination (dmessage, SDATA (service)))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1479 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1480 UNGCPRO; |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1481 XD_SIGNAL1 (build_string ("Unable to create a error message")); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1482 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1483 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1484 UNGCPRO; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1485 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1486 /* Initialize parameter list of message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1487 dbus_message_iter_init_append (dmessage, &iter); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1488 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1489 /* Append parameters to the message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1490 for (i = 3; i < nargs; ++i) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1491 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1492 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1493 if (XD_DBUS_TYPE_P (args[i])) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1494 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1495 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1496 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1497 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1498 SDATA (format2 ("%s", args[i], Qnil)), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1499 SDATA (format2 ("%s", args[i+1], Qnil))); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1500 ++i; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1501 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1502 else |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1503 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1504 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1505 XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1506 SDATA (format2 ("%s", args[i], Qnil))); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1507 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1508 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1509 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1510 indication that there is no parent type. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1511 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1512 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1513 xd_append_arg (dtype, args[i], &iter); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1514 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1515 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1516 /* Send the message. The message is just added to the outgoing |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1517 message queue. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1518 if (!dbus_connection_send (connection, dmessage, NULL)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1519 XD_SIGNAL1 (build_string ("Cannot send message")); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1520 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1521 XD_DEBUG_MESSAGE ("Message sent"); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1522 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1523 /* Cleanup. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1524 dbus_message_unref (dmessage); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1525 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1526 /* Return. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1527 return Qt; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1528 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1529 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1530 DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1531 doc: /* Send signal SIGNAL on the D-Bus BUS. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1532 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1533 BUS is either a Lisp symbol, `:system' or `:session', or a string |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1534 denoting the bus address. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1535 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1536 SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1537 D-Bus object path SERVICE is registered at. INTERFACE is an interface |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1538 offered by SERVICE. It must provide signal SIGNAL. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1539 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1540 All other arguments ARGS are passed to SIGNAL as arguments. They are |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1541 converted into D-Bus types via the following rules: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1542 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1543 t and nil => DBUS_TYPE_BOOLEAN |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1544 number => DBUS_TYPE_UINT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1545 integer => DBUS_TYPE_INT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1546 float => DBUS_TYPE_DOUBLE |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1547 string => DBUS_TYPE_STRING |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1548 list => DBUS_TYPE_ARRAY |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1549 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1550 All arguments can be preceded by a type symbol. For details about |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1551 type symbols, see Info node `(dbus)Type Conversion'. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1552 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1553 Example: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1554 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1555 \(dbus-send-signal |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1556 :session "org.gnu.Emacs" "/org/gnu/Emacs" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1557 "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1558 |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1559 usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1560 (int nargs, register Lisp_Object *args) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1561 { |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1562 Lisp_Object bus, service, path, interface, signal; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1563 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1564 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1565 DBusMessage *dmessage; |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1566 DBusMessageIter iter; |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1567 unsigned int dtype; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1568 int i; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1569 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1570 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1571 /* Check parameters. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1572 bus = args[0]; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1573 service = args[1]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1574 path = args[2]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1575 interface = args[3]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1576 signal = args[4]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1577 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1578 CHECK_STRING (service); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1579 CHECK_STRING (path); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1580 CHECK_STRING (interface); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1581 CHECK_STRING (signal); |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1582 GCPRO5 (bus, service, path, interface, signal); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1583 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1584 XD_DEBUG_MESSAGE ("%s %s %s %s", |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1585 SDATA (service), |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1586 SDATA (path), |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1587 SDATA (interface), |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1588 SDATA (signal)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1589 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1590 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
1591 connection = xd_initialize (bus, TRUE); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1592 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1593 /* Create the message. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1594 dmessage = dbus_message_new_signal (SDATA (path), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1595 SDATA (interface), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1596 SDATA (signal)); |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
1597 UNGCPRO; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1598 if (dmessage == NULL) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1599 XD_SIGNAL1 (build_string ("Unable to create a new message")); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1600 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1601 /* Initialize parameter list of message. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1602 dbus_message_iter_init_append (dmessage, &iter); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1603 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1604 /* Append parameters to the message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1605 for (i = 5; i < nargs; ++i) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1606 { |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1607 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1608 if (XD_DBUS_TYPE_P (args[i])) |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1609 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1610 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1611 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1612 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1613 SDATA (format2 ("%s", args[i], Qnil)), |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1614 SDATA (format2 ("%s", args[i+1], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1615 ++i; |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1616 } |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1617 else |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1618 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1619 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1620 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1621 SDATA (format2 ("%s", args[i], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1622 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1623 |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1624 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1625 indication that there is no parent type. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1626 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1627 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1628 xd_append_arg (dtype, args[i], &iter); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1629 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1630 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1631 /* Send the message. The message is just added to the outgoing |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1632 message queue. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1633 if (!dbus_connection_send (connection, dmessage, NULL)) |
99098
35372c2ca5c9
* dbusbind.c (xd_in_read_queued_messages): New variable.
Michael Albinus <michael.albinus@gmx.de>
parents:
98901
diff
changeset
|
1634 XD_SIGNAL1 (build_string ("Cannot send message")); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1635 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1636 XD_DEBUG_MESSAGE ("Signal sent"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1637 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1638 /* Cleanup. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1639 dbus_message_unref (dmessage); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1640 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1641 /* Return. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1642 return Qt; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1643 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1644 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1645 /* Read one queued incoming message of the D-Bus BUS. |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1646 BUS is either a Lisp symbol, :system or :session, or a string denoting |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1647 the bus address. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1648 static void |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1649 xd_read_message_1 (DBusConnection *connection, Lisp_Object bus) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1650 { |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1651 Lisp_Object args, key, value; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1652 struct gcpro gcpro1; |
87501
38cad849184d
* dbusbind.c (xd_read_message): Use non-static input_event struct.
Michael Albinus <michael.albinus@gmx.de>
parents:
87497
diff
changeset
|
1653 struct input_event event; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1654 DBusMessage *dmessage; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1655 DBusMessageIter iter; |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1656 unsigned int dtype; |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1657 int mtype, serial; |
93156
3ef12fa772f2
* dbusbind.c (xd_read_message): Removed extra copying of message
Michael Albinus <michael.albinus@gmx.de>
parents:
87972
diff
changeset
|
1658 const char *uname, *path, *interface, *member; |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1659 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1660 dmessage = dbus_connection_pop_message (connection); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1661 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1662 /* Return if there is no queued message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1663 if (dmessage == NULL) |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1664 return; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1665 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1666 /* Collect the parameters. */ |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1667 args = Qnil; |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1668 GCPRO1 (args); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1669 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1670 /* Loop over the resulting parameters. Construct a list. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1671 if (dbus_message_iter_init (dmessage, &iter)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1672 { |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1673 while ((dtype = dbus_message_iter_get_arg_type (&iter)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1674 != DBUS_TYPE_INVALID) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1675 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1676 args = Fcons (xd_retrieve_arg (dtype, &iter), args); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1677 dbus_message_iter_next (&iter); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1678 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1679 /* The arguments are stored in reverse order. Reorder them. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1680 args = Fnreverse (args); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1681 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1682 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1683 /* Read message type, message serial, unique name, object path, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1684 interface and member from the message. */ |
97211
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1685 mtype = dbus_message_get_type (dmessage); |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1686 serial = |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1687 ((mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1688 || (mtype == DBUS_MESSAGE_TYPE_ERROR)) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1689 ? dbus_message_get_reply_serial (dmessage) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1690 : dbus_message_get_serial (dmessage); |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1691 uname = dbus_message_get_sender (dmessage); |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1692 path = dbus_message_get_path (dmessage); |
93156
3ef12fa772f2
* dbusbind.c (xd_read_message): Removed extra copying of message
Michael Albinus <michael.albinus@gmx.de>
parents:
87972
diff
changeset
|
1693 interface = dbus_message_get_interface (dmessage); |
97211
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1694 member = dbus_message_get_member (dmessage); |
93156
3ef12fa772f2
* dbusbind.c (xd_read_message): Removed extra copying of message
Michael Albinus <michael.albinus@gmx.de>
parents:
87972
diff
changeset
|
1695 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1696 XD_DEBUG_MESSAGE ("Event received: %s %d %s %s %s %s %s", |
97211
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1697 (mtype == DBUS_MESSAGE_TYPE_INVALID) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1698 ? "DBUS_MESSAGE_TYPE_INVALID" |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1699 : (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1700 ? "DBUS_MESSAGE_TYPE_METHOD_CALL" |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1701 : (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1702 ? "DBUS_MESSAGE_TYPE_METHOD_RETURN" |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1703 : (mtype == DBUS_MESSAGE_TYPE_ERROR) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1704 ? "DBUS_MESSAGE_TYPE_ERROR" |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1705 : "DBUS_MESSAGE_TYPE_SIGNAL", |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1706 serial, uname, path, interface, member, |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1707 SDATA (format2 ("%s", args, Qnil))); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1708 |
97211
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1709 if ((mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN) |
194ecdbbd8a3
* dbusbind.c (xd_read_message): Handle D-Bus error messages.
Michael Albinus <michael.albinus@gmx.de>
parents:
97165
diff
changeset
|
1710 || (mtype == DBUS_MESSAGE_TYPE_ERROR)) |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1711 { |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1712 /* Search for a registered function of the message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1713 key = list2 (bus, make_number (serial)); |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1714 value = Fgethash (key, Vdbus_registered_objects_table, Qnil); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1715 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1716 /* There shall be exactly one entry. Construct an event. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1717 if (NILP (value)) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1718 goto cleanup; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1719 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1720 /* Remove the entry. */ |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1721 Fremhash (key, Vdbus_registered_objects_table); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1722 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1723 /* Construct an event. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1724 EVENT_INIT (event); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1725 event.kind = DBUS_EVENT; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1726 event.frame_or_window = Qnil; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1727 event.arg = Fcons (value, args); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1728 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1729 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1730 else /* (mtype != DBUS_MESSAGE_TYPE_METHOD_RETURN) */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1731 { |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1732 /* Vdbus_registered_objects_table requires non-nil interface and |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1733 member. */ |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1734 if ((interface == NULL) || (member == NULL)) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1735 goto cleanup; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1736 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1737 /* Search for a registered function of the message. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1738 key = list3 (bus, build_string (interface), build_string (member)); |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
1739 value = Fgethash (key, Vdbus_registered_objects_table, Qnil); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1740 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1741 /* Loop over the registered functions. Construct an event. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1742 while (!NILP (value)) |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1743 { |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1744 key = CAR_SAFE (value); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1745 /* key has the structure (UNAME SERVICE PATH HANDLER). */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1746 if (((uname == NULL) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1747 || (NILP (CAR_SAFE (key))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1748 || (strcmp (uname, SDATA (CAR_SAFE (key))) == 0)) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1749 && ((path == NULL) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1750 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1751 || (strcmp (path, |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1752 SDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1753 == 0)) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1754 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1755 { |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1756 EVENT_INIT (event); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1757 event.kind = DBUS_EVENT; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1758 event.frame_or_window = Qnil; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1759 event.arg = Fcons (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key)))), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1760 args); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1761 break; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1762 } |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1763 value = CDR_SAFE (value); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1764 } |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1765 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1766 if (NILP (value)) |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1767 goto cleanup; |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1768 } |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1769 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1770 /* Add type, serial, uname, path, interface and member to the event. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1771 event.arg = Fcons ((member == NULL ? Qnil : build_string (member)), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1772 event.arg); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1773 event.arg = Fcons ((interface == NULL ? Qnil : build_string (interface)), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1774 event.arg); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1775 event.arg = Fcons ((path == NULL ? Qnil : build_string (path)), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1776 event.arg); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1777 event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)), |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1778 event.arg); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1779 event.arg = Fcons (make_number (serial), event.arg); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1780 event.arg = Fcons (make_number (mtype), event.arg); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1781 |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1782 /* Add the bus symbol to the event. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1783 event.arg = Fcons (bus, event.arg); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1784 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1785 /* Store it into the input event queue. */ |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1786 kbd_buffer_store_event (&event); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1787 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1788 XD_DEBUG_MESSAGE ("Event stored: %s", |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
1789 SDATA (format2 ("%s", event.arg, Qnil))); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1790 |
103785
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
1791 /* Cleanup. */ |
93156
3ef12fa772f2
* dbusbind.c (xd_read_message): Removed extra copying of message
Michael Albinus <michael.albinus@gmx.de>
parents:
87972
diff
changeset
|
1792 cleanup: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1793 dbus_message_unref (dmessage); |
103785
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
1794 |
110592
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1795 UNGCPRO; |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1796 } |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1797 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1798 /* Read queued incoming messages of the D-Bus BUS. |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1799 BUS is either a Lisp symbol, :system or :session, or a string denoting |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1800 the bus address. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1801 static Lisp_Object |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1802 xd_read_message (Lisp_Object bus) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1803 { |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1804 /* Open a connection to the bus. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1805 DBusConnection *connection = xd_initialize (bus, TRUE); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1806 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1807 /* Non blocking read of the next available message. */ |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1808 dbus_connection_read_write (connection, 0); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1809 |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1810 while (dbus_connection_get_dispatch_status (connection) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1811 != DBUS_DISPATCH_COMPLETE) |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1812 xd_read_message_1 (connection, bus); |
c06958da83b5
Add fd handling with callbacks to select, dbus needs it for async operation.
Jan D <jan.h.d@swipnet.se>
parents:
109961
diff
changeset
|
1813 return Qnil; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1814 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1815 |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1816 /* Callback called when something is ready to read or write. */ |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1817 static void |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1818 xd_read_queued_messages (int fd, void *data, int for_read) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1819 { |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1820 Lisp_Object busp = Vdbus_registered_buses; |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1821 Lisp_Object bus = Qnil; |
87092
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1822 |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1823 /* Find bus related to fd. */ |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1824 if (data != NULL) |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1825 while (!NILP (busp)) |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1826 { |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1827 if (data == (void*) XHASH (CAR_SAFE (busp))) |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1828 bus = CAR_SAFE (busp); |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1829 busp = CDR_SAFE (busp); |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1830 } |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1831 |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1832 if (NILP(bus)) |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1833 return; |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1834 |
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1835 /* We ignore all Lisp errors during the call. */ |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1836 xd_in_read_queued_messages = 1; |
110609
7867879a43ce
* dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
Michael Albinus <michael.albinus@gmx.de>
parents:
110592
diff
changeset
|
1837 internal_catch (Qdbus_error, xd_read_message, bus); |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1838 xd_in_read_queued_messages = 0; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1839 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1840 |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1841 DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service, |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1842 2, MANY, 0, |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1843 doc: /* Register known name SERVICE on the D-Bus BUS. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1844 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1845 BUS is either a Lisp symbol, `:system' or `:session', or a string |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1846 denoting the bus address. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1847 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1848 SERVICE is the D-Bus service name that should be registered. It must |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1849 be a known name. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1850 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1851 FLAGS are keywords, which control how the service name is registered. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1852 The following keywords are recognized: |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1853 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1854 `:allow-replacement': Allow another service to become the primary |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1855 owner if requested. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1856 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1857 `:replace-existing': Request to replace the current primary owner. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1858 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1859 `:do-not-queue': If we can not become the primary owner do not place |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1860 us in the queue. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1861 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1862 The function returns a keyword, indicating the result of the |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1863 operation. One of the following keywords is returned: |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1864 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1865 `:primary-owner': Service has become the primary owner of the |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1866 requested name. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1867 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1868 `:in-queue': Service could not become the primary owner and has been |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1869 placed in the queue. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1870 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1871 `:exists': Service is already in the queue. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1872 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1873 `:already-owner': Service is already the primary owner. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1874 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1875 Example: |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1876 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1877 \(dbus-register-service :session dbus-service-emacs) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1878 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1879 => :primary-owner. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1880 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1881 \(dbus-register-service |
112185
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1882 :session "org.freedesktop.TextEditor" |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1883 dbus-service-allow-replacement dbus-service-replace-existing) |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1884 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1885 => :already-owner. |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1886 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1887 usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1888 (int nargs, register Lisp_Object *args) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1889 { |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1890 Lisp_Object bus, service; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1891 struct gcpro gcpro1, gcpro2; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1892 DBusConnection *connection; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1893 unsigned int i; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1894 unsigned int value; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1895 unsigned int flags = 0; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1896 int result; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1897 DBusError derror; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1898 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1899 bus = args[0]; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1900 service = args[1]; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1901 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1902 /* Check parameters. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1903 CHECK_STRING (service); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1904 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1905 /* Process flags. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1906 for (i = 2; i < nargs; ++i) { |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1907 value = ((EQ (args[i], QCdbus_request_name_replace_existing)) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1908 ? DBUS_NAME_FLAG_REPLACE_EXISTING |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1909 : (EQ (args[i], QCdbus_request_name_allow_replacement)) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1910 ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1911 : (EQ (args[i], QCdbus_request_name_do_not_queue)) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1912 ? DBUS_NAME_FLAG_DO_NOT_QUEUE |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1913 : -1); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1914 if (value == -1) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1915 XD_SIGNAL2 (build_string ("Unrecognized name request flag"), args[i]); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1916 flags |= value; |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1917 } |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1918 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1919 /* Open a connection to the bus. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1920 connection = xd_initialize (bus, TRUE); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1921 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1922 /* Request the known name from the bus. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1923 dbus_error_init (&derror); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1924 result = dbus_bus_request_name (connection, SDATA (service), flags, |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1925 &derror); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1926 if (dbus_error_is_set (&derror)) |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1927 XD_ERROR (derror); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1928 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1929 /* Cleanup. */ |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1930 dbus_error_free (&derror); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1931 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1932 /* Return object. */ |
112185
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1933 switch (result) |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1934 { |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1935 case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1936 return QCdbus_request_name_reply_primary_owner; |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1937 case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1938 return QCdbus_request_name_reply_in_queue; |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1939 case DBUS_REQUEST_NAME_REPLY_EXISTS: |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1940 return QCdbus_request_name_reply_exists; |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1941 case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1942 return QCdbus_request_name_reply_already_owner; |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1943 default: |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1944 /* This should not happen. */ |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1945 XD_SIGNAL2 (build_string ("Could not register service"), service); |
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
1946 } |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1947 } |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
1948 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1949 DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1950 6, MANY, 0, |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1951 doc: /* Register for signal SIGNAL on the D-Bus BUS. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1952 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1953 BUS is either a Lisp symbol, `:system' or `:session', or a string |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
1954 denoting the bus address. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1955 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1956 SERVICE is the D-Bus service name used by the sending D-Bus object. |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1957 It can be either a known name or the unique name of the D-Bus object |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1958 sending the signal. When SERVICE is nil, related signals from all |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1959 D-Bus objects shall be accepted. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1960 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1961 PATH is the D-Bus object path SERVICE is registered. It can also be |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1962 nil if the path name of incoming signals shall not be checked. |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1963 |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1964 INTERFACE is an interface offered by SERVICE. It must provide SIGNAL. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1965 HANDLER is a Lisp function to be called when the signal is received. |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1966 It must accept as arguments the values SIGNAL is sending. |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1967 |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1968 All other arguments ARGS, if specified, must be strings. They stand |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1969 for the respective arguments of the signal in their order, and are |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1970 used for filtering as well. A nil argument might be used to preserve |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1971 the order. |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1972 |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1973 INTERFACE, SIGNAL and HANDLER must not be nil. Example: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1974 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1975 \(defun my-signal-handler (device) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1976 (message "Device %s added" device)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1977 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1978 \(dbus-register-signal |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1979 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1980 "org.freedesktop.Hal.Manager" "DeviceAdded" 'my-signal-handler) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1981 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1982 => ((:system "org.freedesktop.Hal.Manager" "DeviceAdded") |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1983 ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" my-signal-handler)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1984 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1985 `dbus-register-signal' returns an object, which can be used in |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1986 `dbus-unregister-object' for removing the registration. |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1987 |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1988 usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1989 (int nargs, register Lisp_Object *args) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1990 { |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1991 Lisp_Object bus, service, path, interface, signal, handler; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1992 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1993 Lisp_Object uname, key, key1, value; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1994 DBusConnection *connection; |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
1995 int i; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1996 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; |
96847
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
1997 char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1998 DBusError derror; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1999 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2000 /* Check parameters. */ |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2001 bus = args[0]; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2002 service = args[1]; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2003 path = args[2]; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2004 interface = args[3]; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2005 signal = args[4]; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2006 handler = args[5]; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2007 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2008 if (!NILP (service)) CHECK_STRING (service); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2009 if (!NILP (path)) CHECK_STRING (path); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2010 CHECK_STRING (interface); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2011 CHECK_STRING (signal); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2012 if (!FUNCTIONP (handler)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2013 wrong_type_argument (intern ("functionp"), handler); |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2014 GCPRO6 (bus, service, path, interface, signal, handler); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2015 |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2016 /* Retrieve unique name of service. If service is a known name, we |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2017 will register for the corresponding unique name, if any. Signals |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2018 are sent always with the unique name as sender. Note: the unique |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2019 name of "org.freedesktop.DBus" is that string itself. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
2020 if ((STRINGP (service)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
2021 && (SBYTES (service) > 0) |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
2022 && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0) |
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
2023 && (strncmp (SDATA (service), ":", 1) != 0)) |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2024 { |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2025 uname = call2 (intern ("dbus-get-name-owner"), bus, service); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2026 /* When there is no unique name, we mark it with an empty |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2027 string. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2028 if (NILP (uname)) |
101276
dd95cb42c0aa
* dbusbind.c (Fdbus_register_signal):
Juanma Barranquero <lekktu@gmail.com>
parents:
100951
diff
changeset
|
2029 uname = empty_unibyte_string; |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2030 } |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2031 else |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2032 uname = service; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
2033 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2034 /* Create a matching rule if the unique name exists (when no |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2035 wildcard). */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
2036 if (NILP (uname) || (SBYTES (uname) > 0)) |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2037 { |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2038 /* Open a connection to the bus. */ |
109183
a0cffb71f267
* dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
Michael Albinus <michael.albinus@gmx.de>
parents:
109179
diff
changeset
|
2039 connection = xd_initialize (bus, TRUE); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2040 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2041 /* Create a rule to receive related signals. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2042 sprintf (rule, |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2043 "type='signal',interface='%s',member='%s'", |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2044 SDATA (interface), |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2045 SDATA (signal)); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2046 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2047 /* Add unique name and path to the rule if they are non-nil. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2048 if (!NILP (uname)) |
96847
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2049 { |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2050 sprintf (x, ",sender='%s'", SDATA (uname)); |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2051 strcat (rule, x); |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2052 } |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2053 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2054 if (!NILP (path)) |
96847
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2055 { |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2056 sprintf (x, ",path='%s'", SDATA (path)); |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2057 strcat (rule, x); |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2058 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2059 |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2060 /* Add arguments to the rule if they are non-nil. */ |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2061 for (i = 6; i < nargs; ++i) |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2062 if (!NILP (args[i])) |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2063 { |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2064 CHECK_STRING (args[i]); |
96847
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2065 sprintf (x, ",arg%d='%s'", i-6, SDATA (args[i])); |
5129bcf1c53e
* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead
Michael Albinus <michael.albinus@gmx.de>
parents:
96644
diff
changeset
|
2066 strcat (rule, x); |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2067 } |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2068 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2069 /* Add the rule to the bus. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2070 dbus_error_init (&derror); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2071 dbus_bus_add_match (connection, rule, &derror); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2072 if (dbus_error_is_set (&derror)) |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2073 { |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2074 UNGCPRO; |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2075 XD_ERROR (derror); |
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2076 } |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2077 |
103785
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
2078 /* Cleanup. */ |
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
2079 dbus_error_free (&derror); |
50effbe728da
* dbusbind.c (xd_initialize, Fdbus_call_method, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
103612
diff
changeset
|
2080 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2081 XD_DEBUG_MESSAGE ("Matching rule \"%s\" created", rule); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2082 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2083 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2084 /* Create a hash table entry. */ |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
2085 key = list3 (bus, interface, signal); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2086 key1 = list4 (uname, service, path, handler); |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2087 value = Fgethash (key, Vdbus_registered_objects_table, Qnil); |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
2088 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2089 if (NILP (Fmember (key1, value))) |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2090 Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2091 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2092 /* Return object. */ |
96644
5d614d0d26de
* dbusbind.c (Fdbus_register_signal): Allow also signal arguments
Michael Albinus <michael.albinus@gmx.de>
parents:
94963
diff
changeset
|
2093 RETURN_UNGCPRO (list2 (key, list3 (service, path, handler))); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2094 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2095 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2096 DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, |
112113
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2097 6, 7, 0, |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2098 doc: /* Register for method METHOD on the D-Bus BUS. |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2099 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2100 BUS is either a Lisp symbol, `:system' or `:session', or a string |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2101 denoting the bus address. |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2102 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2103 SERVICE is the D-Bus service name of the D-Bus object METHOD is |
112113
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2104 registered for. It must be a known name (See discussion of |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2105 DONT-REGISTER-SERVICE below). |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2106 |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2107 PATH is the D-Bus object path SERVICE is registered (See discussion of |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2108 DONT-REGISTER-SERVICE below). INTERFACE is the interface offered by |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2109 SERVICE. It must provide METHOD. HANDLER is a Lisp function to be |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2110 called when a method call is received. It must accept the input |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2111 arguments of METHOD. The return value of HANDLER is used for |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2112 composing the returning D-Bus message. |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2113 |
112113
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2114 When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2115 registered. This means that other D-Bus clients have no way of |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2116 noticing the newly registered method. When interfaces are constructed |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2117 incrementally by adding single methods or properties at a time, |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2118 DONT-REGISTER-SERVICE can be use to prevent other clients from |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2119 discovering the still incomplete interface.*/) |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2120 (Lisp_Object bus, Lisp_Object service, Lisp_Object path, |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2121 Lisp_Object interface, Lisp_Object method, Lisp_Object handler, |
f68ebb34e243
* dbusbind.c (Fdbus_register_method): Added optional parameter
Michael Albinus <michael.albinus@gmx.de>
parents:
111474
diff
changeset
|
2122 Lisp_Object dont_register_service) |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2123 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2124 Lisp_Object key, key1, value; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2125 DBusError derror; |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2126 Lisp_Object args[2] = { bus, service }; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2127 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2128 /* Check parameters. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2129 CHECK_STRING (service); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2130 CHECK_STRING (path); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2131 CHECK_STRING (interface); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2132 CHECK_STRING (method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2133 if (!FUNCTIONP (handler)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2134 wrong_type_argument (intern ("functionp"), handler); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2135 /* TODO: We must check for a valid service name, otherwise there is |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2136 a segmentation fault. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2137 |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2138 /* Request the name. */ |
112185
318f49ef9a11
* dbusbind.c (Fdbus_register_service): Raise an error in case of
Michael Albinus <michael.albinus@gmx.de>
parents:
112182
diff
changeset
|
2139 if (NILP (dont_register_service)) |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2140 Fdbus_register_service (2, args); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2141 |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2142 /* Create a hash table entry. We use nil for the unique name, |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2143 because the method might be called from anybody. */ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2144 key = list3 (bus, interface, method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2145 key1 = list4 (Qnil, service, path, handler); |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2146 value = Fgethash (key, Vdbus_registered_objects_table, Qnil); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2147 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2148 if (NILP (Fmember (key1, value))) |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2149 Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2150 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2151 /* Return object. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2152 return list2 (key, list3 (service, path, handler)); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2153 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2154 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2155 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2156 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108946
diff
changeset
|
2157 syms_of_dbusbind (void) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2158 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2159 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2160 Qdbus_init_bus = intern_c_string ("dbus-init-bus"); |
104339
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
2161 staticpro (&Qdbus_init_bus); |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
2162 defsubr (&Sdbus_init_bus); |
dfa6f847adcd
* dbusbind.c (xd_add_watch, xd_remove_watch, Fdbus_init_bus): New
Michael Albinus <michael.albinus@gmx.de>
parents:
104313
diff
changeset
|
2163 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2164 Qdbus_close_bus = intern_c_string ("dbus-close-bus"); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2165 staticpro (&Qdbus_close_bus); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2166 defsubr (&Sdbus_close_bus); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2167 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2168 Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2169 staticpro (&Qdbus_get_unique_name); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2170 defsubr (&Sdbus_get_unique_name); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2171 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2172 Qdbus_call_method = intern_c_string ("dbus-call-method"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2173 staticpro (&Qdbus_call_method); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2174 defsubr (&Sdbus_call_method); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2175 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2176 Qdbus_call_method_asynchronously = intern_c_string ("dbus-call-method-asynchronously"); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2177 staticpro (&Qdbus_call_method_asynchronously); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2178 defsubr (&Sdbus_call_method_asynchronously); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2179 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2180 Qdbus_method_return_internal = intern_c_string ("dbus-method-return-internal"); |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
2181 staticpro (&Qdbus_method_return_internal); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
2182 defsubr (&Sdbus_method_return_internal); |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
2183 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2184 Qdbus_method_error_internal = intern_c_string ("dbus-method-error-internal"); |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2185 staticpro (&Qdbus_method_error_internal); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2186 defsubr (&Sdbus_method_error_internal); |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2187 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2188 Qdbus_send_signal = intern_c_string ("dbus-send-signal"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2189 staticpro (&Qdbus_send_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2190 defsubr (&Sdbus_send_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2191 |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2192 Qdbus_register_service = intern_c_string ("dbus-register-service"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2193 staticpro (&Qdbus_register_service); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2194 defsubr (&Sdbus_register_service); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2195 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2196 Qdbus_register_signal = intern_c_string ("dbus-register-signal"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2197 staticpro (&Qdbus_register_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2198 defsubr (&Sdbus_register_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2199 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2200 Qdbus_register_method = intern_c_string ("dbus-register-method"); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2201 staticpro (&Qdbus_register_method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2202 defsubr (&Sdbus_register_method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
2203 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2204 Qdbus_error = intern_c_string ("dbus-error"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2205 staticpro (&Qdbus_error); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2206 Fput (Qdbus_error, Qerror_conditions, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2207 list2 (Qdbus_error, Qerror)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2208 Fput (Qdbus_error, Qerror_message, |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2209 make_pure_c_string ("D-Bus error")); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2210 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2211 QCdbus_system_bus = intern_c_string (":system"); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2212 staticpro (&QCdbus_system_bus); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2213 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2214 QCdbus_session_bus = intern_c_string (":session"); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2215 staticpro (&QCdbus_session_bus); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2216 |
112182
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2217 QCdbus_request_name_allow_replacement = intern_c_string (":allow-replacement"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2218 staticpro (&QCdbus_request_name_allow_replacement); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2219 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2220 QCdbus_request_name_replace_existing = intern_c_string (":replace-existing"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2221 staticpro (&QCdbus_request_name_replace_existing); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2222 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2223 QCdbus_request_name_do_not_queue = intern_c_string (":do-not-queue"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2224 staticpro (&QCdbus_request_name_do_not_queue); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2225 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2226 QCdbus_request_name_reply_primary_owner = intern_c_string (":primary-owner"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2227 staticpro (&QCdbus_request_name_reply_primary_owner); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2228 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2229 QCdbus_request_name_reply_exists = intern_c_string (":exists"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2230 staticpro (&QCdbus_request_name_reply_exists); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2231 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2232 QCdbus_request_name_reply_in_queue = intern_c_string (":in-queue"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2233 staticpro (&QCdbus_request_name_reply_in_queue); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2234 |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2235 QCdbus_request_name_reply_already_owner = intern_c_string (":already-owner"); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2236 staticpro (&QCdbus_request_name_reply_already_owner); |
e79369283aa1
* dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
Michael Albinus <michael.albinus@gmx.de>
parents:
112113
diff
changeset
|
2237 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2238 QCdbus_timeout = intern_c_string (":timeout"); |
93420
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
2239 staticpro (&QCdbus_timeout); |
629d4147200e
* dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
Michael Albinus <michael.albinus@gmx.de>
parents:
93156
diff
changeset
|
2240 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2241 QCdbus_type_byte = intern_c_string (":byte"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2242 staticpro (&QCdbus_type_byte); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2243 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2244 QCdbus_type_boolean = intern_c_string (":boolean"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2245 staticpro (&QCdbus_type_boolean); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2246 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2247 QCdbus_type_int16 = intern_c_string (":int16"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2248 staticpro (&QCdbus_type_int16); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2249 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2250 QCdbus_type_uint16 = intern_c_string (":uint16"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2251 staticpro (&QCdbus_type_uint16); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2252 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2253 QCdbus_type_int32 = intern_c_string (":int32"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2254 staticpro (&QCdbus_type_int32); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2255 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2256 QCdbus_type_uint32 = intern_c_string (":uint32"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2257 staticpro (&QCdbus_type_uint32); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2258 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2259 QCdbus_type_int64 = intern_c_string (":int64"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2260 staticpro (&QCdbus_type_int64); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2261 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2262 QCdbus_type_uint64 = intern_c_string (":uint64"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2263 staticpro (&QCdbus_type_uint64); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2264 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2265 QCdbus_type_double = intern_c_string (":double"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2266 staticpro (&QCdbus_type_double); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2267 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2268 QCdbus_type_string = intern_c_string (":string"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2269 staticpro (&QCdbus_type_string); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2270 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2271 QCdbus_type_object_path = intern_c_string (":object-path"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2272 staticpro (&QCdbus_type_object_path); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2273 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2274 QCdbus_type_signature = intern_c_string (":signature"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2275 staticpro (&QCdbus_type_signature); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2276 |
111472
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
2277 #ifdef DBUS_TYPE_UNIX_FD |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
2278 QCdbus_type_unix_fd = intern_c_string (":unix-fd"); |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
2279 staticpro (&QCdbus_type_unix_fd); |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
2280 #endif |
943d9b433fca
* dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
Michael Albinus <michael.albinus@gmx.de>
parents:
111311
diff
changeset
|
2281 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2282 QCdbus_type_array = intern_c_string (":array"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2283 staticpro (&QCdbus_type_array); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2284 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2285 QCdbus_type_variant = intern_c_string (":variant"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2286 staticpro (&QCdbus_type_variant); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2287 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2288 QCdbus_type_struct = intern_c_string (":struct"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2289 staticpro (&QCdbus_type_struct); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2290 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2291 QCdbus_type_dict_entry = intern_c_string (":dict-entry"); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2292 staticpro (&QCdbus_type_dict_entry); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
2293 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2294 DEFVAR_LISP ("dbus-registered-buses", |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112278
diff
changeset
|
2295 Vdbus_registered_buses, |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2296 doc: /* List of D-Bus buses we are polling for messages. */); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2297 Vdbus_registered_buses = Qnil; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2298 |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2299 DEFVAR_LISP ("dbus-registered-objects-table", |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112278
diff
changeset
|
2300 Vdbus_registered_objects_table, |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2301 doc: /* Hash table of registered functions for D-Bus. |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2302 |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2303 There are two different uses of the hash table: for accessing |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2304 registered interfaces properties, targeted by signals or method calls, |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2305 and for calling handlers in case of non-blocking method call returns. |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2306 |
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2307 In the first case, the key in the hash table is the list (BUS |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2308 INTERFACE MEMBER). BUS is either a Lisp symbol, `:system' or |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2309 `:session', or a string denoting the bus address. INTERFACE is a |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2310 string which denotes a D-Bus interface, and MEMBER, also a string, is |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2311 either a method, a signal or a property INTERFACE is offering. All |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2312 arguments but BUS must not be nil. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2313 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
2314 The value in the hash table is a list of quadruple lists |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2315 \((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...). |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
2316 SERVICE is the service name as registered, UNAME is the corresponding |
105989
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2317 unique name. In case of registered methods and properties, UNAME is |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2318 nil. PATH is the object path of the sending object. All of them can |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2319 be nil, which means a wildcard then. OBJECT is either the handler to |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2320 be called when a D-Bus message, which matches the key criteria, |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2321 arrives (methods and signals), or a cons cell containing the value of |
3ff20d1c63e0
* dbusbind.c (Vdbus_registered_objects_table): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
105877
diff
changeset
|
2322 the property. |
97165
b0fa771b5389
* dbusbind.c (Fdbus_call_method_asynchronously)
Michael Albinus <michael.albinus@gmx.de>
parents:
96847
diff
changeset
|
2323 |
109961
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2324 In the second case, the key in the hash table is the list (BUS |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2325 SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2326 string denoting the bus address. SERIAL is the serial number of the |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2327 non-blocking method call, a reply is expected. Both arguments must |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2328 not be nil. The value in the hash table is HANDLER, the function to |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2329 be called when the D-Bus reply message arrives. */); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2330 { |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2331 Lisp_Object args[2]; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2332 args[0] = QCtest; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2333 args[1] = Qequal; |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2334 Vdbus_registered_objects_table = Fmake_hash_table (2, args); |
25b9c8c975be
* dbusbind.c: Accept UNIX domain sockets as bus address.
Michael Albinus <michael.albinus@gmx.de>
parents:
109371
diff
changeset
|
2335 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2336 |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112278
diff
changeset
|
2337 DEFVAR_LISP ("dbus-debug", Vdbus_debug, |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
2338 doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2339 #ifdef DBUS_DEBUG |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2340 Vdbus_debug = Qt; |
110840
eb0cb131cf06
* dbusbind.c (syms_of_dbusbind): Move putenv call ...
Michael Albinus <michael.albinus@gmx.de>
parents:
110823
diff
changeset
|
2341 /* We can also set environment variable DBUS_VERBOSE=1 in order to |
eb0cb131cf06
* dbusbind.c (syms_of_dbusbind): Move putenv call ...
Michael Albinus <michael.albinus@gmx.de>
parents:
110823
diff
changeset
|
2342 see more traces. This requires libdbus-1 to be configured with |
eb0cb131cf06
* dbusbind.c (syms_of_dbusbind): Move putenv call ...
Michael Albinus <michael.albinus@gmx.de>
parents:
110823
diff
changeset
|
2343 --enable-verbose-mode. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2344 #else |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2345 Vdbus_debug = Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2346 #endif |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2347 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105749
diff
changeset
|
2348 Fprovide (intern_c_string ("dbusbind"), Qnil); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2349 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2350 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2351 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2352 #endif /* HAVE_DBUS */ |
87053 | 2353 |