90 std::cout << std::flush;
92 Py_TYPE(self)->tp_free((PyObject*)self);
96 static PyObject* SymbolicVariable_getAlias(PyObject* self, PyObject* noarg) {
101 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
106 static PyObject* SymbolicVariable_getName(PyObject* self, PyObject* noarg) {
111 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
116 static PyObject* SymbolicVariable_getId(PyObject* self, PyObject* noarg) {
121 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
126 static PyObject* SymbolicVariable_getType(PyObject* self, PyObject* noarg) {
131 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
136 static PyObject* SymbolicVariable_getOrigin(PyObject* self, PyObject* noarg) {
141 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
146 static PyObject* SymbolicVariable_getBitSize(PyObject* self, PyObject* noarg) {
151 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
156 static PyObject* SymbolicVariable_getComment(PyObject* self, PyObject* noarg) {
161 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
166 static PyObject* SymbolicVariable_setAlias(PyObject* self, PyObject* alias) {
168 if (!PyStr_Check(alias))
169 return PyErr_Format(PyExc_TypeError,
"SymbolicVariable::setAlias(): Expected a string as argument.");
175 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
180 static PyObject* SymbolicVariable_setComment(PyObject* self, PyObject* comment) {
182 if (!PyStr_Check(comment))
183 return PyErr_Format(PyExc_TypeError,
"SymbolicVariable::setComment(): Expected a string as argument.");
189 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
194 #if !defined(IS_PY3_8) || !IS_PY3_8
195 static int SymbolicVariable_print(PyObject* self,
void* io,
int s) {
202 static PyObject* SymbolicVariable_str(PyObject* self) {
207 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
212 static int SymbolicVariable_init(AstNode_Object* self, PyObject* args, PyObject* kwds) {
217 static PyObject* SymbolicVariable_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
218 return type->tp_alloc(type, 0);
222 static long SymbolicVariable_hash(PyObject* self) {
228 static PyObject* SymbolicVariable_richcompare(PyObject* self, PyObject* other,
int op) {
229 PyObject* result =
nullptr;
234 result = Py_NotImplemented;
242 result = (id1 < id2) ? Py_True : Py_False;
245 result = (id1 <= id2) ? Py_True : Py_False;
248 result = (id1 == id2) ? Py_True : Py_False;
251 result = (id1 != id2) ? Py_True : Py_False;
254 result = (id1 > id2) ? Py_True : Py_False;
257 result = (id1 >= id2) ? Py_True : Py_False;
268 {
"getAlias", SymbolicVariable_getAlias, METH_NOARGS,
""},
269 {
"getBitSize", SymbolicVariable_getBitSize, METH_NOARGS,
""},
270 {
"getComment", SymbolicVariable_getComment, METH_NOARGS,
""},
271 {
"getId", SymbolicVariable_getId, METH_NOARGS,
""},
272 {
"getName", SymbolicVariable_getName, METH_NOARGS,
""},
273 {
"getOrigin", SymbolicVariable_getOrigin, METH_NOARGS,
""},
274 {
"getType", SymbolicVariable_getType, METH_NOARGS,
""},
275 {
"setAlias", SymbolicVariable_setAlias, METH_O,
""},
276 {
"setComment", SymbolicVariable_setComment, METH_O,
""},
277 {
nullptr,
nullptr, 0,
nullptr}
282 PyVarObject_HEAD_INIT(&PyType_Type, 0)
290 (printfunc)SymbolicVariable_print,
295 (reprfunc)SymbolicVariable_str,
299 (hashfunc)SymbolicVariable_hash,
301 (reprfunc)SymbolicVariable_str,
306 "SymbolicVariable objects",
309 SymbolicVariable_richcompare,
321 (initproc)SymbolicVariable_init,
323 (newfunc)SymbolicVariable_new,
348 if (symVar ==
nullptr) {
357 if (
object != NULL) {
358 object->symVar = symVar;
361 return (PyObject*)object;
The root class of all exceptions.
TRITON_EXPORT const char * what() const
Returns the exception message.
PyTypeObject SymbolicVariable_Type
pySymbolicVariable type.
PyObject * PySymbolicVariable(const triton::engines::symbolic::SharedSymbolicVariable &symVar)
Creates the SymbolicVariable python class.
PyObject * PyLong_FromUsize(triton::usize value)
Returns a pyObject from a triton::usize.
PyObject * PyLong_FromUint64(triton::uint64 value)
Returns a pyObject from a triton::uint64.
PyObject * PyLong_FromUint32(triton::uint32 value)
Returns a pyObject from a triton::uint32.
std::shared_ptr< triton::engines::symbolic::SymbolicVariable > SharedSymbolicVariable
Shared Symbolic variable.
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 SymbolicVariable_callbacks[]
SymbolicVariable methods.
void SymbolicVariable_dealloc(PyObject *self)
SymbolicVariable destructor.
#define PySymbolicVariable_Check(v)
#define PySymbolicVariable_AsSymbolicVariable(v)
pySymbolicVariable object.