PY_FUNC_RET_OBJECT_LIST(fields, PY_OBJ_NAME) PY_FUNC_RET_STD_STRING(module, PY_OBJ_NAME) PY_FUNC(moduleId, PY_OBJ_NAME, "K") PY_FUNC(arrayElements, PY_OBJ_NAME, "k") PY_FUNC_DECL(templateArguments, PY_OBJ_NAME) { PY_IMPL_GUARD; auto list = PyList_New(0); for (PyType::TemplateArgument arg : self->impl->templateArguments()) PyList_Append(list, arg.numeric ? Py_BuildValue("i", arg.numericValue) : Py_BuildValue("s", arg.typeName.c_str())); return list; } static PyMethodDef typeMethods[] = { {"name", PyCFunction(name), METH_NOARGS, "Return the type name"}, {"bitsize", PyCFunction(bitsize), METH_NOARGS, "Return the size of the type in bits"}, {"code", PyCFunction(code), METH_NOARGS, "Return type code"}, {"unqualified", PyCFunction(unqualified), METH_NOARGS, "Type without const/volatile"}, {"target", PyCFunction(target), METH_NOARGS, "Type dereferenced if it is a pointer type, element if array etc"}, {"targetName", PyCFunction(targetName), METH_NOARGS, "Typename dereferenced if it is a pointer type, element if array etc"}, {"stripTypedef", PyCFunction(stripTypedef), METH_NOARGS, "Type with typedefs removed"}, {"fields", PyCFunction(fields), METH_NOARGS, "List of fields (member and base classes) of this type"},
PY_IMPL_GUARD; FieldPythonObject *field; if (!PyArg_ParseTuple(args, "O", &field)) Py_RETURN_NONE; return createPythonObject(self->impl->childFromField(*(field->impl))); } PY_FUNC_DECL_WITH_ARGS(childFromIndex, PY_OBJ_NAME) { PY_IMPL_GUARD; unsigned int index; if (!PyArg_ParseTuple(args, "I", &index)) Py_RETURN_NONE; return createPythonObject(self->impl->childFromIndex(index)); } static PyMethodDef valueMethods[] = { {"name", PyCFunction(name), METH_NOARGS, "Name of this thing or None"}, {"type", PyCFunction(type), METH_NOARGS, "Type of this value"}, {"bitsize", PyCFunction(bitsize), METH_NOARGS, "Return the size of the value in bits"}, {"asBytes", PyCFunction(asBytes), METH_NOARGS, "Memory contents of this object, or None"}, {"address", PyCFunction(address), METH_NOARGS, "Address of this object, or None"}, {"hasChildren", PyCFunction(hasChildren), METH_NOARGS, "Whether this object has subobjects"}, {"expand", PyCFunction(expand), METH_NOARGS, "Make sure that children are accessible."}, {"nativeDebuggerValue", PyCFunction(nativeDebuggerValue), METH_NOARGS, "Value string returned by the debugger"},
// Python interface implementation namespace PyFieldInterface { #define PY_OBJ_NAME FieldPythonObject PY_NEW_FUNC(PY_OBJ_NAME) PY_DEALLOC_FUNC(PY_OBJ_NAME) PY_FUNC_RET_STD_STRING(name, PY_OBJ_NAME) PY_FUNC_RET_NONE(isBaseClass, PY_OBJ_NAME) PY_FUNC_RET_OBJECT(type, PY_OBJ_NAME) PY_FUNC_RET_OBJECT(parentType, PY_OBJ_NAME) PY_FUNC(bitsize, PY_OBJ_NAME, "Q") PY_FUNC(bitpos, PY_OBJ_NAME, "Q") static PyMethodDef fieldMethods[] = { {"name", PyCFunction(name), METH_NOARGS, "Return the name of this field or None for anonymous fields"}, {"isBaseClass", PyCFunction(isBaseClass), METH_NOARGS, "Whether this is a base class or normal member"}, {"type", PyCFunction(type), METH_NOARGS, "Type of this member"}, {"parentType", PyCFunction(parentType), METH_NOARGS, "Type of class this member belongs to"}, {"bitsize", PyCFunction(bitsize), METH_NOARGS, "Size of member in bits"}, {"bitpos", PyCFunction(bitpos), METH_NOARGS, "Offset of member in parent type in bits"}, {NULL} /* Sentinel */ }; } // PyFieldInterface