Esempio n. 1
0
static PyObject *Triton_getSymVarSize(PyObject *self, PyObject *symVarPy) {
  SymbolicVariable *symVar;

  if (!PyLong_Check(symVarPy) && !PyInt_Check(symVarPy) && !PyString_Check(symVarPy))
    return PyErr_Format(PyExc_TypeError, "getSymVarSize(): expected a symbolic variable ID or a symbolic variable name");

  if (PyLong_Check(symVarPy) || PyInt_Check(symVarPy))
    symVar = ap.getSymVar(PyLong_AsLong(symVarPy));
  else
    symVar = ap.getSymVar(PyString_AsString(symVarPy));

  if (symVar == nullptr)
    return PyErr_Format(PyExc_TypeError, "getSymVarSize(): Invalid symbolic variable ID");

  return Py_BuildValue("k", symVar->getSymVarSize());
}
Esempio n. 2
0
static PyObject *SymbolicVariable_getSize(PyObject *self, PyObject *noarg) {
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarSize());
}