Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Executors.cxx File Reference
#include "cpyrt.h"
#include "CPPInstance.h"
#include "DeclareExecutors.h"
#include "LowLevelViews.h"
#include "ProxyWrappers.h"
#include "PyStrings.h"
#include "TypeManip.h"
#include "Utility.h"
#include "cppjit_interop.h"
#include <complex>
#include <cstring>
#include <map>
#include <new>
#include <sstream>
#include <sys/types.h>
#include <utility>
Include dependency graph for Executors.cxx:

Namespaces

namespace  cppjit
 
namespace  cppjit::cpyrt
 

Macros

#define CCOMPLEX_D   "_Complex double"
 
#define CCOMPLEX_F   "_Complex float"
 
#define CPPJIT_COMPLEX_EXEC(code, type)
 
#define CPPJIT_IMPL_ARRAY_EXEC(name, type, suffix)
 
#define CPPJIT_IMPL_GILCALL(rtype, tcode)
 
#define CPPJIT_IMPL_REFEXEC(name, type, stype, F1, F2)
 
#define WSTRING1   "std::basic_string<wchar_t>"
 
#define WSTRING2
 

Typedefs

typedef std::unordered_map< std::string, ef_t > cppjit::cpyrt::ExecFactories_t
 

Functions

static PyObject * cpyrt_PyBool_FromLong (long b)
 
static PyObject * cpyrt_PyText_FromLong (long cl)
 
static PyObject * cpyrt_PyText_FromULong (unsigned long uc)
 
static unsigned char GILCallB (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
static char GILCallC (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
static interop::TCppObject_t GILCallConstructor (interop::TCppMethod_t method, interop::TCppScope_t klass, cpyrt::CallContext *ctxt)
 
static double GILCallD (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
static float GILCallF (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)
 
static int GILCallI (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)
 
static PY_LONG_DOUBLE GILCallLD (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
static PY_LONG_LONG GILCallLL (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
static interop::TCppObject_t GILCallO (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt, interop::TCppScope_t klass)
 
static void * GILCallR (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
static void GILCallV (interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
 
template<typename T >
static std::complex< T > PyComplex_AsComplex (PyObject *pycplx)
 
template<typename T >
static PyObject * PyComplex_FromComplex (const std::complex< T > &c)
 
static PyObject * SetInstanceCheckError (PyObject *pyobj)
 

Variables

static ExecFactories_t cppjit::cpyrt::gExecFactories
 
std::set< std::string > cppjit::cpyrt::gIteratorTypes
 

Macro Definition Documentation

◆ CCOMPLEX_D

#define CCOMPLEX_D   "_Complex double"

Definition at line 1186 of file Executors.cxx.

◆ CCOMPLEX_F

#define CCOMPLEX_F   "_Complex float"

Definition at line 1187 of file Executors.cxx.

◆ CPPJIT_COMPLEX_EXEC

#define CPPJIT_COMPLEX_EXEC ( code,
type )
Value:
PyObject* cpyrt::Complex##code##Executor::Execute( \
CallContext* ctxt) { \
static interop::TCppScope_t scopeid = \
interop::GetScope("std::complex<" #type ">"); \
std::complex<type>* result = \
(std::complex<type>*)GILCallO(method, self, ctxt, scopeid).data; \
if (!result) { \
PyErr_SetString(PyExc_ValueError, \
"NULL result where temporary expected"); \
return nullptr; \
} \
\
PyObject* pyres = PyComplex_FromDoubles(result->real(), result->imag()); \
::operator delete(result); /* interop::CallO calls ::operator new */ \
return pyres; \
}
static interop::TCppObject_t GILCallO(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt, interop::TCppScope_t klass)
Definition Executors.cxx:85
_object PyObject
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 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
virtual PyObject * Execute(interop::TCppMethod_t, interop::TCppObject_t, CallContext *)=0
Cpp::ObjectRef TCppObject_t
Definition API.h:43
Cpp::FuncRef TCppMethod_t
Definition API.h:44
Cpp::DeclRef TCppScope_t
Definition API.h:41

Definition at line 587 of file Executors.cxx.

◆ CPPJIT_IMPL_ARRAY_EXEC

#define CPPJIT_IMPL_ARRAY_EXEC ( name,
type,
suffix )
Value:
PyObject* cpyrt::name##ArrayExecutor::Execute(interop::TCppMethod_t method, \
CallContext* ctxt) { \
return CreateLowLevelView##suffix((type*)GILCallR(method, self, ctxt), \
fShape); \
}
dims_t fShape
static void * GILCallR(interop::TCppMethod_t method, interop::TCppObject_t self, cpyrt::CallContext *ctxt)
Definition Executors.cxx:82
PyObject * CreateLowLevelView(bool *, cdims_t shape)

Definition at line 554 of file Executors.cxx.

◆ CPPJIT_IMPL_GILCALL

#define CPPJIT_IMPL_GILCALL ( rtype,
tcode )
Value:
static inline rtype GILCall##tcode(interop::TCppMethod_t method, \
cpyrt::CallContext* ctxt) { \
return interop::Call##tcode(method, self, ctxt->GetEncodedSize(), \
ctxt->GetArgs()); \
}
Parameter * GetArgs(size_t sz)
Definition CallContext.h:62

Definition at line 62 of file Executors.cxx.

◆ CPPJIT_IMPL_REFEXEC

#define CPPJIT_IMPL_REFEXEC ( name,
type,
stype,
F1,
F2 )
Value:
PyObject* cpyrt::name##RefExecutor::Execute(interop::TCppMethod_t method, \
CallContext* ctxt) { \
type* ref = (type*)GILCallR(method, self, ctxt); \
if (!ref) { /* can happen if wrapper compilation fails */ \
PyErr_SetString(PyExc_ReferenceError, \
"attempt to access a null-pointer"); \
return nullptr; \
} \
if (!fAssignable) \
return F1((stype) * ref); \
else { \
*ref = (type)F2(fAssignable); \
Py_DECREF(fAssignable); \
fAssignable = nullptr; \
if (*ref == (type) - 1 && PyErr_Occurred()) \
return nullptr; \
Py_INCREF(Py_None); \
return Py_None; \
} \
}
#define F1(x, y, z)
Definition TMD5.cxx:266
#define F2(x, y, z)
Definition TMD5.cxx:267

Definition at line 366 of file Executors.cxx.

◆ WSTRING1

#define WSTRING1   "std::basic_string<wchar_t>"

Definition at line 1178 of file Executors.cxx.

◆ WSTRING2

#define WSTRING2
Value:
"std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_" \
"t>>"

Definition at line 1179 of file Executors.cxx.

Function Documentation

◆ cpyrt_PyBool_FromLong()

static PyObject * cpyrt_PyBool_FromLong ( long b)
inlinestatic

Definition at line 139 of file Executors.cxx.

◆ cpyrt_PyText_FromLong()

static PyObject * cpyrt_PyText_FromLong ( long cl)
inlinestatic

Definition at line 117 of file Executors.cxx.

◆ cpyrt_PyText_FromULong()

static PyObject * cpyrt_PyText_FromULong ( unsigned long uc)
inlinestatic

Definition at line 129 of file Executors.cxx.

◆ GILCallB()

static unsigned char GILCallB ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 73 of file Executors.cxx.

◆ GILCallC()

static char GILCallC ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 74 of file Executors.cxx.

◆ GILCallConstructor()

static interop::TCppObject_t GILCallConstructor ( interop::TCppMethod_t method,
interop::TCppScope_t klass,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 103 of file Executors.cxx.

◆ GILCallD()

static double GILCallD ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 80 of file Executors.cxx.

◆ GILCallF()

static float GILCallF ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 79 of file Executors.cxx.

◆ GILCallH()

static short GILCallH ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 75 of file Executors.cxx.

◆ GILCallI()

static int GILCallI ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 76 of file Executors.cxx.

◆ GILCallL()

static long GILCallL ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 77 of file Executors.cxx.

◆ GILCallLD()

static PY_LONG_DOUBLE GILCallLD ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 81 of file Executors.cxx.

◆ GILCallLL()

static PY_LONG_LONG GILCallLL ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 78 of file Executors.cxx.

◆ GILCallO()

static interop::TCppObject_t GILCallO ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt,
interop::TCppScope_t klass )
inlinestatic

Definition at line 85 of file Executors.cxx.

◆ GILCallR()

static void * GILCallR ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 82 of file Executors.cxx.

◆ GILCallV()

static void GILCallV ( interop::TCppMethod_t method,
interop::TCppObject_t self,
cpyrt::CallContext * ctxt )
inlinestatic

Definition at line 72 of file Executors.cxx.

◆ PyComplex_AsComplex()

template<typename T >
static std::complex< T > PyComplex_AsComplex ( PyObject * pycplx)
inlinestatic

Definition at line 414 of file Executors.cxx.

◆ PyComplex_FromComplex()

template<typename T >
static PyObject * PyComplex_FromComplex ( const std::complex< T > & c)
inlinestatic

Definition at line 409 of file Executors.cxx.

◆ SetInstanceCheckError()

static PyObject * SetInstanceCheckError ( PyObject * pyobj)
inlinestatic

Definition at line 753 of file Executors.cxx.