1#ifndef CPYCPPYY_CPYCPPYY_H
2#define CPYCPPYY_CPYCPPYY_H
6#pragma warning (disable : 4275)
8#pragma warning (disable : 4251)
10#pragma warning (disable : 4800)
24#ifdef _FILE_OFFSET_BITS
25#undef _FILE_OFFSET_BITS
34#define PY_SSIZE_T_CLEAN
43#if PY_VERSION_HEX < 0x03030000
44 typedef PyDictEntry* (*dict_lookup_func)(PyDictObject*,
PyObject*, long);
46#if PY_VERSION_HEX >= 0x030b0000
49#elif PY_VERSION_HEX >= 0x03060000
53 struct PyDictKeyEntry;
55#define PyDictEntry PyDictKeyEntry
60#if PY_VERSION_HEX < 0x03000000
61#define PyBytes_Check PyString_Check
62#define PyBytes_CheckExact PyString_CheckExact
63#define PyBytes_AS_STRING PyString_AS_STRING
64#define PyBytes_AsString PyString_AsString
65#define PyBytes_AsStringAndSize PyString_AsStringAndSize
66#define PyBytes_GET_SIZE PyString_GET_SIZE
67#define PyBytes_Size PyString_Size
68#define PyBytes_FromFormat PyString_FromFormat
69#define PyBytes_FromString PyString_FromString
70#define PyBytes_FromStringAndSize PyString_FromStringAndSize
72#define PyBytes_Type PyString_Type
74#define CPyCppyy_PyText_Check PyString_Check
75#define CPyCppyy_PyText_CheckExact PyString_CheckExact
76#define CPyCppyy_PyText_AsString PyString_AS_STRING
77#define CPyCppyy_PyText_AsStringChecked PyString_AsString
78#define CPyCppyy_PyText_GET_SIZE PyString_GET_SIZE
79#define CPyCppyy_PyText_GetSize PyString_Size
80#define CPyCppyy_PyText_FromFormat PyString_FromFormat
81#define CPyCppyy_PyText_FromString PyString_FromString
82#define CPyCppyy_PyText_InternFromString PyString_InternFromString
83#define CPyCppyy_PyText_Append PyString_Concat
84#define CPyCppyy_PyText_AppendAndDel PyString_ConcatAndDel
85#define CPyCppyy_PyText_FromStringAndSize PyString_FromStringAndSize
94#define CPyCppyy_PyText_Type PyString_Type
96#define CPyCppyy_PyUnicode_GET_SIZE PyUnicode_GET_SIZE
99 void* cobj,
const char* ,
void (*destr)(
void*))
101 return PyCObject_FromVoidPtr(cobj, destr);
103#define CPyCppyy_PyCapsule_CheckExact PyCObject_Check
106 return (
void*)PyCObject_AsVoidPtr(capsule);
109#define CPPYY__long__ "__long__"
110#define CPPYY__idiv__ "__idiv__"
111#define CPPYY__div__ "__div__"
112#define CPPYY__next__ "next"
119#if PY_VERSION_HEX >= 0x03000000
120#define CPyCppyy_PyText_Check PyUnicode_Check
121#define CPyCppyy_PyText_CheckExact PyUnicode_CheckExact
122#define CPyCppyy_PyText_AsString PyUnicode_AsUTF8
123#define CPyCppyy_PyText_AsStringChecked PyUnicode_AsUTF8
124#define CPyCppyy_PyText_GetSize PyUnicode_GetSize
125#if PY_VERSION_HEX < 0x03090000
126#define CPyCppyy_PyText_GET_SIZE PyUnicode_GET_SIZE
127#define CPyCppyy_PyUnicode_GET_SIZE PyUnicode_GET_LENGTH
129#define CPyCppyy_PyText_GET_SIZE PyUnicode_GET_LENGTH
130#define CPyCppyy_PyUnicode_GET_SIZE PyUnicode_GET_LENGTH
132#define CPyCppyy_PyText_FromFormat PyUnicode_FromFormat
133#define CPyCppyy_PyText_FromString PyUnicode_FromString
134#define CPyCppyy_PyText_InternFromString PyUnicode_InternFromString
135#define CPyCppyy_PyText_Append PyUnicode_Append
136#define CPyCppyy_PyText_AppendAndDel PyUnicode_AppendAndDel
137#define CPyCppyy_PyText_FromStringAndSize PyUnicode_FromStringAndSize
139#if PY_VERSION_HEX >= 0x03030000
140#define _CPyCppyy_PyText_AsStringAndSize PyUnicode_AsUTF8AndSize
142#define _CPyCppyy_PyText_AsStringAndSize PyUnicode_AsStringAndSize
147 const char* cstr = _CPyCppyy_PyText_AsStringAndSize(pystr,
size);
155#define CPyCppyy_PyText_Type PyUnicode_Type
157#define PyIntObject PyLongObject
158#define PyInt_Check PyLong_Check
159#define PyInt_AsLong PyLong_AsLong
160#define PyInt_AS_LONG PyLong_AsLong
161#define PyInt_AsSsize_t PyLong_AsSsize_t
162#define PyInt_CheckExact PyLong_CheckExact
163#define PyInt_FromLong PyLong_FromLong
164#define PyInt_FromSsize_t PyLong_FromSsize_t
166#define PyInt_Type PyLong_Type
168#define CPyCppyy_PyCapsule_New PyCapsule_New
169#define CPyCppyy_PyCapsule_CheckExact PyCapsule_CheckExact
170#define CPyCppyy_PyCapsule_GetPointer PyCapsule_GetPointer
172#define CPPYY__long__ "__int__"
173#define CPPYY__idiv__ "__itruediv__"
174#define CPPYY__div__ "__truediv__"
175#define CPPYY__next__ "__next__"
177#define Py_TPFLAGS_HAVE_RICHCOMPARE 0
178#define Py_TPFLAGS_CHECKTYPES 0
180#define PyClass_Check PyType_Check
182#define PyBuffer_Type PyMemoryView_Type
185#if PY_VERSION_HEX >= 0x03020000
186#define CPyCppyy_PySliceCast PyObject*
187#define PyUnicode_GetSize PyUnicode_GetLength
189#define CPyCppyy_PySliceCast PySliceObject*
193#if PY_VERSION_HEX < 0x02060000
194#define PyVarObject_HEAD_INIT(type, size) \
195 PyObject_HEAD_INIT(type) size,
196#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
200#if PY_VERSION_HEX < 0x03020000
203#if PY_VERSION_HEX < 0x02050000
204 return (
Py_ssize_t)PyUnicode_AsWideChar((PyUnicodeObject*)pyobj,
w, (
int)
size);
206 return PyUnicode_AsWideChar((PyUnicodeObject*)pyobj,
w,
size);
210#define CPyCppyy_PyUnicode_AsWideChar PyUnicode_AsWideChar
214#if PY_VERSION_HEX < 0x02050000
216#define PyInt_AsSsize_t PyInt_AsLong
217#define PyInt_FromSsize_t PyInt_FromLong
218# define PY_SSIZE_T_FORMAT "%d"
219# if !defined(PY_SSIZE_T_MIN)
220# define PY_SSIZE_T_MAX INT_MAX
221# define PY_SSIZE_T_MIN INT_MIN
223#define ssizeobjargproc intobjargproc
224#define lenfunc inquiry
225#define ssizeargfunc intargfunc
227#define PyIndex_Check(obj) \
228 (PyInt_Check(obj) || PyLong_Check(obj))
236# if SIZEOF_SIZE_T == SIZEOF_INT
237# if defined(MAC_OS_X_VERSION_10_4)
238# define PY_SSIZE_T_FORMAT "%ld"
240# define PY_SSIZE_T_FORMAT "%d"
242# elif SIZEOF_SIZE_T == SIZEOF_LONG
243# define PY_SSIZE_T_FORMAT "%ld"
246# define PY_SSIZE_T_FORMAT "%zd"
250#if PY_VERSION_HEX < 0x02020000
251#define PyBool_FromLong PyInt_FromLong
254#if PY_VERSION_HEX < 0x03000000
258#define Py_False ((PyObject*)(void*)&_Py_ZeroStruct)
263#define Py_True ((PyObject*)(void*)&_Py_TrueStruct)
267#ifndef Py_RETURN_NONE
268#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
271#ifndef Py_RETURN_TRUE
272#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
275#ifndef Py_RETURN_FALSE
276#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
279#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03010000
280#define CPyCppyy_PyBuffer PyBuffer_Release
283 PyBuffer_Release(view);
288#if PY_VERSION_HEX >= 0x03090000
289#define CPyCppyy_PyCFunction_Call PyObject_Call
291#define CPyCppyy_PyCFunction_Call PyCFunction_Call
295#if PY_VERSION_HEX >= 0x03080000
301 return ((
PyObject**)args)[i] = item;
304 return PyVectorcall_NARGS(nargsf);
310 PyMem_Free((
void*)args);
312#if PY_VERSION_HEX >= 0x03090000
313#define CPyCppyy_PyObject_Call PyObject_Vectorcall
315#define CPyCppyy_PyObject_Call _PyObject_Vectorcall
320 vectorcallfunc func = *(vectorcallfunc*)(((
char*)cb) +
offset);
321 return func(cb, args, nargsf, kwds);
324#ifndef Py_TPFLAGS_HAVE_VECTORCALL
325#define Py_TPFLAGS_HAVE_VECTORCALL _Py_TPFLAGS_HAVE_VECTORCALL
332 return PyTuple_GET_ITEM(args, i);
335 return PyTuple_SET_ITEM(args, i, item);
338 return PyTuple_GET_SIZE(args);
341 return PyTuple_New(
N);
347 return PyObject_Call(cb, args, kwds);
350 return Py_TYPE(cb)->tp_call(cb, args, kwds);
355#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
358#define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type)
362#if PY_VERSION_HEX < 0x03090000
364 return PyObject_CallMethodObjArgs(obj,
name,
nullptr);
368 return PyObject_CallMethodObjArgs(obj,
name, arg,
nullptr);
static Py_ssize_t CPyCppyy_PyUnicode_AsWideChar(PyObject *pyobj, wchar_t *w, Py_ssize_t size)
static void CPyCppyy_PyArgs_DEL(CPyCppyy_PyArgs_t args)
PyDictEntry *(* dict_lookup_func)(PyDictObject *, PyObject *, long)
#define PyBytes_AsStringAndSize
Py_ssize_t PyNumber_AsSsize_t(PyObject *obj, PyObject *)
static void * CPyCppyy_PyCapsule_GetPointer(PyObject *capsule, const char *)
static PyObject * CPyCppyy_PyArgs_SET_ITEM(CPyCppyy_PyArgs_t args, Py_ssize_t i, PyObject *item)
static Py_ssize_t CPyCppyy_PyArgs_GET_SIZE(CPyCppyy_PyArgs_t args, size_t)
PyObject * CPyCppyy_PyArgs_t
static PyObject * CPyCppyy_PyCapsule_New(void *cobj, const char *, void(*destr)(void *))
#define CPyCppyy_PyText_GetSize
void CPyCppyy_PyBuffer_Release(PyObject *, Py_buffer *view)
static PyObject * PyObject_CallMethodOneArg(PyObject *obj, PyObject *name, PyObject *arg)
PyObject * CPyCppyy_PyObject_Call(PyObject *cb, PyObject *args, size_t, PyObject *kwds)
#define PyBytes_CheckExact
static const char * CPyCppyy_PyText_AsStringAndSize(PyObject *pystr, Py_ssize_t *size)
static void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
#define CPyCppyy_PyText_AsStringChecked
PyObject * CPyCppyy_tp_call(PyObject *cb, PyObject *args, size_t, PyObject *kwds)
static PyObject * PyObject_CallMethodNoArgs(PyObject *obj, PyObject *name)
static CPyCppyy_PyArgs_t CPyCppyy_PyArgs_New(Py_ssize_t N)
static PyObject * CPyCppyy_PyArgs_GET_ITEM(CPyCppyy_PyArgs_t args, Py_ssize_t i)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type