1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2018 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt for Python. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 ** packaging of this file. Please review the following information to 22 ** ensure the GNU Lesser General Public License version 3 requirements 23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 ** 25 ** GNU General Public License Usage 26 ** Alternatively, this file may be used under the terms of the GNU 27 ** General Public License version 2.0 or (at your option) the GNU General 28 ** Public license version 3 or any later version approved by the KDE Free 29 ** Qt Foundation. The licenses are as published by the Free Software 30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 ** included in the packaging of this file. Please review the following 32 ** information to ensure the GNU General Public License requirements will 33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 ** https://www.gnu.org/licenses/gpl-3.0.html. 35 ** 36 ** $QT_END_LICENSE$ 37 ** 38 ****************************************************************************/ 39 40 #ifndef TYPESPEC_H 41 #define TYPESPEC_H 42 43 #include "sbkpython.h" 44 #include "shibokenmacros.h" 45 46 #if PY_MAJOR_VERSION < 3 47 extern "C" 48 { 49 50 typedef struct{ 51 int slot; // slot is somehow reserved in Qt /* slot id, see below */ 52 void *pfunc; /* function pointer */ 53 } PyType_Slot; 54 55 typedef struct{ 56 const char *name; 57 int basicsize; 58 int itemsize; 59 unsigned int flags; 60 PyType_Slot *slots; /* terminated by slot==0. */ 61 } PyType_Spec; 62 63 LIBSHIBOKEN_API PyObject *PyType_FromSpec(PyType_Spec *); 64 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 65 LIBSHIBOKEN_API PyObject *PyType_FromSpecWithBases(PyType_Spec *, PyObject *); 66 #endif 67 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 68 LIBSHIBOKEN_API void *PyType_GetSlot(PyTypeObject *, int); 69 #endif 70 71 // from typeslots.h 72 /* Do not renumber the file; these numbers are part of the stable ABI. */ 73 /* Disabled, see #10181 */ 74 #undef Py_bf_getbuffer 75 #undef Py_bf_releasebuffer 76 #define Py_mp_ass_subscript 3 77 #define Py_mp_length 4 78 #define Py_mp_subscript 5 79 #define Py_nb_absolute 6 80 #define Py_nb_add 7 81 #define Py_nb_and 8 82 #define Py_nb_nonzero 9 83 #define Py_nb_divmod 10 84 #define Py_nb_float 11 85 #define Py_nb_floor_divide 12 86 #define Py_nb_index 13 87 #define Py_nb_inplace_add 14 88 #define Py_nb_inplace_and 15 89 #define Py_nb_inplace_floor_divide 16 90 #define Py_nb_inplace_lshift 17 91 #define Py_nb_inplace_multiply 18 92 #define Py_nb_inplace_or 19 93 #define Py_nb_inplace_power 20 94 #define Py_nb_inplace_remainder 21 95 #define Py_nb_inplace_rshift 22 96 #define Py_nb_inplace_subtract 23 97 #define Py_nb_inplace_true_divide 24 98 #define Py_nb_inplace_xor 25 99 #define Py_nb_int 26 100 #define Py_nb_invert 27 101 #define Py_nb_lshift 28 102 #define Py_nb_multiply 29 103 #define Py_nb_negative 30 104 #define Py_nb_or 31 105 #define Py_nb_positive 32 106 #define Py_nb_power 33 107 #define Py_nb_remainder 34 108 #define Py_nb_rshift 35 109 #define Py_nb_subtract 36 110 #define Py_nb_true_divide 37 111 #define Py_nb_xor 38 112 #define Py_sq_ass_item 39 113 #define Py_sq_concat 40 114 #define Py_sq_contains 41 115 #define Py_sq_inplace_concat 42 116 #define Py_sq_inplace_repeat 43 117 #define Py_sq_item 44 118 #define Py_sq_length 45 119 #define Py_sq_repeat 46 120 #define Py_tp_alloc 47 121 #define Py_tp_base 48 122 #define Py_tp_bases 49 123 #define Py_tp_call 50 124 #define Py_tp_clear 51 125 #define Py_tp_dealloc 52 126 #define Py_tp_del 53 127 #define Py_tp_descr_get 54 128 #define Py_tp_descr_set 55 129 #define Py_tp_doc 56 130 #define Py_tp_getattr 57 131 #define Py_tp_getattro 58 132 #define Py_tp_hash 59 133 #define Py_tp_init 60 134 #define Py_tp_is_gc 61 135 #define Py_tp_iter 62 136 #define Py_tp_iternext 63 137 #define Py_tp_methods 64 138 #define Py_tp_new 65 139 #define Py_tp_repr 66 140 #define Py_tp_richcompare 67 141 #define Py_tp_setattr 68 142 #define Py_tp_setattro 69 143 #define Py_tp_str 70 144 #define Py_tp_traverse 71 145 #define Py_tp_members 72 146 #define Py_tp_getset 73 147 #define Py_tp_free 74 148 #define Py_nb_long 75 149 #define Py_nb_divide 76 150 #define Py_sq_slice 77 151 } // extern "C" 152 #endif // PY_MAJOR_VERSION < 3 153 #endif // TYPESPEC_H 154