136 std::cout << std::flush;
138 Py_TYPE(self)->tp_free((PyObject*)self);
142 static PyObject* BasicBlock_add(PyObject* self, PyObject* instruction) {
145 return PyErr_Format(PyExc_TypeError,
"BasicBlock::add(): Expected an Instruction as argument.");
151 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
156 static PyObject* BasicBlock_getFirstAddress(PyObject* self, PyObject* noarg) {
161 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
166 static PyObject* BasicBlock_getInstructions(PyObject* self, PyObject* noarg) {
167 PyObject* ret =
nullptr;
173 for (
auto& inst : insts)
178 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
183 static PyObject* BasicBlock_getLastAddress(PyObject* self, PyObject* noarg) {
188 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
193 static PyObject* BasicBlock_getSize(PyObject* self, PyObject* noarg) {
198 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
203 static PyObject* BasicBlock_remove(PyObject* self, PyObject* position) {
205 if (!PyLong_Check(position) && !PyInt_Check(position))
206 return PyErr_Format(PyExc_TypeError,
"BasicBlock::remove(): Expected an integer as argument.");
212 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
217 #if !defined(IS_PY3_8) || !IS_PY3_8
218 static int BasicBlock_print(PyObject* self,
void* io,
int s) {
225 static PyObject* BasicBlock_str(PyObject* self) {
230 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
237 {
"add", BasicBlock_add, METH_O,
""},
238 {
"getFirstAddress", BasicBlock_getFirstAddress, METH_NOARGS,
""},
239 {
"getInstructions", BasicBlock_getInstructions, METH_NOARGS,
""},
240 {
"getLastAddress", BasicBlock_getLastAddress, METH_NOARGS,
""},
241 {
"getSize", BasicBlock_getSize, METH_NOARGS,
""},
242 {
"remove", BasicBlock_remove, METH_O,
""},
243 {
nullptr,
nullptr, 0,
nullptr}
248 PyVarObject_HEAD_INIT(&PyType_Type, 0)
256 (printfunc)BasicBlock_print,
261 (reprfunc)BasicBlock_str,
267 (reprfunc)BasicBlock_str,
272 "BasicBlock objects",
321 return (PyObject*)object;
325 PyObject*
PyBasicBlock(std::vector<triton::arch::Instruction>& insts) {
333 return (PyObject*)object;
345 return (PyObject*)object;
This class is used to represent a basic block.
The root class of all exceptions.
TRITON_EXPORT const char * what() const
Returns the exception message.
PyTypeObject BasicBlock_Type
pyBasicBlock type.
triton::uint64 PyLong_AsUint64(PyObject *vv)
Returns a triton::uint64 from a pyObject.
PyObject * PyBasicBlock(void)
Creates the BasicBlock python class.
PyObject * PyInstruction(void)
Creates the Instruction python class.
PyObject * xPyList_New(Py_ssize_t len)
Creates a PyList and raises an exception if it fails.
PyObject * PyLong_FromUint64(triton::uint64 value)
Returns a pyObject from a triton::uint64.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::string toString(const T &obj)
Converts an object to a string.
PyMethodDef BasicBlock_callbacks[]
BasicBlock methods.
void BasicBlock_dealloc(PyObject *self)
BasicBlock destructor.
#define PyInstruction_AsInstruction(v)
#define PyInstruction_Check(v)
#define PyBasicBlock_AsBasicBlock(v)