Blame _dbus_bindings/types-internal.h

Packit 130fc8
/* D-Bus types: implementation internals
Packit 130fc8
 *
Packit 130fc8
 * Copyright (C) 2006-2007 Collabora Ltd. <http://www.collabora.co.uk/>
Packit 130fc8
 *
Packit 130fc8
 * Permission is hereby granted, free of charge, to any person
Packit 130fc8
 * obtaining a copy of this software and associated documentation
Packit 130fc8
 * files (the "Software"), to deal in the Software without
Packit 130fc8
 * restriction, including without limitation the rights to use, copy,
Packit 130fc8
 * modify, merge, publish, distribute, sublicense, and/or sell copies
Packit 130fc8
 * of the Software, and to permit persons to whom the Software is
Packit 130fc8
 * furnished to do so, subject to the following conditions:
Packit 130fc8
 *
Packit 130fc8
 * The above copyright notice and this permission notice shall be
Packit 130fc8
 * included in all copies or substantial portions of the Software.
Packit 130fc8
 *
Packit 130fc8
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 130fc8
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 130fc8
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 130fc8
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit 130fc8
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
Packit 130fc8
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Packit 130fc8
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
Packit 130fc8
 * DEALINGS IN THE SOFTWARE.
Packit 130fc8
 */
Packit 130fc8
Packit 130fc8
#include "dbus_bindings-internal.h"
Packit 130fc8
Packit 130fc8
#include <Python.h>
Packit 130fc8
Packit 130fc8
/* In Python2 >= 2.6 this aliases PyString to PyBytes.  There is no PyString
Packit 130fc8
 * in Python 3, so this allows the C extension to be compilable in both Python
Packit 130fc8
 * versions.
Packit 130fc8
 */
Packit 130fc8
#include <bytesobject.h>
Packit 130fc8
Packit 130fc8
/* In Python 2.x, we need this to define the type of PyLongObject */
Packit 130fc8
#ifndef PY3
Packit 130fc8
#include <longintrepr.h>
Packit 130fc8
#endif
Packit 130fc8
Packit 130fc8
#ifndef DBUS_BINDINGS_TYPES_INTERNAL_H
Packit 130fc8
#define DBUS_BINDINGS_TYPES_INTERNAL_H
Packit 130fc8
Packit 130fc8
#ifndef PY3
Packit 130fc8
extern PyTypeObject DBusPyIntBase_Type;
Packit 130fc8
DEFINE_CHECK(DBusPyIntBase)
Packit 130fc8
Packit 130fc8
typedef struct {
Packit 130fc8
    PyIntObject base;
Packit 130fc8
    long variant_level;
Packit 130fc8
} DBusPyIntBase;
Packit 130fc8
#endif
Packit 130fc8
Packit 130fc8
extern PyTypeObject DBusPyLongBase_Type;
Packit 130fc8
DEFINE_CHECK(DBusPyLongBase)
Packit 130fc8
Packit 130fc8
extern PyTypeObject DBusPyFloatBase_Type;
Packit 130fc8
DEFINE_CHECK(DBusPyFloatBase)
Packit 130fc8
Packit 130fc8
typedef struct {
Packit 130fc8
    PyFloatObject base;
Packit 130fc8
    long variant_level;
Packit 130fc8
} DBusPyFloatBase;
Packit 130fc8
Packit 130fc8
typedef struct {
Packit 130fc8
    PyUnicodeObject unicode;
Packit 130fc8
    long variant_level;
Packit 130fc8
} DBusPyString;
Packit 130fc8
Packit 130fc8
extern PyTypeObject DBusPyStrBase_Type;
Packit 130fc8
DEFINE_CHECK(DBusPyStrBase)
Packit 130fc8
Packit 130fc8
#ifdef PY3
Packit 130fc8
extern PyTypeObject DBusPyBytesBase_Type;
Packit 130fc8
DEFINE_CHECK(DBusPyBytesBase)
Packit 130fc8
#endif
Packit 130fc8
Packit 130fc8
dbus_int16_t dbus_py_int16_range_check(PyObject *);
Packit 130fc8
dbus_uint16_t dbus_py_uint16_range_check(PyObject *);
Packit 130fc8
dbus_int32_t dbus_py_int32_range_check(PyObject *);
Packit 130fc8
dbus_uint32_t dbus_py_uint32_range_check(PyObject *);
Packit 130fc8
Packit 130fc8
#if defined(DBUS_HAVE_INT64) && defined(HAVE_LONG_LONG)
Packit 130fc8
#   define DBUS_PYTHON_64_BIT_WORKS 1
Packit 130fc8
dbus_int64_t dbus_py_int64_range_check(PyObject *);
Packit 130fc8
dbus_uint64_t dbus_py_uint64_range_check(PyObject *);
Packit 130fc8
#else
Packit 130fc8
#   undef DBUS_PYTHON_64_BIT_WORKS
Packit 130fc8
#endif /* defined(DBUS_HAVE_INT64) && defined(HAVE_LONG_LONG) */
Packit 130fc8
Packit 130fc8
extern PyObject *dbus_py_variant_level_const;
Packit 130fc8
extern PyObject *dbus_py_signature_const;
Packit 130fc8
extern PyObject *dbus_py__dbus_object_path__const;
Packit 130fc8
Packit 130fc8
typedef struct {
Packit 130fc8
    PyListObject super;
Packit 130fc8
    PyObject *signature;
Packit 130fc8
    long variant_level;
Packit 130fc8
} DBusPyArray;
Packit 130fc8
Packit 130fc8
typedef struct {
Packit 130fc8
    PyDictObject super;
Packit 130fc8
    PyObject *signature;
Packit 130fc8
    long variant_level;
Packit 130fc8
} DBusPyDict;
Packit 130fc8
Packit 130fc8
PyObject *dbus_py_variant_level_getattro(PyObject *obj, PyObject *name);
Packit 130fc8
dbus_bool_t dbus_py_variant_level_set(PyObject *obj, long variant_level);
Packit 130fc8
void dbus_py_variant_level_clear(PyObject *obj);
Packit 130fc8
long dbus_py_variant_level_get(PyObject *obj);
Packit 130fc8
Packit 130fc8
#endif