<commit_before>
#include <PythonUtils.h>
#include <TritonPyObject.h>
#include <xPyFunc.h>

/*
 * Class SymbolicVariable:
 *
 * - getComment() : Returns the symbolic variable comment
 * - getConcreteValue() : Returns the variable's symbolic value
 * - getId() : Returns the symbolic variable id
 * - getKind() : Returns the kind of the symbolic variable
 * - getKindValue() : Returns the kind value (IDREG.REG or integer, it depends of the kind)
 * - getName() : Returns the name of the symbolic variable
 * - getSize() : Returns the symbolic variable size
 */


void SymbolicVariable_dealloc(PyObject *self) {
  Py_DECREF(self);
}


static char SymbolicVariable_getComment_doc[] = "Returns the comment of the symbolic variable";
static PyObject *SymbolicVariable_getComment(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  if (variable->getSymVarComment().empty() == false)
    return PyString_FromFormat("%s", variable->getSymVarComment().c_str());
  Py_INCREF(Py_None);
  return Py_None;
}

static char SymbolicVariable_getConcreteValue_doc[] = "Returns the variable's concrete value";
static PyObject *SymbolicVariable_getConcreteValue(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *symVar = PySymbolicVariable_AsSymbolicVariable(self);
  return uint128ToPyLongObject(symVar->getConcreteValue());
}


static char SymbolicVariable_getId_doc[] = "Returns the id of the symbolic variable";
static PyObject *SymbolicVariable_getId(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarId());
}


static char SymbolicVariable_getKind_doc[] = "Returns the kind of the symbolic variable";
static PyObject *SymbolicVariable_getKind(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarKind());
}


static char SymbolicVariable_getKindValue_doc[] = "Returns the kind value of the symbolic variable";
static PyObject *SymbolicVariable_getKindValue(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarKindValue());
}


static char SymbolicVariable_getName_doc[] = "Returns the name of the symbolic variable";
static PyObject *SymbolicVariable_getName(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return PyString_FromFormat("%s", variable->getSymVarName().c_str());
}


static char SymbolicVariable_getSize_doc[] = "Returns the size of the symbolic variable";
static PyObject *SymbolicVariable_getSize(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarSize());
}


static PyObject *SymbolicVariable_str(SymbolicVariable_Object *obj)
{
  std::stringstream str;
  str << obj->variable->getSymVarName();
  return PyString_FromFormat("%s", str.str().c_str());
}


PyMethodDef SymbolicVariable_callbacks[] = {
  {"getComment",          SymbolicVariable_getComment,          METH_NOARGS,   SymbolicVariable_getComment_doc},
  {"getConcreteValue",    SymbolicVariable_getConcreteValue,    METH_NOARGS,   SymbolicVariable_getConcreteValue_doc},
  {"getId",               SymbolicVariable_getId,               METH_NOARGS,   SymbolicVariable_getId_doc},
  {"getKind",             SymbolicVariable_getKind,             METH_NOARGS,   SymbolicVariable_getKind_doc},
  {"getKindValue",        SymbolicVariable_getKindValue,        METH_NOARGS,   SymbolicVariable_getKindValue_doc},
  {"getName",             SymbolicVariable_getName,             METH_NOARGS,   SymbolicVariable_getName_doc},
  {"getSize",             SymbolicVariable_getSize,             METH_NOARGS,   SymbolicVariable_getSize_doc},
  {nullptr,               nullptr,                              0,             nullptr}
};


PyTypeObject SymbolicVariable_Type = {
    PyObject_HEAD_INIT(&PyType_Type)
    0,                                          /* ob_size*/<commit_msg>Fix #161: symvar.hasConcreteValue()<commit_after>
#include <PythonUtils.h>
#include <TritonPyObject.h>
#include <xPyFunc.h>

/*
 * Class SymbolicVariable:
 *
 * - getComment() : Returns the symbolic variable comment
 * - getConcreteValue() : Returns the variable's symbolic value
 * - getId() : Returns the symbolic variable id
 * - getKind() : Returns the kind of the symbolic variable
 * - getKindValue() : Returns the kind value (IDREG.REG or integer, it depends of the kind)
 * - getName() : Returns the name of the symbolic variable
 * - getSize() : Returns the symbolic variable size
 * - hasConcreteValue() : Returns true of false if the variable contains a concrete value
 */


void SymbolicVariable_dealloc(PyObject *self) {
  Py_DECREF(self);
}


static char SymbolicVariable_getComment_doc[] = "Returns the comment of the symbolic variable";
static PyObject *SymbolicVariable_getComment(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  if (variable->getSymVarComment().empty() == false)
    return PyString_FromFormat("%s", variable->getSymVarComment().c_str());
  Py_INCREF(Py_None);
  return Py_None;
}

static char SymbolicVariable_getConcreteValue_doc[] = "Returns the variable's concrete value";
static PyObject *SymbolicVariable_getConcreteValue(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *symVar = PySymbolicVariable_AsSymbolicVariable(self);
  return uint128ToPyLongObject(symVar->getConcreteValue());
}


static char SymbolicVariable_getId_doc[] = "Returns the id of the symbolic variable";
static PyObject *SymbolicVariable_getId(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarId());
}


static char SymbolicVariable_getKind_doc[] = "Returns the kind of the symbolic variable";
static PyObject *SymbolicVariable_getKind(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarKind());
}


static char SymbolicVariable_getKindValue_doc[] = "Returns the kind value of the symbolic variable";
static PyObject *SymbolicVariable_getKindValue(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarKindValue());
}


static char SymbolicVariable_getName_doc[] = "Returns the name of the symbolic variable";
static PyObject *SymbolicVariable_getName(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return PyString_FromFormat("%s", variable->getSymVarName().c_str());
}


static char SymbolicVariable_getSize_doc[] = "Returns the size of the symbolic variable";
static PyObject *SymbolicVariable_getSize(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  return Py_BuildValue("k", variable->getSymVarSize());
}


static char SymbolicVariable_hasConcreteValue_doc[] = "Returns true of false if the variable contains a concrete value";
static PyObject *SymbolicVariable_hasConcreteValue(PyObject *self, PyObject *noarg)
{
  SymbolicVariable *variable = PySymbolicVariable_AsSymbolicVariable(self);
  if (variable->hasConcreteValue() == true)
    Py_RETURN_TRUE;
  Py_RETURN_FALSE;
}


static PyObject *SymbolicVariable_str(SymbolicVariable_Object *obj)
{
  std::stringstream str;
  str << obj->variable->getSymVarName();
  return PyString_FromFormat("%s", str.str().c_str());
}


PyMethodDef SymbolicVariable_callbacks[] = {
  {"getComment",          SymbolicVariable_getComment,          METH_NOARGS,   SymbolicVariable_getComment_doc},
  {"getConcreteValue",    SymbolicVariable_getConcreteValue,    METH_NOARGS,   SymbolicVariable_getConcreteValue_doc},
  {"getId",               SymbolicVariable_getId,               METH_NOARGS,   SymbolicVariable_getId_doc},
  {"getKind",             SymbolicVariable_getKind,             METH_NOARGS,   SymbolicVariable_getKind_doc},
  {"getKindValue",        SymbolicVariable_getKindValue,        METH_NOARGS,   SymbolicVariable_getKindValue_doc},
  {"getName",             SymbolicVariable_getName,             METH_NOARGS,   SymbolicVariable_getName_doc},
  {"getSize",             SymbolicVariable_getSize,             METH_NOARGS,   SymbolicVariable_getSize_doc},
  {"hasConcreteValue",    SymbolicVariable_hasConcreteValue,    METH_NOARGS,   SymbolicVariable_hasConcreteValue_doc},
  {nullptr,               nullptr,                              0,             nullptr}
};


PyTypeObject SymbolicVariable_Type = {
    PyObject_HEAD_INIT(&PyType_Type)
    0,                                          /* ob_size*/
{'fraction_non_alphanumeric': 0.09486121948500724, 'fraction_numerical': 0.0014491138111693235, 'mean_word_length': 4.9299405155320555, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6809921', 'n_tokens_mistral': 2567, 'n_tokens_neox': 2697, 'n_words': 593}