static PyObject* PathConstraint_getTakenPathConstraintAst(PyObject* self, PyObject* noarg) { try { return PyAstNode(PyPathConstraint_AsPathConstraint(self)->getTakenPathConstraintAst()); } catch (const triton::exceptions::Exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
static PyObject* PathConstraint_getTakenAddress(PyObject* self, PyObject* noarg) { try { return PyLong_FromUint64(PyPathConstraint_AsPathConstraint(self)->getTakenAddress()); } catch (const triton::exceptions::Exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
static PyObject* PathConstraint_isMultipleBranches(PyObject* self, PyObject* noarg) { try { if (PyPathConstraint_AsPathConstraint(self)->isMultipleBranches()) Py_RETURN_TRUE; Py_RETURN_FALSE; } catch (const triton::exceptions::Exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
static PyObject* PathConstraint_getBranchConstraints(PyObject* self, PyObject* noarg) { try { PyObject* ret = nullptr; const auto& branches = PyPathConstraint_AsPathConstraint(self)->getBranchConstraints(); ret = xPyList_New(branches.size()); for (triton::usize index = 0; index != branches.size(); index++) { PyObject* dict = xPyDict_New(); xPyDict_SetItem(dict, PyString_FromString("isTaken"), PyBool_FromLong(std::get<0>(branches[index]))); xPyDict_SetItem(dict, PyString_FromString("srcAddr"), PyLong_FromUint64(std::get<1>(branches[index]))); xPyDict_SetItem(dict, PyString_FromString("dstAddr"), PyLong_FromUint64(std::get<2>(branches[index]))); xPyDict_SetItem(dict, PyString_FromString("constraint"), PyAstNode(std::get<3>(branches[index]))); PyList_SetItem(ret, index, dict); } return ret; } catch (const triton::exceptions::Exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
//! PathConstraint destructor. void PathConstraint_dealloc(PyObject* self) { std::cout << std::flush; delete PyPathConstraint_AsPathConstraint(self); Py_TYPE(self)->tp_free((PyObject*)self); }
static PyObject* PathConstraint_getBranchConstraints(PyObject* self, PyObject* noarg) { try { PyObject* ret = nullptr; std::vector<std::tuple<bool, triton::__uint, triton::ast::AbstractNode*>>& branches = PyPathConstraint_AsPathConstraint(self)->getBranchConstraints(); ret = xPyList_New(branches.size()); for (triton::uint32 index = 0; index != branches.size(); index++) { PyObject* dict = xPyDict_New(); PyDict_SetItem(dict, PyString_FromString("taken"), PyBool_FromLong(std::get<0>(branches[index]))); PyDict_SetItem(dict, PyString_FromString("target"), PyLong_FromUint(std::get<1>(branches[index]))); PyDict_SetItem(dict, PyString_FromString("constraint"), PyAstNode(std::get<2>(branches[index]))); PyList_SetItem(ret, index, dict); } return ret; } catch (const std::exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
//! PathConstraint destructor. void PathConstraint_dealloc(PyObject* self) { std::cout << std::flush; delete PyPathConstraint_AsPathConstraint(self); Py_DECREF(self); }