本文整理汇总了C++中PyObject_HEAD_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ PyObject_HEAD_INIT函数的具体用法?C++ PyObject_HEAD_INIT怎么用?C++ PyObject_HEAD_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PyObject_HEAD_INIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ElfSymbolTable_dealloc
namespace python {
//! ElfSymbolTable destructor.
void ElfSymbolTable_dealloc(PyObject* self) {
std::cout << std::flush;
delete PyElfSymbolTable_AsElfSymbolTable(self);
Py_DECREF(self);
}
static PyObject* ElfSymbolTable_getIdxname(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint32(PyElfSymbolTable_AsElfSymbolTable(self)->getIdxname());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* ElfSymbolTable_getInfo(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint32(PyElfSymbolTable_AsElfSymbolTable(self)->getInfo());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* ElfSymbolTable_getName(PyObject* self, PyObject* noarg) {
try {
return PyString_FromString(PyElfSymbolTable_AsElfSymbolTable(self)->getName().c_str());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* ElfSymbolTable_getOther(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint32(PyElfSymbolTable_AsElfSymbolTable(self)->getOther());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* ElfSymbolTable_getShndx(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint32(PyElfSymbolTable_AsElfSymbolTable(self)->getShndx());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* ElfSymbolTable_getSize(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint64(PyElfSymbolTable_AsElfSymbolTable(self)->getSize());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* ElfSymbolTable_getValue(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint64(PyElfSymbolTable_AsElfSymbolTable(self)->getValue());
}
catch (const triton::exceptions::Exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
//! ElfSymbolTable methods.
PyMethodDef ElfSymbolTable_callbacks[] = {
{"getIdxname", ElfSymbolTable_getIdxname, METH_NOARGS, ""},
{"getInfo", ElfSymbolTable_getInfo, METH_NOARGS, ""},
{"getName", ElfSymbolTable_getName, METH_NOARGS, ""},
{"getOther", ElfSymbolTable_getOther, METH_NOARGS, ""},
{"getShndx", ElfSymbolTable_getShndx, METH_NOARGS, ""},
{"getSize", ElfSymbolTable_getSize, METH_NOARGS, ""},
{"getValue", ElfSymbolTable_getValue, METH_NOARGS, ""},
{nullptr, nullptr, 0, nullptr}
};
PyTypeObject ElfSymbolTable_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size */
"ElfSymbolTable", /* tp_name */
sizeof(ElfSymbolTable_Object), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)ElfSymbolTable_dealloc, /* tp_dealloc */
//.........这里部分代码省略.........
开发者ID:chubbymaggie,项目名称:Triton,代码行数:101,代码来源:pyElfSymbolTable.cpp
示例2: while
char temp[128];
int i = 0;
while (v->vars[i]) {
if (strcmp(v->vars[i]->name,n) == 0) {
return (*v->vars[i]->set_attr)(p);
}
i++;
}
sprintf(temp,"C global variable %s not found.", n);
PyErr_SetString(PyExc_NameError,temp);
return 1;
}
statichere PyTypeObject varlinktype = {
/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */
PyObject_HEAD_INIT(0)
0,
"varlink", /* Type name */
sizeof(swig_varlinkobject), /* Basic size */
0, /* Itemsize */
0, /* Deallocator */
(printfunc) swig_varlink_print, /* Print */
(getattrfunc) swig_varlink_getattr, /* get attr */
(setattrfunc) swig_varlink_setattr, /* Set attr */
0, /* tp_compare */
(reprfunc) swig_varlink_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_mapping*/
0, /* tp_hash */
};
开发者ID:malrsrch,项目名称:pywin32,代码行数:30,代码来源:exchdapi.cpp
示例3: if
else if (!strcmp(attr, "selected")) {
PyObject *ret;
GList *tmp;
gint i;
ret = PyTuple_New(g_list_length(self->data->selected));
for (i = 0, tmp = self->data->selected; tmp; i++, tmp = tmp->next)
PyTuple_SetItem(ret, i, PyDiaObject_New((DiaObject *)tmp->data));
return ret;
}
return Py_FindMethod(PyDiaDiagramData_Methods, (PyObject *)self, attr);
}
PyTypeObject PyDiaDiagramData_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
"dia.DiagramData",
sizeof(PyDiaDiagramData),
0,
(destructor)PyDiaDiagramData_Dealloc,
(printfunc)0,
(getattrfunc)PyDiaDiagramData_GetAttr,
(setattrfunc)0,
(cmpfunc)PyDiaDiagramData_Compare,
(reprfunc)0,
0,
0,
0,
(hashfunc)PyDiaDiagramData_Hash,
(ternaryfunc)0,
开发者ID:UIKit0,项目名称:dia,代码行数:31,代码来源:pydia-diagramdata.c
示例4: PyObject_HEAD_INIT
static PyMethodDef twopence_commandMethods[] = {
{ "suppressOutput", (PyCFunction) Command_suppressOutput, METH_VARARGS | METH_KEYWORDS,
"Do not display command's output to screen"
},
{ "setenv", (PyCFunction) Command_setenv, METH_VARARGS | METH_KEYWORDS,
"Set an environment variable to be passed to the command"
},
{ "unsetenv", (PyCFunction) Command_unsetenv, METH_VARARGS | METH_KEYWORDS,
"Unset an environment variable"
},
{ NULL }
};
PyTypeObject twopence_CommandType = {
PyObject_HEAD_INIT(NULL)
.tp_name = "twopence.Command",
.tp_basicsize = sizeof(twopence_Command),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "Twopence command",
.tp_methods = twopence_commandMethods,
.tp_init = (initproc) Command_init,
.tp_new = Command_new,
.tp_dealloc = (destructor) Command_dealloc,
.tp_getattr = (getattrfunc) Command_getattr,
.tp_setattr = (setattrfunc) Command_setattr,
};
/*
开发者ID:CasaMallo,项目名称:twopence,代码行数:31,代码来源:command.c
示例5: PyObject_HEAD_INIT
METH_VARARGS | METH_KEYWORDS, },
{ "get_configs", (PyCFunction)decoder_get_configs_meth,
METH_VARARGS | METH_KEYWORDS, },
{ "parse_config", (PyCFunction)decoder_parse_config,
METH_VARARGS | METH_KEYWORDS, },
{ "reset", (PyCFunction)decoder_reset,
METH_VARARGS | METH_KEYWORDS, },
{ "new_scan", (PyCFunction)decoder_new_scan,
METH_VARARGS | METH_KEYWORDS, },
{ "set_handler", (PyCFunction)decoder_set_handler,
METH_VARARGS | METH_KEYWORDS, },
{ "decode_width", (PyCFunction)decoder_decode_width,
METH_VARARGS | METH_KEYWORDS, },
{ NULL, },
};
PyTypeObject zbarDecoder_Type = {
PyObject_HEAD_INIT(NULL)
.tp_name = "zbar.Decoder",
.tp_doc = decoder_doc,
.tp_basicsize = sizeof(zbarDecoder),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_HAVE_GC,
.tp_new = (newfunc)decoder_new,
.tp_traverse = (traverseproc)decoder_traverse,
.tp_clear = (inquiry)decoder_clear,
.tp_dealloc = (destructor)decoder_dealloc,
.tp_getset = decoder_getset,
.tp_methods = decoder_methods,
};
开发者ID:13122310958,项目名称:ZBar,代码行数:30,代码来源:decoder.c
示例6: PyObject_HEAD_INIT
0, /*sq_ass_slice*/
0 /*sq_contains*/
};
// ----------------------------------------------------------------
static PyBufferProcs vcstring_as_buffer = {
(getreadbufferproc)vcstring_buffer_getreadbuf,
0,
(getsegcountproc)vcstring_buffer_getsegcount,
0,
};
// ----------------------------------------------------------------
static PyTypeObject VCStringType =
{
PyObject_HEAD_INIT(NULL)
0,
VCSTRING_NAME,
sizeof(PyVCStringObject),
0,
(destructor)VCString_Del, //tp_dealloc
0, //tp_print
0, //tp_getattr
0, //tp_setattr
0, //tp_compare
0, //tp_repr
0, //tp_as_number
&vcstring_as_sequence, //tp_as_sequence
0, //tp_as_mapping
0, /* tp_hash */
0, /* tp_call */
开发者ID:audioburn,项目名称:pymedia-redux-full,代码行数:31,代码来源:vcodec.c
示例7: offsetof
namespace boost { namespace python { namespace objects {
struct enum_object
{
PyIntObject base_object;
PyObject* name;
};
static PyMemberDef enum_members[] = {
{"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0},
{0, 0, 0, 0, 0}
};
extern "C"
{
static PyObject* enum_repr(PyObject* self_)
{
enum_object* self = downcast<enum_object>(self_);
if (!self->name)
{
return PyString_FromFormat("%s(%ld)", self_->ob_type->tp_name, PyInt_AS_LONG(self_));
}
else
{
char* name = PyString_AsString(self->name);
if (name == 0)
return 0;
return PyString_FromFormat("%s.%s", self_->ob_type->tp_name, name);
}
}
static PyObject* enum_str(PyObject* self_)
{
enum_object* self = downcast<enum_object>(self_);
if (!self->name)
{
return PyInt_Type.tp_str(self_);
}
else
{
return incref(self->name);
}
}
}
static PyTypeObject enum_type_object = {
PyObject_HEAD_INIT(0) // &PyType_Type
0,
"Boost.Python.enum",
sizeof(enum_object), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
enum_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
enum_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_CHECKTYPES
| Py_TPFLAGS_HAVE_GC
| Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
enum_members, /* tp_members */
0, /* tp_getset */
0, //&PyInt_Type, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
#if PYTHON_API_VERSION >= 1012
0 /* tp_del */
#endif
//.........这里部分代码省略.........
开发者ID:iceberry,项目名称:flyffsf,代码行数:101,代码来源:enum.cpp
示例8: spamlist_state_get
}
static PyObject *
spamlist_state_get(spamlistobject *self)
{
return PyInt_FromLong(self->state);
}
static PyGetSetDef spamlist_getsets[] = {
{"state", (getter)spamlist_state_get, NULL,
PyDoc_STR("an int variable for demonstration purposes")},
{0}
};
static PyTypeObject spamlist_type = {
PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type))
0,
"xxsubtype.spamlist",
sizeof(spamlistobject),
0,
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
开发者ID:Oize,项目名称:pspstacklesspython,代码行数:31,代码来源:xxsubtype.c
示例9: PyErr_SetString
PyErr_SetString(PyExc_TypeError, "header.type can only be set to a single-character value");
return -1;
}
self->hline->type = (int)(p[0]);
return 0;
}
PyErr_Format(PyExc_AttributeError, "Attribute: %s is not settable", name);
return -1;
}
static PyTypeObject ExPy_Header_Line =
{
PyObject_HEAD_INIT(NULL) /* Workaround problem with Cygwin/GCC, by setting to &PyType_Type at runtime */
0, /*ob_size*/
"ExPy Header Line", /*tp_name*/
sizeof(expy_header_line_t), /*tp_size*/
0, /*tp_itemsize*/
expy_header_line_dealloc, /*tp_dealloc*/
0, /*tp_print*/
(getattrfunc) expy_header_line_getattr, /*tp_getattr*/
(setattrfunc) expy_header_line_setattr, /*tp_setattr*/
};
PyObject * expy_create_header_line(header_line *p)
{
expy_header_line_t * result;
开发者ID:barryp,项目名称:py-exim-localscan,代码行数:30,代码来源:expy_local_scan.c
示例10: PyObject_HEAD_INIT
(PyCFunction)Track_starred,
METH_VARARGS | METH_KEYWORDS,
"Get/set the starred property of the track"},
{"is_autolinked",
(PyCFunction)Track_is_autolinked,
METH_NOARGS,
"Returns whether this track is a link to another track"},
{"playable",
(PyCFunction)Track_get_playable,
METH_NOARGS,
"Return the actual track that will be played if this track is played"},
{NULL}
};
PyTypeObject TrackType = {
PyObject_HEAD_INIT(NULL) 0, /*ob_size */
"spotify.Track", /*tp_name */
sizeof(Track), /*tp_basicsize */
0, /*tp_itemsize */
(destructor) Track_dealloc, /*tp_dealloc */
0, /*tp_print */
0, /*tp_getattr */
0, /*tp_setattr */
0, /*tp_compare */
0, /*tp_repr */
0, /*tp_as_number */
0, /*tp_as_sequence */
0, /*tp_as_mapping */
0, /*tp_hash */
0, /*tp_call */
Track_str, /*tp_str */
开发者ID:adamcik,项目名称:pyspotify,代码行数:31,代码来源:track.c
示例11: Discovery
/*
TODO: Path MTU Discovery (RFC1191)
PyObject *icmp_radv;
PyObject *icmp_mask;
*/
{"packet", T_OBJECT, offsetof(ICMPObject, data), READONLY, "Raw packet data"},
{ NULL }
};
PyTypeObject ICMP_Type =
{
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"pycap.protocol.icmp", /*tp_name*/
sizeof(ICMPObject), /*tp_basicsize*/
0, /*tp_itemsize*/
/* methods */
(destructor)ICMPObject_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)ICMPObject_str, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
开发者ID:Aliced3645,项目名称:DataCenterMarketing,代码行数:31,代码来源:icmp.c
示例12: premalloced_dealloc
typedef struct {
PyObject_HEAD
void *data;
} premalloced_object;
static void premalloced_dealloc(premalloced_object *self)
{
free(self->data);
Py_TYPE(self)->tp_free((PyObject *) self);
}
static PyTypeObject premalloced_type = {
PyObject_HEAD_INIT(NULL)
.tp_name = "premalloced",
.tp_basicsize = sizeof(premalloced_object),
.tp_dealloc = (destructor)premalloced_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "Pre-malloc'd memory"
};
static PyObject *premalloced_new(void *data)
{
premalloced_object *obj = PyObject_New(premalloced_object, &premalloced_type);
if (obj)
obj->data = data;
else
free(data);
return (PyObject *) obj;
开发者ID:astrophysicsvivien,项目名称:lalsuite,代码行数:31,代码来源:sky_map.c
示例13: Comment
/* No additional interface members defined */
/** Type Object ********************************************************/
static char comment_doc[] = "\
Comment(ownerDocument, data) -> Comment object\n\
\n\
This interface represents the content of a comment, i.e., all the characters\n\
between the starting '<!--' and ending '-->'.";
PyTypeObject DomletteComment_Type = {
/* PyObject_HEAD */ PyObject_HEAD_INIT(NULL)
/* ob_size */ 0,
/* tp_name */ DOMLETTE_PACKAGE "Comment",
/* tp_basicsize */ sizeof(PyCommentObject),
/* tp_itemsize */ 0,
/* tp_dealloc */ (destructor) 0,
/* tp_print */ (printfunc) 0,
/* tp_getattr */ (getattrfunc) 0,
/* tp_setattr */ (setattrfunc) 0,
/* tp_compare */ (cmpfunc) 0,
/* tp_repr */ (reprfunc) 0,
/* tp_as_number */ (PyNumberMethods *) 0,
/* tp_as_sequence */ (PySequenceMethods *) 0,
/* tp_as_mapping */ (PyMappingMethods *) 0,
/* tp_hash */ (hashfunc) 0,
/* tp_call */ (ternaryfunc) 0,
开发者ID:flaub,项目名称:Peach,代码行数:29,代码来源:comment.c
示例14: Py_INCREF
Py_INCREF((PyObject*)symbol_NONE);
return(symbol_NONE);
}
return(zbarSymbol_LookupEnum(sym));
}
static PyMethodDef scanner_methods[] = {
{ "reset", (PyCFunction)scanner_reset,
METH_VARARGS | METH_KEYWORDS, },
{ "new_scan", (PyCFunction)scanner_new_scan,
METH_VARARGS | METH_KEYWORDS, },
{ "scan_y", (PyCFunction)scanner_scan_y,
METH_VARARGS | METH_KEYWORDS, },
{ NULL, },
};
PyTypeObject zbarScanner_Type = {
PyObject_HEAD_INIT(NULL)
.tp_name = "zbar.Scanner",
.tp_doc = scanner_doc,
.tp_basicsize = sizeof(zbarScanner),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_HAVE_GC,
.tp_new = (newfunc)scanner_new,
.tp_traverse = (traverseproc)scanner_traverse,
.tp_clear = (inquiry)scanner_clear,
.tp_dealloc = (destructor)scanner_dealloc,
.tp_getset = scanner_getset,
.tp_methods = scanner_methods,
};
开发者ID:13122310958,项目名称:ZBar,代码行数:30,代码来源:scanner.c
示例15: SymbolicVariable_dealloc
//.........这里部分代码省略.........
static int SymbolicVariable_print(PyObject* self) {
std::cout << PySymbolicVariable_AsSymbolicVariable(self);
return 0;
}
static PyObject* SymbolicVariable_str(PyObject* self) {
try {
std::stringstream str;
str << PySymbolicVariable_AsSymbolicVariable(self);
return PyString_FromFormat("%s", str.str().c_str());
}
catch (const std::exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
//! SymbolicVariable methods.
PyMethodDef SymbolicVariable_callbacks[] = {
{"getBitSize", SymbolicVariable_getBitSize, METH_NOARGS, ""},
{"getComment", SymbolicVariable_getComment, METH_NOARGS, ""},
{"getConcreteValue", SymbolicVariable_getConcreteValue, METH_NOARGS, ""},
{"getId", SymbolicVariable_getId, METH_NOARGS, ""},
{"getKind", SymbolicVariable_getKind, METH_NOARGS, ""},
{"getKindValue", SymbolicVariable_getKindValue, METH_NOARGS, ""},
{"getName", SymbolicVariable_getName, METH_NOARGS, ""},
{"setComment", SymbolicVariable_setComment, METH_O, ""},
{"setConcreteValue", SymbolicVariable_setConcreteValue, METH_O, ""},
{nullptr, nullptr, 0, nullptr}
};
PyTypeObject SymbolicVariable_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size*/
"SymbolicVariable", /* tp_name*/
sizeof(SymbolicVariable_Object), /* tp_basicsize*/
0, /* tp_itemsize*/
(destructor)SymbolicVariable_dealloc, /* tp_dealloc*/
(printfunc)SymbolicVariable_print, /* tp_print*/
0, /* tp_getattr*/
0, /* tp_setattr*/
0, /* tp_compare*/
0, /* tp_repr*/
0, /* tp_as_number*/
0, /* tp_as_sequence*/
0, /* tp_as_mapping*/
0, /* tp_hash */
0, /* tp_call*/
(reprfunc)SymbolicVariable_str, /* tp_str*/
0, /* tp_getattro*/
0, /* tp_setattro*/
0, /* tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /* tp_flags*/
"SymbolicVariable objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
SymbolicVariable_callbacks, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
0, /* tp_del */
0 /* tp_version_tag */
};
PyObject* PySymbolicVariable(triton::engines::symbolic::SymbolicVariable* symVar) {
SymbolicVariable_Object* object;
if (symVar == nullptr)
return PyErr_Format(PyExc_TypeError, "PySymbolicVariable(): symVar cannot be null.");
PyType_Ready(&SymbolicVariable_Type);
object = PyObject_NEW(SymbolicVariable_Object, &SymbolicVariable_Type);
if (object != NULL)
object->symVar = symVar;
return (PyObject*)object;
}
}; /* python namespace */
开发者ID:redteamcaliber,项目名称:Triton,代码行数:101,代码来源:pySymbolicVariable.cpp
示例16: MemoryOperand_dealloc
//.........这里部分代码省略.........
static int MemoryOperand_print(PyObject* self) {
std::cout << PyMemoryOperand_AsMemoryOperand(self);
return 0;
}
static PyObject* MemoryOperand_str(PyObject* self) {
try {
std::stringstream str;
str << PyMemoryOperand_AsMemoryOperand(self);
return PyString_FromFormat("%s", str.str().c_str());
}
catch (const std::exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
//! Memory methods.
PyMethodDef MemoryOperand_callbacks[] = {
{"getAddress", MemoryOperand_getAddress, METH_NOARGS, ""},
{"getBaseRegister", MemoryOperand_getBaseRegister, METH_NOARGS, ""},
{"getBitSize", MemoryOperand_getBitSize, METH_NOARGS, ""},
{"getBitvector", MemoryOperand_getBitvector, METH_NOARGS, ""},
{"getConcreteValue", MemoryOperand_getConcreteValue, METH_NOARGS, ""},
{"getDisplacement", MemoryOperand_getDisplacement, METH_NOARGS, ""},
{"getIndexRegister", MemoryOperand_getIndexRegister, METH_NOARGS, ""},
{"getLeaAst", MemoryOperand_getLeaAst, METH_NOARGS, ""},
{"getScale", MemoryOperand_getScale, METH_NOARGS, ""},
{"getSegmentRegister", MemoryOperand_getSegmentRegister, METH_NOARGS, ""},
{"getSize", MemoryOperand_getSize, METH_NOARGS, ""},
{"getType", MemoryOperand_getType, METH_NOARGS, ""},
{"isTrusted", MemoryOperand_isTrusted, METH_NOARGS, ""},
{"setBaseRegister", MemoryOperand_setBaseRegister, METH_O, ""},
{"setConcreteValue", MemoryOperand_setConcreteValue, METH_O, ""},
{"setDisplacement", MemoryOperand_setDisplacement, METH_O, ""},
{"setIndexRegister", MemoryOperand_setIndexRegister, METH_O, ""},
{"setScale", MemoryOperand_setScale, METH_O, ""},
{"setSegmentRegister", MemoryOperand_setSegmentRegister, METH_O, ""},
{"setTrust", MemoryOperand_setTrust, METH_O, ""},
{nullptr, nullptr, 0, nullptr}
};
PyTypeObject MemoryOperand_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size*/
"Memory", /* tp_name*/
sizeof(MemoryOperand_Object), /* tp_basicsize*/
0, /* tp_itemsize*/
(destructor)MemoryOperand_dealloc, /* tp_dealloc*/
(printfunc)MemoryOperand_print, /* tp_print*/
0, /* tp_getattr*/
0, /* tp_setattr*/
0, /* tp_compare*/
0, /* tp_repr*/
0, /* tp_as_number*/
0, /* tp_as_sequence*/
0, /* tp_as_mapping*/
0, /* tp_hash */
0, /* tp_call*/
(reprfunc)MemoryOperand_str, /* tp_str*/
0, /* tp_getattro*/
0, /* tp_setattro*/
0, /* tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /* tp_flags*/
"Memory objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
MemoryOperand_callbacks, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
};
PyObject* PyMemoryOperand(const triton::arch::MemoryOperand& mem) {
MemoryOperand_Object* object;
PyType_Ready(&MemoryOperand_Type);
object = PyObject_NEW(MemoryOperand_Object, &MemoryOperand_Type);
if (object != NULL)
object->mem = new triton::arch::MemoryOperand(mem);
return (PyObject*)object;
}
}; /* python namespace */
开发者ID:jizhongqing,项目名称:Triton,代码行数:101,代码来源:pyMemory.cpp
示例17: Bitvector_dealloc
namespace python {
//! Bitvector destructor.
void Bitvector_dealloc(PyObject* self) {
std::cout << std::flush;
Py_DECREF(self);
}
static PyObject* Bitvector_getHigh(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint32(PyBitvector_AsHigh(self));
}
catch (const std::exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* Bitvector_getLow(PyObject* self, PyObject* noarg) {
try {
return PyLong_FromUint32(PyBitvector_AsLow(self));
}
catch (const std::exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static PyObject* Bitvector_getVectorSize(PyObject* self, PyObject* noarg) {
try {
triton::uint32 vectorSize = ((PyBitvector_AsHigh(self) - PyBitvector_AsLow(self)) + 1);
return PyLong_FromUint32(vectorSize);
}
catch (const std::exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
static int Bitvector_print(PyObject* self) {
std::cout << "bv[" << std::dec << PyBitvector_AsHigh(self) << ".." << PyBitvector_AsLow(self) << "]";
return 0;
}
static PyObject* Bitvector_str(PyObject* self) {
try {
return PyString_FromFormat("bv[%d..%d]", PyBitvector_AsHigh(self), PyBitvector_AsLow(self));
}
catch (const std::exception& e) {
return PyErr_Format(PyExc_TypeError, "%s", e.what());
}
}
//! Bitvector methods.
PyMethodDef Bitvector_callbacks[] = {
{"getHigh", Bitvector_getHigh, METH_NOARGS, ""},
{"getLow", Bitvector_getLow, METH_NOARGS, ""},
{"getVectorSize", Bitvector_getVectorSize, METH_NOARGS, ""},
{nullptr, nullptr, 0, nullptr}
};
PyTypeObject Bitvector_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size */
"Bitvector", /* tp_name */
sizeof(Bitvector_Object), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Bitvector_dealloc, /* tp_dealloc */
(printfunc)Bitvector_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)Bitvector_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Bitvector objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
Bitvector_callbacks, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
//.........这里部分代码省略.........
开发者ID:illera88,项目名称:Triton,代码行数:101,代码来源:pyBitvector.cpp
示例18: PyBool_FromLong
return NULL;
}
// Py_INCREF(Py_True); // return True not None for backward compat
// return Py_True;
// Py_RETURN_TRUE;
return PyBool_FromLong(static_cast<long>(true));
}
static PyMethodDef ImageExport_methods[] = {
{const_cast<char*>("save"), (PyCFunction)ImageExport_save, METH_NOARGS, imgexp_save__doc__},
{const_cast<char*>("saveAs"), (PyCFunction)ImageExport_saveAs, METH_VARARGS, imgexp_saveas__doc__},
{NULL, (PyCFunction)(0), 0, NULL} // sentinel
};
PyTypeObject ImageExport_Type = {
PyObject_HEAD_INIT(NULL) // PyObject_VAR_HEAD
0,
const_cast<char*>("ImageExport"), // char *tp_name; /* For printing, in format "<module>.<name>" */
sizeof(ImageExport), // int tp_basicsize, /* For allocation */
0, // int tp_itemsize; /* For allocation */
(destructor) ImageExport_dealloc, // destructor tp_dealloc;
0, // printfunc tp_print;
0, // getattrfunc tp_getattr;
0, // setattrfunc tp_setattr;
0, // cmpfunc tp_compare;
0, // reprfunc tp_repr;
0, // PyNumberMethods *tp_as_number;
0, // PySequenceMethods *tp_as_sequence;
0, // PyMappingMethods *tp_as_mapping;
0, // hashfunc tp_hash;
0, // ternaryfunc tp_call;
开发者ID:moceap,项目名称:scribus,代码行数:31,代码来源:objimageexport.cpp
示例19: PyObject_HEAD_INIT
namespace IcePy
{
PyTypeObject ConnectionInfoType =
{
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
PyObject_HEAD_INIT(0)
0, /* ob_size */
STRCAST("IcePy.ConnectionInfo"), /* tp_name */
sizeof(ConnectionInfoObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods
|
请发表评论