39 GILControl() : fSave(PyEval_SaveThread()) {}
40 ~GILControl() { PyEval_RestoreThread(fSave); }
50#define CPPJIT_IMPL_GILCALL(rtype, tcode) \
51 static inline rtype GILCall##tcode(interop::TCppMethod_t method, \
52 interop::TCppObject_t self, \
53 cpyrt::CallContext* ctxt) { \
54 if (!ReleasesGIL(ctxt)) \
55 return interop::Call##tcode(method, self, ctxt->GetEncodedSize(), \
58 return interop::Call##tcode(method, self, ctxt->GetEncodedSize(), \
62#define CPPJIT_IMPL_GILCALL(rtype, tcode) \
63 static inline rtype GILCall##tcode(interop::TCppMethod_t method, \
64 interop::TCppObject_t self, \
65 cpyrt::CallContext* ctxt) { \
66 return interop::Call##tcode(method, self, ctxt->GetEncodedSize(), \
85static inline interop::TCppObject_t
GILCallO(interop::TCppMethod_t method,
86 interop::TCppObject_t self,
88 interop::TCppScope_t klass) {
93 return interop::CallO(method, self, ctxt->GetEncodedSize(), ctxt->GetArgs(),
97 return interop::CallO(method, self, ctxt->GetEncodedSize(), ctxt->GetArgs(),
119 if (cl < -256 || cl > 255) {
120 PyErr_SetString(PyExc_ValueError,
"char conversion out of range");
125 return PyUnicode_FromFormat(
"%c", 256 - std::abs(
c));
126 return PyUnicode_FromFormat(
"%c",
c);
132 PyErr_SetString(PyExc_ValueError,
"char conversion out of range");
136 return PyUnicode_FromFormat(
"%c",
c);
154 bool retval =
GILCallB(method, self, ctxt);
209 return PyLong_FromLong(*((int8_t*)
GILCallR(method, self, ctxt)));
216 return PyLong_FromLong(*((uint8_t*)
GILCallR(method, self, ctxt)));
225 wchar_t res = (wchar_t)
GILCallL(method, self, ctxt);
226 return PyUnicode_FromWideChar(&res, 1);
235 char16_t res = (char16_t)
GILCallL(method, self, ctxt);
236 return PyUnicode_DecodeUTF16((
const char*)&res,
sizeof(
char16_t),
nullptr,
246 char32_t res = (char32_t)
GILCallL(method, self, ctxt);
247 return PyUnicode_DecodeUTF32((
const char*)&res,
sizeof(
char32_t),
nullptr,
257 return PyLong_FromLong((
int)
GILCallI(method, self, ctxt));
266 return PyLong_FromLong((int8_t)
GILCallC(method, self, ctxt));
275 return PyLong_FromLong((uint8_t)
GILCallB(method, self, ctxt));
284 return PyLong_FromLong((
short)
GILCallH(method, self, ctxt));
293 return PyLong_FromLong((
long)
GILCallL(method, self, ctxt));
302 return PyLong_FromUnsignedLong((
unsigned long)
GILCallLL(method, self, ctxt));
312 return PyLong_FromLongLong(
result);
322 return PyLong_FromUnsignedLongLong(
result);
331 return PyFloat_FromDouble((
double)
GILCallF(method, self, ctxt));
340 return PyFloat_FromDouble((
double)
GILCallD(method, self, ctxt));
349 return PyFloat_FromDouble((
double)
GILCallLD(method, self, ctxt));
357 fAssignable = pyobject;
361 fAssignable =
nullptr;
366#define CPPJIT_IMPL_REFEXEC(name, type, stype, F1, F2) \
367 PyObject* cpyrt::name##RefExecutor::Execute(interop::TCppMethod_t method, \
368 interop::TCppObject_t self, \
369 CallContext* ctxt) { \
370 type* ref = (type*)GILCallR(method, self, ctxt); \
372 PyErr_SetString(PyExc_ReferenceError, \
373 "attempt to access a null-pointer"); \
377 return F1((stype) * ref); \
379 *ref = (type)F2(fAssignable); \
380 Py_DECREF(fAssignable); \
381 fAssignable = nullptr; \
382 if (*ref == (type) - 1 && PyErr_Occurred()) \
384 Py_INCREF(Py_None); \
410 return PyComplex_FromDoubles(
c.real(),
c.imag());
415 Py_complex cplx = PyComplex_AsCComplex(pycplx);
416 return std::complex<T>(cplx.real, cplx.imag);
420 PyComplex_FromComplex<double>, PyComplex_AsComplex<double>)
430 return PyUnicode_FromStringAndSize(
result->c_str(),
result->size());
433 if (!PyUnicode_Check(fAssignable)) {
434 PyErr_Format(PyExc_TypeError,
"wrong type in assignment (string expected)");
438 *
result = std::string(PyUnicode_AsUTF8(fAssignable),
439 PyUnicode_GET_LENGTH(fAssignable));
441 Py_DECREF(fAssignable);
442 fAssignable =
nullptr;
453 if (PyErr_Occurred())
470 return PyUnicode_FromString(
result);
485 return PyUnicode_FromString(*
result);
497 return PyUnicode_FromWideChar(&
w, 0);
512 return PyUnicode_DecodeUTF16((
const char*)&
w, 0,
nullptr,
nullptr);
515 return PyUnicode_DecodeUTF16((
const char*)
result,
516 std::char_traits<char16_t>::length(
result) *
530 return PyUnicode_DecodeUTF32((
const char*)&
w, 0,
nullptr,
nullptr);
533 return PyUnicode_DecodeUTF32((
const char*)
result,
534 std::char_traits<char32_t>::length(
result) *
554#define CPPJIT_IMPL_ARRAY_EXEC(name, type, suffix) \
555 PyObject* cpyrt::name##ArrayExecutor::Execute(interop::TCppMethod_t method, \
556 interop::TCppObject_t self, \
557 CallContext* ctxt) { \
558 return CreateLowLevelView##suffix((type*)GILCallR(method, self, ctxt), \
587#define CPPJIT_COMPLEX_EXEC(code, type) \
588 PyObject* cpyrt::Complex##code##Executor::Execute( \
589 interop::TCppMethod_t method, interop::TCppObject_t self, \
590 CallContext* ctxt) { \
591 static interop::TCppScope_t scopeid = \
592 interop::GetScope("std::complex<" #type ">"); \
593 std::complex<type>* result = \
594 (std::complex<type>*)GILCallO(method, self, ctxt, scopeid).data; \
596 PyErr_SetString(PyExc_ValueError, \
597 "NULL result where temporary expected"); \
601 PyObject* pyres = PyComplex_FromDoubles(result->real(), result->imag()); \
602 ::operator delete(result); \
619 (std::string*)
GILCallO(method, self, ctxt, sSTLStringScope).data;
624 if (PyErr_Occurred()) {
630 PyUnicode_FromStringAndSize(
result->c_str(),
result->size());
646 (std::wstring*)
GILCallO(method, self, ctxt, sSTLWStringScope).data;
649 return PyUnicode_FromWideChar(&
w, 0);
682 if (!PyErr_Occurred())
683 PyErr_Format(PyExc_ValueError,
684 "cannot allocate the temporary returned by '%s': the size "
685 "of its return type is unknown",
702 : InstanceExecutor(klass) {
714 if (!
result || !fAssignable)
722 if (descr && PyUnicode_CheckExact(descr)) {
723 PyErr_Format(PyExc_TypeError,
"cannot assign to return object (%s)",
724 PyUnicode_AsUTF8(descr));
726 PyErr_SetString(PyExc_TypeError,
"cannot assign to result");
730 Py_DECREF(fAssignable);
731 fAssignable =
nullptr;
736 PyObject_CallFunction(assign,
const_cast<char*
>(
"O"), fAssignable);
740 Py_DECREF(fAssignable);
741 fAssignable =
nullptr;
754 PyObject* pystr = PyObject_Str(pyobj);
756 PyErr_Format(PyExc_TypeError,
"C++ object expected, got %s",
757 PyUnicode_AsUTF8(pystr));
760 PyErr_SetString(PyExc_TypeError,
"C++ object expected");
780 Py_DECREF(fAssignable);
781 fAssignable =
nullptr;
802 Py_DECREF(fAssignable);
803 fAssignable =
nullptr;
848 void* address = (
void*)
GILCallR(method, self, ctxt);
872 if (fullType.empty())
878 return (
h->second)(dims);
884 if (resolvedType != fullType) {
887 return (
h->second)(dims);
892 bool isConst = strncmp(resolvedType.c_str(),
"const", 5) == 0;
899 return (
h->second)(dims);
907 return (
h->second)(dims);
911 if (!cpd.empty() && (std::string::size_type)std::count(cpd.begin(), cpd.end(),
912 '*') == cpd.size()) {
915 return (
h->second)((!dims || dims.
ndim() < (
dim_t)cpd.size())
924 return (
h->second)(dims);
933 return new IteratorExecutor(klass);
937 result =
new InstanceExecutor(klass);
939 result =
new InstanceRefExecutor(klass);
940 else if (cpd ==
"**" || cpd ==
"*[]" || cpd ==
"&*")
941 result =
new InstancePtrPtrExecutor(klass);
942 else if (cpd ==
"*&")
943 result =
new InstancePtrRefExecutor(klass);
944 else if (cpd ==
"[]") {
947 result =
new InstanceArrayExecutor(klass, asize);
949 result =
new InstancePtrRefExecutor(klass);
951 result =
new InstancePtrExecutor(klass);
952 }
else if (resolvedType.find(
"(*)") != std::string::npos ||
953 (resolvedType.find(
"::*)") != std::string::npos)) {
956 auto pos1 = resolvedType.find(
'(');
957 auto pos2 = resolvedType.find(
"*)");
958 auto pos3 = resolvedType.rfind(
')');
959 result =
new FunctionPointerExecutor(
960 resolvedType.substr(0, pos1),
961 resolvedType.substr(pos2 + 2, pos3 - pos2 - 1));
989 if (fullType.size() >= 2 &&
990 fullType.compare(fullType.size() - 2, 2,
" &") == 0)
991 fullType = fullType.substr(0, fullType.size() - 2) +
"&";
995 return (
h->second)(dims);
1010 resolvedTypeStr.erase(
1011 std::remove(resolvedTypeStr.begin(), resolvedTypeStr.end(),
' '),
1012 resolvedTypeStr.end());
1013 if (resolvedTypeStr.rfind(
"(void)") != std::string::npos)
1015 resolvedTypeStr.substr(0, resolvedTypeStr.size() - 6) +
"()";
1019 if (resolvedTypeStr != fullType) {
1022 return (
h->second)(dims);
1027 bool isConst = strncmp(resolvedTypeStr.c_str(),
"const", 5) == 0;
1035 const std::string compounded = cpd.empty() ? realTypeStr : realTypeStr + cpd;
1040 return (
h->second)(dims);
1048 return (
h->second)(dims);
1052 if (!cpd.empty() && (std::string::size_type)std::count(cpd.begin(), cpd.end(),
1053 '*') == cpd.size()) {
1056 return (
h->second)((!dims || dims.
ndim() < (
dim_t)cpd.size())
1065 return (
h->second)(dims);
1072 if (resolvedTypeStr.find(
"iterator") != std::string::npos ||
1075 return new IteratorExecutor(klass);
1079 result =
new InstanceExecutor(klass);
1080 else if (cpd ==
"&")
1081 result =
new InstanceRefExecutor(klass);
1082 else if (cpd ==
"**" || cpd ==
"*[]" || cpd ==
"&*")
1083 result =
new InstancePtrPtrExecutor(klass);
1084 else if (cpd ==
"*&")
1085 result =
new InstancePtrRefExecutor(klass);
1086 else if (cpd ==
"[]") {
1089 result =
new InstanceArrayExecutor(klass, asize);
1091 result =
new InstancePtrRefExecutor(klass);
1093 result =
new InstancePtrExecutor(klass);
1094 }
else if (realTypeStr.find(
"(*)") != std::string::npos ||
1095 (realTypeStr.find(
"::*)") != std::string::npos)) {
1098 auto pos1 = realTypeStr.find(
'(');
1099 auto pos2 = realTypeStr.find(
"*)");
1100 auto pos3 = realTypeStr.rfind(
')');
1101 result =
new FunctionPointerExecutor(
1102 realTypeStr.substr(0, pos1),
1103 realTypeStr.substr(pos2 + 2, pos3 - pos2 - 1));
1121 if (
p &&
p->HasState())
1140 const std::string&
target) {
1178#define WSTRING1 "std::basic_string<wchar_t>"
1180 "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_" \
1186#define CCOMPLEX_D "_Complex double"
1187#define CCOMPLEX_F "_Complex float"
1189#define CCOMPLEX_D "_C_double_complex"
1190#define CCOMPLEX_F "_C_float_complex"
1193struct InitExecFactories_t {
1195 InitExecFactories_t() {
1201 static BoolExecutor
e{};
1204 gf[
"bool&"] = (
ef_t) + [](
cdims_t) {
return new BoolRefExecutor{}; };
1206 static BoolConstRefExecutor
e{};
1210 static CharExecutor
e{};
1213 gf[
"signed char"] = gf[
"char"];
1215 static UCharExecutor
e{};
1218 gf[
"char&"] = (
ef_t) + [](
cdims_t) {
return new CharRefExecutor{}; };
1219 gf[
"signed char&"] = gf[
"char&"];
1220 gf[
"unsigned char&"] =
1221 (
ef_t) + [](
cdims_t) {
return new UCharRefExecutor{}; };
1223 static CharConstRefExecutor
e{};
1226 gf[
"const signed char&"] = gf[
"const char&"];
1227 gf[
"const unsigned char&"] = (
ef_t) + [](
cdims_t) {
1228 static UCharConstRefExecutor
e{};
1232 static WCharExecutor
e{};
1236 static Char16Executor
e{};
1240 static Char32Executor
e{};
1244 static Int8Executor
e{};
1247 gf[
"int8_t&"] = (
ef_t) + [](
cdims_t) {
return new Int8RefExecutor{}; };
1249 static Int8ConstRefExecutor
e{};
1253 static UInt8Executor
e{};
1256 gf[
"uint8_t&"] = (
ef_t) + [](
cdims_t) {
return new UInt8RefExecutor{}; };
1258 static UInt8ConstRefExecutor
e{};
1262 static ShortExecutor
e{};
1265 gf[
"short&"] = (
ef_t) + [](
cdims_t) {
return new ShortRefExecutor{}; };
1267 static IntExecutor
e{};
1270 gf[
"int&"] = (
ef_t) + [](
cdims_t) {
return new IntRefExecutor{}; };
1271 gf[
"unsigned short"] = gf[
"int"];
1272 gf[
"unsigned short&"] =
1273 (
ef_t) + [](
cdims_t) {
return new UShortRefExecutor{}; };
1275 static ULongExecutor
e{};
1278 gf[
"unsigned long&"] =
1279 (
ef_t) + [](
cdims_t) {
return new ULongRefExecutor{}; };
1280 gf[
"unsigned int"] = gf[
"unsigned long"];
1281 gf[
"unsigned int&"] =
1282 (
ef_t) + [](
cdims_t) {
return new UIntRefExecutor{}; };
1284 static LongExecutor
e{};
1287 gf[
"long&"] = (
ef_t) + [](
cdims_t) {
return new LongRefExecutor{}; };
1289 static ULongExecutor
e{};
1292 gf[
"unsigned long&"] =
1293 (
ef_t) + [](
cdims_t) {
return new ULongRefExecutor{}; };
1295 static LongLongExecutor
e{};
1299 (
ef_t) + [](
cdims_t) {
return new LongLongRefExecutor{}; };
1301 static ULongLongExecutor
e{};
1304 gf[
"unsigned long long&"] =
1305 (
ef_t) + [](
cdims_t) {
return new ULongLongRefExecutor{}; };
1308 static FloatExecutor
e{};
1311 gf[
"float&"] = (
ef_t) + [](
cdims_t) {
return new FloatRefExecutor{}; };
1313 static DoubleExecutor
e{};
1316 gf[
"double&"] = (
ef_t) + [](
cdims_t) {
return new DoubleRefExecutor{}; };
1318 static LongDoubleExecutor
e{};
1321 gf[
"long double&"] =
1322 (
ef_t) + [](
cdims_t) {
return new LongDoubleRefExecutor{}; };
1323 gf[
"std::complex<double>"] = (
ef_t) + [](
cdims_t) {
1324 static ComplexDExecutor
e{};
1327 gf[
"std::complex<double>&"] =
1328 (
ef_t) + [](
cdims_t) {
return new ComplexDRefExecutor{}; };
1330 static VoidExecutor
e{};
1336 (
ef_t) + [](
cdims_t d) {
return new VoidArrayExecutor{
d}; };
1338 (
ef_t) + [](
cdims_t d) {
return new BoolArrayExecutor{
d}; };
1339 gf[
"unsigned char ptr"] =
1340 (
ef_t) + [](
cdims_t d) {
return new UCharArrayExecutor{
d}; };
1341 gf[
"const unsigned char ptr"] = gf[
"unsigned char ptr"];
1342 gf[
"std::byte ptr"] =
1343 (
ef_t) + [](
cdims_t d) {
return new ByteArrayExecutor{
d}; };
1344 gf[
"const std::byte ptr"] = gf[
"std::byte ptr"];
1346 (
ef_t) + [](
cdims_t d) {
return new Int8ArrayExecutor{
d}; };
1348 (
ef_t) + [](
cdims_t d) {
return new UInt8ArrayExecutor{
d}; };
1350 (
ef_t) + [](
cdims_t d) {
return new ShortArrayExecutor{
d}; };
1351 gf[
"unsigned short ptr"] =
1352 (
ef_t) + [](
cdims_t d) {
return new UShortArrayExecutor{
d}; };
1353 gf[
"int ptr"] = (
ef_t) + [](
cdims_t d) {
return new IntArrayExecutor{
d}; };
1354 gf[
"unsigned int ptr"] =
1355 (
ef_t) + [](
cdims_t d) {
return new UIntArrayExecutor{
d}; };
1357 (
ef_t) + [](
cdims_t d) {
return new LongArrayExecutor{
d}; };
1358 gf[
"unsigned long ptr"] =
1359 (
ef_t) + [](
cdims_t d) {
return new ULongArrayExecutor{
d}; };
1360 gf[
"long long ptr"] =
1361 (
ef_t) + [](
cdims_t d) {
return new LLongArrayExecutor{
d}; };
1362 gf[
"unsigned long long ptr"] =
1363 (
ef_t) + [](
cdims_t d) {
return new ULLongArrayExecutor{
d}; };
1365 (
ef_t) + [](
cdims_t d) {
return new FloatArrayExecutor{
d}; };
1367 (
ef_t) + [](
cdims_t d) {
return new DoubleArrayExecutor{
d}; };
1368 gf[
"long double ptr"] =
1369 (
ef_t) + [](
cdims_t d) {
return new LDoubleArrayExecutor{
d}; };
1370 gf[
"std::complex<float> ptr"] =
1371 (
ef_t) + [](
cdims_t d) {
return new ComplexFArrayExecutor{
d}; };
1372 gf[
"std::complex<double> ptr"] =
1373 (
ef_t) + [](
cdims_t d) {
return new ComplexDArrayExecutor{
d}; };
1374 gf[
"std::complex<int> ptr"] =
1375 (
ef_t) + [](
cdims_t d) {
return new ComplexIArrayExecutor{
d}; };
1376 gf[
"std::complex<long> ptr"] =
1377 (
ef_t) + [](
cdims_t d) {
return new ComplexLArrayExecutor{
d}; };
1380 gf[
"internal_enum_type_t"] = gf[
"int"];
1381 gf[
"internal_enum_type_t&"] = gf[
"int&"];
1382 gf[
"internal_enum_type_t ptr"] = gf[
"int ptr"];
1383 gf[
"std::byte"] = gf[
"uint8_t"];
1384 gf[
"std::byte&"] = gf[
"uint8_t&"];
1385 gf[
"const std::byte&"] = gf[
"const uint8_t&"];
1386 gf[
"const byte&"] = gf[
"const uint8_t&"];
1387 gf[
"std::int8_t"] = gf[
"int8_t"];
1388 gf[
"std::int8_t&"] = gf[
"int8_t&"];
1389 gf[
"const std::int8_t&"] = gf[
"const int8_t&"];
1390 gf[
"std::int8_t ptr"] = gf[
"int8_t ptr"];
1391 gf[
"std::uint8_t"] = gf[
"uint8_t"];
1392 gf[
"std::uint8_t&"] = gf[
"uint8_t&"];
1393 gf[
"const std::uint8_t&"] = gf[
"const uint8_t&"];
1394 gf[
"std::uint8_t ptr"] = gf[
"uint8_t ptr"];
1396 gf[
"__int64"] = gf[
"long long"];
1397 gf[
"__int64&"] = gf[
"long long&"];
1398 gf[
"__int64 ptr"] = gf[
"long long ptr"];
1399 gf[
"unsigned __int64"] = gf[
"unsigned long long"];
1400 gf[
"unsigned __int64&"] = gf[
"unsigned long long&"];
1401 gf[
"unsigned __int64 ptr"] = gf[
"unsigned long long ptr"];
1404 gf[
CCOMPLEX_D "&"] = gf[
"std::complex<double>&"];
1405 gf[
CCOMPLEX_F " ptr"] = gf[
"std::complex<float> ptr"];
1406 gf[
CCOMPLEX_D " ptr"] = gf[
"std::complex<double> ptr"];
1413 gf[
"Long64_t"] = gf[
"long long"];
1414 gf[
"Long64_t&"] = gf[
"long long&"];
1415 gf[
"Long64_t ptr"] = gf[
"long long ptr"];
1416 gf[
"ULong64_t"] = gf[
"unsigned long long"];
1417 gf[
"ULong64_t&"] = gf[
"unsigned long long&"];
1418 gf[
"ULong64_t ptr"] = gf[
"unsigned long long ptr"];
1422 static CStringExecutor
e{};
1425 gf[
"char*"] = gf[
"const char*"];
1427 static CStringRefExecutor
e{};
1430 gf[
"char*&"] = gf[
"const char*&"];
1431 gf[
"const signed char*"] = gf[
"const char*"];
1433 gf[
"signed char ptr"] =
1434 (
ef_t) + [](
cdims_t d) {
return new SCharArrayExecutor{
d}; };
1436 static WCStringExecutor
e{};
1440 static CString16Executor
e{};
1444 static CString32Executor
e{};
1447 gf[
"std::basic_string<char>"] = (
ef_t) + [](
cdims_t) {
1448 static STLStringExecutor
e{};
1451 gf[
"std::basic_string<char>&"] =
1452 (
ef_t) + [](
cdims_t) {
return new STLStringRefExecutor{}; };
1453 gf[
"std::basic_string<wchar_t>"] = (
ef_t) + [](
cdims_t) {
1454 static STLWStringExecutor
e{};
1457 gf[
WSTRING1] = gf[
"std::basic_string<wchar_t>"];
1458 gf[
WSTRING2] = gf[
"std::basic_string<wchar_t>"];
1460 static ConstructorExecutor
e{};
1464 static PyObjectExecutor
e{};
1467 gf[
"_object*"] = gf[
"PyObject*"];
1468 gf[
"FILE*"] = gf[
"void ptr"];
1470} initExecvFactories_;
interop::TCppScope_t fClass
static interop::TCppObject_t GILCallConstructor(interop::TCppMethod_t method, interop::TCppScope_t klass, cpyrt::CallContext *ctxt)
static float GILCallF(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static PyObject * PyComplex_FromComplex(const std::complex< T > &c)
static PY_LONG_LONG GILCallLL(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static PyObject * SetInstanceCheckError(PyObject *pyobj)
static std::complex< T > PyComplex_AsComplex(PyObject *pycplx)
static interop::TCppObject_t GILCallO(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt, interop::TCppScope_t klass)
static void GILCallV(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static void * GILCallR(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static short GILCallH(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
#define CPPJIT_IMPL_GILCALL(rtype, tcode)
#define CPPJIT_COMPLEX_EXEC(code, type)
static double GILCallD(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static long GILCallL(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
#define CPPJIT_IMPL_ARRAY_EXEC(name, type, suffix)
static PY_LONG_DOUBLE GILCallLD(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static PyObject * cpyrt_PyBool_FromLong(long b)
static int GILCallI(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static unsigned char GILCallB(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static PyObject * cpyrt_PyText_FromULong(unsigned long uc)
#define CPPJIT_IMPL_REFEXEC(name, type, stype, F1, F2)
static char GILCallC(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
static PyObject * cpyrt_PyText_FromLong(long cl)
winID h TVirtualViewer3D TVirtualGLPainter p
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 target
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
virtual bool SetAssignable(PyObject *)
long double PY_LONG_DOUBLE
unsigned long long PY_ULONG_LONG
RooArgList L(Args_t &&... args)
std::string remove_const(const std::string &cppname)
std::string clean_type(const std::string &cppname, bool template_strip=true, bool const_strip=true)
Py_ssize_t array_size(const std::string &name)
std::string compound(const std::string &name)
bool IsSTLIterator(const std::string &classname)
PyObject * FuncPtr2StdFunction(const std::string &retType, const std::string &signature, void *address)
CPYRT_EXTERN bool RegisterExecutorAlias(const std::string &name, const std::string &target)
static ExecFactories_t gExecFactories
PyObject * gNullPtrObject
PyObject * CreatePointerView(void *ptr, cdims_t shape=0)
PyObject * BindCppObject(interop::TCppObject_t object, interop::TCppScope_t klass, const unsigned flags=0)
PyObject * BindCppObjectArray(interop::TCppObject_t address, interop::TCppScope_t klass, cdims_t dims)
CPYRT_EXTERN Executor * CreateExecutor(const std::string &name, cdims_t=0)
bool ReleasesGIL(CallContext *ctxt)
PyObject * BindCppObjectNoCast(interop::TCppObject_t object, interop::TCppScope_t klass, const unsigned flags=0)
CPYRT_EXPORT void DestroyExecutor(Executor *p)
unsigned long PyLongOrInt_AsULong(PyObject *pyobject)
std::set< std::string > gIteratorTypes
bool CPPInstance_Check(T *object)
CPYRT_EXTERN bool UnregisterExecutor(const std::string &name)
PY_ULONG_LONG PyLongOrInt_AsULong64(PyObject *pyobject)
std::unordered_map< std::string, ef_t > ExecFactories_t
Executor *(* ef_t)(cdims_t)
CPYRT_EXTERN void * CallVoidP(interop::TCppMethod_t, interop::TCppObject_t, CallContext *)
CPYRT_EXTERN bool RegisterExecutor(const std::string &name, ExecutorFactory_t)
TCppScope_t GetFullScope(const std::string &scope_name)
Cpp::ObjectRef TCppObject_t
TCppType_t GetTypeFromScope(TCppScope_t klass)
std::string GetTypeAsString(TCppType_t type)
TCppType_t ResolveEnumPointerType(TCppType_t type)
bool IsClassType(TCppType_t type)
std::string ResolveName(const std::string &cppitem_name)
Cpp::FuncRef TCppMethod_t
bool IsFunctionPointerType(TCppType_t type)
TCppObject_t CallO(TCppMethod_t method, TCppObject_t self, size_t nargs, void *args, TCppType_t result_type)
TCppType_t ResolveType(TCppType_t cppitem_name)
std::string GetMethodSignature(TCppMethod_t, bool show_formal_args, TCppIndex_t max_args=(TCppIndex_t) -1)
TCppObject_t CallConstructor(TCppMethod_t method, TCppScope_t klass, size_t nargs, void *args)
TCppScope_t GetScopeFromType(TCppType_t type)
TCppType_t GetRealType(TCppType_t type)
TCppType_t ResolveEnumReferenceType(TCppType_t type)
Parameter * GetArgs(size_t sz)