当前位置: 首页>>代码示例>>C++>>正文


C++ PySmtAstNode_AsSmtAstNode函数代码示例

本文整理汇总了C++中PySmtAstNode_AsSmtAstNode函数的典型用法代码示例。如果您正苦于以下问题:C++ PySmtAstNode_AsSmtAstNode函数的具体用法?C++ PySmtAstNode_AsSmtAstNode怎么用?C++ PySmtAstNode_AsSmtAstNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PySmtAstNode_AsSmtAstNode函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PyArg_ParseTuple

static PyObject *smt2lib_bvlshr(PyObject *self, PyObject *args) {
  PyObject *op1 = nullptr;
  PyObject *op2 = nullptr;

  /* Extract arguments */
  PyArg_ParseTuple(args, "O|O", &op1, &op2);

  if (op1 == nullptr || !PySmtAstNode_Check(op1))
    return PyErr_Format(PyExc_TypeError, "bvlshr(): expected a SmtAstNode as first argument");

  if (op2 == nullptr || !PySmtAstNode_Check(op2))
    return PyErr_Format(PyExc_TypeError, "bvlshr(): expected a SmtAstNode as second argument");

  return PySmtAstNode(smt2lib::bvlshr(PySmtAstNode_AsSmtAstNode(op1), PySmtAstNode_AsSmtAstNode(op2)));
}
开发者ID:v0re,项目名称:Triton,代码行数:15,代码来源:smt2libCallbacks.cpp

示例2: PyErr_Format

static PyObject *Triton_evaluateAST(PyObject *self, PyObject *smtAST) {
  uint512 value = 0;

  if (!PySmtAstNode_Check(smtAST))
    return PyErr_Format(PyExc_TypeError, "evaluateAST(): expected an SmtAstNode as argument");

  value = ap.evaluateAST(PySmtAstNode_AsSmtAstNode(smtAST));

  return uint512ToPyLongObject(value);
}
开发者ID:killbug2004,项目名称:Triton,代码行数:10,代码来源:tritonCallbacks.cpp

示例3: PySmtAstNode_AsSmtAstNode

static PyObject *SmtAstNode_getChilds(PyObject *self, PyObject *noarg) {
  PyObject *childs;
  smt2lib::smtAstAbstractNode *node = PySmtAstNode_AsSmtAstNode(self);

  uint64 size = node->getChilds().size();
  childs = xPyList_New(size);
  uint64 index = 0;
  for ( ; index < size; index++)
    PyList_SetItem(childs, index, PySmtAstNode(node->getChilds()[index]));

  return childs;
}
开发者ID:v0re,项目名称:Triton,代码行数:12,代码来源:PySmtAstNode.cpp

示例4: PyErr_Format

static PyObject *Triton_getFullExpression(PyObject *self, PyObject *node)
{
  smt2lib::smtAstAbstractNode *fullExpr;

  if (!PySmtAstNode_Check(node))
    return PyErr_Format(PyExc_TypeError, "getFullSymExpr(): expected an SmtAstNode node as argument");

  fullExpr = ap.getFullExpression(PySmtAstNode_AsSmtAstNode(node));
  if (fullExpr == nullptr)
    return Py_None;

  return PySmtAstNode(fullExpr);
}
开发者ID:sigma-random,项目名称:Triton,代码行数:13,代码来源:tritonCallbacks.cpp

示例5: PyArg_ParseTuple

static PyObject *SmtAstNode_setChild(PyObject *self, PyObject *args) {
  PyObject *index;
  PyObject *node;
  uint64 i;
  smt2lib::smtAstAbstractNode *dst, *src;

  PyArg_ParseTuple(args, "O|O", &index, &node);

  if (!PyLong_Check(index) && !PyInt_Check(index))
    return PyErr_Format(PyExc_TypeError, "setChild(): expected an index (integer) as first argument");

  if (!PySmtAstNode_Check(node))
    return PyErr_Format(PyExc_TypeError, "setChild(): expected a SmtAstNode as second argument");

  i = PyLong_AsLong(index);
  src = PySmtAstNode_AsSmtAstNode(node);
  dst = PySmtAstNode_AsSmtAstNode(self);
  if (i >= dst->getChilds().size())
    return PyErr_Format(PyExc_TypeError, "setChild(): index out-of-range");

  dst->getChilds()[i] = src;

  Py_RETURN_TRUE;
}
开发者ID:v0re,项目名称:Triton,代码行数:24,代码来源:PySmtAstNode.cpp

示例6: PyErr_Format

static PyObject *smt2lib_compound(PyObject *self, PyObject *exprsList) {
  std::vector<smt2lib::smtAstAbstractNode *> exprs;

  if (exprsList == nullptr || !PyList_Check(exprsList))
    return PyErr_Format(PyExc_TypeError, "compound(): expected a list of SmtAstNodes as first argument");

  /* Check if the mems list contains only integer item and craft a std::list */
  for (Py_ssize_t i = 0; i < PyList_Size(exprsList); i++){
    PyObject *item = PyList_GetItem(exprsList, i);

    if (!PySmtAstNode_Check(item))
      return PyErr_Format(PyExc_TypeError, "compound(): Each element from the list must be a SmtAstNode");

    exprs.push_back(PySmtAstNode_AsSmtAstNode(item));
  }

  return PySmtAstNode(smt2lib::compound(exprs));
}
开发者ID:v0re,项目名称:Triton,代码行数:18,代码来源:smt2libCallbacks.cpp

示例7: PyArg_ParseTuple

static PyObject *smt2lib_extract(PyObject *self, PyObject *args) {
  PyObject *op1 = nullptr;
  PyObject *op2 = nullptr;
  PyObject *op3 = nullptr;

  /* Extract arguments */
  PyArg_ParseTuple(args, "|OOO", &op1, &op2, &op3);

  if (op1 == nullptr || (!PyLong_Check(op1) && !PyInt_Check(op1)))
    return PyErr_Format(PyExc_TypeError, "extract(): expected an integer as first argument");

  if (op2 == nullptr || (!PyLong_Check(op2) && !PyInt_Check(op2)))
    return PyErr_Format(PyExc_TypeError, "extract(): expected an integer as second argument");

  if (op3 == nullptr || !PySmtAstNode_Check(op3))
    return PyErr_Format(PyExc_TypeError, "extract(): expected a SmtAstNode as third argument");

  return PySmtAstNode(smt2lib::extract(PyLong_AsUint(op1), PyLong_AsUint(op2), PySmtAstNode_AsSmtAstNode(op3)));
}
开发者ID:YHVHvx,项目名称:Triton,代码行数:19,代码来源:smt2libCallbacks.cpp

示例8: PyArg_ParseTuple

static PyObject *Triton_getModels(PyObject *self, PyObject *args)
{
  PyObject                        *node = nullptr;
  PyObject                        *limit;
  PyObject                        *modelsList;
  std::vector<std::list<Smodel>>  models;
  uint64                          limit_c = 0;
  uint64                          modelsSize = 0;

  /* Extract arguments */
  PyArg_ParseTuple(args, "O|O", &node, &limit);

  if (node == nullptr || !PySmtAstNode_Check(node))
    return PyErr_Format(PyExc_TypeError, "getModels(): expected a SmtAstNode as first argument");

  if (!PyLong_Check(limit) && !PyInt_Check(limit))
    return PyErr_Format(PyExc_TypeError, "getModels(): expected a limit (integer) as second argument");

  limit_c = PyLong_AsLong(limit);
  if (limit_c == 0)
    return PyErr_Format(PyExc_TypeError, "getModels(): The limit must be greater than 0");

  /* Get models */
  models        = ap.getModels(PySmtAstNode_AsSmtAstNode(node), limit_c);
  modelsSize    = models.size();
  modelsList    = xPyList_New(modelsSize);

  for (uint64 index = 0; index < modelsSize; index++){
    std::list<Smodel> model = models[index];
    std::list<Smodel>::iterator it;
    /* Craft the model dictionary */
    PyObject *modelDict = xPyDict_New();
    for (it = model.begin() ; it != model.end(); it++)
      PyDict_SetItemString(modelDict, it->getName().c_str(), Py_BuildValue("k", it->getValue()));

    PyList_SetItem(modelsList, index, modelDict);
  }

  return modelsList;
}
开发者ID:sigma-random,项目名称:Triton,代码行数:40,代码来源:tritonCallbacks.cpp

示例9: Py_BuildValue

static PyObject *SmtAstNode_getKind(PyObject *self, PyObject *noarg) {
  return Py_BuildValue("k", PySmtAstNode_AsSmtAstNode(self)->getKind());
}
开发者ID:v0re,项目名称:Triton,代码行数:3,代码来源:PySmtAstNode.cpp


注:本文中的PySmtAstNode_AsSmtAstNode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。