_dbus_bindings: debug-impl.h -> debug.c
[dbus-python-phuang.git] / _dbus_bindings / dbus_bindings-internal.h
blobeace329d93ce197f26cb3117448a6587bbd74d12
1 /* _dbus_bindings internal API. For use within _dbus_bindings only.
3 * Copyright (C) 2006 Collabora Ltd. <http://www.collabora.co.uk/>
5 * Licensed under the Academic Free License version 2.1
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef DBUS_BINDINGS_INTERNAL_H
26 #define DBUS_BINDINGS_INTERNAL_H
28 #include <Python.h>
29 #define INSIDE_DBUS_BINDINGS
30 #include "dbus_bindings.h"
32 /* no need for extern "C", this is only for internal use */
34 /* on/off switch for debugging support (see below) */
35 #undef USING_DBG
36 /* #define USING_DBG */
38 /* conn.c */
39 extern PyTypeObject DBusPyConnectionType;
40 #define DBusPyConnection_Check(o) PyObject_TypeCheck(o, &DBusPyConnectionType)
41 extern PyObject *DBusPyConnection_NewConsumingDBusConnection(PyTypeObject *,
42 DBusConnection *,
43 PyObject *);
44 extern dbus_bool_t dbus_py_init_conn_types(void);
45 extern dbus_bool_t dbus_py_insert_conn_types(PyObject *this_module);
47 /* bus.c */
48 extern dbus_bool_t dbus_py_init_bus_types(void);
49 extern dbus_bool_t dbus_py_insert_bus_types(PyObject *this_module);
51 /* exceptions.c */
52 extern PyObject *DBusPyException;
53 extern PyObject *DBusPyException_ConsumeError(DBusError *error);
55 /* generic */
56 extern void dbus_py_take_gil_and_xdecref(PyObject *);
58 /* message.c */
59 extern DBusMessage *DBusPyMessage_BorrowDBusMessage(PyObject *msg);
60 extern PyObject *DBusPyMessage_ConsumeDBusMessage(DBusMessage *);
62 /* pending-call.c */
63 extern PyObject *DBusPyPendingCall_ConsumeDBusPendingCall(DBusPendingCall *,
64 PyObject *);
66 /* mainloop.c */
67 extern dbus_bool_t dbus_py_set_up_connection(PyObject *conn,
68 PyObject *mainloop);
69 extern PyObject *dbus_py_get_default_main_loop(void);
71 /* validation.c */
72 dbus_bool_t dbus_py_validate_bus_name(const char *name,
73 dbus_bool_t may_be_unique,
74 dbus_bool_t may_be_not_unique);
75 dbus_bool_t dbus_py_validate_member_name(const char *name);
76 dbus_bool_t dbus_py_validate_interface_name(const char *name);
77 dbus_bool_t dbus_py_validate_object_path(const char *path);
78 #define dbus_py_validate_error_name dbus_py_validate_interface_name
80 /* debugging support */
81 #ifdef USING_DBG
83 # include <sys/types.h>
84 # include <unistd.h>
86 void _dbus_py_dbg_exc(void);
87 void _dbus_py_dbg_dump_message(DBusMessage *);
89 # define DBG(format, ...) fprintf(stderr, "DEBUG: " format "\n",\
90 __VA_ARGS__)
91 # define DBG_EXC(format, ...) do {DBG(format, __VA_ARGS__); \
92 _dbus_py_dbg_exc();} while (0)
93 # define DBG_DUMP_MESSAGE(x) _dbg_dump_message(x)
95 #else /* !defined(USING_DBG) */
97 # define DBG(format, ...) do {} while (0)
98 # define DBG_EXC(format, ...) do {} while (0)
99 # define DBG_DUMP_MESSAGE(x) do {} while(0)
101 #endif /* !defined(USING_DBG) */
103 /* General-purpose Python glue */
105 #define DEFERRED_ADDRESS(ADDR) 0
107 #if defined(__GNUC__)
108 # if __GNUC__ >= 3
109 # define UNUSED __attribute__((__unused__))
110 # else
111 # define UNUSED /*nothing*/
112 # endif
113 #else
114 # define UNUSED /*nothing*/
115 #endif
117 #endif