122 std::cout << std::flush;
124 Py_TYPE(self)->tp_free((PyObject*)self);
128 static PyObject* Immediate_getBitvector(PyObject* self, PyObject* noarg) {
133 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
138 static PyObject* Immediate_getBitSize(PyObject* self, PyObject* noarg) {
143 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
148 static PyObject* Immediate_getShiftType(PyObject* self, PyObject* noarg) {
153 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
158 static PyObject* Immediate_getShiftImmediate(PyObject* self, PyObject* noarg) {
163 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
168 static PyObject* Immediate_getShiftRegister(PyObject* self, PyObject* noarg) {
173 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
178 static PyObject* Immediate_getSize(PyObject* self, PyObject* noarg) {
183 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
188 static PyObject* Immediate_getType(PyObject* self, PyObject* noarg) {
193 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
198 static PyObject* Immediate_getValue(PyObject* self, PyObject* noarg) {
203 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
208 static PyObject* Immediate_setValue(PyObject* self, PyObject* args) {
209 PyObject* value =
nullptr;
210 PyObject* size =
nullptr;
213 if (PyArg_ParseTuple(args,
"|OO", &value, &size) ==
false) {
214 return PyErr_Format(PyExc_TypeError,
"Immediate::setValue(): Invalid number of arguments");
218 if (!PyLong_Check(value) && !PyInt_Check(value))
219 return PyErr_Format(PyExc_TypeError,
"Immediate::setValue(): expected an integer as first argument");
221 if (!PyLong_Check(size) && !PyInt_Check(size))
222 return PyErr_Format(PyExc_TypeError,
"Immediate::setValue(): expected an integer as second argument");
229 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
234 #if !defined(IS_PY3_8) || !IS_PY3_8
235 static int Immediate_print(PyObject* self,
void* io,
int s) {
242 static PyObject* Immediate_str(PyObject* self) {
247 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
254 {
"getBitSize", Immediate_getBitSize, METH_NOARGS,
""},
255 {
"getBitvector", Immediate_getBitvector, METH_NOARGS,
""},
256 {
"getShiftType", Immediate_getShiftType, METH_NOARGS,
""},
257 {
"getShiftImmediate", Immediate_getShiftImmediate, METH_NOARGS,
""},
258 {
"getShiftRegister", Immediate_getShiftRegister, METH_NOARGS,
""},
259 {
"getSize", Immediate_getSize, METH_NOARGS,
""},
260 {
"getType", Immediate_getType, METH_NOARGS,
""},
261 {
"getValue", Immediate_getValue, METH_NOARGS,
""},
262 {
"setValue", Immediate_setValue, METH_VARARGS,
""},
263 {
nullptr,
nullptr, 0,
nullptr}
268 PyVarObject_HEAD_INIT(&PyType_Type, 0)
276 (printfunc)Immediate_print,
281 (reprfunc)Immediate_str,
287 (reprfunc)Immediate_str,
341 return (PyObject*)object;
The root class of all exceptions.
TRITON_EXPORT const char * what() const
Returns the exception message.
triton::uint64 PyLong_AsUint64(PyObject *vv)
Returns a triton::uint64 from a pyObject.
PyObject * PyImmediate(const triton::arch::Immediate &imm)
Creates the Immediate python class.
PyObject * PyLong_FromUint64(triton::uint64 value)
Returns a pyObject from a triton::uint64.
triton::uint32 PyLong_AsUint32(PyObject *vv)
Returns a triton::uint32 from a pyObject.
PyTypeObject Immediate_Type
pyImmediate type.
PyObject * PyLong_FromUint32(triton::uint32 value)
Returns a pyObject from a triton::uint32.
std::string toString(const T &obj)
Converts an object to a string.
PyMethodDef Immediate_callbacks[]
Immediate methods.
void Immediate_dealloc(PyObject *self)
Immediate destructor.
#define PyImmediate_AsImmediate(v)