• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PySmtAstNode_Check函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PyArg_ParseTuple

static PyObject *smt2lib_bvmul(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, "bvmul(): expected a SmtAstNode as first argument");

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

  return PySmtAstNode(smt2lib::bvmul(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: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PyString_AS_STRING函数代码示例发布时间:2022-05-30
下一篇:
C++ PySmtAstNode_AsSmtAstNode函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap