text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185 values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```c++
#include "UEPyFbxMesh.h"
#if WITH_EDITOR
#if ENGINE_MINOR_VERSION > 12
#include "UEPyFbx.h"
static PyObject *py_ue_fbx_mesh_get_polygon_count(ue_PyFbxMesh *self, PyObject *args)
{
return PyLong_FromLong(self->fbx_mesh->GetPolygonCount());
}
static PyObject *py_ue_fbx_mesh_get_control_points_count(ue_PyFbxMesh *self, PyObject *args)
{
return PyLong_FromLong(self->fbx_mesh->GetControlPointsCount());
}
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_count(ue_PyFbxMesh *self, PyObject *args)
{
return PyLong_FromLong(self->fbx_mesh->GetPolygonVertexCount());
}
static PyObject *py_ue_fbx_mesh_get_name(ue_PyFbxMesh *self, PyObject *args)
{
return PyUnicode_FromString(self->fbx_mesh->GetName());
}
static PyObject *py_ue_fbx_mesh_get_polygon_vertices(ue_PyFbxMesh *self, PyObject *args)
{
PyObject *py_list = PyList_New(0);
int *indices = self->fbx_mesh->GetPolygonVertices();
for (int i = 0; i < self->fbx_mesh->GetPolygonVertexCount(); i++)
{
PyList_Append(py_list, PyLong_FromLong(indices[i]));
}
return py_list;
}
static PyObject *py_ue_fbx_mesh_get_control_points(ue_PyFbxMesh *self, PyObject *args)
{
PyObject *py_list = PyList_New(0);
FbxVector4* control_points = self->fbx_mesh->GetControlPoints();
for (int i = 0; i < self->fbx_mesh->GetControlPointsCount(); i++)
{
FbxVector4 vec4 = control_points[i];
PyList_Append(py_list, py_ue_new_fvector(FVector(vec4[0], vec4[1], vec4[2])));
}
return py_list;
}
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_normals(ue_PyFbxMesh *self, PyObject *args)
{
FbxArray<FbxVector4> normals;
if (!self->fbx_mesh->GetPolygonVertexNormals(normals))
{
Py_RETURN_NONE;
}
PyObject *py_list = PyList_New(0);
for (int i = 0; i < normals.Size(); i++)
{
FbxVector4 vec = normals.GetAt(i);
PyList_Append(py_list, py_ue_new_fvector(FVector(vec[0], vec[1], vec[2])));
}
return py_list;
}
static PyObject *py_ue_fbx_mesh_get_uv_set_names(ue_PyFbxMesh *self, PyObject *args)
{
PyObject *py_list = PyList_New(0);
FbxStringList name_list;
self->fbx_mesh->GetUVSetNames(name_list);
for (int i = 0; i < name_list.GetCount(); i++)
{
PyList_Append(py_list, PyUnicode_FromString(name_list.GetStringAt(i)));
}
return py_list;
}
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_uvs(ue_PyFbxMesh *self, PyObject *args)
{
char *uv_set;
if (!PyArg_ParseTuple(args, "s", &uv_set))
return nullptr;
FbxArray<FbxVector2> uvs;
if (!self->fbx_mesh->GetPolygonVertexUVs(uv_set, uvs))
{
Py_RETURN_NONE;
}
PyObject *py_list = PyList_New(0);
for (int i = 0; i < uvs.Size(); i++)
{
FbxVector2 vec = uvs.GetAt(i);
PyList_Append(py_list, Py_BuildValue((char *)"(ff)", vec[0], vec[1]));
}
return py_list;
}
static PyObject *py_ue_fbx_mesh_remove_bad_polygons(ue_PyFbxMesh *self, PyObject *args)
{
self->fbx_mesh->RemoveBadPolygons();
Py_RETURN_NONE;
}
static PyMethodDef ue_PyFbxMesh_methods[] = {
{ "remove_bad_polygons", (PyCFunction)py_ue_fbx_mesh_remove_bad_polygons, METH_VARARGS, "" },
{ "get_polygon_count", (PyCFunction)py_ue_fbx_mesh_get_polygon_count, METH_VARARGS, "" },
{ "get_polygon_vertices", (PyCFunction)py_ue_fbx_mesh_get_polygon_vertices, METH_VARARGS, "" },
{ "get_polygon_vertex_count", (PyCFunction)py_ue_fbx_mesh_get_polygon_vertex_count, METH_VARARGS, "" },
{ "get_control_points_count", (PyCFunction)py_ue_fbx_mesh_get_control_points_count, METH_VARARGS, "" },
{ "get_control_points", (PyCFunction)py_ue_fbx_mesh_get_control_points, METH_VARARGS, "" },
{ "get_polygon_vertex_uvs", (PyCFunction)py_ue_fbx_mesh_get_polygon_vertex_uvs, METH_VARARGS, "" },
{ "get_uv_set_names", (PyCFunction)py_ue_fbx_mesh_get_uv_set_names, METH_VARARGS, "" },
{ "get_name", (PyCFunction)py_ue_fbx_mesh_get_name, METH_VARARGS, "" },
{ "get_polygon_vertex_normals", (PyCFunction)py_ue_fbx_mesh_get_polygon_vertex_normals, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFbxMeshType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FbxMesh", /* tp_name */
sizeof(ue_PyFbxMesh), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FbxMesh", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFbxMesh_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
};
static int py_ue_fbx_mesh_init(ue_PyFbxMesh *self, PyObject * args)
{
PyObject *py_object;
char *name;
if (!PyArg_ParseTuple(args, "Os", &py_object, &name))
{
return -1;
}
ue_PyFbxManager *py_fbx_manager = py_ue_is_fbx_manager(py_object);
if (!py_fbx_manager)
{
PyErr_SetString(PyExc_Exception, "argument is not a FbxManager");
return -1;
}
self->fbx_mesh = FbxMesh::Create(py_fbx_manager->fbx_manager, name);
return 0;
}
void ue_python_init_fbx_mesh(PyObject *ue_module)
{
ue_PyFbxMeshType.tp_new = PyType_GenericNew;;
ue_PyFbxMeshType.tp_init = (initproc)py_ue_fbx_mesh_init;
if (PyType_Ready(&ue_PyFbxMeshType) < 0)
return;
Py_INCREF(&ue_PyFbxMeshType);
PyModule_AddObject(ue_module, "FbxMesh", (PyObject *)&ue_PyFbxMeshType);
}
PyObject *py_ue_new_fbx_mesh(FbxMesh *fbx_mesh)
{
ue_PyFbxMesh *ret = (ue_PyFbxMesh *)PyObject_New(ue_PyFbxMesh, &ue_PyFbxMeshType);
ret->fbx_mesh = fbx_mesh;
return (PyObject *)ret;
}
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Fbx/UEPyFbxMesh.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,811 |
```objective-c
#pragma once
#if ENGINE_MINOR_VERSION > 12
#include "UEPyModule.h"
#if WITH_EDITOR
#include "UEPyFbxManager.h"
#include "UEPyFbxIOSettings.h"
#include "UEPyFbxImporter.h"
#include "UEPyFbxScene.h"
#include "UEPyFbxNode.h"
#include "UEPyFbxObject.h"
#include "UEPyFbxProperty.h"
#include "UEPyFbxPose.h"
#include "UEPyFbxMesh.h"
void ue_python_init_fbx(PyObject *);
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Fbx/UEPyFbx.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 117 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if WITH_EDITOR
#if PLATFORM_LINUX
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wnull-dereference"
#endif
#endif
#include <fbxsdk.h>
struct ue_PyFbxObject {
PyObject_HEAD
/* Type-specific fields go here. */
FbxObject *fbx_object;
};
void ue_python_init_fbx_object(PyObject *);
PyObject *py_ue_new_fbx_object(FbxObject *);
ue_PyFbxObject *py_ue_is_fbx_object(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Fbx/UEPyFbxObject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 114 |
```c++
#include "UEPyFbxPose.h"
#if ENGINE_MINOR_VERSION > 12
#if WITH_EDITOR
#include "UEPyFbx.h"
static PyObject *py_ue_fbx_pose_get_count(ue_PyFbxPose *self, PyObject *args)
{
return PyLong_FromLong(self->fbx_pose->GetCount());
}
static PyObject *py_ue_fbx_pose_get_name(ue_PyFbxPose *self, PyObject *args)
{
return PyUnicode_FromString(self->fbx_pose->GetName());
}
static PyObject *py_ue_fbx_pose_is_bind_pose(ue_PyFbxPose *self, PyObject *args)
{
if (self->fbx_pose->IsBindPose())
{
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
}
static PyObject *py_ue_fbx_pose_is_rest_pose(ue_PyFbxPose *self, PyObject *args)
{
if (self->fbx_pose->IsRestPose())
{
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
}
static PyObject *py_ue_fbx_pose_get_node(ue_PyFbxPose *self, PyObject *args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
{
return nullptr;
}
FbxNode *fbx_node = self->fbx_pose->GetNode(index);
if (!fbx_node)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxNode at index %d", index);
}
return py_ue_new_fbx_node(fbx_node);
}
static PyObject *py_ue_fbx_pose_find(ue_PyFbxPose *self, PyObject *args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFbxNode *py_node = py_ue_is_fbx_node(py_obj);
if (!py_node)
return PyErr_Format(PyExc_Exception, "argument is not a FbxNode");
int index = self->fbx_pose->Find(py_node->fbx_node);
if (index < 0)
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxNode index from FbxPose");
return PyLong_FromLong(index);
}
static PyObject *py_ue_fbx_pose_get_transform(ue_PyFbxPose *self, PyObject *args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
{
return nullptr;
}
FbxMatrix fbx_matrix = self->fbx_pose->GetMatrix(index);
FbxAMatrix matrix = *(FbxAMatrix *)&fbx_matrix;
FTransform transform;
FbxVector4 mt = matrix.GetT();
FbxQuaternion mq = matrix.GetQ();
FbxVector4 ms = matrix.GetS();
transform.SetTranslation(FVector(mt[0], -mt[1], mt[2]));
transform.SetRotation(FQuat(mq[0], -mq[1], mq[2], -mq[3]));
transform.SetScale3D(FVector(ms[0], ms[1], ms[2]));
return py_ue_new_ftransform(transform);
}
static PyMethodDef ue_PyFbxPose_methods[] = {
{ "get_count", (PyCFunction)py_ue_fbx_pose_get_count, METH_VARARGS, "" },
{ "get_name", (PyCFunction)py_ue_fbx_pose_get_name, METH_VARARGS, "" },
{ "get_node", (PyCFunction)py_ue_fbx_pose_get_node, METH_VARARGS, "" },
{ "is_bind_pose", (PyCFunction)py_ue_fbx_pose_is_bind_pose, METH_VARARGS, "" },
{ "is_rest_pose", (PyCFunction)py_ue_fbx_pose_is_rest_pose, METH_VARARGS, "" },
{ "find", (PyCFunction)py_ue_fbx_pose_find, METH_VARARGS, "" },
{ "get_transform", (PyCFunction)py_ue_fbx_pose_get_transform, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFbxPoseType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FbxPose", /* tp_name */
sizeof(ue_PyFbxPose), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FbxPose", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFbxPose_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
};
static int py_ue_fbx_pose_init(ue_PyFbxPose *self, PyObject * args)
{
PyObject *py_object;
char *name;
if (!PyArg_ParseTuple(args, "Os", &py_object, &name))
{
return -1;
}
ue_PyFbxManager *py_fbx_manager = py_ue_is_fbx_manager(py_object);
if (!py_fbx_manager)
{
PyErr_SetString(PyExc_Exception, "argument is not a FbxManager");
return -1;
}
self->fbx_pose = FbxPose::Create(py_fbx_manager->fbx_manager, name);
return 0;
}
void ue_python_init_fbx_pose(PyObject *ue_module)
{
ue_PyFbxPoseType.tp_new = PyType_GenericNew;;
ue_PyFbxPoseType.tp_init = (initproc)py_ue_fbx_pose_init;
if (PyType_Ready(&ue_PyFbxPoseType) < 0)
return;
Py_INCREF(&ue_PyFbxPoseType);
PyModule_AddObject(ue_module, "FbxPose", (PyObject *)&ue_PyFbxPoseType);
}
PyObject *py_ue_new_fbx_pose(FbxPose *fbx_pose)
{
ue_PyFbxPose *ret = (ue_PyFbxPose *)PyObject_New(ue_PyFbxPose, &ue_PyFbxPoseType);
ret->fbx_pose = fbx_pose;
return (PyObject *)ret;
}
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Fbx/UEPyFbxPose.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,488 |
```c++
#include "UEPyFbxNode.h"
#if WITH_EDITOR
#if ENGINE_MINOR_VERSION > 12
#include "UEPyFbx.h"
static PyObject *py_ue_fbx_node_get_child_count(ue_PyFbxNode *self, PyObject *args)
{
return PyLong_FromLong(self->fbx_node->GetChildCount());
}
static PyObject *py_ue_fbx_node_get_name(ue_PyFbxNode *self, PyObject *args)
{
return PyUnicode_FromString(self->fbx_node->GetName());
}
static PyObject *py_ue_fbx_node_get_local_translation(ue_PyFbxNode *self, PyObject *args)
{
FbxDouble3 fbx_vec = self->fbx_node->LclTranslation.Get();
return py_ue_new_fvector(FVector(fbx_vec[0], fbx_vec[1], fbx_vec[2]));
}
static PyObject *py_ue_fbx_node_get_local_rotation(ue_PyFbxNode *self, PyObject *args)
{
FbxDouble3 fbx_vec = self->fbx_node->LclRotation.Get();
return py_ue_new_fvector(FVector(fbx_vec[0], fbx_vec[1], fbx_vec[2]));
}
static PyObject *py_ue_fbx_node_get_local_scaling(ue_PyFbxNode *self, PyObject *args)
{
FbxDouble3 fbx_vec = self->fbx_node->LclScaling.Get();
return py_ue_new_fvector(FVector(fbx_vec[0], fbx_vec[1], fbx_vec[2]));
}
static PyObject *py_ue_fbx_node_get_child(ue_PyFbxNode *self, PyObject *args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
{
return nullptr;
}
FbxNode *fbx_node = self->fbx_node->GetChild(index);
if (!fbx_node)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxNode at index %d", index);
}
return py_ue_new_fbx_node(fbx_node);
}
static PyObject *py_ue_fbx_node_get_parent(ue_PyFbxNode *self, PyObject *args)
{
FbxNode *fbx_node = self->fbx_node->GetParent();
if (!fbx_node)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxNode parent");
}
return py_ue_new_fbx_node(fbx_node);
}
static PyObject *py_ue_fbx_node_get_node_attribute(ue_PyFbxNode *self, PyObject *args)
{
FbxNodeAttribute *fbx_node_attribute = self->fbx_node->GetNodeAttribute();
if (!fbx_node_attribute)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxNodeAttribute");
}
return py_ue_new_fbx_object(fbx_node_attribute);
}
static PyObject *py_ue_fbx_node_get_node_attribute_count(ue_PyFbxNode *self, PyObject *args)
{
return PyLong_FromLong(self->fbx_node->GetNodeAttributeCount());
}
static PyObject *py_ue_fbx_node_get_node_attribute_by_index(ue_PyFbxNode *self, PyObject *args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
{
return nullptr;
}
FbxNodeAttribute *fbx_node_attribute = self->fbx_node->GetNodeAttributeByIndex(index);
if (!fbx_node_attribute)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxNodeAttribute at index %d", index);
}
return py_ue_new_fbx_object(fbx_node_attribute);
}
static PyObject *py_ue_fbx_node_get_mesh(ue_PyFbxNode *self, PyObject *args)
{
FbxMesh *fbx_mesh = self->fbx_node->GetMesh();
if (!fbx_mesh)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve FbxMesh from FbxNode");
}
return py_ue_new_fbx_mesh(fbx_mesh);
}
static PyObject *py_ue_fbx_node_evaluate_local_transform(ue_PyFbxNode *self, PyObject *args)
{
float t;
if (!PyArg_ParseTuple(args, "f", &t))
{
return nullptr;
}
FbxTime time;
time.SetSecondDouble(t);
FbxAMatrix& matrix = self->fbx_node->EvaluateLocalTransform(time);
FTransform transform;
FbxVector4 mt = matrix.GetT();
FbxQuaternion mq = matrix.GetQ();
FbxVector4 ms = matrix.GetS();
transform.SetTranslation(FVector(mt[0], -mt[1], mt[2]));
transform.SetRotation(FQuat(mq[0], -mq[1], mq[2], -mq[3]));
transform.SetScale3D(FVector(ms[0], ms[1], ms[2]));
return py_ue_new_ftransform(transform);
}
static PyObject *py_ue_fbx_node_evaluate_global_transform(ue_PyFbxNode *self, PyObject *args)
{
float t;
if (!PyArg_ParseTuple(args, "f", &t))
{
return nullptr;
}
FbxTime time;
time.SetSecondDouble(t);
FbxAMatrix& matrix = self->fbx_node->EvaluateGlobalTransform(time);
FTransform transform;
FbxVector4 mt = matrix.GetT();
FbxQuaternion mq = matrix.GetQ();
FbxVector4 ms = matrix.GetS();
transform.SetTranslation(FVector(mt[0], -mt[1], mt[2]));
transform.SetRotation(FQuat(mq[0], -mq[1], mq[2], -mq[3]));
transform.SetScale3D(FVector(ms[0], ms[1], ms[2]));
return py_ue_new_ftransform(transform);
}
static PyMethodDef ue_PyFbxNode_methods[] = {
{ "get_child_count", (PyCFunction)py_ue_fbx_node_get_child_count, METH_VARARGS, "" },
{ "get_name", (PyCFunction)py_ue_fbx_node_get_name, METH_VARARGS, "" },
{ "evaluate_local_transform", (PyCFunction)py_ue_fbx_node_evaluate_local_transform, METH_VARARGS, "" },
{ "evaluate_global_transform", (PyCFunction)py_ue_fbx_node_evaluate_global_transform, METH_VARARGS, "" },
{ "get_local_translation", (PyCFunction)py_ue_fbx_node_get_local_translation, METH_VARARGS, "" },
{ "get_local_rotation", (PyCFunction)py_ue_fbx_node_get_local_rotation, METH_VARARGS, "" },
{ "get_local_scaling", (PyCFunction)py_ue_fbx_node_get_local_scaling, METH_VARARGS, "" },
{ "get_child", (PyCFunction)py_ue_fbx_node_get_child, METH_VARARGS, "" },
{ "get_parent", (PyCFunction)py_ue_fbx_node_get_parent, METH_VARARGS, "" },
{ "get_node_attribute", (PyCFunction)py_ue_fbx_node_get_node_attribute, METH_VARARGS, "" },
{ "get_node_attribute_count", (PyCFunction)py_ue_fbx_node_get_node_attribute_count, METH_VARARGS, "" },
{ "get_node_attribute_by_index", (PyCFunction)py_ue_fbx_node_get_node_attribute_by_index, METH_VARARGS, "" },
{ "get_mesh", (PyCFunction)py_ue_fbx_node_get_mesh, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFbxNodeType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FbxNode", /* tp_name */
sizeof(ue_PyFbxNode), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FbxNode", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFbxNode_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
};
static int py_ue_fbx_node_init(ue_PyFbxNode *self, PyObject * args)
{
PyObject *py_object;
char *name;
if (!PyArg_ParseTuple(args, "Os", &py_object, &name))
{
return -1;
}
ue_PyFbxManager *py_fbx_manager = py_ue_is_fbx_manager(py_object);
if (!py_fbx_manager)
{
PyErr_SetString(PyExc_Exception, "argument is not a FbxManager");
return -1;
}
self->fbx_node = FbxNode::Create(py_fbx_manager->fbx_manager, name);
return 0;
}
void ue_python_init_fbx_node(PyObject *ue_module)
{
ue_PyFbxNodeType.tp_new = PyType_GenericNew;;
ue_PyFbxNodeType.tp_init = (initproc)py_ue_fbx_node_init;
if (PyType_Ready(&ue_PyFbxNodeType) < 0)
return;
Py_INCREF(&ue_PyFbxNodeType);
PyModule_AddObject(ue_module, "FbxNode", (PyObject *)&ue_PyFbxNodeType);
}
PyObject *py_ue_new_fbx_node(FbxNode *fbx_node)
{
ue_PyFbxNode *ret = (ue_PyFbxNode *)PyObject_New(ue_PyFbxNode, &ue_PyFbxNodeType);
ret->fbx_node = fbx_node;
return (PyObject *)ret;
}
ue_PyFbxNode *py_ue_is_fbx_node(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFbxNodeType))
return nullptr;
return (ue_PyFbxNode *)obj;
}
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Fbx/UEPyFbxNode.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,274 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if WITH_EDITOR
#if ENGINE_MINOR_VERSION > 12
#if PLATFORM_LINUX
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wnull-dereference"
#endif
#endif
#include <fbxsdk.h>
struct ue_PyFbxMesh
{
PyObject_HEAD
/* Type-specific fields go here. */
FbxMesh *fbx_mesh;
};
void ue_python_init_fbx_mesh(PyObject *);
PyObject *py_ue_new_fbx_mesh(FbxMesh *);
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Fbx/UEPyFbxMesh.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 112 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
} ue_PyFSlateApplication;
void ue_python_init_fslate_application(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/SlateApplication/UEPyFSlateApplication.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 47 |
```c++
#include "UEPyFSlateApplication.h"
#include "Slate/UEPySWidget.h"
#include "Runtime/Slate/Public/Framework/Application/SlateApplication.h"
#include "Runtime/SlateRHIRenderer/Public/Interfaces/ISlateRHIRendererModule.h"
#include "Slate/UEPySWindow.h"
static PyObject *py_ue_get_average_delta_time(PyObject *cls, PyObject * args)
{
return PyFloat_FromDouble(FSlateApplication::Get().GetAverageDeltaTime());
}
static PyObject *py_ue_get_delta_time(PyObject *cls, PyObject * args)
{
return PyFloat_FromDouble(FSlateApplication::Get().GetDeltaTime());
}
static PyObject *py_ue_get_modifier_keys(PyObject *cls, PyObject * args)
{
return py_ue_new_fmodifier_keys_state(FSlateApplication::Get().GetModifierKeys());
}
static PyObject *py_ue_get_cursor_radius(PyObject *cls, PyObject * args)
{
return PyFloat_FromDouble(FSlateApplication::Get().GetCursorRadius());
}
static PyObject *py_ue_goto_line_in_source(PyObject *cls, PyObject * args)
{
char *filename;
int line_number;
if (!PyArg_ParseTuple(args, "si:goto_line_in_source", &filename, &line_number))
{
return nullptr;
}
FSlateApplication::Get().GotoLineInSource(FString(UTF8_TO_TCHAR(filename)), line_number);
Py_RETURN_NONE;
}
static PyObject *py_ue_is_gamepad_attached(PyObject *cls, PyObject * args)
{
bool bAttached = FSlateApplication::Get().IsGamepadAttached();
if (bAttached)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_is_mouse_attached(PyObject *cls, PyObject * args)
{
bool bAttached = FSlateApplication::Get().IsMouseAttached();
if (bAttached)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_set_all_user_focus(PyObject *cls, PyObject * args)
{
PyObject *py_widget;
int focus_cause = (int)EFocusCause::SetDirectly;
if (!PyArg_ParseTuple(args, "O|i:set_all_user_focus", &py_widget, &focus_cause))
{
return nullptr;
}
TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(py_widget);
if (!Widget.IsValid())
{
return nullptr;
}
FSlateApplication::Get().SetAllUserFocus(Widget, (EFocusCause)focus_cause);
Py_RETURN_NONE;
}
static PyObject *py_ue_set_application_scale(PyObject *cls, PyObject * args)
{
float scale;
if (!PyArg_ParseTuple(args, "f:set_application_scale", &scale))
{
return nullptr;
}
FSlateApplication::Get().SetApplicationScale(scale);
Py_RETURN_NONE;
}
static PyObject *py_ue_set_cursor_pos(PyObject *cls, PyObject * args)
{
float x;
float y;
if (!PyArg_ParseTuple(args, "(ff):set_cursor_pos", &x, &y))
{
return nullptr;
}
FSlateApplication::Get().SetCursorPos(FVector2D(x, y));
Py_RETURN_NONE;
}
static PyObject *py_ue_process_key_down_event(PyObject *cls, PyObject * args)
{
PyObject *py_event;
if (!PyArg_ParseTuple(args, "O:process_key_down_event", &py_event))
{
return nullptr;
}
FKeyEvent *InKeyEvent = ue_py_check_struct<FKeyEvent>(py_event);
if (!InKeyEvent)
{
ue_PyFKeyEvent *py_fkey_event = py_ue_is_fkey_event(py_event);
if (!py_fkey_event)
{
return PyErr_Format(PyExc_Exception, "argument is not a FKeyEvent");
}
InKeyEvent = &py_fkey_event->key_event;
}
if (FSlateApplication::Get().ProcessKeyDownEvent(*InKeyEvent))
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_process_key_char_event(PyObject *cls, PyObject * args)
{
PyObject *py_event;
if (!PyArg_ParseTuple(args, "O:process_key_char_event", &py_event))
{
return nullptr;
}
FCharacterEvent *InCharEvent = ue_py_check_struct<FCharacterEvent>(py_event);
if (!InCharEvent)
{
ue_PyFCharacterEvent *py_fchar_event = py_ue_is_fcharacter_event(py_event);
if (!py_fchar_event)
{
return PyErr_Format(PyExc_Exception, "argument is not a FCharacterEvent");
}
InCharEvent = &py_fchar_event->character_event;
}
if (FSlateApplication::Get().ProcessKeyCharEvent(*InCharEvent))
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_create(PyObject *cls, PyObject * args)
{
#if ENGINE_MINOR_VERSION > 18
#if ENGINE_MINOR_VERSION > 20
FSlateApplication::InitHighDPI(true);
#else
FSlateApplication::InitHighDPI();
#endif
#endif
FSlateApplication::Create();
TSharedRef<FSlateRenderer> SlateRenderer = FModuleManager::Get().LoadModuleChecked<ISlateRHIRendererModule>("SlateRHIRenderer").CreateSlateRHIRenderer();
FSlateApplication::Get().InitializeRenderer(SlateRenderer);
Py_RETURN_NONE;
}
static PyObject *py_ue_get_active_top_level_window(PyObject *cls, PyObject * args)
{
TSharedPtr<SWindow> Window = FSlateApplication::Get().GetActiveTopLevelWindow();
if (!Window.IsValid())
return PyErr_Format(PyExc_Exception, "no active TopLevel Window found");
return (PyObject *)py_ue_new_swindow(Window.ToSharedRef());
}
static PyMethodDef ue_PyFSlateApplication_methods[] = {
{ "create", (PyCFunction)py_ue_create, METH_VARARGS | METH_CLASS, "" },
{ "get_average_delta_time", (PyCFunction)py_ue_get_average_delta_time, METH_VARARGS | METH_CLASS, "" },
{ "get_cursor_radius", (PyCFunction)py_ue_get_cursor_radius, METH_VARARGS | METH_CLASS, "" },
{ "get_delta_time", (PyCFunction)py_ue_get_delta_time, METH_VARARGS | METH_CLASS, "" },
{ "get_modifier_keys", (PyCFunction)py_ue_get_modifier_keys, METH_VARARGS | METH_CLASS, "" },
{ "goto_line_in_source", (PyCFunction)py_ue_goto_line_in_source, METH_VARARGS | METH_CLASS, "" },
{ "is_gamepad_attached", (PyCFunction)py_ue_is_gamepad_attached, METH_VARARGS | METH_CLASS, "" },
{ "is_mouse_attached", (PyCFunction)py_ue_is_mouse_attached, METH_VARARGS | METH_CLASS, "" },
{ "process_key_down_event", (PyCFunction)py_ue_process_key_down_event, METH_VARARGS | METH_CLASS, "" },
{ "process_key_char_event", (PyCFunction)py_ue_process_key_char_event, METH_VARARGS | METH_CLASS, "" },
{ "set_application_scale", (PyCFunction)py_ue_set_application_scale, METH_VARARGS | METH_CLASS, "" },
{ "set_all_user_focus", (PyCFunction)py_ue_set_all_user_focus, METH_VARARGS | METH_CLASS, "" },
{ "set_cursor_pos", (PyCFunction)py_ue_set_cursor_pos, METH_VARARGS | METH_CLASS, "" },
{ "get_active_top_level_window", (PyCFunction)py_ue_get_active_top_level_window, METH_VARARGS | METH_CLASS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFSlateApplicationType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FSlateApplication", /* tp_name */
sizeof(ue_PyFSlateApplication), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine SlateApplication", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFSlateApplication_methods, /* tp_methods */
0,
0,
};
static int py_ue_fslate_application_init(ue_PyFSlateApplication *self, PyObject * args)
{
PyErr_SetString(PyExc_Exception, "FSlateApplication is a singleton");
return -1;
}
void ue_python_init_fslate_application(PyObject *ue_module)
{
ue_PyFSlateApplicationType.tp_new = PyType_GenericNew;
ue_PyFSlateApplicationType.tp_init = (initproc)py_ue_fslate_application_init;
if (PyType_Ready(&ue_PyFSlateApplicationType) < 0)
return;
Py_INCREF(&ue_PyFSlateApplicationType);
PyModule_AddObject(ue_module, "FSlateApplication", (PyObject *)&ue_PyFSlateApplicationType);
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/SlateApplication/UEPyFSlateApplication.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,060 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if WITH_EDITOR
#include "Editor/MaterialEditor/Public/MaterialEditorUtilities.h"
#include "Editor/MaterialEditor/Public/MaterialEditorActions.h"
#include "Editor/UnrealEd/Public/Toolkits/AssetEditorManager.h"
#include "Editor/MaterialEditor/Public/IMaterialEditor.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
} ue_PyFMaterialEditorUtilities;
void ue_python_init_fmaterial_editor_utilities(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/MaterialEditorUtilities/UEPyFMaterialEditorUtilities.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 110 |
```c++
#include "UEPyFMaterialEditorUtilities.h"
#if WITH_EDITOR
#include "Materials/Material.h"
#include "Runtime/Engine/Classes/EdGraph/EdGraph.h"
static PyObject *py_ue_paste_nodes_here(PyObject *cls, PyObject * args)
{
PyObject *py_graph;
float x;
float y;
if (!PyArg_ParseTuple(args, "O(ff):paste_nodes_here", &py_graph, &x, &y))
return nullptr;
UEdGraph *Graph = ue_py_check_type<UEdGraph>(py_graph);
if (!Graph)
{
return PyErr_Format(PyExc_Exception, "argument is not a UEdGraph");
}
FMaterialEditorUtilities::PasteNodesHere(Graph, FVector2D(x, y));
Py_RETURN_NONE;
}
static PyObject *py_ue_update_material_after_graph_change(PyObject *cls, PyObject * args)
{
PyObject *py_graph;
if (!PyArg_ParseTuple(args, "O:update_material_after_graph_change", &py_graph))
return nullptr;
UEdGraph *Graph = ue_py_check_type<UEdGraph>(py_graph);
if (!Graph)
{
return PyErr_Format(PyExc_Exception, "argument is not a UEdGraph");
}
FMaterialEditorUtilities::UpdateMaterialAfterGraphChange(Graph);
Py_RETURN_NONE;
}
static PyObject *py_ue_command_apply(PyObject *cls, PyObject * args)
{
PyObject *py_material;
if (!PyArg_ParseTuple(args, "O:command_apply", &py_material))
return nullptr;
UMaterial *Material = ue_py_check_type<UMaterial>(py_material);
if (!Material)
{
return PyErr_Format(PyExc_Exception, "argument is not a UMaterial");
}
IAssetEditorInstance *Instance = FAssetEditorManager::Get().FindEditorForAsset(Material, false);
if (!Instance)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve editor for UMaterial");
}
IMaterialEditor *MaterialEditor = (IMaterialEditor *)Instance;
MaterialEditor->GetToolkitCommands()->ExecuteAction(FMaterialEditorCommands::Get().Apply.ToSharedRef());
Py_RETURN_NONE;
}
static PyMethodDef ue_PyFMaterialEditorUtilities_methods[] = {
{ "paste_nodes_here", (PyCFunction)py_ue_paste_nodes_here, METH_VARARGS | METH_CLASS, "" },
{ "update_material_after_graph_change", (PyCFunction)py_ue_update_material_after_graph_change, METH_VARARGS | METH_CLASS, "" },
{ "command_apply", (PyCFunction)py_ue_command_apply, METH_VARARGS | METH_CLASS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFMaterialEditorUtilitiesType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FMaterialEditorUtilities", /* tp_name */
sizeof(ue_PyFMaterialEditorUtilities), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine MaterialEditorUtilities", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFMaterialEditorUtilities_methods, /* tp_methods */
0,
0,
};
static int py_ue_fmaterial_editor_utilities_init(ue_PyFMaterialEditorUtilities *self, PyObject * args)
{
PyErr_SetString(PyExc_Exception, "FMaterialEditorUtilities is a singleton");
return -1;
}
void ue_python_init_fmaterial_editor_utilities(PyObject *ue_module)
{
ue_PyFMaterialEditorUtilitiesType.tp_new = PyType_GenericNew;
ue_PyFMaterialEditorUtilitiesType.tp_init = (initproc)py_ue_fmaterial_editor_utilities_init;
if (PyType_Ready(&ue_PyFMaterialEditorUtilitiesType) < 0)
return;
Py_INCREF(&ue_PyFMaterialEditorUtilitiesType);
PyModule_AddObject(ue_module, "FMaterialEditorUtilities", (PyObject *)&ue_PyFMaterialEditorUtilitiesType);
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/MaterialEditorUtilities/UEPyFMaterialEditorUtilities.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,015 |
```c++
#include "UEPyFPythonOutputDevice.h"
static PyMethodDef ue_PyFPythonOutputDevice_methods[] = {
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFPythonOutputDevice_str(ue_PyFPythonOutputDevice *self)
{
return PyUnicode_FromFormat("<unreal_engine.FPythonOutputDevice '%p'>",
self->device);
}
static void ue_PyFPythonOutputDevice_dealloc(ue_PyFPythonOutputDevice *self)
{
delete(self->device);
#if PY_MAJOR_VERSION < 3
self->ob_type->tp_free((PyObject*)self);
#else
Py_TYPE(self)->tp_free((PyObject*)self);
#endif
}
static PyTypeObject ue_PyFPythonOutputDeviceType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FPythonOutputDevice", /* tp_name */
sizeof(ue_PyFPythonOutputDevice), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)ue_PyFPythonOutputDevice_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFPythonOutputDevice_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FPythonOutputDevice", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFPythonOutputDevice_methods, /* tp_methods */
0,
0,
};
static int ue_py_fpython_output_device_init(ue_PyFPythonOutputDevice *self, PyObject *args, PyObject *kwargs)
{
PyObject *py_serialize;
if (!PyArg_ParseTuple(args, "O", &py_serialize))
{
return -1;
}
if (!PyCallable_Check(py_serialize))
{
PyErr_SetString(PyExc_TypeError, "argument is not a callable");
return -1;
}
self->device = new FPythonOutputDevice();
self->device->SetPySerialize(py_serialize);
return 0;
}
void ue_python_init_fpython_output_device(PyObject *ue_module)
{
ue_PyFPythonOutputDeviceType.tp_new = PyType_GenericNew;
ue_PyFPythonOutputDeviceType.tp_init = (initproc)ue_py_fpython_output_device_init;
if (PyType_Ready(&ue_PyFPythonOutputDeviceType) < 0)
return;
Py_INCREF(&ue_PyFPythonOutputDeviceType);
PyModule_AddObject(ue_module, "FPythonOutputDevice", (PyObject *)&ue_PyFPythonOutputDeviceType);
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFPythonOutputDevice.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 697 |
```c++
#include "UEPyFObjectThumbnail.h"
static PyObject *py_ue_fobject_thumbnail_get_image_width(ue_PyFObjectThumbnail *self, PyObject * args)
{
return PyLong_FromLong(self->object_thumbnail.GetImageWidth());
}
static PyObject *py_ue_fobject_thumbnail_get_image_height(ue_PyFObjectThumbnail *self, PyObject * args)
{
return PyLong_FromLong(self->object_thumbnail.GetImageHeight());
}
static PyObject *py_ue_fobject_thumbnail_get_compressed_data_size(ue_PyFObjectThumbnail *self, PyObject * args)
{
return PyLong_FromLong(self->object_thumbnail.GetCompressedDataSize());
}
static PyObject *py_ue_fobject_thumbnail_get_uncompressed_image_data(ue_PyFObjectThumbnail *self, PyObject * args)
{
const TArray<uint8> &data = self->object_thumbnail.GetUncompressedImageData();
return PyByteArray_FromStringAndSize((char *)data.GetData(), data.Num());
}
static PyObject *py_ue_fobject_thumbnail_compress_image_data(ue_PyFObjectThumbnail *self, PyObject * args)
{
self->object_thumbnail.CompressImageData();
Py_RETURN_NONE;
}
static PyMethodDef ue_PyFObjectThumbnail_methods[] = {
{ "get_image_width", (PyCFunction)py_ue_fobject_thumbnail_get_image_width, METH_VARARGS, "" },
{ "get_image_height", (PyCFunction)py_ue_fobject_thumbnail_get_image_height, METH_VARARGS, "" },
{ "get_compressed_data_size", (PyCFunction)py_ue_fobject_thumbnail_get_compressed_data_size, METH_VARARGS, "" },
{ "get_uncompressed_image_data", (PyCFunction)py_ue_fobject_thumbnail_get_uncompressed_image_data, METH_VARARGS, "" },
{ "compress_image_data", (PyCFunction)py_ue_fobject_thumbnail_get_uncompressed_image_data, METH_VARARGS, "" },
{ nullptr } /* Sentinel */
};
static PyObject *ue_PyFObjectThumbnail_str(ue_PyFObjectThumbnail *self)
{
return PyUnicode_FromFormat("<unreal_engine.FObjectThumbnail {'width': %d, 'height': %d, 'compressed_data_size': %d}>",
self->object_thumbnail.GetImageWidth(),
self->object_thumbnail.GetImageHeight(),
self->object_thumbnail.GetCompressedDataSize());
}
static PyTypeObject ue_PyFObjectThumbnailType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FObjectThumbnail", /* tp_name */
sizeof(ue_PyFObjectThumbnail), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFObjectThumbnail_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FObjectThumbnail", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFObjectThumbnail_methods, /* tp_methods */
0,
};
static int py_ue_fobject_thumbnail_init(ue_PyFObjectThumbnail *self, PyObject * args)
{
new(&self->object_thumbnail) FObjectThumbnail();
return 0;
}
void ue_python_init_fobject_thumbnail(PyObject *ue_module)
{
ue_PyFObjectThumbnailType.tp_new = PyType_GenericNew;
ue_PyFObjectThumbnailType.tp_init = (initproc)py_ue_fobject_thumbnail_init;
if (PyType_Ready(&ue_PyFObjectThumbnailType) < 0)
return;
Py_INCREF(&ue_PyFObjectThumbnailType);
PyModule_AddObject(ue_module, "FObjectThumbnail", (PyObject *)&ue_PyFObjectThumbnailType);
}
ue_PyFObjectThumbnail *py_ue_is_fobject_thumbnail(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFObjectThumbnailType))
return nullptr;
return (ue_PyFObjectThumbnail *)obj;
}
PyObject *py_ue_new_fobject_thumbnail(FObjectThumbnail object_thumnail)
{
ue_PyFObjectThumbnail *ret = (ue_PyFObjectThumbnail *)PyObject_New(ue_PyFObjectThumbnail, &ue_PyFObjectThumbnailType);
new(&ret->object_thumbnail) FObjectThumbnail(object_thumnail);
return (PyObject *)ret;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFObjectThumbnail.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,088 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
uint8 val;
} ue_PyESlateEnums;
void ue_python_init_eslate_enums(PyObject *);
ue_PyESlateEnums *py_ue_is_eslate_enums(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyESlateEnums.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 68 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
FTransform transform;
} ue_PyFTransform;
extern PyTypeObject ue_PyFTransformType;
PyObject *py_ue_new_ftransform(FTransform);
ue_PyFTransform *py_ue_is_ftransform(PyObject *);
void ue_python_init_ftransform(PyObject *);
bool py_ue_transform_arg(PyObject *, FTransform &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFTransform.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 90 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#include "Wrappers/UEPyFVector.h"
#if ENGINE_MINOR_VERSION > 12
#include "Runtime/Engine/Classes/Animation/MorphTarget.h"
struct ue_PyFMorphTargetDelta {
PyObject_HEAD
/* Type-specific fields go here. */
FMorphTargetDelta morph_target_delta;
};
void ue_python_init_fmorph_target_delta(PyObject *);
PyObject *py_ue_new_fmorph_target_delta(FMorphTargetDelta);
ue_PyFMorphTargetDelta *py_ue_is_fmorph_target_delta(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFMorphTargetDelta.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 121 |
```c++
#include "UEPyFAssetData.h"
#if WITH_EDITOR
#include "ObjectTools.h"
#include "Wrappers/UEPyFObjectThumbnail.h"
static PyObject *py_ue_fassetdata_get_asset(ue_PyFAssetData *self, PyObject * args)
{
Py_RETURN_UOBJECT(self->asset_data.GetAsset());
}
static PyObject *py_ue_fassetdata_is_asset_loaded(ue_PyFAssetData *self, PyObject * args)
{
if (self->asset_data.IsAssetLoaded())
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_fassetdata_get_thumbnail(ue_PyFAssetData *self, PyObject * args)
{
TArray<FName> names;
FName name = FName(*self->asset_data.GetFullName());
names.Add(name);
FThumbnailMap map;
if (!ThumbnailTools::ConditionallyLoadThumbnailsForObjects(names, map))
{
return PyErr_Format(PyExc_Exception, "Unable to retrieve thumbnail from FAssetData");
}
FObjectThumbnail *thumbnail = map.Find(name);
if (!thumbnail)
{
return PyErr_Format(PyExc_Exception, "Unable to retrieve thumbnail from FAssetData");
}
return py_ue_new_fobject_thumbnail(*thumbnail);
}
#if ENGINE_MINOR_VERSION >= 18
static PyObject *py_ue_fassetdata_has_custom_thumbnail(ue_PyFAssetData *self, PyObject * args)
{
#if ENGINE_MINOR_VERSION > 18
if (!ThumbnailTools::AssetHasCustomThumbnail(self->asset_data.GetFullName()))
#else
if (!ThumbnailTools::AssetHasCustomThumbnail(self->asset_data))
#endif
{
Py_RETURN_FALSE;
}
Py_RETURN_TRUE;
}
#endif
static PyObject *py_ue_fassetdata_has_cached_thumbnail(ue_PyFAssetData *self, PyObject * args)
{
if (!ThumbnailTools::FindCachedThumbnail(self->asset_data.GetFullName()))
{
Py_RETURN_FALSE;
}
Py_RETURN_TRUE;
}
static PyMethodDef ue_PyFAssetData_methods[] = {
{ "get_asset", (PyCFunction)py_ue_fassetdata_get_asset, METH_VARARGS, "" },
{ "is_asset_loaded", (PyCFunction)py_ue_fassetdata_is_asset_loaded, METH_VARARGS, "" },
{ "get_thumbnail", (PyCFunction)py_ue_fassetdata_get_thumbnail, METH_VARARGS, "" },
#if ENGINE_MINOR_VERSION >= 18
{ "has_custom_thumbnail", (PyCFunction)py_ue_fassetdata_has_custom_thumbnail, METH_VARARGS, "" },
#endif
{ "has_cached_thumbnail", (PyCFunction)py_ue_fassetdata_has_cached_thumbnail, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fassetdata_get_asset_class(ue_PyFAssetData *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.AssetClass.ToString()));
}
static PyObject *py_ue_fassetdata_get_asset_name(ue_PyFAssetData *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.AssetName.ToString()));
}
#if ENGINE_MINOR_VERSION < 17
static PyObject *py_ue_fassetdata_get_group_names(ue_PyFAssetData *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.GroupNames.ToString()));
}
#endif
static PyObject *py_ue_fassetdata_get_object_path(ue_PyFAssetData *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.ObjectPath.ToString()));
}
static PyObject *py_ue_fassetdata_get_package_flags(ue_PyFAssetData *self, void *closure)
{
return PyLong_FromUnsignedLong(self->asset_data.PackageFlags);
}
static PyObject *py_ue_fassetdata_get_package_name(ue_PyFAssetData *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.PackageName.ToString()));
}
static PyObject *py_ue_fassetdata_get_package_path(ue_PyFAssetData *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.PackagePath.ToString()));
}
static PyObject *py_ue_fassetdata_get_tags_and_values(ue_PyFAssetData *self, void *closure)
{
PyObject *ret = PyDict_New();
for (auto It = self->asset_data.TagsAndValues.CreateConstIterator(); It; ++It)
{
PyDict_SetItem(ret,
PyUnicode_FromString(TCHAR_TO_UTF8(*It->Key.ToString())),
PyUnicode_FromString(TCHAR_TO_UTF8(*It->Value)));
}
return ret;
}
static PyGetSetDef ue_PyFAssetData_getseters[] = {
{ (char *)"asset_class", (getter)py_ue_fassetdata_get_asset_class, nullptr, (char *)"asset_class" },
{ (char *)"asset_name", (getter)py_ue_fassetdata_get_asset_name, nullptr, (char *)"asset_name" },
#if ENGINE_MINOR_VERSION < 17
{ (char *)"group_names", (getter)py_ue_fassetdata_get_group_names, nullptr, (char *)"group_names" },
#endif
{ (char *)"object_path",(getter)py_ue_fassetdata_get_object_path, nullptr, (char *)"object_path" },
{ (char *)"package_flags",(getter)py_ue_fassetdata_get_package_flags, nullptr, (char *)"package_flags" },
{ (char *)"package_name", (getter)py_ue_fassetdata_get_package_name, nullptr, (char *)"package_name" },
{ (char *)"package_path", (getter)py_ue_fassetdata_get_package_path, nullptr, (char *)"package_path" },
{ (char *)"tags_and_values", (getter)py_ue_fassetdata_get_tags_and_values, nullptr, (char *)"tags_and_values" },
{ NULL } /* Sentinel */
};
static int ue_py_fassetdata_init(ue_PyFAssetData *self, PyObject *args, PyObject *kwargs)
{
// avoid FAssetData manual creation
return -1;
}
static PyObject *ue_PyFAssetData_str(ue_PyFAssetData *self)
{
return PyUnicode_FromFormat("<unreal_engine.FAssetData '%s'>",
TCHAR_TO_UTF8(*self->asset_data.GetExportTextName()));
}
static PyTypeObject ue_PyFAssetDataType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FAssetData", /* tp_name */
sizeof(ue_PyFAssetData), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFAssetData_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FAssetData", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFAssetData_methods, /* tp_methods */
0, /* tp_members */
ue_PyFAssetData_getseters, /* tp_getset */
};
void ue_python_init_fassetdata(PyObject *ue_module)
{
ue_PyFAssetDataType.tp_new = PyType_GenericNew;;
ue_PyFAssetDataType.tp_init = (initproc)ue_py_fassetdata_init;
if (PyType_Ready(&ue_PyFAssetDataType) < 0)
return;
Py_INCREF(&ue_PyFAssetDataType);
PyModule_AddObject(ue_module, "FAssetData", (PyObject *)&ue_PyFAssetDataType);
}
PyObject *py_ue_new_fassetdata(FAssetData asset_data)
{
ue_PyFAssetData *ret = (ue_PyFAssetData *)PyObject_New(ue_PyFAssetData, &ue_PyFAssetDataType);
new(&ret->asset_data) FAssetData(asset_data);
return (PyObject *)ret;
}
ue_PyFAssetData *py_ue_is_fassetdata(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFAssetDataType))
return nullptr;
return (ue_PyFAssetData *)obj;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFAssetData.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,903 |
```c++
#include "UEPyFSlowTask.h"
#include "Misc/FeedbackContext.h"
#if WITH_EDITOR
static PyObject *py_ue_fslowtask_initialize(ue_PyFSlowTask *self, PyObject * args)
{
self->slowtask.Initialize();
Py_RETURN_NONE;
}
static PyObject *py_ue_fslowtask_destroy(ue_PyFSlowTask *self, PyObject * args)
{
self->slowtask.Destroy();
Py_RETURN_NONE;
}
static PyObject *py_ue_fslowtask_make_dialog_delayed(ue_PyFSlowTask *self, PyObject * args)
{
float threshold;
PyObject *py_show_cancel_button = nullptr;
PyObject *py_allow_in_pie = nullptr;
if(!PyArg_ParseTuple(args, "f|OO:make_dialog_delayed", &threshold, &py_show_cancel_button, &py_allow_in_pie))
{
return nullptr;
}
bool show_cancel_button = false;
if (nullptr != py_show_cancel_button && PyObject_IsTrue(py_show_cancel_button))
{
show_cancel_button = true;
}
bool allow_in_pie = false;
if (nullptr != py_allow_in_pie && PyObject_IsTrue(py_allow_in_pie))
{
allow_in_pie = true;
}
self->slowtask.MakeDialogDelayed(threshold, show_cancel_button, allow_in_pie);
Py_RETURN_NONE;
}
static PyObject *py_ue_fslowtask_make_dialog(ue_PyFSlowTask *self, PyObject * args)
{
PyObject *py_show_cancel_button = nullptr;
PyObject *py_allow_in_pie = nullptr;
if(!PyArg_ParseTuple(args, "|OO:make_dialog", &py_show_cancel_button, &py_allow_in_pie))
{
return nullptr;
}
bool show_cancel_button = false;
if (nullptr != py_show_cancel_button && PyObject_IsTrue(py_show_cancel_button))
{
show_cancel_button = true;
}
bool allow_in_pie = false;
if (nullptr != py_allow_in_pie && PyObject_IsTrue(py_allow_in_pie))
{
allow_in_pie = true;
}
self->slowtask.MakeDialog(show_cancel_button, allow_in_pie);
Py_RETURN_NONE;
}
static PyObject *py_ue_fslowtask_enter_progress_frame(ue_PyFSlowTask *self, PyObject * args)
{
float expected_work_this_frame = 1.0;
char *text = (char *)"";
if(!PyArg_ParseTuple(args, "|fs:enter_progress_frame", &expected_work_this_frame, &text))
{
return nullptr;
}
self->slowtask.EnterProgressFrame(expected_work_this_frame, FText::FromString(UTF8_TO_TCHAR(text)));
Py_RETURN_NONE;
}
static PyObject *py_ue_fslowtask_get_current_message(ue_PyFSlowTask *self, PyObject * args)
{
FText current_message = self->slowtask.GetCurrentMessage();
return PyUnicode_FromString(TCHAR_TO_UTF8(*current_message.ToString()));
}
static PyObject *py_ue_fslowtask_received_user_cancel(ue_PyFSlowTask *self, PyObject * args )
{
if(GWarn->ReceivedUserCancel())
{
Py_INCREF(Py_True);
return Py_True;
}
Py_INCREF(Py_False);
return Py_False;
}
static PyMethodDef ue_PyFSlowTask_methods[] = {
{ "initialize", (PyCFunction)py_ue_fslowtask_initialize, METH_VARARGS, "" },
{ "destroy", (PyCFunction)py_ue_fslowtask_destroy, METH_VARARGS, "" },
{ "make_dialog_delayed", (PyCFunction)py_ue_fslowtask_make_dialog_delayed, METH_VARARGS, "" },
{ "make_dialog", (PyCFunction)py_ue_fslowtask_make_dialog, METH_VARARGS, "" },
{ "enter_progress_frame", (PyCFunction)py_ue_fslowtask_enter_progress_frame, METH_VARARGS, "" },
{ "get_current_message", (PyCFunction)py_ue_fslowtask_get_current_message, METH_VARARGS, "" },
{ "received_user_cancel", (PyCFunction)py_ue_fslowtask_received_user_cancel, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFSlowTaskType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FSlowTask", /* tp_name */
sizeof(ue_PyFSlowTask), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FSlowTask", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFSlowTask_methods, /* tp_methods */
0,
0,
};
static int py_ue_fslowtask_init(ue_PyFSlowTask *self, PyObject * args)
{
float amount_of_work;
char *default_message = (char *)"";
PyObject *py_enabled = nullptr;
if(!PyArg_ParseTuple(args, "f|sO:__init__", &amount_of_work, &default_message, &py_enabled))
{
return -1;
}
bool enabled = true;
if (nullptr != py_enabled && !PyObject_IsTrue(py_enabled))
{
enabled = false;
}
new(&self->slowtask) FSlowTask(amount_of_work, FText::FromString(UTF8_TO_TCHAR(default_message)), enabled);
return 0;
}
void ue_python_init_fslowtask(PyObject *ue_module)
{
ue_PyFSlowTaskType.tp_new = PyType_GenericNew;
ue_PyFSlowTaskType.tp_init = (initproc)py_ue_fslowtask_init;
if (PyType_Ready(&ue_PyFSlowTaskType) < 0)
return;
Py_INCREF(&ue_PyFSlowTaskType);
PyModule_AddObject(ue_module, "FSlowTask", (PyObject *)&ue_PyFSlowTaskType);
}
ue_PyFSlowTask *py_ue_is_fslowtask(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFSlowTaskType))
return nullptr;
return (ue_PyFSlowTask *)obj;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFSlowTask.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,514 |
```c++
#include "UEPyFColor.h"
static PyObject *py_ue_fcolor_to_hex(ue_PyFColor *self, PyObject * args)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->color.ToString()));
}
static PyObject *py_ue_fcolor_to_linear(ue_PyFColor *self, PyObject * args)
{
return py_ue_new_flinearcolor(self->color.ReinterpretAsLinear());
}
static PyMethodDef ue_PyFColor_methods[] = {
{ "to_hex", (PyCFunction)py_ue_fcolor_to_hex, METH_VARARGS, "" },
{ "to_linear", (PyCFunction)py_ue_fcolor_to_linear, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fcolor_get_r(ue_PyFColor *self, void *closure)
{
return PyLong_FromLong(self->color.R);
}
static int py_ue_fcolor_set_r(ue_PyFColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Long(value);
self->color.R = PyLong_AsLong(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fcolor_get_g(ue_PyFColor *self, void *closure)
{
return PyLong_FromLong(self->color.G);
}
static int py_ue_fcolor_set_g(ue_PyFColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Long(value);
self->color.G = PyLong_AsLong(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fcolor_get_b(ue_PyFColor *self, void *closure)
{
return PyLong_FromLong(self->color.B);
}
static int py_ue_fcolor_set_b(ue_PyFColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Long(value);
self->color.B = PyLong_AsLong(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fcolor_get_a(ue_PyFColor *self, void *closure)
{
return PyLong_FromLong(self->color.A);
}
static int py_ue_fcolor_set_a(ue_PyFColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Long(value);
self->color.A = PyLong_AsLong(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyGetSetDef ue_PyFColor_getseters[] = {
{ (char*)"r", (getter)py_ue_fcolor_get_r, (setter)py_ue_fcolor_set_r, (char *)"", NULL },
{ (char *)"g", (getter)py_ue_fcolor_get_g, (setter)py_ue_fcolor_set_g, (char *)"", NULL },
{ (char *)"b", (getter)py_ue_fcolor_get_b, (setter)py_ue_fcolor_set_b, (char *)"", NULL },
{ (char *)"a", (getter)py_ue_fcolor_get_a, (setter)py_ue_fcolor_set_a, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFColor_str(ue_PyFColor *self)
{
return PyUnicode_FromFormat("<unreal_engine.FColor {'r': %d, 'g': %d, 'b': %d, 'a': %d}>",
self->color.R, self->color.G, self->color.B, self->color.A);
}
PyTypeObject ue_PyFColorType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FColor", /* tp_name */
sizeof(ue_PyFColor), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFColor_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FColor", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFColor_methods, /* tp_methods */
0,
ue_PyFColor_getseters,
};
static PyObject *ue_py_fcolor_add(ue_PyFColor *self, PyObject *value)
{
FColor color = self->color;
ue_PyFColor *py_color = py_ue_is_fcolor(value);
if (py_color)
{
color += py_color->color;
}
else if (PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Long(value);
long l = PyLong_AsLong(l_value);
color.R += l;
color.G += l;
color.B += l;
color.A += l;
Py_DECREF(l_value);
}
return py_ue_new_fcolor(color);
}
PyNumberMethods ue_PyFColor_number_methods;
static Py_ssize_t ue_py_fcolor_seq_length(ue_PyFColor *self)
{
return 4;
}
static PyObject *ue_py_fcolor_seq_item(ue_PyFColor *self, Py_ssize_t i)
{
switch (i)
{
case 0:
return PyLong_FromLong(self->color.R);
case 1:
return PyLong_FromLong(self->color.G);
case 2:
return PyLong_FromLong(self->color.B);
case 3:
return PyLong_FromLong(self->color.A);
}
return PyErr_Format(PyExc_IndexError, "FColor has only 4 items");
}
PySequenceMethods ue_PyFColor_sequence_methods;
static int ue_py_fcolor_init(ue_PyFColor *self, PyObject *args, PyObject *kwargs)
{
int r = 0;
int g = 0;
int b = 0;
int a = 255;
if (!PyArg_ParseTuple(args, "|iiii", &r, &g, &b, &a))
return -1;
if (PyTuple_Size(args) == 1)
{
g = a;
b = a;
}
self->color.R = r;
self->color.G = g;
self->color.B = b;
self->color.A = a;
return 0;
}
static void fcolor_add_color(const char *color_name, FColor fcolor)
{
PyObject *color = py_ue_new_fcolor(fcolor);
// not required
Py_INCREF(color);
PyDict_SetItemString(ue_PyFColorType.tp_dict, color_name, color);
}
void ue_python_init_fcolor(PyObject *ue_module)
{
ue_PyFColorType.tp_new = PyType_GenericNew;
ue_PyFColorType.tp_init = (initproc)ue_py_fcolor_init;
memset(&ue_PyFColor_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFColorType.tp_as_number = &ue_PyFColor_number_methods;
ue_PyFColor_number_methods.nb_add = (binaryfunc)ue_py_fcolor_add;
memset(&ue_PyFColor_sequence_methods, 0, sizeof(PySequenceMethods));
ue_PyFColorType.tp_as_sequence = &ue_PyFColor_sequence_methods;
ue_PyFColor_sequence_methods.sq_length = (lenfunc)ue_py_fcolor_seq_length;
ue_PyFColor_sequence_methods.sq_item = (ssizeargfunc)ue_py_fcolor_seq_item;
if (PyType_Ready(&ue_PyFColorType) < 0)
return;
Py_INCREF(&ue_PyFColorType);
PyModule_AddObject(ue_module, "FColor", (PyObject *)&ue_PyFColorType);
fcolor_add_color("Black", FColor::Black);
fcolor_add_color("Blue", FColor::Blue);
fcolor_add_color("Cyan", FColor::Cyan);
fcolor_add_color("Emerald", FColor::Emerald);
fcolor_add_color("Green", FColor::Green);
fcolor_add_color("Magenta", FColor::Magenta);
fcolor_add_color("Orange", FColor::Orange);
fcolor_add_color("Purple", FColor::Purple);
fcolor_add_color("Red", FColor::Red);
fcolor_add_color("Silver", FColor::Silver);
fcolor_add_color("Turquoise", FColor::Turquoise);
fcolor_add_color("White", FColor::White);
fcolor_add_color("Yellow", FColor::Yellow);
}
PyObject *py_ue_new_fcolor(FColor color)
{
ue_PyFColor *ret = (ue_PyFColor *)PyObject_New(ue_PyFColor, &ue_PyFColorType);
ret->color = color;
return (PyObject *)ret;
}
ue_PyFColor *py_ue_is_fcolor(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFColorType))
return nullptr;
return (ue_PyFColor *)obj;
}
bool py_ue_get_fcolor(PyObject *obj, FColor &color)
{
if (ue_PyFColor *py_fcolor = py_ue_is_fcolor(obj))
{
color = py_fcolor->color;
return true;
}
if (ue_PyFLinearColor *py_flinearcolor = py_ue_is_flinearcolor(obj))
{
color = py_flinearcolor->color.ToFColor(true);
return true;
}
return false;
}
bool py_ue_color_arg(PyObject *args, FColor &color)
{
if (PyTuple_Size(args) == 1)
{
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFColor *py_color = py_ue_is_fcolor(arg);
if (!py_color)
{
PyErr_Format(PyExc_TypeError, "argument is not a FColor");
return false;
}
color = py_color->color;
return true;
}
int r = 0;
int g = 0;
int b = 0;
int a = 255;
if (!PyArg_ParseTuple(args, "iii|i", &r, &g, &b, &a))
return false;
color.R = r;
color.G = g;
color.B = b;
color.A = a;
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFColor.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,499 |
```c++
#include "UEPyFHitResult.h"
#include "GameFramework/Actor.h"
static PyObject *py_ue_fhitresult_get_reversed_hit(ue_PyFHitResult *self, PyObject * args)
{
return py_ue_new_fhitresult(FHitResult::GetReversedHit(self->hit));
}
static PyMethodDef ue_PyFHitResult_methods[] = {
{ "get_reversed_hit", (PyCFunction)py_ue_fhitresult_get_reversed_hit, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fhitresult_get_location(ue_PyFHitResult *self, void *closure)
{
return py_ue_new_fvector(self->hit.Location);
}
static PyObject *py_ue_fhitresult_get_normal(ue_PyFHitResult *self, void *closure)
{
return py_ue_new_fvector(self->hit.Normal);
}
static PyObject *py_ue_fhitresult_get_impact_point(ue_PyFHitResult *self, void *closure)
{
return py_ue_new_fvector(self->hit.ImpactPoint);
}
static PyObject *py_ue_fhitresult_get_impact_normal(ue_PyFHitResult *self, void *closure)
{
return py_ue_new_fvector(self->hit.ImpactNormal);
}
static PyObject *py_ue_fhitresult_get_distance(ue_PyFHitResult *self, void *closure)
{
return PyFloat_FromDouble(self->hit.Distance);
}
static PyObject *py_ue_fhitresult_get_time(ue_PyFHitResult *self, void *closure)
{
return PyFloat_FromDouble(self->hit.Time);
}
static PyObject *py_ue_fhitresult_get_bone_name(ue_PyFHitResult *self, void *closure)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->hit.BoneName.ToString()));
}
static PyObject *py_ue_fhitresult_get_actor(ue_PyFHitResult *self, void *closure)
{
AActor *actor = self->hit.Actor.Get();
if (!actor)
{
Py_RETURN_NONE;
}
Py_RETURN_UOBJECT(actor);
}
static PyGetSetDef ue_PyFHitResult_getseters[] = {
{(char *)"location", (getter)py_ue_fhitresult_get_location, NULL, (char *)"", NULL },
{(char *)"normal", (getter)py_ue_fhitresult_get_normal, NULL, (char *)"", NULL },
{(char *)"actor", (getter)py_ue_fhitresult_get_actor, NULL, (char *)"", NULL },
{(char *)"distance", (getter)py_ue_fhitresult_get_distance, NULL, (char *)"", NULL },
{(char *)"impact_point", (getter)py_ue_fhitresult_get_impact_point, NULL, (char *)"", NULL },
{(char *)"impact_normal", (getter)py_ue_fhitresult_get_impact_normal, NULL, (char *)"", NULL },
{(char *)"time", (getter)py_ue_fhitresult_get_time, NULL, (char *)"", NULL },
{(char *)"bone_name", (getter)py_ue_fhitresult_get_bone_name, NULL, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFHitResult_str(ue_PyFHitResult *self)
{
return PyUnicode_FromFormat("<unreal_engine.FHitResult {'location': {'x': %S, 'y': %S, 'x': %S}, 'impact_point': {'x': %S, 'y': %S, 'x': %S}}>",
PyFloat_FromDouble(self->hit.Location.X), PyFloat_FromDouble(self->hit.Location.Y), PyFloat_FromDouble(self->hit.Location.Z),
PyFloat_FromDouble(self->hit.ImpactPoint.X), PyFloat_FromDouble(self->hit.ImpactPoint.Y), PyFloat_FromDouble(self->hit.ImpactPoint.Z));
}
static PyTypeObject ue_PyFHitResultType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FHitResult", /* tp_name */
sizeof(ue_PyFHitResult), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFHitResult_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FHitResult", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFHitResult_methods, /* tp_methods */
0,
ue_PyFHitResult_getseters,
};
void ue_python_init_fhitresult(PyObject *ue_module)
{
ue_PyFHitResultType.tp_new = PyType_GenericNew;
if (PyType_Ready(&ue_PyFHitResultType) < 0)
return;
Py_INCREF(&ue_PyFHitResultType);
PyModule_AddObject(ue_module, "FHitResult", (PyObject *)&ue_PyFHitResultType);
}
PyObject *py_ue_new_fhitresult(FHitResult hit)
{
ue_PyFHitResult *ret = (ue_PyFHitResult *)PyObject_New(ue_PyFHitResult, &ue_PyFHitResultType);
ret->hit = hit;
return (PyObject *)ret;
}
ue_PyFHitResult *py_ue_is_fhitresult(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFHitResultType))
return nullptr;
return (ue_PyFHitResult *)obj;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFHitResult.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,340 |
```c++
#include "UEPyFFoliageInstance.h"
#include "Wrappers/UEPyFVector.h"
#include "Wrappers/UEPyFRotator.h"
#include "Wrappers/UEPyFTransform.h"
#include "Components/ActorComponent.h"
#include "Runtime/Foliage/Public/InstancedFoliageActor.h"
#if WITH_EDITOR
#define get_instance(x) FFoliageInstance *instance = get_foliage_instance(x);\
if (!instance)\
return nullptr;
#define set_instance(x) FFoliageInstance *instance = get_foliage_instance(x);\
if (!instance)\
return -1;
static FFoliageInstance* get_foliage_instance(ue_PyFFoliageInstance* self)
{
if (!self->foliage_actor.IsValid())
{
PyErr_SetString(PyExc_Exception, "AInstancedFoliageActor is in invalid state");
return nullptr;
}
if (!self->foliage_type.IsValid())
{
PyErr_SetString(PyExc_Exception, "UFoliageType is in invalid state");
return nullptr;
}
#if ENGINE_MINOR_VERSION >= 23
FFoliageInfo& info = self->foliage_actor->FoliageInfos[self->foliage_type.Get()].Get();
#else
FFoliageMeshInfo& info = self->foliage_actor->FoliageMeshes[self->foliage_type.Get()].Get();
#endif
if (self->instance_id >= 0 && self->instance_id < info.Instances.Num())
{
return &info.Instances[self->instance_id];
}
PyErr_SetString(PyExc_Exception, "invalid foliage instance id");
return nullptr;
}
static PyObject* ue_PyFFoliageInstance_str(ue_PyFFoliageInstance* self)
{
return PyUnicode_FromFormat("<unreal_engine.FFoliageInstance %d>",
self->instance_id);
}
static PyObject* py_ue_ffoliage_instance_get_location(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return py_ue_new_fvector(instance->Location);
}
static int py_ue_ffoliage_instance_set_location(ue_PyFFoliageInstance* self, PyObject* value, void* closure)
{
set_instance(self);
if (value)
{
ue_PyFVector* vec = py_ue_is_fvector(value);
if (vec)
{
TArray<int32> instances;
instances.Add(self->instance_id);
#if ENGINE_MINOR_VERSION >= 23
FFoliageInfo& info = self->foliage_actor->FoliageInfos[self->foliage_type.Get()].Get();
#else
FFoliageMeshInfo& info = self->foliage_actor->FoliageMeshes[self->foliage_type.Get()].Get();
#endif
info.PreMoveInstances(self->foliage_actor.Get(), instances);
instance->Location = vec->vec;
info.PostMoveInstances(self->foliage_actor.Get(), instances);
return 0;
}
}
PyErr_SetString(PyExc_TypeError, "value is not an FVector");
return -1;
}
static int py_ue_ffoliage_instance_set_rotation(ue_PyFFoliageInstance* self, PyObject* value, void* closure)
{
set_instance(self);
if (value)
{
ue_PyFRotator* rot = py_ue_is_frotator(value);
if (rot)
{
TArray<int32> instances;
instances.Add(self->instance_id);
#if ENGINE_MINOR_VERSION >= 23
FFoliageInfo& info = self->foliage_actor->FoliageInfos[self->foliage_type.Get()].Get();
#else
FFoliageMeshInfo& info = self->foliage_actor->FoliageMeshes[self->foliage_type.Get()].Get();
#endif
info.PreMoveInstances(self->foliage_actor.Get(), instances);
instance->Rotation = rot->rot;
info.PostMoveInstances(self->foliage_actor.Get(), instances);
return 0;
}
}
PyErr_SetString(PyExc_TypeError, "value is not an FRotator");
return -1;
}
static PyObject* py_ue_ffoliage_instance_get_draw_scale3d(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return py_ue_new_fvector(instance->DrawScale3D);
}
static PyObject* py_ue_ffoliage_instance_get_flags(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return PyLong_FromUnsignedLong(instance->Flags);
}
static PyObject* py_ue_ffoliage_instance_get_pre_align_rotation(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return py_ue_new_frotator(instance->PreAlignRotation);
}
static PyObject* py_ue_ffoliage_instance_get_rotation(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return py_ue_new_frotator(instance->Rotation);
}
static PyObject* py_ue_ffoliage_instance_get_zoffset(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return PyFloat_FromDouble(instance->ZOffset);
}
static PyObject* py_ue_ffoliage_instance_get_procedural_guid(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
FGuid guid = instance->ProceduralGuid;
return py_ue_new_owned_uscriptstruct(FindObject<UScriptStruct>(ANY_PACKAGE, UTF8_TO_TCHAR((char*)"Guid")), (uint8*)& guid);
}
static PyObject* py_ue_ffoliage_instance_get_base_id(ue_PyFFoliageInstance* self, void* closure)
{
get_instance(self);
return PyLong_FromLong(instance->BaseId);
}
static PyObject* py_ue_ffoliage_instance_get_instance_id(ue_PyFFoliageInstance* self, void* closure)
{
return PyLong_FromLong(self->instance_id);
}
#if ENGINE_MINOR_VERSION > 19
static PyObject * py_ue_ffoliage_instance_get_base_component(ue_PyFFoliageInstance * self, void* closure)
{
get_instance(self);
Py_RETURN_UOBJECT(instance->BaseComponent);
}
#endif
static PyGetSetDef ue_PyFFoliageInstance_getseters[] = {
{ (char*)"location", (getter)py_ue_ffoliage_instance_get_location, (setter)py_ue_ffoliage_instance_set_location, (char*)"", NULL },
{ (char*)"draw_scale3d", (getter)py_ue_ffoliage_instance_get_draw_scale3d, nullptr, (char*)"", NULL },
{ (char*)"flags", (getter)py_ue_ffoliage_instance_get_flags, nullptr, (char*)"", NULL },
{ (char*)"pre_align_rotation", (getter)py_ue_ffoliage_instance_get_pre_align_rotation, nullptr, (char*)"", NULL },
{ (char*)"rotation", (getter)py_ue_ffoliage_instance_get_rotation, (setter)py_ue_ffoliage_instance_set_rotation, (char*)"", NULL },
{ (char*)"zoffset", (getter)py_ue_ffoliage_instance_get_zoffset, nullptr, (char*)"", NULL },
{ (char*)"procedural_guid", (getter)py_ue_ffoliage_instance_get_procedural_guid, nullptr, (char*)"", NULL },
{ (char*)"guid", (getter)py_ue_ffoliage_instance_get_procedural_guid, nullptr, (char*)"", NULL },
{ (char*)"base_id", (getter)py_ue_ffoliage_instance_get_base_id, nullptr, (char*)"", NULL },
{ (char*)"instance_id", (getter)py_ue_ffoliage_instance_get_instance_id, nullptr, (char*)"", NULL },
#if ENGINE_MINOR_VERSION > 19
{ (char*)"base_component", (getter)py_ue_ffoliage_instance_get_base_component, nullptr, (char*)"", NULL },
#endif
{ NULL } /* Sentinel */
};
static PyObject* py_ue_ffoliage_instance_get_instance_world_transform(ue_PyFFoliageInstance* self, PyObject* args)
{
get_instance(self);
return py_ue_new_ftransform(instance->GetInstanceWorldTransform());
}
static PyObject* py_ue_ffoliage_instance_align_to_normal(ue_PyFFoliageInstance* self, PyObject* args)
{
get_instance(self);
PyObject* py_vec;
float align_max_angle = 0;
if (!PyArg_ParseTuple(args, "O|f:align_to_normal", &py_vec, &align_max_angle))
return nullptr;
ue_PyFVector* vec = py_ue_is_fvector(py_vec);
if (!vec)
{
return PyErr_Format(PyExc_Exception, "argument is not an FVector");
}
instance->AlignToNormal(vec->vec, align_max_angle);
Py_RETURN_NONE;
}
static PyMethodDef ue_PyFFoliageInstance_methods[] = {
{ "get_instance_world_transform", (PyCFunction)py_ue_ffoliage_instance_get_instance_world_transform, METH_VARARGS, "" },
{ "align_to_normal", (PyCFunction)py_ue_ffoliage_instance_align_to_normal, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFFoliageInstanceType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FFoliageInstance", /* tp_name */
sizeof(ue_PyFFoliageInstance), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFFoliageInstance_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#endif
"Unreal Engine FFoliageInstance", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFFoliageInstance_methods, /* tp_methods */
0,
ue_PyFFoliageInstance_getseters,
};
void ue_python_init_ffoliage_instance(PyObject* ue_module)
{
ue_PyFFoliageInstanceType.tp_new = PyType_GenericNew;
if (PyType_Ready(&ue_PyFFoliageInstanceType) < 0)
return;
Py_INCREF(&ue_PyFFoliageInstanceType);
PyModule_AddObject(ue_module, "FoliageInstance", (PyObject*)& ue_PyFFoliageInstanceType);
}
PyObject* py_ue_new_ffoliage_instance(AInstancedFoliageActor* foliage_actor, UFoliageType* foliage_type, int32 instance_id)
{
ue_PyFFoliageInstance* ret = (ue_PyFFoliageInstance*)PyObject_New(ue_PyFFoliageInstance, &ue_PyFFoliageInstanceType);
ret->foliage_actor = TWeakObjectPtr<AInstancedFoliageActor>(foliage_actor);
ret->foliage_type = TWeakObjectPtr<UFoliageType>(foliage_type);
ret->instance_id = instance_id;
return (PyObject*)ret;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,543 |
```c++
#include "UEPyFFrameNumber.h"
#if ENGINE_MINOR_VERSION >= 20
static PyObject *ue_PyFFrameNumber_str(ue_PyFFrameNumber *self)
{
return PyUnicode_FromFormat("<unreal_engine.FFrameNumber %d>",
self->frame_number.Value);
}
static PyTypeObject ue_PyFFrameNumberType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FFrameNumber", /* tp_name */
sizeof(ue_PyFFrameNumber), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFFrameNumber_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FFrameNumber", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0,
0,
};
static int py_ue_fframe_number_init(ue_PyFFrameNumber *self, PyObject * args)
{
int value = 0;
if (!PyArg_ParseTuple(args, "i", &value))
return -1;
new(&self->frame_number) FFrameNumber(value);
return 0;
}
void ue_python_init_fframe_number(PyObject *ue_module)
{
ue_PyFFrameNumberType.tp_new = PyType_GenericNew;
ue_PyFFrameNumberType.tp_init = (initproc)py_ue_fframe_number_init;
if (PyType_Ready(&ue_PyFFrameNumberType) < 0)
return;
Py_INCREF(&ue_PyFFrameNumberType);
PyModule_AddObject(ue_module, "FFrameNumber", (PyObject *)&ue_PyFFrameNumberType);
}
ue_PyFFrameNumber *py_ue_is_fframe_number(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFFrameNumberType))
return nullptr;
return (ue_PyFFrameNumber *)obj;
}
PyObject *py_ue_new_fframe_number(FFrameNumber frame_number)
{
ue_PyFFrameNumber *ret = (ue_PyFFrameNumber *)PyObject_New(ue_PyFFrameNumber, &ue_PyFFrameNumberType);
new(&ret->frame_number) FFrameNumber(frame_number);
return (PyObject *)ret;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFFrameNumber.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 685 |
```c++
#include "UEPyIAssetEditorInstance.h"
#if WITH_EDITOR
static PyObject *py_ue_iasset_editor_instance_close_window(ue_PyIAssetEditorInstance *self, PyObject * args)
{
self->editor_instance->CloseWindow();
Py_RETURN_NONE;
}
static PyObject *py_ue_iasset_editor_instance_focus_window(ue_PyIAssetEditorInstance *self, PyObject * args)
{
self->editor_instance->FocusWindow();
Py_RETURN_NONE;
}
static PyObject *py_ue_iasset_editor_instance_get_editor_name(ue_PyIAssetEditorInstance *self, PyObject * args)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->editor_instance->GetEditorName().ToString()));
}
static PyObject *py_ue_iasset_editor_instance_get_last_activation_time(ue_PyIAssetEditorInstance *self, PyObject * args)
{
return PyFloat_FromDouble(self->editor_instance->GetLastActivationTime());
}
static PyMethodDef ue_PyIAssetEditorInstance_methods[] = {
{ "close_window", (PyCFunction)py_ue_iasset_editor_instance_close_window, METH_VARARGS, "" },
{ "focus_window", (PyCFunction)py_ue_iasset_editor_instance_focus_window, METH_VARARGS, "" },
{ "get_editor_name", (PyCFunction)py_ue_iasset_editor_instance_get_editor_name, METH_VARARGS, "" },
{ "get_last_activation_time", (PyCFunction)py_ue_iasset_editor_instance_get_last_activation_time, METH_VARARGS, "" },
{ nullptr } /* Sentinel */
};
static PyObject *ue_PyIAssetEditorInstance_str(ue_PyIAssetEditorInstance *self)
{
return PyUnicode_FromFormat("<unreal_engine.IAssetEditorInstance %p>",
&self->editor_instance);
}
static PyTypeObject ue_PyIAssetEditorInstanceType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.IAssetEditorInstance", /* tp_name */
sizeof(ue_PyIAssetEditorInstance), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyIAssetEditorInstance_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#endif
"Unreal Engine IAssetEditorInstance", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyIAssetEditorInstance_methods, /* tp_methods */
0,
};
void ue_python_init_iasset_editor_instance(PyObject *ue_module)
{
ue_PyIAssetEditorInstanceType.tp_new = PyType_GenericNew;
if (PyType_Ready(&ue_PyIAssetEditorInstanceType) < 0)
return;
Py_INCREF(&ue_PyIAssetEditorInstanceType);
PyModule_AddObject(ue_module, "IAssetEditorInstance", (PyObject *)&ue_PyIAssetEditorInstanceType);
}
ue_PyIAssetEditorInstance *py_ue_is_iasset_editor_instance(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyIAssetEditorInstanceType))
return nullptr;
return (ue_PyIAssetEditorInstance *)obj;
}
PyObject *py_ue_new_iasset_editor_instance(IAssetEditorInstance *editor_instance)
{
ue_PyIAssetEditorInstance *ret = (ue_PyIAssetEditorInstance *)PyObject_New(ue_PyIAssetEditorInstance, &ue_PyIAssetEditorInstanceType);
ret->editor_instance = editor_instance;
return (PyObject *)ret;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyIAssetEditorInstance.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 940 |
```c++
#include "UEPyFRotator.h"
static PyObject *py_ue_frotator_get_vector(ue_PyFRotator *self, PyObject * args) {
FVector vec = self->rot.Vector();
return py_ue_new_fvector(vec);
}
static PyObject *py_ue_frotator_get_euler(ue_PyFRotator *self, PyObject * args) {
FVector vec = self->rot.Euler();
return py_ue_new_fvector(vec);
}
static PyObject *py_ue_frotator_inversed(ue_PyFRotator *self, PyObject * args) {
FRotator rot = self->rot.GetInverse();
return py_ue_new_frotator(rot);
}
static PyObject *py_ue_frotator_normalized(ue_PyFRotator *self, PyObject * args) {
FRotator rot = self->rot.GetNormalized();
return py_ue_new_frotator(rot);
}
static PyObject *py_ue_frotator_quaternion(ue_PyFRotator *self, PyObject * args) {
FQuat quat = self->rot.Quaternion();
return py_ue_new_fquat(quat);
}
static PyMethodDef ue_PyFRotator_methods[] = {
{ "get_vector", (PyCFunction)py_ue_frotator_get_vector, METH_VARARGS, "" },
{ "get_euler", (PyCFunction)py_ue_frotator_get_euler, METH_VARARGS, "" },
{ "normalized", (PyCFunction)py_ue_frotator_normalized, METH_VARARGS, "" },
{ "inversed", (PyCFunction)py_ue_frotator_inversed, METH_VARARGS, "" },
{ "quaternion", (PyCFunction)py_ue_frotator_quaternion, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_frotator_get_pitch(ue_PyFRotator *self, void *closure) {
return PyFloat_FromDouble(self->rot.Pitch);
}
static int py_ue_frotator_set_pitch(ue_PyFRotator *self, PyObject *value, void *closure) {
if (value && PyNumber_Check(value)) {
PyObject *f_value = PyNumber_Float(value);
self->rot.Pitch = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_frotator_get_yaw(ue_PyFRotator *self, void *closure) {
return PyFloat_FromDouble(self->rot.Yaw);
}
static int py_ue_frotator_set_yaw(ue_PyFRotator *self, PyObject *value, void *closure) {
if (value && PyNumber_Check(value)) {
PyObject *f_value = PyNumber_Float(value);
self->rot.Yaw = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_frotator_get_roll(ue_PyFRotator *self, void *closure) {
return PyFloat_FromDouble(self->rot.Roll);
}
static int py_ue_frotator_set_roll(ue_PyFRotator *self, PyObject *value, void *closure) {
if (value && PyNumber_Check(value)) {
PyObject *f_value = PyNumber_Float(value);
self->rot.Roll = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyGetSetDef ue_PyFRotator_getseters[] = {
{ (char*)"pitch", (getter)py_ue_frotator_get_pitch, (setter)py_ue_frotator_set_pitch, (char *)"", NULL },
{ (char *)"yaw", (getter)py_ue_frotator_get_yaw, (setter)py_ue_frotator_set_yaw, (char *)"", NULL },
{ (char *)"roll", (getter)py_ue_frotator_get_roll, (setter)py_ue_frotator_set_roll, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFRotator_str(ue_PyFRotator *self)
{
return PyUnicode_FromFormat("<unreal_engine.FRotator {'roll': %S, 'pitch': %S, 'yaw': %S}>",
PyFloat_FromDouble(self->rot.Roll), PyFloat_FromDouble(self->rot.Pitch), PyFloat_FromDouble(self->rot.Yaw));
}
PyTypeObject ue_PyFRotatorType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FRotator", /* tp_name */
sizeof(ue_PyFRotator), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFRotator_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FRotator", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFRotator_methods, /* tp_methods */
0,
ue_PyFRotator_getseters,
};
static PyObject *ue_py_frotator_add(ue_PyFRotator *self, PyObject *value) {
FRotator rot = self->rot;
ue_PyFRotator *py_rot = py_ue_is_frotator(value);
if (py_rot) {
rot += py_rot->rot;
}
else if (PyNumber_Check(value)) {
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
rot.Pitch += f;
rot.Yaw += f;
rot.Roll += f;
Py_DECREF(f_value);
}
return py_ue_new_frotator(rot);
}
static PyObject *ue_py_frotator_sub(ue_PyFRotator *self, PyObject *value) {
FRotator rot = self->rot;
ue_PyFRotator *py_rot = py_ue_is_frotator(value);
if (py_rot) {
rot -= py_rot->rot;
}
else if (PyNumber_Check(value)) {
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
rot.Pitch -= f;
rot.Yaw -= f;
rot.Roll -= f;
Py_DECREF(f_value);
}
return py_ue_new_frotator(rot);
}
static PyObject *ue_py_frotator_mul(ue_PyFRotator *self, PyObject *value) {
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec) {
FVector vec = self->rot.RotateVector(py_vec->vec);
return py_ue_new_fvector(vec);
}
else if (PyNumber_Check(value)) {
FRotator rot = self->rot;
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
rot.Pitch *= f;
rot.Yaw *= f;
rot.Roll *= f;
Py_DECREF(f_value);
return py_ue_new_frotator(rot);
}
return PyErr_Format(PyExc_TypeError, "unsupported argument type");
}
static PyObject *ue_py_frotator_div(ue_PyFRotator *self, PyObject *value) {
FRotator rot = self->rot;
if (PyNumber_Check(value)) {
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
if (f == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
rot.Pitch /= f;
rot.Yaw /= f;
rot.Roll /= f;
Py_DECREF(f_value);
return py_ue_new_frotator(rot);
}
return PyErr_Format(PyExc_TypeError, "unsupported argument type");
}
PyNumberMethods ue_PyFRotator_number_methods;
static Py_ssize_t ue_py_frotator_seq_length(ue_PyFRotator *self) {
return 3;
}
static PyObject *ue_py_frotator_seq_item(ue_PyFRotator *self, Py_ssize_t i) {
switch (i) {
case 0:
return PyFloat_FromDouble(self->rot.Roll);
case 1:
return PyFloat_FromDouble(self->rot.Pitch);
case 2:
return PyFloat_FromDouble(self->rot.Yaw);
}
return PyErr_Format(PyExc_IndexError, "FRotator has only 3 items");
}
PySequenceMethods ue_PyFRotator_sequence_methods;
static int ue_py_frotator_init(ue_PyFRotator *self, PyObject *args, PyObject *kwargs) {
float pitch = 0, yaw = 0, roll = 0;
if (PyTuple_Size(args) == 1) {
if (ue_PyFQuat *py_quat = py_ue_is_fquat(PyTuple_GetItem(args, 0))) {
self->rot = FRotator(py_quat->quat);
return 0;
}
}
if (!PyArg_ParseTuple(args, "|fff", &roll, &pitch, &yaw))
return -1;
if (PyTuple_Size(args) == 1) {
yaw = pitch;
roll = pitch;
}
self->rot.Pitch = pitch;
self->rot.Yaw = yaw;
self->rot.Roll = roll;
return 0;
}
void ue_python_init_frotator(PyObject *ue_module) {
ue_PyFRotatorType.tp_new = PyType_GenericNew;
ue_PyFRotatorType.tp_init = (initproc)ue_py_frotator_init;
memset(&ue_PyFRotator_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFRotatorType.tp_as_number = &ue_PyFRotator_number_methods;
ue_PyFRotator_number_methods.nb_add = (binaryfunc)ue_py_frotator_add;
ue_PyFRotator_number_methods.nb_subtract = (binaryfunc)ue_py_frotator_sub;
ue_PyFRotator_number_methods.nb_multiply = (binaryfunc)ue_py_frotator_mul;
ue_PyFRotator_number_methods.nb_divmod = (binaryfunc)ue_py_frotator_div;
memset(&ue_PyFRotator_sequence_methods, 0, sizeof(PySequenceMethods));
ue_PyFRotatorType.tp_as_sequence = &ue_PyFRotator_sequence_methods;
ue_PyFRotator_sequence_methods.sq_length = (lenfunc)ue_py_frotator_seq_length;
ue_PyFRotator_sequence_methods.sq_item = (ssizeargfunc)ue_py_frotator_seq_item;
if (PyType_Ready(&ue_PyFRotatorType) < 0)
return;
Py_INCREF(&ue_PyFRotatorType);
PyModule_AddObject(ue_module, "FRotator", (PyObject *)&ue_PyFRotatorType);
}
PyObject *py_ue_new_frotator(FRotator rot) {
ue_PyFRotator *ret = (ue_PyFRotator *)PyObject_New(ue_PyFRotator, &ue_PyFRotatorType);
ret->rot = rot;
return (PyObject *)ret;
}
ue_PyFRotator *py_ue_is_frotator(PyObject *obj) {
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFRotatorType))
return nullptr;
return (ue_PyFRotator *)obj;
}
bool py_ue_rotator_arg(PyObject *args, FRotator &rot) {
if (PyTuple_Size(args) == 1) {
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFRotator *py_rot = py_ue_is_frotator(arg);
if (!py_rot) {
PyErr_Format(PyExc_TypeError, "argument is not a FRotator");
return false;
}
rot = py_rot->rot;
return true;
}
float pitch, yaw, roll;
if (!PyArg_ParseTuple(args, "fff", &roll, &pitch, &yaw))
return false;
rot.Pitch = pitch;
rot.Yaw = yaw;
rot.Roll = roll;
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRotator.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,893 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if WITH_EDITOR
struct ue_PyFAssetData
{
PyObject_HEAD
/* Type-specific fields go here. */
FAssetData asset_data;
};
PyObject *py_ue_new_fassetdata(FAssetData);
ue_PyFAssetData *py_ue_is_fassetdata(PyObject *);
void ue_python_init_fassetdata(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFAssetData.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 84 |
```c++
#include "UEPyFRawAnimSequenceTrack.h"
static PyObject *py_ue_fraw_anim_sequence_track_get_pos_keys(ue_PyFRawAnimSequenceTrack *self, void *closure)
{
PyObject *py_list = PyList_New(0);
for (FVector vec : self->raw_anim_sequence_track.PosKeys)
{
PyObject *py_vec = py_ue_new_fvector(vec);
PyList_Append(py_list, py_vec);
Py_DECREF(py_vec);
}
return py_list;
}
static PyObject *py_ue_fraw_anim_sequence_track_get_scale_keys(ue_PyFRawAnimSequenceTrack *self, void *closure)
{
PyObject *py_list = PyList_New(0);
for (FVector vec : self->raw_anim_sequence_track.ScaleKeys)
{
PyObject *py_vec = py_ue_new_fvector(vec);
PyList_Append(py_list, py_vec);
Py_DECREF(py_vec);
}
return py_list;
}
static PyObject *py_ue_fraw_anim_sequence_track_get_rot_keys(ue_PyFRawAnimSequenceTrack *self, void *closure)
{
PyObject *py_list = PyList_New(0);
for (FQuat quat : self->raw_anim_sequence_track.RotKeys)
{
PyObject *py_quat = py_ue_new_fquat(quat);
PyList_Append(py_list, py_quat);
Py_DECREF(py_quat);
}
return py_list;
}
static int py_ue_fraw_anim_sequence_track_set_pos_keys(ue_PyFRawAnimSequenceTrack *self, PyObject *value, void *closure)
{
TArray<FVector> pos;
if (value)
{
PyObject *py_iter = PyObject_GetIter(value);
if (py_iter)
{
bool failed = false;
while (PyObject *py_item = PyIter_Next(py_iter))
{
ue_PyFVector *py_vec = py_ue_is_fvector(py_item);
if (!py_vec)
{
failed = true;
break;
}
pos.Add(py_vec->vec);
}
Py_DECREF(py_iter);
if (!failed)
{
self->raw_anim_sequence_track.PosKeys = pos;
return 0;
}
}
}
PyErr_SetString(PyExc_TypeError, "value is not an iterable of FVector's");
return -1;
}
static int py_ue_fraw_anim_sequence_track_set_scale_keys(ue_PyFRawAnimSequenceTrack *self, PyObject *value, void *closure)
{
TArray<FVector> scale;
if (value)
{
PyObject *py_iter = PyObject_GetIter(value);
if (py_iter)
{
bool failed = false;
while (PyObject *py_item = PyIter_Next(py_iter))
{
ue_PyFVector *py_vec = py_ue_is_fvector(py_item);
if (!py_vec)
{
failed = true;
break;
}
scale.Add(py_vec->vec);
}
Py_DECREF(py_iter);
if (!failed)
{
self->raw_anim_sequence_track.ScaleKeys = scale;
return 0;
}
}
}
PyErr_SetString(PyExc_TypeError, "value is not an iterable of FVector's");
return -1;
}
static int py_ue_fraw_anim_sequence_track_set_rot_keys(ue_PyFRawAnimSequenceTrack *self, PyObject *value, void *closure)
{
TArray<FQuat> rot;
if (value)
{
PyObject *py_iter = PyObject_GetIter(value);
if (py_iter)
{
bool failed = false;
while (PyObject *py_item = PyIter_Next(py_iter))
{
ue_PyFQuat *py_quat = py_ue_is_fquat(py_item);
if (!py_quat)
{
failed = true;
break;
}
rot.Add(py_quat->quat);
}
Py_DECREF(py_iter);
if (!failed)
{
self->raw_anim_sequence_track.RotKeys = rot;
return 0;
}
}
}
PyErr_SetString(PyExc_TypeError, "value is not an iterable of FQuat's");
return -1;
}
static PyGetSetDef ue_PyFRawAnimSequenceTrack_getseters[] = {
{(char *) "pos_keys", (getter)py_ue_fraw_anim_sequence_track_get_pos_keys, (setter)py_ue_fraw_anim_sequence_track_set_pos_keys, (char *)"", NULL },
{(char *) "rot_keys", (getter)py_ue_fraw_anim_sequence_track_get_rot_keys, (setter)py_ue_fraw_anim_sequence_track_set_rot_keys, (char *)"", NULL },
{(char *) "scale_keys", (getter)py_ue_fraw_anim_sequence_track_get_scale_keys, (setter)py_ue_fraw_anim_sequence_track_set_scale_keys, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFRawAnimSequenceTrack_str(ue_PyFRawAnimSequenceTrack *self)
{
return PyUnicode_FromFormat("<unreal_engine.FRawAnimSequenceTrack {'pos': %d, 'rot': %d, 'scale': %d}>",
self->raw_anim_sequence_track.PosKeys.Num(), self->raw_anim_sequence_track.RotKeys.Num(), self->raw_anim_sequence_track.ScaleKeys.Num());
}
static PyTypeObject ue_PyFRawAnimSequenceTrackType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FRawAnimSequenceTrack", /* tp_name */
sizeof(ue_PyFRawAnimSequenceTrack), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFRawAnimSequenceTrack_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FRawAnimSequenceTrack", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0,
ue_PyFRawAnimSequenceTrack_getseters,
};
void ue_python_init_fraw_anim_sequence_track(PyObject *ue_module)
{
ue_PyFRawAnimSequenceTrackType.tp_new = PyType_GenericNew;
if (PyType_Ready(&ue_PyFRawAnimSequenceTrackType) < 0)
return;
Py_INCREF(&ue_PyFRawAnimSequenceTrackType);
PyModule_AddObject(ue_module, "FRawAnimSequenceTrack", (PyObject *)&ue_PyFRawAnimSequenceTrackType);
}
ue_PyFRawAnimSequenceTrack *py_ue_is_fraw_anim_sequence_track(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFRawAnimSequenceTrackType))
return nullptr;
return (ue_PyFRawAnimSequenceTrack *)obj;
}
PyObject *py_ue_new_fraw_anim_sequence_track(FRawAnimSequenceTrack raw_anim_sequence_track)
{
ue_PyFRawAnimSequenceTrack *ret = (ue_PyFRawAnimSequenceTrack *)PyObject_New(ue_PyFRawAnimSequenceTrack, &ue_PyFRawAnimSequenceTrackType);
new(&ret->raw_anim_sequence_track) FRawAnimSequenceTrack(raw_anim_sequence_track);
return (PyObject *)ret;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRawAnimSequenceTrack.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,768 |
```c++
#include "UEPyFViewportClient.h"
#include "Engine/World.h"
static PyObject *py_ue_fviewport_client_get_world(ue_PyFViewportClient *self, PyObject * args)
{
UWorld *u_world = self->viewport_client->GetWorld();
if (!u_world)
return PyErr_Format(PyExc_Exception, "unable to get UWorld");
Py_RETURN_UOBJECT(u_world);
}
static PyObject *py_ue_fviewport_client_is_ortho(ue_PyFViewportClient *self, PyObject * args)
{
if (self->viewport_client->IsOrtho())
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_fviewport_client_is_in_game_view(ue_PyFViewportClient *self, PyObject * args)
{
if (self->viewport_client->IsInGameView())
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyMethodDef ue_PyFViewportClient_methods[] = {
{ "get_world", (PyCFunction)py_ue_fviewport_client_get_world, METH_VARARGS, "" },
{ "is_in_game_view", (PyCFunction)py_ue_fviewport_client_is_in_game_view, METH_VARARGS, "" },
{ "is_ortho", (PyCFunction)py_ue_fviewport_client_is_ortho, METH_VARARGS, "" },
{ nullptr } /* Sentinel */
};
static PyObject *ue_PyFViewportClient_str(ue_PyFViewportClient *self)
{
return PyUnicode_FromFormat("<unreal_engine.FViewportClient %p>",
&self->viewport_client.Get());
}
PyTypeObject ue_PyFViewportClientType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FViewportClient", /* tp_name */
sizeof(ue_PyFViewportClient), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFViewportClient_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#endif
"Unreal Engine FViewportClient", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFViewportClient_methods, /* tp_methods */
0,
};
void ue_python_init_fviewport_client(PyObject *ue_module)
{
ue_PyFViewportClientType.tp_new = PyType_GenericNew;
if (PyType_Ready(&ue_PyFViewportClientType) < 0)
return;
Py_INCREF(&ue_PyFViewportClientType);
PyModule_AddObject(ue_module, "FViewportClient", (PyObject *)&ue_PyFViewportClientType);
}
ue_PyFViewportClient *py_ue_is_fviewport_client(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFViewportClientType))
return nullptr;
return (ue_PyFViewportClient *)obj;
}
PyObject *py_ue_new_fviewport_client(TSharedRef<FViewportClient> viewport_client)
{
ue_PyFViewportClient *ret = (ue_PyFViewportClient *)PyObject_New(ue_PyFViewportClient, &ue_PyFViewportClientType);
new(&ret->viewport_client) TSharedRef<FViewportClient>(viewport_client);
return (PyObject *)ret;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFViewportClient.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 885 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if WITH_EDITOR
#include "AssetRegistryModule.h"
#include "Runtime/AssetRegistry/Public/ARFilter.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FARFilter filter;
PyObject *class_names;
PyObject *object_paths;
PyObject *package_names;
PyObject *package_paths;
PyObject *recursive_classes_exclusion_set;
PyObject *tags_and_values;
} ue_PyFARFilter;
PyObject *py_ue_new_farfilter(FARFilter);
ue_PyFARFilter *py_ue_is_farfilter(PyObject *);
void ue_python_init_farfilter(PyObject *);
void py_ue_sync_farfilter(PyObject *);
void py_ue_clear_farfilter(ue_PyFARFilter *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFARFilter.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 163 |
```objective-c
#pragma once
#include "UEPyModule.h"
#include "Engine/EngineTypes.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FHitResult hit;
} ue_PyFHitResult;
PyObject *py_ue_new_fhitresult(FHitResult);
ue_PyFHitResult *py_ue_is_fhitresult(PyObject *);
void ue_python_init_fhitresult(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFHitResult.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 88 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if ENGINE_MINOR_VERSION < 18
#include "Runtime/CoreUObject/Public/Misc/StringAssetReference.h"
#endif
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FStringAssetReference fstring_asset_reference;
} ue_PyFStringAssetReference;
PyObject *py_ue_new_fstring_asset_reference(FStringAssetReference);
ue_PyFStringAssetReference *py_ue_is_fstring_asset_reference(PyObject *);
void ue_python_init_fstring_asset_reference(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFStringAssetReference.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 114 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#if WITH_EDITOR
#include "Wrappers/UEPyFViewportClient.h"
#include "Editor/UnrealEd/Public/EditorViewportClient.h"
struct ue_PyFEditorViewportClient
{
ue_PyFViewportClient viewport_client;
/* Type-specific fields go here. */
TSharedRef<FEditorViewportClient> editor_viewport_client;;
};
void ue_python_init_feditor_viewport_client(PyObject *);
PyObject *py_ue_new_feditor_viewport_client(TSharedRef<FEditorViewportClient>);
ue_PyFEditorViewportClient *py_ue_is_feditor_viewport_client(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFEditorViewportClient.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 134 |
```c++
#include "UEPyFSoftSkinVertex.h"
#if WITH_EDITOR
static PyObject *py_ue_fsoft_skin_vertex_get_color(ue_PyFSoftSkinVertex *self, void *closure)
{
return py_ue_new_fcolor(self->ss_vertex.Color);
}
static int py_ue_fsoft_skin_vertex_set_color(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
ue_PyFColor *py_color = py_ue_is_fcolor(value);
if (py_color)
{
self->ss_vertex.Color = py_color->color;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FColor");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_position(ue_PyFSoftSkinVertex *self, void *closure)
{
return py_ue_new_fvector(self->ss_vertex.Position);
}
static int py_ue_fsoft_skin_vertex_set_position(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
self->ss_vertex.Position = py_vec->vec;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FVector");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_tangent_x(ue_PyFSoftSkinVertex *self, void *closure)
{
return py_ue_new_fvector(self->ss_vertex.TangentX);
}
static int py_ue_fsoft_skin_vertex_set_tangent_x(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
self->ss_vertex.TangentX = py_vec->vec;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FVector");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_tangent_y(ue_PyFSoftSkinVertex *self, void *closure)
{
return py_ue_new_fvector(self->ss_vertex.TangentX);
}
static int py_ue_fsoft_skin_vertex_set_tangent_y(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
self->ss_vertex.TangentY = py_vec->vec;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FVector");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_tangent_z(ue_PyFSoftSkinVertex *self, void *closure)
{
return py_ue_new_fvector(self->ss_vertex.TangentZ);
}
static int py_ue_fsoft_skin_vertex_set_tangent_z(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
self->ss_vertex.TangentZ = py_vec->vec;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FVector");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_influence_bones(ue_PyFSoftSkinVertex *self, void *closure)
{
uint8 *data = self->ss_vertex.InfluenceBones;
return Py_BuildValue((char*)"(iiiiiiii)", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}
static int py_ue_fsoft_skin_vertex_set_influence_bones(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
PyObject *py_iter = PyObject_GetIter(value);
int pos = 0;
if (py_iter)
{
while (PyObject *py_item = PyIter_Next(py_iter))
{
if (!PyNumber_Check(py_item))
{
Py_DECREF(py_iter);
PyErr_SetString(PyExc_TypeError, "value is not an iterable of numbers");
return -1;
}
PyObject *py_num = PyNumber_Long(py_item);
uint8 num = PyLong_AsUnsignedLong(py_num);
Py_DECREF(py_num);
self->ss_vertex.InfluenceBones[pos] = num;
pos++;
if (pos >= MAX_TOTAL_INFLUENCES)
break;
}
Py_DECREF(py_iter);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not an iterable of numbers");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_influence_weights(ue_PyFSoftSkinVertex *self, void *closure)
{
uint8 *data = self->ss_vertex.InfluenceWeights;
return Py_BuildValue((char*)"(iiiiiiii)", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}
static int py_ue_fsoft_skin_vertex_set_influence_weights(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
PyObject *py_iter = PyObject_GetIter(value);
int pos = 0;
if (py_iter)
{
while (PyObject *py_item = PyIter_Next(py_iter))
{
if (!PyNumber_Check(py_item))
{
Py_DECREF(py_iter);
PyErr_SetString(PyExc_TypeError, "value is not an iterable of numbers");
return -1;
}
PyObject *py_num = PyNumber_Long(py_item);
uint8 num = PyLong_AsUnsignedLong(py_num);
Py_DECREF(py_num);
self->ss_vertex.InfluenceWeights[pos] = num;
pos++;
if (pos >= MAX_TOTAL_INFLUENCES)
break;
}
Py_DECREF(py_iter);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not an iterable of numbers");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_uvs(ue_PyFSoftSkinVertex *self, void *closure)
{
PyObject *py_tuple = PyTuple_New(MAX_TEXCOORDS);
for (int32 i = 0; i < MAX_TEXCOORDS; i++)
{
PyTuple_SetItem(py_tuple, i, Py_BuildValue((char*)"(ff)", self->ss_vertex.UVs[i].X, self->ss_vertex.UVs[i].Y));
}
return py_tuple;
}
static int py_ue_fsoft_skin_vertex_set_uvs(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
PyObject *py_iter = PyObject_GetIter(value);
int pos = 0;
if (py_iter)
{
while (PyObject *py_item = PyIter_Next(py_iter))
{
if (!PyTuple_Check(py_item))
{
Py_DECREF(py_iter);
PyErr_SetString(PyExc_TypeError, "value is not an iterable of 2-members tuples");
return -1;
}
if (PyTuple_Size(py_item) != 2)
{
Py_DECREF(py_iter);
PyErr_SetString(PyExc_TypeError, "value is not an iterable of 2-members tuples");
return -1;
}
PyObject *py_x = PyTuple_GetItem(py_item, 0);
PyObject *py_y = PyTuple_GetItem(py_item, 1);
if (!PyNumber_Check(py_x))
{
Py_DECREF(py_iter);
PyErr_SetString(PyExc_TypeError, "tuple item is not a number");
return -1;
}
PyObject *py_num = PyNumber_Float(py_x);
float x = PyFloat_AsDouble(py_num);
Py_DECREF(py_num);
if (!PyNumber_Check(py_y))
{
Py_DECREF(py_iter);
PyErr_SetString(PyExc_TypeError, "tuple item is not a number");
return -1;
}
py_num = PyNumber_Float(py_y);
float y = PyFloat_AsDouble(py_num);
Py_DECREF(py_num);
self->ss_vertex.UVs[pos] = FVector2D(x, y);
pos++;
if (pos >= MAX_TEXCOORDS)
break;
}
Py_DECREF(py_iter);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not an iterable of numbers");
return -1;
}
static int py_ue_fsoft_skin_vertex_set_material_index(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
if (PyNumber_Check(value))
{
PyObject *py_num = PyNumber_Long(value);
self->material_index = PyLong_AsUnsignedLong(py_num);
Py_DECREF(py_num);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a number");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_material_index(ue_PyFSoftSkinVertex *self, void *closure)
{
return PyLong_FromUnsignedLong(self->material_index);
}
static int py_ue_fsoft_skin_vertex_set_smoothing_group(ue_PyFSoftSkinVertex *self, PyObject *value, void *closure)
{
if (PyNumber_Check(value))
{
PyObject *py_num = PyNumber_Long(value);
self->smoothing_group = PyLong_AsUnsignedLong(py_num);
Py_DECREF(py_num);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a number");
return -1;
}
static PyObject *py_ue_fsoft_skin_vertex_get_smoothing_group(ue_PyFSoftSkinVertex *self, void *closure)
{
return PyLong_FromUnsignedLong(self->smoothing_group);
}
static PyGetSetDef ue_PyFSoftSkinVertex_getseters[] = {
{ (char *) "color", (getter)py_ue_fsoft_skin_vertex_get_color, (setter)py_ue_fsoft_skin_vertex_set_color, (char *)"", NULL },
{ (char *) "influence_bones", (getter)py_ue_fsoft_skin_vertex_get_influence_bones, (setter)py_ue_fsoft_skin_vertex_set_influence_bones, (char *)"", NULL },
{ (char *) "influence_weights", (getter)py_ue_fsoft_skin_vertex_get_influence_weights, (setter)py_ue_fsoft_skin_vertex_set_influence_weights, (char *)"", NULL },
{ (char *) "position", (getter)py_ue_fsoft_skin_vertex_get_position, (setter)py_ue_fsoft_skin_vertex_set_position, (char *)"", NULL },
{ (char *) "tangent_x", (getter)py_ue_fsoft_skin_vertex_get_tangent_x, (setter)py_ue_fsoft_skin_vertex_set_tangent_x, (char *)"", NULL },
{ (char *) "tangent_y", (getter)py_ue_fsoft_skin_vertex_get_tangent_y, (setter)py_ue_fsoft_skin_vertex_set_tangent_y, (char *)"", NULL },
{ (char *) "tangent_z", (getter)py_ue_fsoft_skin_vertex_get_tangent_z, (setter)py_ue_fsoft_skin_vertex_set_tangent_z, (char *)"", NULL },
{ (char *) "uvs", (getter)py_ue_fsoft_skin_vertex_get_uvs, (setter)py_ue_fsoft_skin_vertex_set_uvs, (char *)"", NULL },
{ (char *) "material_index", (getter)py_ue_fsoft_skin_vertex_get_material_index, (setter)py_ue_fsoft_skin_vertex_set_material_index, (char *)"", NULL },
{ (char *) "smoothing_group", (getter)py_ue_fsoft_skin_vertex_get_smoothing_group, (setter)py_ue_fsoft_skin_vertex_set_smoothing_group, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fsoft_skin_vertex_copy(ue_PyFSoftSkinVertex *self, PyObject * args)
{
ue_PyFSoftSkinVertex *py_ss_vertex = (ue_PyFSoftSkinVertex *)py_ue_new_fsoft_skin_vertex(self->ss_vertex);
py_ss_vertex->material_index = self->material_index;
py_ss_vertex->smoothing_group = self->smoothing_group;
return (PyObject *)py_ss_vertex;
}
static PyMethodDef ue_PyFSoftSkinVertex_methods[] = {
{ "copy", (PyCFunction)py_ue_fsoft_skin_vertex_copy, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFSoftSkinVertex_str(ue_PyFSoftSkinVertex *self)
{
return PyUnicode_FromFormat("<unreal_engine.FSoftSkinVertex {'position': {'x': %S, 'y': %S, 'z': %S}}>",
PyFloat_FromDouble(self->ss_vertex.Position.X), PyFloat_FromDouble(self->ss_vertex.Position.Y), PyFloat_FromDouble(self->ss_vertex.Position.Z));
}
static PyTypeObject ue_PyFSoftSkinVertexType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FSoftSkinVertex", /* tp_name */
sizeof(ue_PyFSoftSkinVertex), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFSoftSkinVertex_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FSoftSkinVertex", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFSoftSkinVertex_methods, /* tp_methods */
0,
ue_PyFSoftSkinVertex_getseters,
};
static int py_ue_fsoft_skin_vertex_init(ue_PyFSoftSkinVertex *self, PyObject * args)
{
new(&self->ss_vertex) FSoftSkinVertex();
return 0;
}
void ue_python_init_fsoft_skin_vertex(PyObject *ue_module)
{
ue_PyFSoftSkinVertexType.tp_new = PyType_GenericNew;
ue_PyFSoftSkinVertexType.tp_init = (initproc)py_ue_fsoft_skin_vertex_init;
if (PyType_Ready(&ue_PyFSoftSkinVertexType) < 0)
return;
Py_INCREF(&ue_PyFSoftSkinVertexType);
PyModule_AddObject(ue_module, "FSoftSkinVertex", (PyObject *)&ue_PyFSoftSkinVertexType);
}
ue_PyFSoftSkinVertex *py_ue_is_fsoft_skin_vertex(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFSoftSkinVertexType))
return nullptr;
return (ue_PyFSoftSkinVertex *)obj;
}
PyObject *py_ue_new_fsoft_skin_vertex(FSoftSkinVertex ss_vertex)
{
ue_PyFSoftSkinVertex *ret = (ue_PyFSoftSkinVertex *)PyObject_New(ue_PyFSoftSkinVertex, &ue_PyFSoftSkinVertexType);
new(&ret->ss_vertex) FSoftSkinVertex(ss_vertex);
return (PyObject *)ret;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFSoftSkinVertex.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,470 |
```c++
#include "UEPyFLinearColor.h"
static PyObject *py_ue_flinearcolor_to_fcolor(ue_PyFLinearColor *self, PyObject * args)
{
PyObject *py_srgb = nullptr;
if (!PyArg_ParseTuple(args, "|O:to_fcolor", &py_srgb))
return NULL;
bool b_srgb = false;
if (py_srgb && PyObject_IsTrue(py_srgb))
b_srgb = true;
return py_ue_new_fcolor(self->color.ToFColor(b_srgb));
}
static PyMethodDef ue_PyFLinearColor_methods[] = {
{ "to_fcolor", (PyCFunction)py_ue_flinearcolor_to_fcolor, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_flinearcolor_get_r(ue_PyFLinearColor *self, void *closure)
{
return PyFloat_FromDouble(self->color.R);
}
static int py_ue_flinearcolor_set_r(ue_PyFLinearColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Float(value);
self->color.R = PyFloat_AsDouble(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_flinearcolor_get_g(ue_PyFLinearColor *self, void *closure)
{
return PyFloat_FromDouble(self->color.G);
}
static int py_ue_flinearcolor_set_g(ue_PyFLinearColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Float(value);
self->color.G = PyFloat_AsDouble(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_flinearcolor_get_b(ue_PyFLinearColor *self, void *closure)
{
return PyFloat_FromDouble(self->color.B);
}
static int py_ue_flinearcolor_set_b(ue_PyFLinearColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Float(value);
self->color.B = PyFloat_AsDouble(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_flinearcolor_get_a(ue_PyFLinearColor *self, void *closure)
{
return PyFloat_FromDouble(self->color.A);
}
static int py_ue_flinearcolor_set_a(ue_PyFLinearColor *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Float(value);
self->color.A = PyFloat_AsDouble(l_value);
Py_DECREF(l_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyGetSetDef ue_PyFLinearColor_getseters[] = {
{ (char*)"r", (getter)py_ue_flinearcolor_get_r, (setter)py_ue_flinearcolor_set_r, (char *)"", NULL },
{ (char *)"g", (getter)py_ue_flinearcolor_get_g, (setter)py_ue_flinearcolor_set_g, (char *)"", NULL },
{ (char *)"b", (getter)py_ue_flinearcolor_get_b, (setter)py_ue_flinearcolor_set_b, (char *)"", NULL },
{ (char *)"a", (getter)py_ue_flinearcolor_get_a, (setter)py_ue_flinearcolor_set_a, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFLinearColor_str(ue_PyFLinearColor *self)
{
return PyUnicode_FromFormat("<unreal_engine.FLinearColor {'r': %S, 'g': %S, 'b': %S, 'a': %S}>",
PyFloat_FromDouble(self->color.R),
PyFloat_FromDouble(self->color.G),
PyFloat_FromDouble(self->color.B),
PyFloat_FromDouble(self->color.A));
}
PyTypeObject ue_PyFLinearColorType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FLinearColor", /* tp_name */
sizeof(ue_PyFLinearColor), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFLinearColor_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FLinearColor", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFLinearColor_methods, /* tp_methods */
0,
ue_PyFLinearColor_getseters,
};
static PyObject *ue_py_flinearcolor_add(ue_PyFLinearColor *self, PyObject *value)
{
FLinearColor color = self->color;
ue_PyFLinearColor *py_color = py_ue_is_flinearcolor(value);
if (py_color)
{
color += py_color->color;
}
else if (PyNumber_Check(value))
{
PyObject *l_value = PyNumber_Float(value);
long l = PyFloat_AsDouble(l_value);
color.R += l;
color.G += l;
color.B += l;
color.A += l;
Py_DECREF(l_value);
}
return py_ue_new_flinearcolor(color);
}
PyNumberMethods ue_PyFLinearColor_number_methods;
static Py_ssize_t ue_py_flinearcolor_seq_length(ue_PyFLinearColor *self)
{
return 4;
}
static PyObject *ue_py_flinearcolor_seq_item(ue_PyFLinearColor *self, Py_ssize_t i)
{
switch (i)
{
case 0:
return PyFloat_FromDouble(self->color.R);
case 1:
return PyFloat_FromDouble(self->color.G);
case 2:
return PyFloat_FromDouble(self->color.B);
case 3:
return PyFloat_FromDouble(self->color.A);
}
return PyErr_Format(PyExc_IndexError, "FLinearColor has only 4 items");
}
PySequenceMethods ue_PyFLinearColor_sequence_methods;
static int ue_py_flinearcolor_init(ue_PyFLinearColor *self, PyObject *args, PyObject *kwargs)
{
float r = 0;
float g = 0;
float b = 0;
float a = 1.0;
if (!PyArg_ParseTuple(args, "|ffff", &r, &g, &b, &a))
return -1;
if (PyTuple_Size(args) == 1)
{
g = a;
b = a;
}
self->color.R = r;
self->color.G = g;
self->color.B = b;
self->color.A = a;
return 0;
}
static void flinearcolor_add_color(const char *color_name, FLinearColor lcolor)
{
PyObject *color = py_ue_new_flinearcolor(lcolor);
// not required
Py_INCREF(color);
PyDict_SetItemString(ue_PyFLinearColorType.tp_dict, color_name, color);
}
void ue_python_init_flinearcolor(PyObject *ue_module)
{
ue_PyFLinearColorType.tp_new = PyType_GenericNew;
ue_PyFLinearColorType.tp_init = (initproc)ue_py_flinearcolor_init;
memset(&ue_PyFLinearColor_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFLinearColorType.tp_as_number = &ue_PyFLinearColor_number_methods;
ue_PyFLinearColor_number_methods.nb_add = (binaryfunc)ue_py_flinearcolor_add;
memset(&ue_PyFLinearColor_sequence_methods, 0, sizeof(PySequenceMethods));
ue_PyFLinearColorType.tp_as_sequence = &ue_PyFLinearColor_sequence_methods;
ue_PyFLinearColor_sequence_methods.sq_length = (lenfunc)ue_py_flinearcolor_seq_length;
ue_PyFLinearColor_sequence_methods.sq_item = (ssizeargfunc)ue_py_flinearcolor_seq_item;
if (PyType_Ready(&ue_PyFLinearColorType) < 0)
return;
Py_INCREF(&ue_PyFLinearColorType);
PyModule_AddObject(ue_module, "FLinearColor", (PyObject *)&ue_PyFLinearColorType);
flinearcolor_add_color("Black", FLinearColor::Black);
flinearcolor_add_color("Blue", FLinearColor::Blue);
flinearcolor_add_color("Gray", FLinearColor::Gray);
flinearcolor_add_color("Green", FLinearColor::Green);
flinearcolor_add_color("Red", FLinearColor::Red);
flinearcolor_add_color("White", FLinearColor::White);
flinearcolor_add_color("Yellow", FLinearColor::Yellow);
}
PyObject *py_ue_new_flinearcolor(FLinearColor color)
{
ue_PyFLinearColor *ret = (ue_PyFLinearColor *)PyObject_New(ue_PyFLinearColor, &ue_PyFLinearColorType);
ret->color = color;
return (PyObject *)ret;
}
ue_PyFLinearColor *py_ue_is_flinearcolor(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFLinearColorType))
return nullptr;
return (ue_PyFLinearColor *)obj;
}
bool py_ue_get_flinearcolor(PyObject *obj, FLinearColor &color)
{
if (ue_PyFLinearColor *py_flinearcolor = py_ue_is_flinearcolor(obj))
{
color = py_flinearcolor->color;
return true;
}
if (ue_PyFColor *py_fcolor = py_ue_is_fcolor(obj))
{
color = py_fcolor->color;
return true;
}
return false;
}
bool py_ue_color_arg(PyObject *args, FLinearColor &color)
{
if (PyTuple_Size(args) == 1)
{
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFLinearColor *py_color = py_ue_is_flinearcolor(arg);
if (!py_color)
{
PyErr_Format(PyExc_TypeError, "argument is not a FLinearColor");
return false;
}
color = py_color->color;
return true;
}
float r = 0;
float g = 0;
float b = 0;
float a = 1;
if (!PyArg_ParseTuple(args, "fff|f", &r, &g, &b, &a))
return false;
color.R = r;
color.G = g;
color.B = b;
color.A = a;
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFLinearColor.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,546 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FVector2D vec;
} ue_PyFVector2D;
extern PyTypeObject ue_PyFVector2DType;
PyObject *py_ue_new_fvector2d(FVector2D);
ue_PyFVector2D *py_ue_is_fvector2d(PyObject *);
void ue_python_init_fvector2d(PyObject *);
bool py_ue_vector2d_arg(PyObject *, FVector2D &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFVector2D.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 112 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#include "Runtime/Core/Public/Misc/ObjectThumbnail.h"
struct ue_PyFObjectThumbnail {
PyObject_HEAD
/* Type-specific fields go here. */
FObjectThumbnail object_thumbnail;
};
void ue_python_init_fobject_thumbnail(PyObject *);
PyObject *py_ue_new_fobject_thumbnail(FObjectThumbnail);
ue_PyFObjectThumbnail *py_ue_is_fobject_thumbnail(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFObjectThumbnail.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 87 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#if WITH_EDITOR
#include "Editor/UnrealEd/Public/Toolkits/AssetEditorManager.h"
struct ue_PyIAssetEditorInstance
{
PyObject_HEAD
/* Type-specific fields go here. */
IAssetEditorInstance *editor_instance;
};
void ue_python_init_iasset_editor_instance(PyObject *);
PyObject *py_ue_new_iasset_editor_instance(IAssetEditorInstance *);
ue_PyIAssetEditorInstance *py_ue_is_iasset_editor_instance(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyIAssetEditorInstance.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 107 |
```c++
#include "UEPyFVector2D.h"
static PyObject *py_ue_fvector2d_length(ue_PyFVector2D *self, PyObject * args)
{
return PyFloat_FromDouble(self->vec.Size());
}
static PyObject *py_ue_fvector2d_length_squared(ue_PyFVector2D *self, PyObject * args)
{
return PyFloat_FromDouble(self->vec.SizeSquared());
}
static PyObject *py_ue_fvector2d_normalized(ue_PyFVector2D *self, PyObject * args)
{
FVector2D vec = self->vec;
vec.Normalize();
return py_ue_new_fvector2d(vec);
}
static PyObject *py_ue_fvector2d_dot(ue_PyFVector2D *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:dot", &py_obj))
return NULL;
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector2D");
return PyFloat_FromDouble(FVector2D::DotProduct(self->vec, py_vec->vec));
}
static PyObject *py_ue_fvector2d_cross(ue_PyFVector2D *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:cross", &py_obj))
return NULL;
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector2D");
return PyFloat_FromDouble(FVector2D::CrossProduct(self->vec, py_vec->vec));
}
static PyMethodDef ue_PyFVector2D_methods[] = {
{ "length", (PyCFunction)py_ue_fvector2d_length, METH_VARARGS, "" },
{ "size", (PyCFunction)py_ue_fvector2d_length, METH_VARARGS, "" },
{ "size_squared", (PyCFunction)py_ue_fvector2d_length_squared, METH_VARARGS, "" },
{ "length_squared", (PyCFunction)py_ue_fvector2d_length_squared, METH_VARARGS, "" },
{ "normalized", (PyCFunction)py_ue_fvector2d_normalized, METH_VARARGS, "" },
{ "dot", (PyCFunction)py_ue_fvector2d_dot, METH_VARARGS, "" },
{ "cross", (PyCFunction)py_ue_fvector2d_cross, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fvector2d_get_x(ue_PyFVector2D *self, void *closure)
{
return PyFloat_FromDouble(self->vec.X);
}
static int py_ue_fvector2d_set_x(ue_PyFVector2D *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->vec.X = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fvector2d_get_y(ue_PyFVector2D *self, void *closure)
{
return PyFloat_FromDouble(self->vec.Y);
}
static int py_ue_fvector2d_set_y(ue_PyFVector2D *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->vec.Y = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyGetSetDef ue_PyFVector2D_getseters[] = {
{(char *) "x", (getter)py_ue_fvector2d_get_x, (setter)py_ue_fvector2d_set_x, (char *)"", NULL },
{(char *) "y", (getter)py_ue_fvector2d_get_y, (setter)py_ue_fvector2d_set_y, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFVector2D_str(ue_PyFVector2D *self)
{
return PyUnicode_FromFormat("<unreal_engine.FVector2D {'x': %S, 'y': %S}>",
PyFloat_FromDouble(self->vec.X), PyFloat_FromDouble(self->vec.Y));
}
PyTypeObject ue_PyFVector2DType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FVector2D", /* tp_name */
sizeof(ue_PyFVector2D), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFVector2D_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FVector2D", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFVector2D_methods, /* tp_methods */
0,
ue_PyFVector2D_getseters,
};
static PyObject *ue_py_fvector2d_add(ue_PyFVector2D *self, PyObject *value)
{
FVector2D vec = self->vec;
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(value);
if (py_vec)
{
vec += py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
vec.X += f;
vec.Y += f;
Py_DECREF(f_value);
}
return py_ue_new_fvector2d(vec);
}
static PyObject *ue_py_fvector2d_sub(ue_PyFVector2D *self, PyObject *value)
{
FVector2D vec = self->vec;
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(value);
if (py_vec)
{
vec -= py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
vec.X -= f;
vec.Y -= f;
Py_DECREF(f_value);
}
return py_ue_new_fvector2d(vec);
}
static PyObject *ue_py_fvector2d_mul(ue_PyFVector2D *self, PyObject *value)
{
FVector2D vec = self->vec;
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(value);
if (py_vec)
{
vec *= py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
vec *= f;
Py_DECREF(f_value);
}
return py_ue_new_fvector2d(vec);
}
static PyObject *ue_py_fvector2d_div(ue_PyFVector2D *self, PyObject *value)
{
FVector2D vec = self->vec;
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(value);
if (py_vec)
{
if (py_vec->vec.X == 0 || py_vec->vec.Y == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
vec /= py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
if (f == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
vec /= f;
Py_DECREF(f_value);
}
return py_ue_new_fvector2d(vec);
}
static PyObject *ue_py_fvector2d_floor_div(ue_PyFVector2D *self, PyObject *value)
{
FVector2D vec = self->vec;
if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
if (f == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
vec.X = floor(vec.X / f);
vec.Y = floor(vec.Y / f);
Py_DECREF(f_value);
return py_ue_new_fvector2d(vec);
}
return PyErr_Format(PyExc_TypeError, "value is not numeric");
}
PyNumberMethods ue_PyFVector2D_number_methods;
static Py_ssize_t ue_py_fvector2d_seq_length(ue_PyFVector2D *self)
{
return 2;
}
static PyObject *ue_py_fvector2d_seq_item(ue_PyFVector2D *self, Py_ssize_t i)
{
switch (i)
{
case 0:
return PyFloat_FromDouble(self->vec.X);
case 1:
return PyFloat_FromDouble(self->vec.Y);
}
return PyErr_Format(PyExc_IndexError, "FVector2D has only 2 items");
}
PySequenceMethods ue_PyFVector2D_sequence_methods;
static int ue_py_fvector2d_init(ue_PyFVector2D *self, PyObject *args, PyObject *kwargs)
{
float x = 0, y = 0;
if (!PyArg_ParseTuple(args, "|ff", &x, &y))
return -1;
if (PyTuple_Size(args) == 1)
{
y = x;
}
self->vec.X = x;
self->vec.Y = y;
return 0;
}
static PyObject *ue_py_fvector2d_richcompare(ue_PyFVector2D *vec1, PyObject *b, int op)
{
ue_PyFVector2D *vec2 = py_ue_is_fvector2d(b);
if (!vec2 || (op != Py_EQ && op != Py_NE))
{
return PyErr_Format(PyExc_NotImplementedError, "can only compare with another FVector2D");
}
if (op == Py_EQ)
{
if (vec1->vec.X == vec2->vec.X &&
vec1->vec.Y == vec2->vec.Y)
{
Py_INCREF(Py_True);
return Py_True;
}
Py_INCREF(Py_False);
return Py_False;
}
if (vec1->vec.X == vec2->vec.X &&
vec1->vec.Y == vec2->vec.Y)
{
Py_INCREF(Py_False);
return Py_False;
}
Py_INCREF(Py_True);
return Py_True;
}
void ue_python_init_fvector2d(PyObject *ue_module)
{
ue_PyFVector2DType.tp_new = PyType_GenericNew;
ue_PyFVector2DType.tp_init = (initproc)ue_py_fvector2d_init;
ue_PyFVector2DType.tp_richcompare = (richcmpfunc)ue_py_fvector2d_richcompare;
memset(&ue_PyFVector2D_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFVector2DType.tp_as_number = &ue_PyFVector2D_number_methods;
ue_PyFVector2D_number_methods.nb_add = (binaryfunc)ue_py_fvector2d_add;
ue_PyFVector2D_number_methods.nb_subtract = (binaryfunc)ue_py_fvector2d_sub;
ue_PyFVector2D_number_methods.nb_multiply = (binaryfunc)ue_py_fvector2d_mul;
ue_PyFVector2D_number_methods.nb_true_divide = (binaryfunc)ue_py_fvector2d_div;
ue_PyFVector2D_number_methods.nb_floor_divide = (binaryfunc)ue_py_fvector2d_floor_div;
memset(&ue_PyFVector2D_sequence_methods, 0, sizeof(PySequenceMethods));
ue_PyFVector2DType.tp_as_sequence = &ue_PyFVector2D_sequence_methods;
ue_PyFVector2D_sequence_methods.sq_length = (lenfunc)ue_py_fvector2d_seq_length;
ue_PyFVector2D_sequence_methods.sq_item = (ssizeargfunc)ue_py_fvector2d_seq_item;
if (PyType_Ready(&ue_PyFVector2DType) < 0)
return;
Py_INCREF(&ue_PyFVector2DType);
PyModule_AddObject(ue_module, "FVector2D", (PyObject *)&ue_PyFVector2DType);
}
PyObject *py_ue_new_fvector2d(FVector2D vec)
{
ue_PyFVector2D *ret = (ue_PyFVector2D *)PyObject_New(ue_PyFVector2D, &ue_PyFVector2DType);
ret->vec = vec;
return (PyObject *)ret;
}
ue_PyFVector2D *py_ue_is_fvector2d(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFVector2DType))
return nullptr;
return (ue_PyFVector2D *)obj;
}
bool py_ue_vector2d_arg(PyObject *args, FVector2D &vec)
{
if (PyTuple_Size(args) == 1)
{
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFVector2D *py_vec = py_ue_is_fvector2d(arg);
if (!py_vec)
{
PyErr_Format(PyExc_TypeError, "argument is not a FVector2D");
return false;
}
vec = py_vec->vec;
return true;
}
float x, y;
if (!PyArg_ParseTuple(args, "ff", &x, &y))
return false;
vec.X = x;
vec.Y = y;
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFVector2D.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,262 |
```c++
#include "UEPyFSocket.h"
static PyObject *py_ue_fsocket_start_receiver(ue_PyFSocket *self, PyObject * args)
{
if (self->udp_receiver)
{
return PyErr_Format(PyExc_Exception, "receiver already started");
}
self->udp_receiver = new FUdpSocketReceiver(self->sock, FTimespan::FromMilliseconds(100), *FString::Printf(TEXT("%s Thread"), *self->sock->GetDescription()));
self->udp_receiver->OnDataReceived().BindRaw(self, &ue_PyFSocket::udp_recv);
self->udp_receiver->Start();
Py_INCREF(Py_None);
return Py_None;
}
static void sock_close(ue_PyFSocket *self)
{
if (self->sock)
{
self->sock->Close();
ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(self->sock);
self->sock = nullptr;
}
}
static void sock_stop_receiver(ue_PyFSocket *self)
{
if (self->udp_receiver)
{
self->udp_receiver->Stop();
delete(self->udp_receiver);
self->udp_receiver = nullptr;
}
}
static PyObject *py_ue_fsocket_stop_receiver(ue_PyFSocket *self, PyObject * args)
{
if (!self->udp_receiver)
{
return PyErr_Format(PyExc_Exception, "receiver not started");
}
sock_stop_receiver(self);
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *py_ue_fsocket_close(ue_PyFSocket *self, PyObject * args)
{
if (self->udp_receiver)
{
return PyErr_Format(PyExc_Exception, "you have to stop its receiver before closing a socket");
}
sock_close(self);
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef ue_PyFSocket_methods[] = {
{ "start_receiver", (PyCFunction)py_ue_fsocket_start_receiver, METH_VARARGS, "" },
{ "stop_receiver", (PyCFunction)py_ue_fsocket_stop_receiver, METH_VARARGS, "" },
{ "close", (PyCFunction)py_ue_fsocket_close, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFSocket_str(ue_PyFSocket *self)
{
return PyUnicode_FromFormat("<unreal_engine.FSocket '%s'>",
TCHAR_TO_UTF8(*self->sock->GetDescription()));
}
static void ue_py_fsocket_dealloc(ue_PyFSocket *self)
{
sock_stop_receiver(self);
sock_close(self);
}
static PyTypeObject ue_PyFSocketType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FSocket", /* tp_name */
sizeof(ue_PyFSocket), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)ue_py_fsocket_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFSocket_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FSocket", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFSocket_methods, /* tp_methods */
0,
0,
};
static int ue_py_fsocket_init(ue_PyFSocket *self, PyObject *args, PyObject *kwargs)
{
char *socket_desc;
char *socket_addr;
int port_number;
int buffer_size = 1024;
if (!PyArg_ParseTuple(args, "ssi|i", &socket_desc, &socket_addr, &port_number, &buffer_size))
return -1;
FIPv4Address addr;
FIPv4Address::Parse(socket_addr, addr);
FIPv4Endpoint endpoint(addr, port_number);
self->sock = FUdpSocketBuilder(UTF8_TO_TCHAR(socket_desc)).AsNonBlocking().AsReusable().BoundToEndpoint(endpoint).WithReceiveBufferSize(buffer_size);
return 0;
}
void ue_python_init_fsocket(PyObject *ue_module)
{
ue_PyFSocketType.tp_new = PyType_GenericNew;
ue_PyFSocketType.tp_init = (initproc)ue_py_fsocket_init;
if (PyType_Ready(&ue_PyFSocketType) < 0)
return;
Py_INCREF(&ue_PyFSocketType);
PyModule_AddObject(ue_module, "FSocket", (PyObject *)&ue_PyFSocketType);
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFSocket.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,093 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#if WITH_EDITOR
#include "InstancedFoliage.h"
typedef struct
{
PyObject_HEAD
TWeakObjectPtr<AInstancedFoliageActor> foliage_actor;
TWeakObjectPtr<UFoliageType> foliage_type;
int32 instance_id;
} ue_PyFFoliageInstance;
void ue_python_init_ffoliage_instance(PyObject *);
PyObject *py_ue_new_ffoliage_instance(AInstancedFoliageActor *foliage_actor, UFoliageType *foliage_type, int32 instance_id);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 122 |
```objective-c
#pragma once
#include "UEPyModule.h"
#if WITH_EDITOR
#if ENGINE_MINOR_VERSION > 13
#include "Developer/RawMesh/Public/RawMesh.h"
struct ue_PyFRawMesh
{
PyObject_HEAD
/* Type-specific fields go here. */
FRawMesh raw_mesh;
};
void ue_python_init_fraw_mesh(PyObject *);
PyObject *py_ue_new_fraw_mesh(FRawMesh);
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRawMesh.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 92 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#include "UEPyFVector.h"
#include "UEPyFQuat.h"
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
FRotator rot;
} ue_PyFRotator;
extern PyTypeObject ue_PyFRotatorType;
PyObject *py_ue_new_frotator(FRotator);
ue_PyFRotator *py_ue_is_frotator(PyObject *);
void ue_python_init_frotator(PyObject *);
bool py_ue_rotator_arg(PyObject *, FRotator &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRotator.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 119 |
```c++
#include "UEPyFRawMesh.h"
#if WITH_EDITOR
#if ENGINE_MINOR_VERSION > 13
#include "Engine/StaticMesh.h"
static PyObject *py_ue_fraw_mesh_set_vertex_positions(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_vertex_positions", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<FVector> vertex;
for (;;)
{
PyObject *item_x = PyIter_Next(iter);
if (!item_x)
break;
if (ue_PyFVector *py_fvector = py_ue_is_fvector(item_x))
{
vertex.Add(py_fvector->vec);
}
else
{
if (!PyNumber_Check(item_x))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_x = PyNumber_Float(item_x);
float x = PyFloat_AsDouble(py_x);
Py_DECREF(py_x);
PyObject *item_y = PyIter_Next(iter);
if (!item_y)
break;
if (!PyNumber_Check(item_y))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_y = PyNumber_Float(item_y);
float y = PyFloat_AsDouble(py_y);
Py_DECREF(py_y);
PyObject *item_z = PyIter_Next(iter);
if (!item_z)
break;
if (!PyNumber_Check(item_z))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_z = PyNumber_Float(item_z);
float z = PyFloat_AsDouble(py_z);
Py_DECREF(py_z);
vertex.Add(FVector(x, y, z));
}
}
self->raw_mesh.VertexPositions = vertex;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_set_wedge_tex_coords(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
int index = 0;
if (!PyArg_ParseTuple(args, "O|i:set_wedge_tex_coords", &data, &index))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<FVector2D> uv;
for (;;)
{
PyObject *item_x = PyIter_Next(iter);
if (!item_x)
break;
if (PyTuple_Check(item_x) && PyTuple_Size(item_x) == 2)
{
float x, y;
if (!PyArg_ParseTuple(item_x, "ff", &x, &y))
return nullptr;
uv.Add(FVector2D(x, y));
}
else
{
if (!PyNumber_Check(item_x))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_x = PyNumber_Float(item_x);
float x = PyFloat_AsDouble(py_x);
Py_DECREF(py_x);
PyObject *item_y = PyIter_Next(iter);
if (!item_y)
break;
if (!PyNumber_Check(item_y))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_y = PyNumber_Float(item_y);
float y = PyFloat_AsDouble(py_y);
Py_DECREF(py_y);
uv.Add(FVector2D(x, y));
}
}
self->raw_mesh.WedgeTexCoords[index] = uv;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_set_wedge_indices(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_wedge_indices", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<uint32> indices;
for (;;)
{
PyObject *item = PyIter_Next(iter);
if (!item)
break;
if (!PyNumber_Check(item))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_value = PyNumber_Long(item);
uint32 i = PyLong_AsUnsignedLong(py_value);
Py_DECREF(py_value);
indices.Add(i);
}
self->raw_mesh.WedgeIndices = indices;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_set_face_material_indices(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_face_material_indices", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<int32> indices;
for (;;)
{
PyObject *item = PyIter_Next(iter);
if (!item)
break;
if (!PyNumber_Check(item))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_value = PyNumber_Long(item);
int32 i = PyLong_AsLong(py_value);
Py_DECREF(py_value);
indices.Add(i);
}
self->raw_mesh.FaceMaterialIndices = indices;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_save_to_static_mesh_source_model(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *model;
if (!PyArg_ParseTuple(args, "O:save_to_static_mesh_source_model", &model))
{
return nullptr;
}
FStaticMeshSourceModel *source_model = ue_py_check_struct<FStaticMeshSourceModel>(model);
if (!source_model)
return PyErr_Format(PyExc_Exception, "argument is not a FStaticMeshSourceModel");
if (self->raw_mesh.WedgeIndices.Num() >= 3)
{
// set default sane values (read: 0) to face materials and smoothing groups
if (self->raw_mesh.FaceSmoothingMasks.Num() == 0)
self->raw_mesh.FaceSmoothingMasks.AddZeroed(self->raw_mesh.WedgeIndices.Num() / 3);
if (self->raw_mesh.FaceMaterialIndices.Num() == 0)
self->raw_mesh.FaceMaterialIndices.AddZeroed(self->raw_mesh.WedgeIndices.Num() / 3);
}
if (!self->raw_mesh.IsValidOrFixable())
return PyErr_Format(PyExc_Exception, "FRawMesh is not valid or fixable");
source_model->RawMeshBulkData->SaveRawMesh(self->raw_mesh);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_get_wedge_position(ue_PyFRawMesh *self, PyObject * args)
{
int index;
if (!PyArg_ParseTuple(args, "i:get_wedge_position", &index))
{
return nullptr;
}
if (index > self->raw_mesh.WedgeIndices.Num() - 1 || index < 0)
return PyErr_Format(PyExc_IndexError, "wedge index error");
FVector vec = self->raw_mesh.GetWedgePosition(index);
return py_ue_new_fvector(vec);
}
static PyObject *py_ue_fraw_mesh_set_wedge_tangent_x(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_wedge_tangent_x", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<FVector> vertex;
for (;;)
{
PyObject *item_x = PyIter_Next(iter);
if (!item_x)
break;
if (ue_PyFVector *py_fvector = py_ue_is_fvector(item_x))
{
vertex.Add(py_fvector->vec);
}
else
{
if (!PyNumber_Check(item_x))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_x = PyNumber_Float(item_x);
float x = PyFloat_AsDouble(py_x);
Py_DECREF(py_x);
PyObject *item_y = PyIter_Next(iter);
if (!item_y)
break;
if (!PyNumber_Check(item_y))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_y = PyNumber_Float(item_y);
float y = PyFloat_AsDouble(py_y);
Py_DECREF(py_y);
PyObject *item_z = PyIter_Next(iter);
if (!item_z)
break;
if (!PyNumber_Check(item_z))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_z = PyNumber_Float(item_z);
float z = PyFloat_AsDouble(py_z);
Py_DECREF(py_z);
vertex.Add(FVector(x, y, z));
}
}
self->raw_mesh.WedgeTangentX = vertex;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_set_wedge_tangent_y(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_wedge_tangent_y", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<FVector> vertex;
for (;;)
{
PyObject *item_x = PyIter_Next(iter);
if (!item_x)
break;
if (ue_PyFVector *py_fvector = py_ue_is_fvector(item_x))
{
vertex.Add(py_fvector->vec);
}
else
{
if (!PyNumber_Check(item_x))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_x = PyNumber_Float(item_x);
float x = PyFloat_AsDouble(py_x);
Py_DECREF(py_x);
PyObject *item_y = PyIter_Next(iter);
if (!item_y)
break;
if (!PyNumber_Check(item_y))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_y = PyNumber_Float(item_y);
float y = PyFloat_AsDouble(py_y);
Py_DECREF(py_y);
PyObject *item_z = PyIter_Next(iter);
if (!item_z)
break;
if (!PyNumber_Check(item_z))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_z = PyNumber_Float(item_z);
float z = PyFloat_AsDouble(py_z);
Py_DECREF(py_z);
vertex.Add(FVector(x, y, z));
}
}
self->raw_mesh.WedgeTangentY = vertex;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_set_wedge_tangent_z(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_wedge_tangent_z", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<FVector> vertex;
for (;;)
{
PyObject *item_x = PyIter_Next(iter);
if (!item_x)
break;
if (ue_PyFVector *py_fvector = py_ue_is_fvector(item_x))
{
vertex.Add(py_fvector->vec);
}
else
{
if (!PyNumber_Check(item_x))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_x = PyNumber_Float(item_x);
float x = PyFloat_AsDouble(py_x);
Py_DECREF(py_x);
PyObject *item_y = PyIter_Next(iter);
if (!item_y)
break;
if (!PyNumber_Check(item_y))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_y = PyNumber_Float(item_y);
float y = PyFloat_AsDouble(py_y);
Py_DECREF(py_y);
PyObject *item_z = PyIter_Next(iter);
if (!item_z)
break;
if (!PyNumber_Check(item_z))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_z = PyNumber_Float(item_z);
float z = PyFloat_AsDouble(py_z);
Py_DECREF(py_z);
vertex.Add(FVector(x, y, z));
}
}
self->raw_mesh.WedgeTangentZ = vertex;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_set_wedge_colors(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *data;
if (!PyArg_ParseTuple(args, "O:set_wedge_colors", &data))
{
return nullptr;
}
PyObject *iter = PyObject_GetIter(data);
if (!iter)
return PyErr_Format(PyExc_TypeError, "argument is not an iterable");
TArray<FColor> colors;
for (;;)
{
PyObject *item_x = PyIter_Next(iter);
if (!item_x)
break;
if (ue_PyFColor *py_fcolor = py_ue_is_fcolor(item_x))
{
colors.Add(py_fcolor->color);
}
else
{
if (!PyNumber_Check(item_x))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_x = PyNumber_Long(item_x);
uint8 x = PyLong_AsUnsignedLong(py_x);
Py_DECREF(py_x);
PyObject *item_y = PyIter_Next(iter);
if (!item_y)
break;
if (!PyNumber_Check(item_y))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_y = PyNumber_Long(item_y);
uint8 y = PyLong_AsUnsignedLong(py_y);
Py_DECREF(py_y);
PyObject *item_z = PyIter_Next(iter);
if (!item_z)
break;
if (!PyNumber_Check(item_z))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_z = PyNumber_Long(item_z);
uint8 z = PyLong_AsUnsignedLong(py_z);
Py_DECREF(py_z);
PyObject *item_a = PyIter_Next(iter);
if (!item_a)
break;
if (!PyNumber_Check(item_a))
return PyErr_Format(PyExc_Exception, "argument iterable does not contains only numbers");
PyObject *py_a = PyNumber_Long(item_a);
uint8 a = PyLong_AsUnsignedLong(py_a);
Py_DECREF(py_a);
colors.Add(FColor(x, y, z, a));
}
}
self->raw_mesh.WedgeColors = colors;
Py_DECREF(iter);
Py_RETURN_NONE;
}
static PyObject *py_ue_fraw_mesh_get_vertex_positions(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.VertexPositions.Num(); i++)
{
PyList_Append(py_list, py_ue_new_fvector(self->raw_mesh.VertexPositions[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedge_tangent_x(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.WedgeTangentX.Num(); i++)
{
PyList_Append(py_list, py_ue_new_fvector(self->raw_mesh.WedgeTangentX[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedge_tangent_y(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.WedgeTangentY.Num(); i++)
{
PyList_Append(py_list, py_ue_new_fvector(self->raw_mesh.WedgeTangentY[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedge_tangent_z(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.WedgeTangentZ.Num(); i++)
{
PyList_Append(py_list, py_ue_new_fvector(self->raw_mesh.WedgeTangentZ[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedge_colors(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.WedgeColors.Num(); i++)
{
PyList_Append(py_list, py_ue_new_fcolor(self->raw_mesh.WedgeColors[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedge_indices(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.WedgeIndices.Num(); i++)
{
PyList_Append(py_list, PyLong_FromUnsignedLong(self->raw_mesh.WedgeIndices[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedges_num(ue_PyFRawMesh *self, PyObject * args)
{
return PyLong_FromUnsignedLong(self->raw_mesh.WedgeIndices.Num());
}
static PyObject *py_ue_fraw_mesh_get_face_material_indices(ue_PyFRawMesh *self, PyObject * args)
{
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.FaceMaterialIndices.Num(); i++)
{
PyList_Append(py_list, PyLong_FromUnsignedLong(self->raw_mesh.FaceMaterialIndices[i]));
}
return py_list;
}
static PyObject *py_ue_fraw_mesh_get_wedge_tex_coords(ue_PyFRawMesh *self, PyObject * args)
{
int index = 0;
if (!PyArg_ParseTuple(args, "|i:get_wedge_tex_coords", &index))
return nullptr;
if (index < 0 || index >= MAX_MESH_TEXTURE_COORDS)
return PyErr_Format(PyExc_Exception, "invalid TexCoords index");
PyObject *py_list = PyList_New(0);
for (int32 i = 0; i < self->raw_mesh.WedgeTexCoords[index].Num(); i++)
{
PyList_Append(py_list, Py_BuildValue((char*)"(ff)", self->raw_mesh.WedgeTexCoords[index][i].X, self->raw_mesh.WedgeTexCoords[index][i].Y));
}
return py_list;
}
static PyMethodDef ue_PyFRawMesh_methods[] = {
{ "set_vertex_positions", (PyCFunction)py_ue_fraw_mesh_set_vertex_positions, METH_VARARGS, "" },
{ "set_wedge_indices", (PyCFunction)py_ue_fraw_mesh_set_wedge_indices, METH_VARARGS, "" },
{ "set_face_material_indices", (PyCFunction)py_ue_fraw_mesh_set_face_material_indices, METH_VARARGS, "" },
{ "set_wedge_tex_coords", (PyCFunction)py_ue_fraw_mesh_set_wedge_tex_coords, METH_VARARGS, "" },
{ "set_wedge_tangent_x", (PyCFunction)py_ue_fraw_mesh_set_wedge_tangent_x, METH_VARARGS, "" },
{ "set_wedge_tangent_y", (PyCFunction)py_ue_fraw_mesh_set_wedge_tangent_y, METH_VARARGS, "" },
{ "set_wedge_tangent_z", (PyCFunction)py_ue_fraw_mesh_set_wedge_tangent_z, METH_VARARGS, "" },
{ "set_wedge_colors", (PyCFunction)py_ue_fraw_mesh_set_wedge_colors, METH_VARARGS, "" },
{ "get_wedge_position", (PyCFunction)py_ue_fraw_mesh_get_wedge_position, METH_VARARGS, "" },
{ "get_vertex_positions", (PyCFunction)py_ue_fraw_mesh_get_vertex_positions, METH_VARARGS, "" },
{ "get_wedge_indices", (PyCFunction)py_ue_fraw_mesh_get_wedge_indices, METH_VARARGS, "" },
{ "get_wedge_tex_coords", (PyCFunction)py_ue_fraw_mesh_get_wedge_tex_coords, METH_VARARGS, "" },
{ "get_wedge_tangent_x", (PyCFunction)py_ue_fraw_mesh_get_wedge_tangent_x, METH_VARARGS, "" },
{ "get_wedge_tangent_y", (PyCFunction)py_ue_fraw_mesh_get_wedge_tangent_y, METH_VARARGS, "" },
{ "get_wedge_tangent_z", (PyCFunction)py_ue_fraw_mesh_get_wedge_tangent_z, METH_VARARGS, "" },
{ "get_wedge_colors", (PyCFunction)py_ue_fraw_mesh_get_wedge_colors, METH_VARARGS, "" },
{ "get_face_material_indices", (PyCFunction)py_ue_fraw_mesh_get_face_material_indices, METH_VARARGS, "" },
{ "save_to_static_mesh_source_model", (PyCFunction)py_ue_fraw_mesh_save_to_static_mesh_source_model, METH_VARARGS, "" },
{ "get_wedges_num", (PyCFunction)py_ue_fraw_mesh_get_wedges_num, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static int ue_py_fraw_mesh_init(ue_PyFRawMesh *self, PyObject *args, PyObject *kwargs)
{
new(&self->raw_mesh) FRawMesh();
return 0;
}
static PyTypeObject ue_PyFRawMeshType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FRawMesh", /* tp_name */
sizeof(ue_PyFRawMesh), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FRawMesh", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFRawMesh_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
};
PyObject *py_ue_new_fraw_mesh(FRawMesh raw_mesh)
{
ue_PyFRawMesh *ret = (ue_PyFRawMesh *)PyObject_New(ue_PyFRawMesh, &ue_PyFRawMeshType);
new(&ret->raw_mesh) FRawMesh(raw_mesh);
return (PyObject *)ret;
}
void ue_python_init_fraw_mesh(PyObject *ue_module)
{
ue_PyFRawMeshType.tp_new = PyType_GenericNew;;
ue_PyFRawMeshType.tp_init = (initproc)ue_py_fraw_mesh_init;
if (PyType_Ready(&ue_PyFRawMeshType) < 0)
return;
Py_INCREF(&ue_PyFRawMeshType);
PyModule_AddObject(ue_module, "FRawMesh", (PyObject *)&ue_PyFRawMeshType);
}
#endif
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRawMesh.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 5,374 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#if ENGINE_MINOR_VERSION >= 20
#include "Runtime/Core/Public/Misc/FrameNumber.h"
struct ue_PyFFrameNumber {
PyObject_HEAD
/* Type-specific fields go here. */
FFrameNumber frame_number;
};
void ue_python_init_fframe_number(PyObject *);
PyObject *py_ue_new_fframe_number(FFrameNumber);
ue_PyFFrameNumber *py_ue_is_fframe_number(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFFrameNumber.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 100 |
```c++
#include "UEPyFEditorViewportClient.h"
#if WITH_EDITOR
static PyObject *py_ue_feditor_viewport_client_take_high_res_screen_shot(ue_PyFEditorViewportClient *self, PyObject * args)
{
self->editor_viewport_client->TakeHighResScreenShot();
self->editor_viewport_client->Invalidate();
if (self->editor_viewport_client->Viewport)
{
FIntPoint point = self->editor_viewport_client->Viewport->GetSizeXY();
if (point.X > 0 && point.Y > 0)
{
self->editor_viewport_client->Viewport->Draw();
}
}
Py_RETURN_NONE;
}
static PyObject *py_ue_feditor_viewport_client_tick(ue_PyFEditorViewportClient *self, PyObject * args)
{
float delta_seconds = 0;
if (!PyArg_ParseTuple(args, "|f:tick", &delta_seconds))
return nullptr;
self->editor_viewport_client->Tick(delta_seconds);
Py_RETURN_NONE;
}
static PyObject *py_ue_feditor_viewport_client_get_look_at_location(ue_PyFEditorViewportClient *self, PyObject * args)
{
return py_ue_new_fvector(self->editor_viewport_client->GetLookAtLocation());
}
static PyObject *py_ue_feditor_viewport_client_get_view_location(ue_PyFEditorViewportClient *self, PyObject * args)
{
return py_ue_new_fvector(self->editor_viewport_client->GetViewLocation());
}
static PyObject *py_ue_feditor_viewport_client_get_view_rotation(ue_PyFEditorViewportClient *self, PyObject * args)
{
return py_ue_new_frotator(self->editor_viewport_client->GetViewRotation());
}
static PyObject *py_ue_feditor_viewport_client_get_camera_speed(ue_PyFEditorViewportClient *self, PyObject * args)
{
return PyFloat_FromDouble(self->editor_viewport_client->GetCameraSpeed());
}
static PyObject *py_ue_feditor_viewport_client_get_viewport_dimensions(ue_PyFEditorViewportClient *self, PyObject * args)
{
FIntPoint origin;
FIntPoint size;
self->editor_viewport_client->GetViewportDimensions(origin, size);
return Py_BuildValue((char *)"(ii)(ii)", origin.X, origin.Y, size.X, size.Y);
}
static PyObject *py_ue_feditor_viewport_client_is_visible(ue_PyFEditorViewportClient *self, PyObject * args)
{
if (self->editor_viewport_client->IsVisible())
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject *py_ue_feditor_viewport_client_get_scene_depth_at_location(ue_PyFEditorViewportClient *self, PyObject * args)
{
int x;
int y;
if (!PyArg_ParseTuple(args, "ii:get_scene_depth_at_location", &x, &y))
return nullptr;
return PyFloat_FromDouble(self->editor_viewport_client->GetSceneDepthAtLocation(x, y));
}
static PyObject *py_ue_feditor_viewport_client_set_look_at_location(ue_PyFEditorViewportClient *self, PyObject * args)
{
FVector vec;
if (!py_ue_vector_arg(args, vec))
return PyErr_Format(PyExc_Exception, "argument is not a FVector");
self->editor_viewport_client->SetLookAtLocation(vec);
Py_RETURN_NONE;
}
static PyObject *py_ue_feditor_viewport_client_set_view_location(ue_PyFEditorViewportClient *self, PyObject * args)
{
FVector vec;
if (!py_ue_vector_arg(args, vec))
return PyErr_Format(PyExc_Exception, "argument is not a FVector");
self->editor_viewport_client->SetViewLocation(vec);
Py_RETURN_NONE;
}
static PyObject *py_ue_feditor_viewport_client_set_view_rotation(ue_PyFEditorViewportClient *self, PyObject * args)
{
FRotator rot;
if (!py_ue_rotator_arg(args, rot))
return PyErr_Format(PyExc_Exception, "argument is not a FRotator");
self->editor_viewport_client->SetViewRotation(rot);
Py_RETURN_NONE;
}
static PyObject *py_ue_feditor_viewport_client_set_realtime(ue_PyFEditorViewportClient *self, PyObject * args)
{
PyObject* bInRealtime;
PyObject* bStoreCurrentValue;
if (!PyArg_ParseTuple(args, "OO", &bInRealtime, &bStoreCurrentValue))
return nullptr;
self->editor_viewport_client->SetRealtime(PyObject_IsTrue(bInRealtime) ? true : false,
PyObject_IsTrue(bStoreCurrentValue) ? true : false);
Py_RETURN_NONE;
}
static PyMethodDef ue_PyFEditorViewportClient_methods[] = {
{ "take_high_res_screen_shot", (PyCFunction)py_ue_feditor_viewport_client_take_high_res_screen_shot, METH_VARARGS, "" },
{ "tick", (PyCFunction)py_ue_feditor_viewport_client_tick, METH_VARARGS, "" },
{ "get_look_at_location", (PyCFunction)py_ue_feditor_viewport_client_get_look_at_location, METH_VARARGS, "" },
{ "get_view_location", (PyCFunction)py_ue_feditor_viewport_client_get_view_location, METH_VARARGS, "" },
{ "get_view_rotation", (PyCFunction)py_ue_feditor_viewport_client_get_view_location, METH_VARARGS, "" },
{ "get_camera_speed", (PyCFunction)py_ue_feditor_viewport_client_get_camera_speed, METH_VARARGS, "" },
{ "get_viewport_dimensions", (PyCFunction)py_ue_feditor_viewport_client_get_viewport_dimensions, METH_VARARGS, "" },
{ "is_visible", (PyCFunction)py_ue_feditor_viewport_client_is_visible, METH_VARARGS, "" },
{ "get_scene_depth_at_location", (PyCFunction)py_ue_feditor_viewport_client_get_scene_depth_at_location, METH_VARARGS, "" },
{ "set_look_at_location", (PyCFunction)py_ue_feditor_viewport_client_set_look_at_location, METH_VARARGS, "" },
{ "set_view_location", (PyCFunction)py_ue_feditor_viewport_client_set_view_location, METH_VARARGS, "" },
{ "set_view_rotation", (PyCFunction)py_ue_feditor_viewport_client_set_view_rotation, METH_VARARGS, "" },
{ "set_realtime", (PyCFunction)py_ue_feditor_viewport_client_set_realtime, METH_VARARGS, "" },
{ nullptr } /* Sentinel */
};
static PyObject *ue_PyFEditorViewportClient_str(ue_PyFEditorViewportClient *self)
{
return PyUnicode_FromFormat("<unreal_engine.FEditorViewportClient %p>",
&self->editor_viewport_client.Get());
}
static PyTypeObject ue_PyFEditorViewportClientType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FEditorViewportClient", /* tp_name */
sizeof(ue_PyFEditorViewportClient), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFEditorViewportClient_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#endif
"Unreal Engine FEditorViewportClient", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFEditorViewportClient_methods, /* tp_methods */
0,
};
void ue_python_init_feditor_viewport_client(PyObject *ue_module)
{
ue_PyFEditorViewportClientType.tp_new = PyType_GenericNew;
ue_PyFEditorViewportClientType.tp_base = &ue_PyFViewportClientType;
if (PyType_Ready(&ue_PyFEditorViewportClientType) < 0)
return;
Py_INCREF(&ue_PyFEditorViewportClientType);
PyModule_AddObject(ue_module, "FEditorViewportClient", (PyObject *)&ue_PyFEditorViewportClientType);
}
ue_PyFEditorViewportClient *py_ue_is_feditor_viewport_client(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFEditorViewportClientType))
return nullptr;
return (ue_PyFEditorViewportClient *)obj;
}
PyObject *py_ue_new_feditor_viewport_client(TSharedRef<FEditorViewportClient> editor_viewport_client)
{
ue_PyFEditorViewportClient *ret = (ue_PyFEditorViewportClient *)PyObject_New(ue_PyFEditorViewportClient, &ue_PyFEditorViewportClientType);
new(&ret->viewport_client.viewport_client) TSharedRef<FViewportClient>(editor_viewport_client);
new(&ret->editor_viewport_client) TSharedRef<FEditorViewportClient>(editor_viewport_client);
return (PyObject *)ret;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFEditorViewportClient.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,050 |
```c++
#include "UEPyFARFilter.h"
#if WITH_EDITOR
static PyObject *py_ue_farfilter_append(ue_PyFARFilter *self, PyObject * args)
{
PyObject *pyfilter = nullptr;
py_ue_sync_farfilter((PyObject *)self);
if (!PyArg_ParseTuple(args, "|O:append", &pyfilter))
return NULL;
ue_PyFARFilter *filter = py_ue_is_farfilter(pyfilter);
self->filter.Append(filter->filter);
Py_RETURN_NONE;
}
static PyObject *py_ue_farfilter_clear(ue_PyFARFilter *self)
{
py_ue_clear_farfilter(self);
self->filter.Clear();
Py_RETURN_NONE;
}
static PyObject *py_ue_farfilter_is_empty(ue_PyFARFilter *self, PyObject * args)
{
py_ue_sync_farfilter((PyObject *)self);
if (self->filter.IsEmpty())
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyMethodDef ue_PyFARFilter_methods[] = {
{ "append", (PyCFunction)py_ue_farfilter_append, METH_VARARGS, "" },
{ "clear", (PyCFunction)py_ue_farfilter_clear, METH_VARARGS, "" },
{ "is_empty", (PyCFunction)py_ue_farfilter_is_empty, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_farfilter_get_include_only_on_disk_assets(ue_PyFARFilter *self, void *closure)
{
if (self->filter.bIncludeOnlyOnDiskAssets)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static int py_ue_farfilter_set_include_only_on_disk_assets(ue_PyFARFilter *self, PyObject *value, void *closure)
{
if (value && PyBool_Check(value))
{
if (PyObject_IsTrue(value))
self->filter.bIncludeOnlyOnDiskAssets = true;
else
self->filter.bIncludeOnlyOnDiskAssets = false;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a bool");
return -1;
}
static PyObject *py_ue_farfilter_get_recursive_classes(ue_PyFARFilter *self, void *closure)
{
if (self->filter.bRecursiveClasses)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static int py_ue_farfilter_set_recursive_classes(ue_PyFARFilter *self, PyObject *value, void *closure)
{
if (value && PyBool_Check(value))
{
if (PyObject_IsTrue(value))
self->filter.bRecursiveClasses = true;
else
self->filter.bRecursiveClasses = false;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a bool");
return -1;
}
static PyObject *py_ue_farfilter_get_recursive_paths(ue_PyFARFilter *self, void *closure)
{
if (self->filter.bRecursivePaths)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static int py_ue_farfilter_set_recursive_paths(ue_PyFARFilter *self, PyObject *value, void *closure)
{
if (value && PyBool_Check(value))
{
if (PyObject_IsTrue(value))
self->filter.bRecursivePaths = true;
else
self->filter.bRecursivePaths = false;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a bool");
return -1;
}
static PyGetSetDef ue_PyFARFilter_getseters[] = {
{ (char *)"include_only_on_disk_assets", (getter)py_ue_farfilter_get_include_only_on_disk_assets,
(setter)py_ue_farfilter_set_include_only_on_disk_assets, (char *)"", NULL },
{ (char *)"recursive_classes", (getter)py_ue_farfilter_get_recursive_classes,
(setter)py_ue_farfilter_set_recursive_classes, (char *)"", NULL },
{ (char *)"recursive_paths", (getter)py_ue_farfilter_get_recursive_paths,
(setter)py_ue_farfilter_set_recursive_paths, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyMemberDef ue_PyFARFilter_members[] = {
{ (char *)"class_names", T_OBJECT_EX, offsetof(ue_PyFARFilter, class_names), 0, (char *)"class_names" },
{ (char *)"object_paths", T_OBJECT_EX, offsetof(ue_PyFARFilter, object_paths), 0, (char *)"object_paths" },
{ (char *)"package_names", T_OBJECT_EX, offsetof(ue_PyFARFilter, package_names), 0, (char *)"package_names" },
{ (char *)"package_paths", T_OBJECT_EX, offsetof(ue_PyFARFilter, package_paths), 0, (char *)"package_paths" },
{ (char *)"recursive_classes_exclusion_set", T_OBJECT_EX, offsetof(ue_PyFARFilter, recursive_classes_exclusion_set), 0, (char *)"recursive_classes_exclusion_set" },
{ (char *)"tags_and_values", T_OBJECT_EX, offsetof(ue_PyFARFilter, tags_and_values), 0, (char *)"tags_and_values" },
{ NULL } /* Sentinel */
};
static int ue_py_farfilter_init(ue_PyFARFilter *self, PyObject *args, PyObject *kwargs)
{
return 0;
}
static void ue_py_farfilter_dealloc(ue_PyFARFilter *self)
{
self->filter.~FARFilter();
Py_XDECREF(self->class_names);
Py_XDECREF(self->object_paths);
Py_XDECREF(self->package_names);
Py_XDECREF(self->package_paths);
Py_XDECREF(self->recursive_classes_exclusion_set);
Py_XDECREF(self->tags_and_values);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject * ue_py_farfilter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
ue_PyFARFilter *self;
self = (ue_PyFARFilter *)type->tp_alloc(type, 0);
if (self != NULL)
{
new(&self->filter) FARFilter();
self->class_names = PyList_New(0);
if (self->class_names == NULL)
{
Py_DECREF(self);
return NULL;
}
self->object_paths = PyList_New(0);
if (self->object_paths == NULL)
{
Py_DECREF(self);
return NULL;
}
self->package_names = PyList_New(0);
if (self->package_names == NULL)
{
Py_DECREF(self);
return NULL;
}
self->package_paths = PyList_New(0);
if (self->package_paths == NULL)
{
Py_DECREF(self);
return NULL;
}
self->recursive_classes_exclusion_set = PySet_New(NULL);
if (self->recursive_classes_exclusion_set == NULL)
{
Py_DECREF(self);
return NULL;
}
PyObject *collections = PyImport_ImportModule("collections");
if (!collections)
{
unreal_engine_py_log_error();
Py_DECREF(self);
return NULL;
}
PyObject *collections_module_dict = PyModule_GetDict(collections);
PyObject *defaultdict_cls = PyDict_GetItemString(collections_module_dict, "defaultdict");
PyObject *builtins_module = PyImport_ImportModule("builtins");
if (!builtins_module)
{
unreal_engine_py_log_error();
Py_DECREF(self);
return NULL;
}
PyObject *builtins_dict = PyModule_GetDict(builtins_module);
PyObject *set_cls = PyDict_GetItemString(builtins_dict, "set");
// required because PyTuple_SetItem below will steal a reference
Py_INCREF(set_cls);
PyObject *py_args = PyTuple_New(1);
PyTuple_SetItem(py_args, 0, set_cls);
PyObject *default_dict = PyObject_CallObject(defaultdict_cls, py_args);
Py_DECREF(py_args);
if (!default_dict)
{
unreal_engine_py_log_error();
Py_DECREF(self);
return NULL;
}
self->tags_and_values = default_dict;
}
return (PyObject *)self;
}
static PyTypeObject ue_PyFARFilterType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FARFilter", /* tp_name */
sizeof(ue_PyFARFilter), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)ue_py_farfilter_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FARFilter", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFARFilter_methods, /* tp_methods */
ue_PyFARFilter_members, /* tp_members */
ue_PyFARFilter_getseters, /* tp_getset */
};
void ue_python_init_farfilter(PyObject *ue_module)
{
ue_PyFARFilterType.tp_new = ue_py_farfilter_new;
ue_PyFARFilterType.tp_init = (initproc)ue_py_farfilter_init;
if (PyType_Ready(&ue_PyFARFilterType) < 0)
return;
Py_INCREF(&ue_PyFARFilterType);
PyModule_AddObject(ue_module, "FARFilter", (PyObject *)&ue_PyFARFilterType);
}
void py_ue_clear_seq(PyObject *pyseq)
{
if (PyList_Check(pyseq))
{
Py_ssize_t pysize = PyObject_Length(pyseq);
PyObject *pyitem;
for (int i = 0; i < (int)pysize; i++)
{
pyitem = PyList_GetItem(pyseq, i);
PyObject_DelItem(pyseq, pyitem);
}
}
else if (PySet_Check(pyseq))
{
PySet_Clear(pyseq);
}
else if (PyDict_Check(pyseq))
{
PyObject *pykeys = PyDict_Keys(pyseq);
Py_ssize_t pysize = PyObject_Length(pykeys);
PyObject *pykey;
for (int i = 0; i < (int)pysize; i++)
{
pykey = PyList_GetItem(pykeys, i);
PyObject_DelItem(pyseq, pykey);
}
}
}
void py_ue_clear_farfilter(ue_PyFARFilter *pyfilter)
{
py_ue_clear_seq(pyfilter->class_names);
py_ue_clear_seq(pyfilter->object_paths);
py_ue_clear_seq(pyfilter->package_names);
py_ue_clear_seq(pyfilter->package_paths);
py_ue_clear_seq(pyfilter->recursive_classes_exclusion_set);
py_ue_clear_seq(pyfilter->tags_and_values);
}
void ue_sync_farfilter_name_array(PyObject *pylist, TArray<FName> &uelist)
{
Py_ssize_t pylist_len = PyList_Size(pylist);
uelist.Reset(pylist_len);
for (int i = 0; i < (int)pylist_len; i++)
{
PyObject *py_item = PyList_GetItem(pylist, i);
uelist.Add(FName(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(py_item))));
}
}
void py_ue_sync_farfilter(PyObject *pyobj)
{
ue_PyFARFilter *pyfilter = py_ue_is_farfilter(pyobj);
ue_sync_farfilter_name_array(pyfilter->class_names, pyfilter->filter.ClassNames);
ue_sync_farfilter_name_array(pyfilter->object_paths, pyfilter->filter.ObjectPaths);
ue_sync_farfilter_name_array(pyfilter->package_names, pyfilter->filter.PackageNames);
ue_sync_farfilter_name_array(pyfilter->package_paths, pyfilter->filter.PackagePaths);
PyObject *pyset = pyfilter->recursive_classes_exclusion_set;
Py_ssize_t pyset_len = PySet_Size(pyset);
PyObject *py_item;
pyfilter->filter.RecursiveClassesExclusionSet.Reset();
for (int i = 0; i < (int)pyset_len; i++)
{
py_item = PyList_GetItem(pyset, i);
pyfilter->filter.RecursiveClassesExclusionSet.Add(FName(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(py_item))));
}
PyObject *pykey, *pyvalue;
Py_ssize_t pypos;
FName ukey;
pyfilter->filter.TagsAndValues.Reset();
while (PyDict_Next(pyfilter->tags_and_values, &pypos, &pykey, &pyvalue))
{
ukey = UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(pykey));
pyset_len = PySet_Size(pyvalue);
for (int i = 0; i < (int)pyset_len; i++)
{
py_item = PyList_GetItem(pyset, i);
#if ENGINE_MINOR_VERSION < 20
pyfilter->filter.TagsAndValues.AddUnique(ukey, UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(py_item)));
#else
pyfilter->filter.TagsAndValues.AddUnique(ukey, FString(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(py_item))));
#endif
}
}
}
PyObject *py_ue_new_farfilter(FARFilter filter)
{
ue_PyFARFilter *ret = (ue_PyFARFilter *)PyObject_CallObject((PyObject *)&ue_PyFARFilterType, NULL);
ret->filter = filter;
return (PyObject *)ret;
}
ue_PyFARFilter *py_ue_is_farfilter(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFARFilterType))
return nullptr;
return (ue_PyFARFilter *)obj;
}
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFARFilter.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,154 |
```c++
#include "UEPyFStringAssetReference.h"
static PyObject *py_ue_fstring_asset_reference_get_asset_name(ue_PyFStringAssetReference *self, PyObject * args)
{
#if ENGINE_MINOR_VERSION > 13
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->fstring_asset_reference.GetAssetName()));
#else
return PyUnicode_FromString(TCHAR_TO_UTF8(*FPackageName::ObjectPathToObjectName(self->fstring_asset_reference.ToString())));
#endif
}
static PyObject *py_ue_fstring_asset_reference_get_long_package_name(ue_PyFStringAssetReference *self, PyObject * args)
{
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->fstring_asset_reference.GetLongPackageName()));
}
static PyMethodDef ue_PyFStringAssetReference_methods[] = {
{ "get_asset_name", (PyCFunction)py_ue_fstring_asset_reference_get_asset_name, METH_VARARGS, "" },
{ "get_long_package_name", (PyCFunction)py_ue_fstring_asset_reference_get_long_package_name, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFStringAssetReference_str(ue_PyFStringAssetReference *self)
{
return PyUnicode_FromFormat("<unreal_engine.FStringAssetReference {'asset_name': %s}>",
#if ENGINE_MINOR_VERSION > 13
TCHAR_TO_UTF8(*self->fstring_asset_reference.GetAssetName()));
#else
TCHAR_TO_UTF8(*FPackageName::ObjectPathToObjectName(self->fstring_asset_reference.ToString())));
#endif
}
static PyTypeObject ue_PyFStringAssetReferenceType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FStringAssetReference", /* tp_name */
sizeof(ue_PyFVector), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFStringAssetReference_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FStringAssetReference", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFStringAssetReference_methods, /* tp_methods */
0,
0,
};
static int ue_py_fstring_asset_reference_init(ue_PyFStringAssetReference *self, PyObject *args, PyObject *kwargs)
{
PyObject *py_object;
if (!PyArg_ParseTuple(args, "O", &py_object))
return -1;
if (PyUnicodeOrString_Check(py_object))
{
const char *value = UEPyUnicode_AsUTF8(py_object);
self->fstring_asset_reference = FStringAssetReference(FString(UTF8_TO_TCHAR(value)));
return 0;
}
UObject *u_object = ue_py_check_type<UObject>(py_object);
if (!u_object)
{
PyErr_SetString(PyExc_Exception, "argument is not a UObject or a string");
return -1;
}
self->fstring_asset_reference = FStringAssetReference(u_object);
return 0;
}
void ue_python_init_fstring_asset_reference(PyObject *ue_module)
{
ue_PyFStringAssetReferenceType.tp_new = PyType_GenericNew;
ue_PyFStringAssetReferenceType.tp_init = (initproc)ue_py_fstring_asset_reference_init;
if (PyType_Ready(&ue_PyFStringAssetReferenceType) < 0)
return;
Py_INCREF(&ue_PyFStringAssetReferenceType);
PyModule_AddObject(ue_module, "FStringAssetReference", (PyObject *)&ue_PyFStringAssetReferenceType);
PyModule_AddObject(ue_module, "FSoftObjectPath", (PyObject *)&ue_PyFStringAssetReferenceType);
}
PyObject *py_ue_new_fstring_asset_reference(FStringAssetReference ref)
{
ue_PyFStringAssetReference *ret = (ue_PyFStringAssetReference *)PyObject_New(ue_PyFStringAssetReference, &ue_PyFStringAssetReferenceType);
ret->fstring_asset_reference = ref;
return (PyObject *)ret;
}
ue_PyFStringAssetReference *py_ue_is_fstring_asset_reference(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFStringAssetReferenceType))
return nullptr;
return (ue_PyFStringAssetReference *)obj;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFStringAssetReference.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,083 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#include "Runtime/Sockets/Public/Sockets.h"
#include "Runtime/Networking/Public/Networking.h"
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
FSocket *sock;
FUdpSocketReceiver *udp_receiver;
void udp_recv(const FArrayReaderPtr& ArrayReaderPtr, const FIPv4Endpoint& EndPt) {
UE_LOG(LogPython, Warning, TEXT("DATA !!!"));
}
} ue_PyFSocket;
void ue_python_init_fsocket(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFSocket.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 118 |
```objective-c
#pragma once
#include "UEPyModule.h"
#include "UnrealClient.h"
extern PyTypeObject ue_PyFViewportClientType;
struct ue_PyFViewportClient
{
PyObject_HEAD
/* Type-specific fields go here. */
TSharedRef<FViewportClient> viewport_client;;
};
void ue_python_init_fviewport_client(PyObject *);
PyObject *py_ue_new_fviewport_client(TSharedRef<FViewportClient>);
ue_PyFViewportClient *py_ue_is_fviewport_client(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFViewportClient.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 105 |
```c++
#include "UEPyESlateEnums.h"
#include "Runtime/Slate/Public/Framework/Commands/UICommandInfo.h"
static PyObject *py_ue_eslate_enums_get(ue_PyESlateEnums *self, void *closure)
{
return PyLong_FromLong(self->val);
}
static PyGetSetDef ue_PyESlateEnums_getseters[] = {
{ (char*)"val", (getter)py_ue_eslate_enums_get, 0, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyESlateEnums_str(ue_PyESlateEnums *self)
{
return PyUnicode_FromFormat("<unreal_engine.ESlateEnums {'val': %S}>", PyLong_FromLong(self->val));
}
static PyTypeObject ue_PyESlateEnumsType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.ESlateEnums", /* tp_name */
sizeof(ue_PyESlateEnums), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyESlateEnums_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine ESlateEnums", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0,
ue_PyESlateEnums_getseters,
};
static int ue_py_eslate_enums_init(ue_PyESlateEnums *self, PyObject *args, PyObject *kwargs)
{
int val = 0;
if (!PyArg_ParseTuple(args, "i", &val))
return -1;
self->val = val;
return 0;
}
void ue_python_init_eslate_enums(PyObject *ue_module)
{
ue_PyESlateEnumsType.tp_new = PyType_GenericNew;
ue_PyESlateEnumsType.tp_init = (initproc)ue_py_eslate_enums_init;
if (PyType_Ready(&ue_PyESlateEnumsType) < 0)
return;
Py_INCREF(&ue_PyESlateEnumsType);
PyModule_AddObject(ue_module, "ESlateEnums", (PyObject *)&ue_PyESlateEnumsType);
auto add_native_enum = [](const char *enum_name, uint8 val)
{
ue_PyESlateEnums* native_enum = (ue_PyESlateEnums *)PyObject_New(ue_PyESlateEnums, &ue_PyESlateEnumsType);
native_enum->val = val;
PyDict_SetItemString(ue_PyESlateEnumsType.tp_dict, enum_name, (PyObject *)native_enum);
};
#if ENGINE_MINOR_VERSION > 15
#if ENGINE_MINOR_VERSION >= 23
#define ADD_NATIVE_ENUM(EnumType, EnumVal) add_native_enum(#EnumType "." #EnumVal, (uint8)EnumType::EnumVal)
#else
#define ADD_NATIVE_ENUM(EnumType, EnumVal) add_native_enum(#EnumType "." #EnumVal, (uint8)EnumType::Type::EnumVal)
#endif
ADD_NATIVE_ENUM(EUserInterfaceActionType, None);
ADD_NATIVE_ENUM(EUserInterfaceActionType, Button);
ADD_NATIVE_ENUM(EUserInterfaceActionType, ToggleButton);
ADD_NATIVE_ENUM(EUserInterfaceActionType, RadioButton);
ADD_NATIVE_ENUM(EUserInterfaceActionType, Check);
ADD_NATIVE_ENUM(EUserInterfaceActionType, CollapsedButton);
#undef ADD_NATIVE_ENUM
#endif
}
ue_PyESlateEnums *py_ue_is_eslate_enums(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyESlateEnumsType))
return nullptr;
return (ue_PyESlateEnums *)obj;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyESlateEnums.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 947 |
```objective-c
#pragma once
#include "UEPyModule.h"
#include "Runtime/Core/Public/Math/Quat.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FQuat quat;
} ue_PyFQuat;
extern PyTypeObject ue_PyFQuatType;
PyObject *py_ue_new_fquat(FQuat);
ue_PyFQuat *py_ue_is_fquat(PyObject *);
void ue_python_init_fquat(PyObject *);
bool py_ue_quat_arg(PyObject *, FQuat &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFQuat.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 111 |
```c++
#include "UEPyFQuat.h"
#if ENGINE_MINOR_VERSION > 12
static PyObject *py_ue_fquat_angular_distance(ue_PyFQuat *self, PyObject * args)
{
FQuat q;
if (!py_ue_quat_arg(args, q))
{
return nullptr;
}
return PyFloat_FromDouble(self->quat.AngularDistance(q));
}
#endif
static PyObject *py_ue_fquat_euler(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fvector(self->quat.Euler());
}
static PyObject *py_ue_fquat_get_axis_x(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fvector(self->quat.GetAxisX());
}
static PyObject *py_ue_fquat_get_axis_y(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fvector(self->quat.GetAxisY());
}
static PyObject *py_ue_fquat_get_axis_z(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fvector(self->quat.GetAxisZ());
}
static PyObject *py_ue_fquat_inverse(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fquat(self->quat.Inverse());
}
static PyObject *py_ue_fquat_get_normalized(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fquat(self->quat.GetNormalized());
}
static PyObject *py_ue_fquat_vector(ue_PyFQuat *self, PyObject * args)
{
return py_ue_new_fvector(self->quat.Vector());
}
static PyMethodDef ue_PyFQuat_methods[] = {
#if ENGINE_MINOR_VERSION > 12
{ "angular_distance", (PyCFunction)py_ue_fquat_angular_distance, METH_VARARGS, "" },
#endif
{ "euler", (PyCFunction)py_ue_fquat_euler, METH_VARARGS, "" },
{ "rotator", (PyCFunction)py_ue_fquat_euler, METH_VARARGS, "" },
{ "get_axis_x", (PyCFunction)py_ue_fquat_get_axis_x, METH_VARARGS, "" },
{ "get_axis_y", (PyCFunction)py_ue_fquat_get_axis_y, METH_VARARGS, "" },
{ "get_axis_z", (PyCFunction)py_ue_fquat_get_axis_z, METH_VARARGS, "" },
{ "get_forward_vector", (PyCFunction)py_ue_fquat_get_axis_x, METH_VARARGS, "" },
{ "get_right_vector", (PyCFunction)py_ue_fquat_get_axis_y, METH_VARARGS, "" },
{ "get_up_vector", (PyCFunction)py_ue_fquat_get_axis_z, METH_VARARGS, "" },
{ "inverse", (PyCFunction)py_ue_fquat_inverse, METH_VARARGS, "" },
{ "vector", (PyCFunction)py_ue_fquat_vector, METH_VARARGS, "" },
{ "get_normalized", (PyCFunction)py_ue_fquat_get_normalized, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fquat_get_x(ue_PyFQuat *self, void *closure)
{
return PyFloat_FromDouble(self->quat.X);
}
static int py_ue_fquat_set_x(ue_PyFQuat *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->quat.X = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fquat_get_y(ue_PyFQuat *self, void *closure)
{
return PyFloat_FromDouble(self->quat.Y);
}
static int py_ue_fquat_set_y(ue_PyFQuat *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->quat.Y = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fquat_get_z(ue_PyFQuat *self, void *closure)
{
return PyFloat_FromDouble(self->quat.Z);
}
static int py_ue_fquat_set_z(ue_PyFQuat *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->quat.Z = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fquat_get_w(ue_PyFQuat *self, void *closure)
{
return PyFloat_FromDouble(self->quat.W);
}
static int py_ue_fquat_set_w(ue_PyFQuat *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->quat.W = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyGetSetDef ue_PyFQuat_getseters[] = {
{ (char*)"x", (getter)py_ue_fquat_get_x, (setter)py_ue_fquat_set_x, (char *)"", NULL },
{ (char *)"y", (getter)py_ue_fquat_get_y, (setter)py_ue_fquat_set_y, (char *)"", NULL },
{ (char *)"z", (getter)py_ue_fquat_get_z, (setter)py_ue_fquat_set_z, (char *)"", NULL },
{ (char *)"w", (getter)py_ue_fquat_get_w, (setter)py_ue_fquat_set_w, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFQuat_str(ue_PyFQuat *self)
{
return PyUnicode_FromFormat("<unreal_engine.FQuat {'x': %S, 'y': %S, 'z': %S, 'w': %S}>",
PyFloat_FromDouble(self->quat.X), PyFloat_FromDouble(self->quat.Y), PyFloat_FromDouble(self->quat.Z), PyFloat_FromDouble(self->quat.W));
}
PyTypeObject ue_PyFQuatType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FQuat", /* tp_name */
sizeof(ue_PyFQuat), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFQuat_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FQuat", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFQuat_methods, /* tp_methods */
0,
ue_PyFQuat_getseters,
};
static PyObject *ue_py_fquat_add(ue_PyFQuat *self, PyObject *value)
{
FQuat quat = self->quat;
ue_PyFQuat *py_quat = py_ue_is_fquat(value);
if (py_quat)
{
quat += py_quat->quat;
}
return py_ue_new_fquat(quat);
}
static PyObject *ue_py_fquat_sub(ue_PyFQuat *self, PyObject *value)
{
FQuat quat = self->quat;
ue_PyFQuat *py_quat = py_ue_is_fquat(value);
if (py_quat)
{
quat -= py_quat->quat;
}
return py_ue_new_fquat(quat);
}
static PyObject *ue_py_fquat_mul(ue_PyFQuat *self, PyObject *value)
{
if (ue_PyFVector *py_vec = py_ue_is_fvector(value))
{
FVector vec = self->quat * py_vec->vec;
return py_ue_new_fvector(vec);
}
if (ue_PyFQuat *py_quat = py_ue_is_fquat(value))
{
FQuat quat = self->quat * py_quat->quat;
return py_ue_new_fquat(quat);
}
else if (PyNumber_Check(value))
{
FQuat quat = self->quat;
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
quat *= f;
Py_DECREF(f_value);
return py_ue_new_fquat(quat);
}
return PyErr_Format(PyExc_TypeError, "unsupported argument type");
}
static PyObject *ue_py_fquat_div(ue_PyFQuat *self, PyObject *value)
{
FQuat quat = self->quat;
if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
if (f == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
quat /= f;
Py_DECREF(f_value);
return py_ue_new_fquat(quat);
}
return PyErr_Format(PyExc_TypeError, "unsupported argument type");
}
PyNumberMethods ue_PyFQuat_number_methods;
static Py_ssize_t ue_py_fquat_seq_length(ue_PyFQuat *self)
{
return 4;
}
static PyObject *ue_py_fquat_seq_item(ue_PyFQuat *self, Py_ssize_t i)
{
switch (i)
{
case 0:
return PyFloat_FromDouble(self->quat.X);
case 1:
return PyFloat_FromDouble(self->quat.Y);
case 2:
return PyFloat_FromDouble(self->quat.Z);
case 3:
return PyFloat_FromDouble(self->quat.W);
}
return PyErr_Format(PyExc_IndexError, "FQuat has only 4 items");
}
PySequenceMethods ue_PyFQuat_sequence_methods;
static int ue_py_fquat_init(ue_PyFQuat *self, PyObject *args, PyObject *kwargs)
{
float x = 0, y = 0, z = 0, w = 1;
if (!PyArg_ParseTuple(args, "|ffff", &x, &y, &z, &w))
return -1;
self->quat.X = x;
self->quat.Y = y;
self->quat.Z = z;
self->quat.W = w;
return 0;
}
void ue_python_init_fquat(PyObject *ue_module)
{
ue_PyFQuatType.tp_new = PyType_GenericNew;
ue_PyFQuatType.tp_init = (initproc)ue_py_fquat_init;
memset(&ue_PyFQuat_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFQuatType.tp_as_number = &ue_PyFQuat_number_methods;
ue_PyFQuat_number_methods.nb_add = (binaryfunc)ue_py_fquat_add;
ue_PyFQuat_number_methods.nb_subtract = (binaryfunc)ue_py_fquat_sub;
ue_PyFQuat_number_methods.nb_multiply = (binaryfunc)ue_py_fquat_mul;
ue_PyFQuat_number_methods.nb_divmod = (binaryfunc)ue_py_fquat_div;
memset(&ue_PyFQuat_sequence_methods, 0, sizeof(PySequenceMethods));
ue_PyFQuatType.tp_as_sequence = &ue_PyFQuat_sequence_methods;
ue_PyFQuat_sequence_methods.sq_length = (lenfunc)ue_py_fquat_seq_length;
ue_PyFQuat_sequence_methods.sq_item = (ssizeargfunc)ue_py_fquat_seq_item;
if (PyType_Ready(&ue_PyFQuatType) < 0)
return;
Py_INCREF(&ue_PyFQuatType);
PyModule_AddObject(ue_module, "FQuat", (PyObject *)&ue_PyFQuatType);
}
PyObject *py_ue_new_fquat(FQuat quat)
{
ue_PyFQuat *ret = (ue_PyFQuat *)PyObject_New(ue_PyFQuat, &ue_PyFQuatType);
ret->quat = quat;
return (PyObject *)ret;
}
ue_PyFQuat *py_ue_is_fquat(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFQuatType))
return nullptr;
return (ue_PyFQuat *)obj;
}
bool py_ue_quat_arg(PyObject *args, FQuat &quat)
{
if (PyTuple_Size(args) == 1)
{
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFQuat *py_quat = py_ue_is_fquat(arg);
if (!py_quat)
{
PyErr_Format(PyExc_TypeError, "argument is not a FQuat");
return false;
}
quat = py_quat->quat;
return true;
}
float x, y, z, w;
if (!PyArg_ParseTuple(args, "ffff", &x, &y, &z, &w))
return false;
quat.X = x;
quat.Y = y;
quat.Z = z;
quat.W = w;
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFQuat.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,164 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FRandomStream rstream;
} ue_PyFRandomStream;
void ue_python_init_frandomstream(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRandomStream.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 55 |
```c++
#include "UEPyFMorphTargetDelta.h"
static PyObject *py_ue_fmorph_target_delta_get_position_delta(ue_PyFMorphTargetDelta *self, void *closure)
{
return py_ue_new_fvector(self->morph_target_delta.PositionDelta);
}
static int py_ue_fmorph_target_delta_set_position_delta(ue_PyFMorphTargetDelta *self, PyObject *value, void *closure)
{
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
self->morph_target_delta.PositionDelta = py_vec->vec;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FVector");
return -1;
}
static PyObject *py_ue_fmorph_target_delta_get_tangent_z_delta(ue_PyFMorphTargetDelta *self, void *closure)
{
return py_ue_new_fvector(self->morph_target_delta.TangentZDelta);
}
static int py_ue_fmorph_target_delta_set_tangent_z_delta(ue_PyFMorphTargetDelta *self, PyObject *value, void *closure)
{
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
self->morph_target_delta.TangentZDelta = py_vec->vec;
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a FVector");
return -1;
}
static int py_ue_fmorph_target_delta_set_source_idx(ue_PyFMorphTargetDelta *self, PyObject *value, void *closure)
{
if (PyNumber_Check(value))
{
PyObject *py_num = PyNumber_Long(value);
self->morph_target_delta.SourceIdx = PyLong_AsUnsignedLong(py_num);
Py_DECREF(py_num);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a number");
return -1;
}
static PyObject *py_ue_fmorph_target_delta_get_source_idx(ue_PyFMorphTargetDelta *self, void *closure)
{
return PyLong_FromUnsignedLong(self->morph_target_delta.SourceIdx);
}
static PyGetSetDef ue_PyFMorphTargetDelta_getseters[] = {
{ (char *) "position_delta", (getter)py_ue_fmorph_target_delta_get_position_delta, (setter)py_ue_fmorph_target_delta_set_position_delta, (char *)"", NULL },
{ (char *) "tangent_z_delta", (getter)py_ue_fmorph_target_delta_get_tangent_z_delta, (setter)py_ue_fmorph_target_delta_set_tangent_z_delta, (char *)"", NULL },
{ (char *) "source_idx", (getter)py_ue_fmorph_target_delta_get_source_idx, (setter)py_ue_fmorph_target_delta_set_source_idx, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFMorphTargetDelta_str(ue_PyFMorphTargetDelta *self)
{
return PyUnicode_FromFormat("<unreal_engine.FMorphTargetDelta {'position_delta': {'x': %S, 'y': %S, 'z': %S}, 'source_idx': %d}>",
PyFloat_FromDouble(self->morph_target_delta.PositionDelta.X),
PyFloat_FromDouble(self->morph_target_delta.PositionDelta.Y),
PyFloat_FromDouble(self->morph_target_delta.PositionDelta.Z),
self->morph_target_delta.SourceIdx);
}
static PyTypeObject ue_PyFMorphTargetDeltaType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FMorphTargetDelta", /* tp_name */
sizeof(ue_PyFMorphTargetDelta), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFMorphTargetDelta_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FMorphTargetDelta", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0,
ue_PyFMorphTargetDelta_getseters,
};
static int py_ue_fmorph_target_delta_init(ue_PyFMorphTargetDelta *self, PyObject * args)
{
new(&self->morph_target_delta) FMorphTargetDelta();
return 0;
}
void ue_python_init_fmorph_target_delta(PyObject *ue_module)
{
ue_PyFMorphTargetDeltaType.tp_new = PyType_GenericNew;
ue_PyFMorphTargetDeltaType.tp_init = (initproc)py_ue_fmorph_target_delta_init;
if (PyType_Ready(&ue_PyFMorphTargetDeltaType) < 0)
return;
Py_INCREF(&ue_PyFMorphTargetDeltaType);
PyModule_AddObject(ue_module, "FMorphTargetDelta", (PyObject *)&ue_PyFMorphTargetDeltaType);
}
ue_PyFMorphTargetDelta *py_ue_is_fmorph_target_delta(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFMorphTargetDeltaType))
return nullptr;
return (ue_PyFMorphTargetDelta *)obj;
}
PyObject *py_ue_new_fmorph_target_delta(FMorphTargetDelta morph_target_delta)
{
ue_PyFMorphTargetDelta *ret = (ue_PyFMorphTargetDelta *)PyObject_New(ue_PyFMorphTargetDelta, &ue_PyFMorphTargetDeltaType);
new(&ret->morph_target_delta) FMorphTargetDelta(morph_target_delta);
return (PyObject *)ret;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFMorphTargetDelta.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,357 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FLinearColor color;
} ue_PyFLinearColor;
extern PyTypeObject ue_PyFLinearColorType;
PyObject *py_ue_new_flinearcolor(FLinearColor);
ue_PyFLinearColor *py_ue_is_flinearcolor(PyObject *);
void ue_python_init_flinearcolor(PyObject *);
bool py_ue_linearcolor_arg(PyObject *, FLinearColor &);
bool py_ue_get_flinearcolor(PyObject *, FLinearColor &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFLinearColor.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 117 |
```objective-c
#pragma once
#include "UEPyModule.h"
#include "Runtime/Engine/Classes/Animation/AnimSequence.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FRawAnimSequenceTrack raw_anim_sequence_track;
} ue_PyFRawAnimSequenceTrack;
PyObject *py_ue_new_fraw_anim_sequence_track(FRawAnimSequenceTrack);
void ue_python_init_fraw_anim_sequence_track(PyObject *);
ue_PyFRawAnimSequenceTrack *py_ue_is_fraw_anim_sequence_track(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRawAnimSequenceTrack.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 112 |
```c++
#include "UEPyFVector.h"
static PyObject *py_ue_fvector_length(ue_PyFVector *self, PyObject * args)
{
return PyFloat_FromDouble(self->vec.Size());
}
static PyObject *py_ue_fvector_length_squared(ue_PyFVector *self, PyObject * args)
{
return PyFloat_FromDouble(self->vec.SizeSquared());
}
static PyObject *py_ue_fvector_normalized(ue_PyFVector *self, PyObject * args)
{
FVector vec = self->vec;
vec.Normalize();
return py_ue_new_fvector(vec);
}
static PyObject *py_ue_fvector_rotation(ue_PyFVector *self, PyObject * args)
{
FRotator rot = self->vec.Rotation();
return py_ue_new_frotator(rot);
}
static PyObject *py_ue_fvector_dot(ue_PyFVector *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:dot", &py_obj))
return NULL;
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector");
return PyFloat_FromDouble(FVector::DotProduct(self->vec, py_vec->vec));
}
static PyObject *py_ue_fvector_cross(ue_PyFVector *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:cross", &py_obj))
return NULL;
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector");
return py_ue_new_fvector(FVector::CrossProduct(self->vec, py_vec->vec));
}
static PyObject *py_ue_fvector_project_on_to(ue_PyFVector *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:cross", &py_obj))
return nullptr;
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector");
return py_ue_new_fvector(self->vec.ProjectOnTo(py_vec->vec));
}
static PyObject *py_ue_fvector_project_on_to_normal(ue_PyFVector *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:cross", &py_obj))
return nullptr;
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector");
return py_ue_new_fvector(self->vec.ProjectOnToNormal(py_vec->vec));
}
static PyMethodDef ue_PyFVector_methods[] = {
{ "length", (PyCFunction)py_ue_fvector_length, METH_VARARGS, "" },
{ "size", (PyCFunction)py_ue_fvector_length, METH_VARARGS, "" },
{ "size_squared", (PyCFunction)py_ue_fvector_length_squared, METH_VARARGS, "" },
{ "length_squared", (PyCFunction)py_ue_fvector_length_squared, METH_VARARGS, "" },
{ "normalized", (PyCFunction)py_ue_fvector_normalized, METH_VARARGS, "" },
{ "rotation", (PyCFunction)py_ue_fvector_rotation, METH_VARARGS, "" },
{ "dot", (PyCFunction)py_ue_fvector_dot, METH_VARARGS, "" },
{ "cross", (PyCFunction)py_ue_fvector_cross, METH_VARARGS, "" },
{ "project_on_to", (PyCFunction)py_ue_fvector_project_on_to, METH_VARARGS, "" },
{ "project_on_to_normal", (PyCFunction)py_ue_fvector_project_on_to_normal, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *py_ue_fvector_get_x(ue_PyFVector *self, void *closure)
{
return PyFloat_FromDouble(self->vec.X);
}
static int py_ue_fvector_set_x(ue_PyFVector *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->vec.X = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fvector_get_y(ue_PyFVector *self, void *closure)
{
return PyFloat_FromDouble(self->vec.Y);
}
static int py_ue_fvector_set_y(ue_PyFVector *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->vec.Y = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyObject *py_ue_fvector_get_z(ue_PyFVector *self, void *closure)
{
return PyFloat_FromDouble(self->vec.Z);
}
static int py_ue_fvector_set_z(ue_PyFVector *self, PyObject *value, void *closure)
{
if (value && PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
self->vec.Z = PyFloat_AsDouble(f_value);
Py_DECREF(f_value);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not numeric");
return -1;
}
static PyGetSetDef ue_PyFVector_getseters[] = {
{(char *) "x", (getter)py_ue_fvector_get_x, (setter)py_ue_fvector_set_x, (char *)"", NULL },
{(char *) "y", (getter)py_ue_fvector_get_y, (setter)py_ue_fvector_set_y, (char *)"", NULL },
{(char *) "z", (getter)py_ue_fvector_get_z, (setter)py_ue_fvector_set_z, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFVector_str(ue_PyFVector *self)
{
return PyUnicode_FromFormat("<unreal_engine.FVector {'x': %S, 'y': %S, 'z': %S}>",
PyFloat_FromDouble(self->vec.X), PyFloat_FromDouble(self->vec.Y), PyFloat_FromDouble(self->vec.Z));
}
PyTypeObject ue_PyFVectorType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FVector", /* tp_name */
sizeof(ue_PyFVector), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFVector_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION < 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#else
Py_TPFLAGS_DEFAULT, /* tp_flags */
#endif
"Unreal Engine FVector", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFVector_methods, /* tp_methods */
0,
ue_PyFVector_getseters,
};
static PyObject *ue_py_fvector_add(ue_PyFVector *self, PyObject *value)
{
FVector vec = self->vec;
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
vec += py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
vec.X += f;
vec.Y += f;
vec.Z += f;
Py_DECREF(f_value);
}
return py_ue_new_fvector(vec);
}
static PyObject *ue_py_fvector_sub(ue_PyFVector *self, PyObject *value)
{
FVector vec = self->vec;
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
vec -= py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
vec.X -= f;
vec.Y -= f;
vec.Z -= f;
Py_DECREF(f_value);
}
return py_ue_new_fvector(vec);
}
static PyObject *ue_py_fvector_mul(ue_PyFVector *self, PyObject *value)
{
FVector vec = self->vec;
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
vec *= py_vec->vec;
}
else if (ue_PyFRotator *py_rot = py_ue_is_frotator(value))
{
return py_ue_new_fvector(py_rot->rot.RotateVector(vec));
}
else if (ue_PyFQuat *py_quat = py_ue_is_fquat(value))
{
return py_ue_new_fvector(py_quat->quat.RotateVector(vec));
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
vec *= f;
Py_DECREF(f_value);
}
return py_ue_new_fvector(vec);
}
static PyObject *ue_py_fvector_div(ue_PyFVector *self, PyObject *value)
{
FVector vec = self->vec;
ue_PyFVector *py_vec = py_ue_is_fvector(value);
if (py_vec)
{
if (py_vec->vec.X == 0 || py_vec->vec.Y == 0 || py_vec->vec.Z == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
vec /= py_vec->vec;
}
else if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
if (f == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
vec /= f;
Py_DECREF(f_value);
}
return py_ue_new_fvector(vec);
}
static PyObject *ue_py_fvector_floor_div(ue_PyFVector *self, PyObject *value)
{
FVector vec = self->vec;
if (PyNumber_Check(value))
{
PyObject *f_value = PyNumber_Float(value);
float f = PyFloat_AsDouble(f_value);
if (f == 0)
return PyErr_Format(PyExc_ZeroDivisionError, "division by zero");
vec.X = floor(vec.X / f);
vec.Y = floor(vec.Y / f);
vec.Z = floor(vec.Z / f);
Py_DECREF(f_value);
return py_ue_new_fvector(vec);
}
return PyErr_Format(PyExc_TypeError, "value is not numeric");
}
PyNumberMethods ue_PyFVector_number_methods;
static Py_ssize_t ue_py_fvector_seq_length(ue_PyFVector *self)
{
return 3;
}
static PyObject *ue_py_fvector_seq_item(ue_PyFVector *self, Py_ssize_t i)
{
switch (i)
{
case 0:
return PyFloat_FromDouble(self->vec.X);
case 1:
return PyFloat_FromDouble(self->vec.Y);
case 2:
return PyFloat_FromDouble(self->vec.Z);
}
return PyErr_Format(PyExc_IndexError, "FVector has only 3 items");
}
PySequenceMethods ue_PyFVector_sequence_methods;
static int ue_py_fvector_init(ue_PyFVector *self, PyObject *args, PyObject *kwargs)
{
float x = 0, y = 0, z = 0;
if (!PyArg_ParseTuple(args, "|fff", &x, &y, &z))
return -1;
if (PyTuple_Size(args) == 1)
{
y = x;
z = x;
}
self->vec.X = x;
self->vec.Y = y;
self->vec.Z = z;
return 0;
}
static PyObject *ue_py_fvector_richcompare(ue_PyFVector *vec1, PyObject *b, int op)
{
ue_PyFVector *vec2 = py_ue_is_fvector(b);
if (!vec2 || (op != Py_EQ && op != Py_NE))
{
return PyErr_Format(PyExc_NotImplementedError, "can only compare with another FVector");
}
if (op == Py_EQ)
{
if (vec1->vec.X == vec2->vec.X &&
vec1->vec.Y == vec2->vec.Y &&
vec1->vec.Z == vec2->vec.Z)
{
Py_INCREF(Py_True);
return Py_True;
}
Py_INCREF(Py_False);
return Py_False;
}
if (vec1->vec.X == vec2->vec.X &&
vec1->vec.Y == vec2->vec.Y &&
vec1->vec.Z == vec2->vec.Z)
{
Py_INCREF(Py_False);
return Py_False;
}
Py_INCREF(Py_True);
return Py_True;
}
void ue_python_init_fvector(PyObject *ue_module)
{
ue_PyFVectorType.tp_new = PyType_GenericNew;
ue_PyFVectorType.tp_init = (initproc)ue_py_fvector_init;
ue_PyFVectorType.tp_richcompare = (richcmpfunc)ue_py_fvector_richcompare;
memset(&ue_PyFVector_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFVectorType.tp_as_number = &ue_PyFVector_number_methods;
ue_PyFVector_number_methods.nb_add = (binaryfunc)ue_py_fvector_add;
ue_PyFVector_number_methods.nb_subtract = (binaryfunc)ue_py_fvector_sub;
ue_PyFVector_number_methods.nb_multiply = (binaryfunc)ue_py_fvector_mul;
ue_PyFVector_number_methods.nb_true_divide = (binaryfunc)ue_py_fvector_div;
ue_PyFVector_number_methods.nb_floor_divide = (binaryfunc)ue_py_fvector_floor_div;
memset(&ue_PyFVector_sequence_methods, 0, sizeof(PySequenceMethods));
ue_PyFVectorType.tp_as_sequence = &ue_PyFVector_sequence_methods;
ue_PyFVector_sequence_methods.sq_length = (lenfunc)ue_py_fvector_seq_length;
ue_PyFVector_sequence_methods.sq_item = (ssizeargfunc)ue_py_fvector_seq_item;
if (PyType_Ready(&ue_PyFVectorType) < 0)
return;
PyDict_SetItemString(ue_PyFVectorType.tp_dict, "forward", py_ue_new_fvector(FVector(1, 0, 0)));
PyDict_SetItemString(ue_PyFVectorType.tp_dict, "right", py_ue_new_fvector(FVector(0, 1, 0)));
PyDict_SetItemString(ue_PyFVectorType.tp_dict, "up", py_ue_new_fvector(FVector(0, 0, 1)));
Py_INCREF(&ue_PyFVectorType);
PyModule_AddObject(ue_module, "FVector", (PyObject *)&ue_PyFVectorType);
}
PyObject *py_ue_new_fvector(FVector vec)
{
ue_PyFVector *ret = (ue_PyFVector *)PyObject_New(ue_PyFVector, &ue_PyFVectorType);
ret->vec = vec;
return (PyObject *)ret;
}
ue_PyFVector *py_ue_is_fvector(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFVectorType))
return nullptr;
return (ue_PyFVector *)obj;
}
bool py_ue_vector_arg(PyObject *args, FVector &vec)
{
if (PyTuple_Size(args) == 1)
{
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFVector *py_vec = py_ue_is_fvector(arg);
if (!py_vec)
{
PyErr_Format(PyExc_TypeError, "argument is not a FVector");
return false;
}
vec = py_vec->vec;
return true;
}
float x, y, z;
if (!PyArg_ParseTuple(args, "fff", &x, &y, &z))
return false;
vec.X = x;
vec.Y = y;
vec.Z = z;
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFVector.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,785 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#if WITH_EDITOR
#include "Runtime/Engine/Public/SkeletalMeshTypes.h"
#if ENGINE_MINOR_VERSION > 18
#include "Runtime/Engine/Public/Rendering/SkeletalMeshLODModel.h"
#endif
#include "Wrappers/UEPyFColor.h"
struct ue_PyFSoftSkinVertex {
PyObject_HEAD
/* Type-specific fields go here. */
FSoftSkinVertex ss_vertex;
uint16 material_index;
uint32 smoothing_group;
};
void ue_python_init_fsoft_skin_vertex(PyObject *);
PyObject *py_ue_new_fsoft_skin_vertex(FSoftSkinVertex);
ue_PyFSoftSkinVertex *py_ue_is_fsoft_skin_vertex(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFSoftSkinVertex.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 148 |
```objective-c
#pragma once
#include "UEPyModule.h"
#include "Runtime/Core/Public/Misc/OutputDevice.h"
class FPythonOutputDevice : FOutputDevice
{
public:
FPythonOutputDevice()
{
GLog->AddOutputDevice(this);
GLog->SerializeBacklog(this);
}
~FPythonOutputDevice()
{
if (GLog)
{
GLog->RemoveOutputDevice(this);
}
Py_XDECREF(py_serialize);
}
void SetPySerialize(PyObject *py_callable)
{
py_serialize = py_callable;
Py_INCREF(py_serialize);
}
protected:
virtual void Serialize(const TCHAR * V, ELogVerbosity::Type Verbosity, const class FName& Category) override
{
if (!py_serialize)
return;
PyObject *ret = PyObject_CallFunction(py_serialize, (char *)"sis", TCHAR_TO_UTF8(V), Verbosity, TCHAR_TO_UTF8(*Category.ToString()));
if (!ret)
{
unreal_engine_py_log_error();
}
Py_XDECREF(ret);
}
private:
PyObject * py_serialize;
};
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FPythonOutputDevice *device;
} ue_PyFPythonOutputDevice;
void ue_python_init_fpython_output_device(PyObject *);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFPythonOutputDevice.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 283 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FColor color;
} ue_PyFColor;
extern PyTypeObject ue_PyFColorType;
PyObject *py_ue_new_fcolor(FColor);
ue_PyFColor *py_ue_is_fcolor(PyObject *);
void ue_python_init_fcolor(PyObject *);
bool py_ue_color_arg(PyObject *, FColor &);
bool py_ue_get_fcolor(PyObject *, FColor &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFColor.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 105 |
```c++
#include "UEPyFRandomStream.h"
static PyObject *py_ue_frandomstream_frand(ue_PyFRandomStream *self, PyObject * args) {
return PyFloat_FromDouble(self->rstream.FRand());
}
static PyObject *py_ue_frandomstream_frand_range(ue_PyFRandomStream *self, PyObject * args) {
float min;
float max;
if (!PyArg_ParseTuple(args, "ff:frand_range", &min, &max))
return NULL;
return PyFloat_FromDouble(self->rstream.FRandRange(min, max));
}
static PyObject *py_ue_frandomstream_generate_new_seed(ue_PyFRandomStream *self, PyObject * args) {
self->rstream.GenerateNewSeed();
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *py_ue_frandomstream_get_current_seed(ue_PyFRandomStream *self, PyObject * args) {
return PyLong_FromLong(self->rstream.GetCurrentSeed());
}
static PyObject *py_ue_frandomstream_get_fraction(ue_PyFRandomStream *self, PyObject * args) {
return PyFloat_FromDouble(self->rstream.GetFraction());
}
static PyObject *py_ue_frandomstream_get_initial_seed(ue_PyFRandomStream *self, PyObject * args) {
return PyLong_FromLong(self->rstream.GetInitialSeed());
}
static PyObject *py_ue_frandomstream_get_unit_vector(ue_PyFRandomStream *self, PyObject * args) {
return py_ue_new_fvector(self->rstream.GetUnitVector());
}
static PyObject *py_ue_frandomstream_get_unsigned_int(ue_PyFRandomStream *self, PyObject * args) {
return PyLong_FromUnsignedLong(self->rstream.GetUnsignedInt());
}
static PyObject *py_ue_frandomstream_initialize(ue_PyFRandomStream *self, PyObject * args) {
int seed;
if (!PyArg_ParseTuple(args, "i:initialize", &seed))
return NULL;
self->rstream.Initialize(seed);
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *py_ue_frandomstream_rand_helper(ue_PyFRandomStream *self, PyObject * args) {
int max;
if (!PyArg_ParseTuple(args, "i:rand_helper", &max))
return NULL;
return PyLong_FromLong(self->rstream.RandHelper(max));
}
static PyObject *py_ue_frandomstream_rand_range(ue_PyFRandomStream *self, PyObject * args) {
int min;
int max;
if (!PyArg_ParseTuple(args, "ii:rand_range", &min, &max))
return NULL;
return PyLong_FromLong(self->rstream.RandRange(min, max));
}
static PyObject *py_ue_frandomstream_reset(ue_PyFRandomStream *self, PyObject * args) {
self->rstream.Reset();
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *py_ue_frandomstream_vrand(ue_PyFRandomStream *self, PyObject * args) {
return py_ue_new_fvector(self->rstream.VRand());
}
static PyObject *py_ue_frandomstream_vrand_cone(ue_PyFRandomStream *self, PyObject * args) {
PyObject *py_obj;
float horizontal = 0;
float vertical = -1;
if (!PyArg_ParseTuple(args, "Of|f:vrand_cone", &py_obj, &horizontal, &vertical))
return NULL;
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_TypeError, "argument is not a FVector");
if (vertical < 0)
vertical = horizontal;
return py_ue_new_fvector(self->rstream.VRandCone(py_vec->vec, horizontal, vertical));
}
static PyMethodDef ue_PyFRandomStream_methods[] = {
{ "frand", (PyCFunction)py_ue_frandomstream_frand, METH_VARARGS, "" },
{ "frand_range", (PyCFunction)py_ue_frandomstream_frand_range, METH_VARARGS, "" },
{ "generate_new_seed", (PyCFunction)py_ue_frandomstream_generate_new_seed, METH_VARARGS, "" },
{ "get_current_seed", (PyCFunction)py_ue_frandomstream_get_current_seed, METH_VARARGS, "" },
{ "get_fraction", (PyCFunction)py_ue_frandomstream_get_fraction, METH_VARARGS, "" },
{ "get_initial_seed", (PyCFunction)py_ue_frandomstream_get_initial_seed, METH_VARARGS, "" },
{ "get_unit_vector", (PyCFunction)py_ue_frandomstream_get_unit_vector, METH_VARARGS, "" },
{ "get_unsigned_int", (PyCFunction)py_ue_frandomstream_get_unsigned_int, METH_VARARGS, "" },
{ "initialize", (PyCFunction)py_ue_frandomstream_initialize, METH_VARARGS, "" },
{ "rand_helper", (PyCFunction)py_ue_frandomstream_rand_helper, METH_VARARGS, "" },
{ "rand_range", (PyCFunction)py_ue_frandomstream_rand_range, METH_VARARGS, "" },
{ "reset", (PyCFunction)py_ue_frandomstream_reset, METH_VARARGS, "" },
{ "vrand", (PyCFunction)py_ue_frandomstream_vrand, METH_VARARGS, "" },
{ "vrand_cone", (PyCFunction)py_ue_frandomstream_vrand_cone, METH_VARARGS, "" },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFRandomStream_str(ue_PyFRandomStream *self)
{
return PyUnicode_FromFormat("<unreal_engine.FRandomStream {'seed': %d}>",
self->rstream.GetCurrentSeed());
}
static PyTypeObject ue_PyFRandomStreamType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FRandomStream", /* tp_name */
sizeof(ue_PyFRandomStream), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFRandomStream_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FRandomStream", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFRandomStream_methods, /* tp_methods */
0,
0,
};
static int ue_py_frandomstream_init(ue_PyFRandomStream *self, PyObject *args, PyObject *kwargs) {
self->rstream.GenerateNewSeed();
return 0;
}
void ue_python_init_frandomstream(PyObject *ue_module) {
ue_PyFRandomStreamType.tp_new = PyType_GenericNew;
ue_PyFRandomStreamType.tp_init = (initproc)ue_py_frandomstream_init;
if (PyType_Ready(&ue_PyFRandomStreamType) < 0)
return;
Py_INCREF(&ue_PyFRandomStreamType);
PyModule_AddObject(ue_module, "FRandomStream", (PyObject *)&ue_PyFRandomStreamType);
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFRandomStream.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,679 |
```c++
#include "UEPyFTransform.h"
static PyObject *py_ue_ftransform_inverse(ue_PyFTransform *self, PyObject * args)
{
return py_ue_new_ftransform(self->transform.Inverse());
}
static PyObject *py_ue_ftransform_normalize_rotation(ue_PyFTransform *self, PyObject * args)
{
FTransform transform = self->transform;
transform.NormalizeRotation();
return py_ue_new_ftransform(transform);
}
static PyObject *py_ue_ftransform_get_relative_transform(ue_PyFTransform *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFTransform *py_transform = py_ue_is_ftransform(py_obj);
if (!py_transform)
return PyErr_Format(PyExc_Exception, "argument is not a FTransform");
return py_ue_new_ftransform(self->transform.GetRelativeTransform(py_transform->transform));
}
static PyObject *py_ue_ftransform_transform_vector(ue_PyFTransform *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_Exception, "argument is not a FVector");
return py_ue_new_fvector(self->transform.TransformVector(py_vec->vec));
}
static PyObject *py_ue_ftransform_transform_vector_no_scale(ue_PyFTransform *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_Exception, "argument is not a FVector");
return py_ue_new_fvector(self->transform.TransformVectorNoScale(py_vec->vec));
}
static PyObject *py_ue_ftransform_transform_position(ue_PyFTransform *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_Exception, "argument is not a FVector");
return py_ue_new_fvector(self->transform.TransformPosition(py_vec->vec));
}
static PyObject *py_ue_ftransform_transform_position_no_scale(ue_PyFTransform *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFVector *py_vec = py_ue_is_fvector(py_obj);
if (!py_vec)
return PyErr_Format(PyExc_Exception, "argument is not a FVector");
return py_ue_new_fvector(self->transform.TransformPositionNoScale(py_vec->vec));
}
#if ENGINE_MINOR_VERSION > 17
static PyObject *py_ue_ftransform_transform_rotation(ue_PyFTransform *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O", &py_obj))
{
return nullptr;
}
ue_PyFQuat *py_quat = py_ue_is_fquat(py_obj);
if (!py_quat)
return PyErr_Format(PyExc_Exception, "argument is not a FQuat");
return py_ue_new_fquat(self->transform.TransformRotation(py_quat->quat));
}
#endif
static PyObject *py_ue_ftransform_get_matrix(ue_PyFTransform *self, PyObject * args)
{
FTransform transform = self->transform;
transform.NormalizeRotation();
FMatrix matrix = transform.ToMatrixWithScale();
UScriptStruct *u_struct = FindObject<UScriptStruct>(ANY_PACKAGE, UTF8_TO_TCHAR("Matrix"));
if (!u_struct)
{
return PyErr_Format(PyExc_Exception, "unable to get Matrix struct");
}
return py_ue_new_owned_uscriptstruct(u_struct, (uint8 *)&matrix);
}
static PyMethodDef ue_PyFTransform_methods[] = {
{ "inverse", (PyCFunction)py_ue_ftransform_inverse, METH_VARARGS, "" },
{ "get_relative_transform", (PyCFunction)py_ue_ftransform_get_relative_transform, METH_VARARGS, "" },
{ "normalize_rotation", (PyCFunction)py_ue_ftransform_normalize_rotation, METH_VARARGS, "" },
{ "get_matrix", (PyCFunction)py_ue_ftransform_get_matrix, METH_VARARGS, "" },
{ "transform_vector", (PyCFunction)py_ue_ftransform_transform_vector, METH_VARARGS, "" },
{ "transform_vector_no_scale", (PyCFunction)py_ue_ftransform_transform_vector_no_scale, METH_VARARGS, "" },
{ "transform_position", (PyCFunction)py_ue_ftransform_transform_position, METH_VARARGS, "" },
{ "transform_position_no_scale", (PyCFunction)py_ue_ftransform_transform_position_no_scale, METH_VARARGS, "" },
#if ENGINE_MINOR_VERSION > 17
{ "transform_rotation", (PyCFunction)py_ue_ftransform_transform_rotation, METH_VARARGS, "" },
#endif
{ NULL } /* Sentinel */
};
static PyObject *py_ue_ftransform_get_translation(ue_PyFTransform *self, void *closure)
{
return py_ue_new_fvector(self->transform.GetTranslation());
}
static PyObject *py_ue_ftransform_get_scale(ue_PyFTransform *self, void *closure)
{
return py_ue_new_fvector(self->transform.GetScale3D());
}
static PyObject *py_ue_ftransform_get_rotation(ue_PyFTransform *self, void *closure)
{
return py_ue_new_frotator(self->transform.GetRotation().Rotator());
}
static PyObject *py_ue_ftransform_get_quaternion(ue_PyFTransform *self, void *closure)
{
return py_ue_new_fquat(self->transform.GetRotation());
}
static int py_ue_ftransform_set_translation(ue_PyFTransform *self, PyObject *value, void *closure)
{
if (ue_PyFVector *py_vec = py_ue_is_fvector(value))
{
self->transform.SetLocation(py_vec->vec);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a vector");
return -1;
}
static int py_ue_ftransform_set_rotation(ue_PyFTransform *self, PyObject *value, void *closure)
{
if (ue_PyFRotator *py_rot = py_ue_is_frotator(value))
{
self->transform.SetRotation(py_rot->rot.Quaternion());
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a rotator");
return -1;
}
static int py_ue_ftransform_set_quaternion(ue_PyFTransform *self, PyObject *value, void *closure)
{
if (ue_PyFQuat *py_quat = py_ue_is_fquat(value))
{
self->transform.SetRotation(py_quat->quat);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a quaternion");
return -1;
}
static int py_ue_ftransform_set_scale(ue_PyFTransform *self, PyObject *value, void *closure)
{
if (ue_PyFVector *py_vec = py_ue_is_fvector(value))
{
self->transform.SetScale3D(py_vec->vec);
return 0;
}
PyErr_SetString(PyExc_TypeError, "value is not a vector");
return -1;
}
static PyGetSetDef ue_PyFTransform_getseters[] = {
{(char *) "translation", (getter)py_ue_ftransform_get_translation, (setter)py_ue_ftransform_set_translation, (char *)"", NULL },
{(char *) "scale", (getter)py_ue_ftransform_get_scale, (setter)py_ue_ftransform_set_scale, (char *)"", NULL },
{(char *) "rotation", (getter)py_ue_ftransform_get_rotation, (setter)py_ue_ftransform_set_rotation, (char *)"", NULL },
{(char *) "quaternion", (getter)py_ue_ftransform_get_quaternion, (setter)py_ue_ftransform_set_quaternion, (char *)"", NULL },
{ NULL } /* Sentinel */
};
static PyObject *ue_PyFTransform_str(ue_PyFTransform *self)
{
FVector vec = self->transform.GetTranslation();
FRotator rot = self->transform.Rotator();
FVector scale = self->transform.GetScale3D();
return PyUnicode_FromFormat("<unreal_engine.FTransform {'translation': (%S, %S, %S), 'rotation': (%S, %S, %S), 'scale': (%S, %S, %S)}>",
PyFloat_FromDouble(vec.X),
PyFloat_FromDouble(vec.Y),
PyFloat_FromDouble(vec.Z),
PyFloat_FromDouble(rot.Roll),
PyFloat_FromDouble(rot.Pitch),
PyFloat_FromDouble(rot.Yaw),
PyFloat_FromDouble(scale.X),
PyFloat_FromDouble(scale.Y),
PyFloat_FromDouble(scale.Z)
);
}
PyTypeObject ue_PyFTransformType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FTransform", /* tp_name */
sizeof(ue_PyFTransform), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
(reprfunc)ue_PyFTransform_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine FTransform", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFTransform_methods, /* tp_methods */
0,
ue_PyFTransform_getseters,
};
static int ue_py_ftransform_init(ue_PyFTransform *self, PyObject *args, PyObject *kwargs)
{
PyObject *py_translation = nullptr;
PyObject *py_rotation = nullptr;
PyObject *py_scale = nullptr;
if (!PyArg_ParseTuple(args, "|OOO:__init__", &py_translation, &py_rotation, &py_scale))
{
return -1;
}
if (py_translation)
{
if (ue_PyFVector *py_vec = py_ue_is_fvector(py_translation))
{
self->transform.SetTranslation(py_vec->vec);
}
else
{
PyObject *py_iter = PyObject_GetIter(py_translation);
if (py_iter)
{
FMatrix matrix;
for (int row = 0; row < 4; row++)
{
for (int column = 0; column < 4; column++)
{
PyObject *py_item = PyIter_Next(py_iter);
if (!py_item)
{
PyErr_SetString(PyExc_Exception, "matrix is not 4x4");
Py_DECREF(py_iter);
return -1;
}
if (!PyNumber_Check(py_item))
{
PyErr_SetString(PyExc_Exception, "matrix can contains only float");
Py_DECREF(py_iter);
return -1;
}
PyObject *py_num = PyNumber_Float(py_item);
if (!py_num)
{
PyErr_SetString(PyExc_Exception, "matrix can contains only float");
Py_DECREF(py_iter);
return -1;
}
matrix.M[row][column] = PyFloat_AsDouble(py_num);
Py_DECREF(py_num);
}
}
self->transform.SetFromMatrix(matrix);
Py_DECREF(py_iter);
return 0;
}
PyErr_SetString(PyExc_Exception, "argument is not a FVector or a 4x4 float matrix");
return -1;
}
}
if (py_rotation)
{
if (ue_PyFRotator *py_rot = py_ue_is_frotator(py_rotation))
{
self->transform.SetRotation(py_rot->rot.Quaternion());
}
else if (ue_PyFQuat *py_quat = py_ue_is_fquat(py_rotation))
{
self->transform.SetRotation(py_quat->quat);
}
else
{
PyErr_SetString(PyExc_Exception, "argument is not a FRotator or a FQuat");
return -1;
}
}
else
{
self->transform.SetRotation(FQuat::Identity);
}
// ensure scaling is set to 1,1,1
FVector scale(1, 1, 1);
if (py_scale)
{
if (ue_PyFVector *py_vec = py_ue_is_fvector(py_scale))
{
scale = py_vec->vec;
}
else
{
PyErr_SetString(PyExc_Exception, "argument is not a FVector");
return -1;
}
}
self->transform.SetScale3D(scale);
return 0;
}
static PyObject *ue_py_ftransform_mul(ue_PyFTransform *self, PyObject *value)
{
FTransform t = self->transform;
if (ue_PyFQuat *py_quat = py_ue_is_fquat(value))
{
t *= py_quat->quat;
}
else if (ue_PyFRotator *py_rot = py_ue_is_frotator(value))
{
t *= py_rot->rot.Quaternion();
}
else if (ue_PyFTransform *py_transform = py_ue_is_ftransform(value))
{
t *= py_transform->transform;
}
else
{
return PyErr_Format(PyExc_TypeError, "FTransform can be multiplied only for an FQuat, an FRotator or an FTransform");
}
return py_ue_new_ftransform(t);
}
PyNumberMethods ue_PyFTransform_number_methods;
void ue_python_init_ftransform(PyObject *ue_module)
{
ue_PyFTransformType.tp_new = PyType_GenericNew;
ue_PyFTransformType.tp_init = (initproc)ue_py_ftransform_init;
memset(&ue_PyFTransform_number_methods, 0, sizeof(PyNumberMethods));
ue_PyFTransformType.tp_as_number = &ue_PyFTransform_number_methods;
ue_PyFTransform_number_methods.nb_multiply = (binaryfunc)ue_py_ftransform_mul;
if (PyType_Ready(&ue_PyFTransformType) < 0)
return;
Py_INCREF(&ue_PyFTransformType);
PyModule_AddObject(ue_module, "FTransform", (PyObject *)&ue_PyFTransformType);
}
PyObject *py_ue_new_ftransform(FTransform transform)
{
ue_PyFTransform *ret = (ue_PyFTransform *)PyObject_New(ue_PyFTransform, &ue_PyFTransformType);
ret->transform = transform;
return (PyObject *)ret;
}
ue_PyFTransform *py_ue_is_ftransform(PyObject *obj)
{
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFTransformType))
return nullptr;
return (ue_PyFTransform *)obj;
}
bool py_ue_transform_arg(PyObject *args, FTransform &t)
{
if (PyTuple_Size(args) == 1)
{
PyObject *arg = PyTuple_GetItem(args, 0);
ue_PyFTransform *py_t = py_ue_is_ftransform(arg);
if (!py_t)
{
PyErr_Format(PyExc_TypeError, "argument is not a FTransform");
return false;
}
t = py_t->transform;
return true;
}
float x, y, z;
float roll, pitch, yaw;
float sx, sy, sz;
if (!PyArg_ParseTuple(args, "fffffffff", &x, &y, &z, &roll, &pitch, &yaw, &sx, &sy, &sz))
return false;
t.SetLocation(FVector(x, y, z));
t.SetRotation(FRotator(pitch, yaw, roll).Quaternion());
t.SetScale3D(FVector(sx, sy, sz));
return true;
}
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFTransform.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,627 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#include "Misc/SlowTask.h"
#if WITH_EDITOR
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
FSlowTask slowtask;
} ue_PyFSlowTask;
void ue_python_init_fslowtask(PyObject *);
ue_PyFSlowTask *py_ue_is_fslowtask(PyObject *);
#endif
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFSlowTask.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 81 |
```objective-c
#pragma once
#include "UEPyModule.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
FVector vec;
} ue_PyFVector;
extern PyTypeObject ue_PyFVectorType;
PyObject *py_ue_new_fvector(FVector);
ue_PyFVector *py_ue_is_fvector(PyObject *);
void ue_python_init_fvector(PyObject *);
bool py_ue_vector_arg(PyObject *, FVector &);
``` | /content/code_sandbox/Source/UnrealEnginePython/Private/Wrappers/UEPyFVector.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 92 |
```smalltalk
using UnrealBuildTool;
using System.IO;
public class PythonAutomation : ModuleRules
{
#if WITH_FORWARDED_MODULE_RULES_CTOR
public PythonAutomation(ReadOnlyTargetRules Target) : base(Target)
#else
public PythonAutomation(TargetInfo Target)
#endif
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
PrivateIncludePaths.AddRange(
new string[] {
"PythonConsole/Private",
// ... add other private include paths required here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject", // @todo Mac: for some reason it's needed to link in debug on Mac
"Engine",
"UnrealEd",
"UnrealEnginePython"
}
);
}
}
``` | /content/code_sandbox/Source/PythonAutomation/PythonAutomation.Build.cs | smalltalk | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 208 |
```objective-c
#pragma once
#include "CoreMinimal.h"
#if ENGINE_MAJOR_VERSION==4 && ENGINE_MINOR_VERSION>=22
#include "Modules/ModuleInterface.h"
#else
#include "ModuleInterface.h"
#endif
class FPythonAutomationModule : public IModuleInterface
{
public:
virtual void StartupModule();
virtual void ShutdownModule();
};
``` | /content/code_sandbox/Source/PythonAutomation/Public/PythonAutomationModule.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 67 |
```objective-c
#pragma once
#include "UnrealEnginePython.h"
#include "Tests/AutomationEditorCommon.h"
typedef struct
{
PyObject_HEAD
/* Type-specific fields go here. */
} ue_PyFAutomationEditorCommonUtils;
void ue_python_init_fautomation_editor_common_utils(PyObject *);
``` | /content/code_sandbox/Source/PythonAutomation/Private/UEPyFAutomationEditorCommonUtils.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 60 |
```c++
#include "UEPyFAutomationEditorCommonUtils.h"
#include "UnrealEnginePython.h"
#include "Engine/World.h"
static PyObject *py_ue_fautomation_editor_common_utils_run_pie(PyObject *cls, PyObject * args)
{
Py_BEGIN_ALLOW_THREADS;
FAutomationEditorCommonUtils::RunPIE();
Py_END_ALLOW_THREADS;
Py_RETURN_NONE;
}
static PyObject *py_ue_fautomation_editor_common_utils_load_map(PyObject *cls, PyObject * args)
{
char *map_name;
if (!PyArg_ParseTuple(args, "s:load_map", &map_name))
return nullptr;
Py_BEGIN_ALLOW_THREADS;
FAutomationEditorCommonUtils::LoadMap(FString(UTF8_TO_TCHAR(map_name)));
Py_END_ALLOW_THREADS;
Py_RETURN_NONE;
}
static PyObject *py_ue_fautomation_editor_common_utils_create_new_map(PyObject *cls, PyObject * args)
{
Py_RETURN_UOBJECT(FAutomationEditorCommonUtils::CreateNewMap());
}
static PyMethodDef ue_PyFAutomationEditorCommonUtils_methods[] = {
{ "run_pie", (PyCFunction)py_ue_fautomation_editor_common_utils_run_pie, METH_VARARGS | METH_CLASS, "" },
{ "load_map", (PyCFunction)py_ue_fautomation_editor_common_utils_load_map, METH_VARARGS | METH_CLASS, "" },
{ "create_new_map", (PyCFunction)py_ue_fautomation_editor_common_utils_create_new_map, METH_VARARGS | METH_CLASS, "" },
{ NULL } /* Sentinel */
};
static PyTypeObject ue_PyFAutomationEditorCommonUtilsType = {
PyVarObject_HEAD_INIT(NULL, 0)
"unreal_engine.FAutomationEditorCommonUtils", /* tp_name */
sizeof(ue_PyFAutomationEditorCommonUtils), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Unreal Engine AutomationEditorCommonUtils", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ue_PyFAutomationEditorCommonUtils_methods, /* tp_methods */
0,
0,
};
static int py_ue_fautomation_editor_common_utils_init(ue_PyFAutomationEditorCommonUtils *self, PyObject * args)
{
PyErr_SetString(PyExc_Exception, "FAutomationEditorCommonUtils is a singleton");
return -1;
}
void ue_python_init_fautomation_editor_common_utils(PyObject *ue_module)
{
ue_PyFAutomationEditorCommonUtilsType.tp_new = PyType_GenericNew;
ue_PyFAutomationEditorCommonUtilsType.tp_init = (initproc)py_ue_fautomation_editor_common_utils_init;
if (PyType_Ready(&ue_PyFAutomationEditorCommonUtilsType) < 0)
return;
Py_INCREF(&ue_PyFAutomationEditorCommonUtilsType);
PyModule_AddObject(ue_module, "FAutomationEditorCommonUtils", (PyObject *)&ue_PyFAutomationEditorCommonUtilsType);
}
``` | /content/code_sandbox/Source/PythonAutomation/Private/UEPyFAutomationEditorCommonUtils.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 790 |
```c++
#include "PythonAutomationModule.h"
#include "UnrealEnginePython.h"
#include "UEPyFAutomationEditorCommonUtils.h"
IMPLEMENT_MODULE(FPythonAutomationModule, PythonAutomation);
void FPythonAutomationModule::StartupModule()
{
FScopePythonGIL gil;
PyObject *py_automation_module = ue_py_register_module("unreal_engine.automation");
ue_python_init_fautomation_editor_common_utils(py_automation_module);
}
void FPythonAutomationModule::ShutdownModule()
{
}
``` | /content/code_sandbox/Source/PythonAutomation/Private/PythonAutomationModule.cpp | c++ | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 102 |
```objective-c
/* pyconfig.h. Generated from pyconfig.h.in by configure. */
/* pyconfig.h.in. Generated from configure.ac by autoheader. */
#ifndef Py_PYCONFIG_H
#define Py_PYCONFIG_H
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
support for AIX C++ shared extension modules. */
/* #undef AIX_GENUINE_CPLUSPLUS */
/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM
mixed-endian order (byte order 45670123) */
/* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most
significant byte first */
/* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the
least significant byte first */
/* #undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 */
/* Define if --enable-ipv6 is specified */
#define ENABLE_IPV6 1
/* Define if flock needs to be linked with bsd library. */
/* #undef FLOCK_NEEDS_LIBBSD */
/* Define if getpgrp() must be called as getpgrp(0). */
/* #undef GETPGRP_HAVE_ARG */
/* Define if gettimeofday() does not have second (timezone) argument This is
the case on Motorola V4 (R40V4.2) */
/* #undef GETTIMEOFDAY_NO_TZ */
/* Define to 1 if you have the `accept4' function. */
#define HAVE_ACCEPT4 1
/* Define to 1 if you have the `acosh' function. */
#define HAVE_ACOSH 1
/* struct addrinfo (netdb.h) */
#define HAVE_ADDRINFO 1
/* Define to 1 if you have the `alarm' function. */
#define HAVE_ALARM 1
/* Define if aligned memory access is required */
#define HAVE_ALIGNED_REQUIRED 1
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define this if your time.h defines altzone. */
/* #undef HAVE_ALTZONE */
/* Define to 1 if you have the `asinh' function. */
#define HAVE_ASINH 1
/* Define to 1 if you have the <asm/types.h> header file. */
#define HAVE_ASM_TYPES_H 1
/* Define to 1 if you have the `atanh' function. */
#define HAVE_ATANH 1
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */
/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */
/* #undef HAVE_BLUETOOTH_BLUETOOTH_H */
/* Define to 1 if you have the <bluetooth.h> header file. */
/* #undef HAVE_BLUETOOTH_H */
/* Define if mbstowcs(NULL, "text", 0) does not return the number of wide
chars that would be converted. */
/* #undef HAVE_BROKEN_MBSTOWCS */
/* Define if nice() returns success/failure instead of the new priority. */
/* #undef HAVE_BROKEN_NICE */
/* Define if the system reports an invalid PIPE_BUF value. */
/* #undef HAVE_BROKEN_PIPE_BUF */
/* Define if poll() sets errno on invalid file descriptors. */
/* #undef HAVE_BROKEN_POLL */
/* Define if the Posix semaphores do not work on your system */
/* #undef HAVE_BROKEN_POSIX_SEMAPHORES */
/* Define if pthread_sigmask() does not work on your system. */
/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */
/* define to 1 if your sem_getvalue is broken. */
#define HAVE_BROKEN_SEM_GETVALUE 1
/* Define if `unsetenv` does not return an int. */
/* #undef HAVE_BROKEN_UNSETENV */
/* Has builtin atomics */
#define HAVE_BUILTIN_ATOMIC 1
/* Define this if you have the type _Bool. */
#define HAVE_C99_BOOL 1
/* Define to 1 if you have the 'chflags' function. */
/* #undef HAVE_CHFLAGS */
/* Define to 1 if you have the `chown' function. */
#define HAVE_CHOWN 1
/* Define if you have the 'chroot' function. */
#define HAVE_CHROOT 1
/* Define to 1 if you have the `clock' function. */
#define HAVE_CLOCK 1
/* Define to 1 if you have the `clock_getres' function. */
#define HAVE_CLOCK_GETRES 1
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* Define if the C compiler supports computed gotos. */
#define HAVE_COMPUTED_GOTOS 1
/* Define to 1 if you have the `confstr' function. */
/* #undef HAVE_CONFSTR */
/* Define to 1 if you have the <conio.h> header file. */
/* #undef HAVE_CONIO_H */
/* Define to 1 if you have the `copysign' function. */
#define HAVE_COPYSIGN 1
/* Define to 1 if you have the `ctermid' function. */
/* #undef HAVE_CTERMID */
/* Define if you have the 'ctermid_r' function. */
#define HAVE_CTERMID_R 1
/* Define to 1 if you have the <curses.h> header file. */
/* #undef HAVE_CURSES_H */
/* Define if you have the 'is_term_resized' function. */
/* #undef HAVE_CURSES_IS_TERM_RESIZED */
/* Define if you have the 'resizeterm' function. */
/* #undef HAVE_CURSES_RESIZETERM */
/* Define if you have the 'resize_term' function. */
/* #undef HAVE_CURSES_RESIZE_TERM */
/* Define to 1 if you have the declaration of `isfinite', and to 0 if you
don't. */
#define HAVE_DECL_ISFINITE 1
/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
*/
#define HAVE_DECL_ISINF 1
/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
*/
#define HAVE_DECL_ISNAN 1
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
*/
/* #undef HAVE_DECL_TZNAME */
/* Define to 1 if you have the device macros. */
#define HAVE_DEVICE_MACROS 1
/* Define to 1 if you have the /dev/ptc device file. */
/* #undef HAVE_DEV_PTC */
/* Define to 1 if you have the /dev/ptmx device file. */
/* #undef HAVE_DEV_PTMX */
/* Define to 1 if you have the <direct.h> header file. */
/* #undef HAVE_DIRECT_H */
/* Define to 1 if the dirent structure has a d_type field */
#define HAVE_DIRENT_D_TYPE 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define if you have the 'dirfd' function or macro. */
#define HAVE_DIRFD 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `dlopen' function. */
#define HAVE_DLOPEN 1
/* Define to 1 if you have the `dup2' function. */
#define HAVE_DUP2 1
/* Define to 1 if you have the `dup3' function. */
#define HAVE_DUP3 1
/* Defined when any dynamic module loading is enabled. */
#define HAVE_DYNAMIC_LOADING 1
/* Define to 1 if you have the <endian.h> header file. */
#define HAVE_ENDIAN_H 1
/* Define if you have the 'epoll' functions. */
#define HAVE_EPOLL 1
/* Define if you have the 'epoll_create1' function. */
#define HAVE_EPOLL_CREATE1 1
/* Define to 1 if you have the `erf' function. */
#define HAVE_ERF 1
/* Define to 1 if you have the `erfc' function. */
#define HAVE_ERFC 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the `execv' function. */
#define HAVE_EXECV 1
/* Define to 1 if you have the `expm1' function. */
#define HAVE_EXPM1 1
/* Define to 1 if you have the `faccessat' function. */
/* #undef HAVE_FACCESSAT */
/* Define if you have the 'fchdir' function. */
#define HAVE_FCHDIR 1
/* Define to 1 if you have the `fchmod' function. */
#define HAVE_FCHMOD 1
/* Define to 1 if you have the `fchmodat' function. */
#define HAVE_FCHMODAT 1
/* Define to 1 if you have the `fchown' function. */
#define HAVE_FCHOWN 1
/* Define to 1 if you have the `fchownat' function. */
#define HAVE_FCHOWNAT 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the 'fdatasync' function. */
#define HAVE_FDATASYNC 1
/* Define to 1 if you have the `fdopendir' function. */
#define HAVE_FDOPENDIR 1
/* Define to 1 if you have the `fexecve' function. */
/* #undef HAVE_FEXECVE */
/* Define to 1 if you have the `finite' function. */
#define HAVE_FINITE 1
/* Define to 1 if you have the `flock' function. */
#define HAVE_FLOCK 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if you have the `forkpty' function. */
/* #undef HAVE_FORKPTY */
/* Define to 1 if you have the `fpathconf' function. */
#define HAVE_FPATHCONF 1
/* Define to 1 if you have the `fseek64' function. */
/* #undef HAVE_FSEEK64 */
/* Define to 1 if you have the `fseeko' function. */
#define HAVE_FSEEKO 1
/* Define to 1 if you have the `fstatat' function. */
#define HAVE_FSTATAT 1
/* Define to 1 if you have the `fstatvfs' function. */
#define HAVE_FSTATVFS 1
/* Define if you have the 'fsync' function. */
#define HAVE_FSYNC 1
/* Define to 1 if you have the `ftell64' function. */
/* #undef HAVE_FTELL64 */
/* Define to 1 if you have the `ftello' function. */
#define HAVE_FTELLO 1
/* Define to 1 if you have the `ftime' function. */
/* #undef HAVE_FTIME */
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the `futimens' function. */
#define HAVE_FUTIMENS 1
/* Define to 1 if you have the `futimes' function. */
/* #undef HAVE_FUTIMES */
/* Define to 1 if you have the `futimesat' function. */
/* #undef HAVE_FUTIMESAT */
/* Define to 1 if you have the `gai_strerror' function. */
#define HAVE_GAI_STRERROR 1
/* Define to 1 if you have the `gamma' function. */
/* #undef HAVE_GAMMA */
/* Define if we can use gcc inline assembler to get and set mc68881 fpcr */
/* #undef HAVE_GCC_ASM_FOR_MC68881 */
/* Define if we can use x64 gcc inline assembler */
#define HAVE_GCC_ASM_FOR_X64 1
/* Define if we can use gcc inline assembler to get and set x87 control word
*/
#define HAVE_GCC_ASM_FOR_X87 1
/* Define if your compiler provides __uint128_t */
#define HAVE_GCC_UINT128_T 1
/* Define if you have the getaddrinfo function. */
#define HAVE_GETADDRINFO 1
/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */
#define HAVE_GETC_UNLOCKED 1
/* Define to 1 if you have the `getentropy' function. */
/* #undef HAVE_GETENTROPY */
/* Define to 1 if you have the `getgrouplist' function. */
#define HAVE_GETGROUPLIST 1
/* Define to 1 if you have the `getgroups' function. */
#define HAVE_GETGROUPS 1
/* Define to 1 if you have the `gethostbyname' function. */
#define HAVE_GETHOSTBYNAME 1
/* Define this if you have some version of gethostbyname_r() */
/* #undef HAVE_GETHOSTBYNAME_R */
/* Define this if you have the 3-arg version of gethostbyname_r(). */
/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */
/* Define this if you have the 5-arg version of gethostbyname_r(). */
/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */
/* Define this if you have the 6-arg version of gethostbyname_r(). */
/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */
/* Define to 1 if you have the `getitimer' function. */
#define HAVE_GETITIMER 1
/* Define to 1 if you have the `getloadavg' function. */
#define HAVE_GETLOADAVG 1
/* Define to 1 if you have the `getlogin' function. */
#define HAVE_GETLOGIN 1
/* Define to 1 if you have the `getnameinfo' function. */
#define HAVE_GETNAMEINFO 1
/* Define if you have the 'getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getpeername' function. */
#define HAVE_GETPEERNAME 1
/* Define to 1 if you have the `getpgid' function. */
#define HAVE_GETPGID 1
/* Define to 1 if you have the `getpgrp' function. */
#define HAVE_GETPGRP 1
/* Define to 1 if you have the `getpid' function. */
#define HAVE_GETPID 1
/* Define to 1 if you have the `getpriority' function. */
#define HAVE_GETPRIORITY 1
/* Define to 1 if you have the `getpwent' function. */
#define HAVE_GETPWENT 1
/* Define to 1 if the Linux getrandom() syscall is available */
/* #undef HAVE_GETRANDOM_SYSCALL */
/* Define to 1 if you have the `getresgid' function. */
#define HAVE_GETRESGID 1
/* Define to 1 if you have the `getresuid' function. */
#define HAVE_GETRESUID 1
/* Define to 1 if you have the `getsid' function. */
#define HAVE_GETSID 1
/* Define to 1 if you have the `getspent' function. */
/* #undef HAVE_GETSPENT */
/* Define to 1 if you have the `getspnam' function. */
/* #undef HAVE_GETSPNAM */
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `getwd' function. */
/* #undef HAVE_GETWD */
/* Define if glibc has incorrect _FORTIFY_SOURCE wrappers for memmove and
bcopy. */
/* #undef HAVE_GLIBC_MEMMOVE_BUG */
/* Define to 1 if you have the <grp.h> header file. */
#define HAVE_GRP_H 1
/* Define if you have the 'hstrerror' function. */
#define HAVE_HSTRERROR 1
/* Define this if you have le64toh() */
#define HAVE_HTOLE64 1
/* Define to 1 if you have the `hypot' function. */
#define HAVE_HYPOT 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define to 1 if you have the `if_nameindex' function. */
/* #undef HAVE_IF_NAMEINDEX */
/* Define if you have the 'inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define if you have the 'inet_pton' function. */
#define HAVE_INET_PTON 1
/* Define to 1 if you have the `initgroups' function. */
#define HAVE_INITGROUPS 1
/* Define if your compiler provides int32_t. */
#define HAVE_INT32_T 1
/* Define if your compiler provides int64_t. */
#define HAVE_INT64_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
/* Define if gcc has the ipa-pure-const bug. */
/* #undef HAVE_IPA_PURE_CONST_BUG */
/* Define to 1 if you have the `kill' function. */
#define HAVE_KILL 1
/* Define to 1 if you have the `killpg' function. */
#define HAVE_KILLPG 1
/* Define if you have the 'kqueue' functions. */
#define HAVE_KQUEUE 1
/* Define to 1 if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1
/* Defined to enable large file support when an off_t is bigger than a long
and long long is available and at least as big as an off_t. You may need to
add some flags for configuration and compilation to enable this mode. (For
Solaris and Linux, the necessary defines are already defined.) */
/* #undef HAVE_LARGEFILE_SUPPORT */
/* Define to 1 if you have the 'lchflags' function. */
/* #undef HAVE_LCHFLAGS */
/* Define to 1 if you have the `lchmod' function. */
/* #undef HAVE_LCHMOD */
/* Define to 1 if you have the `lchown' function. */
#define HAVE_LCHOWN 1
/* Define to 1 if you have the `lgamma' function. */
#define HAVE_LGAMMA 1
/* Define to 1 if you have the `dl' library (-ldl). */
#define HAVE_LIBDL 1
/* Define to 1 if you have the `dld' library (-ldld). */
/* #undef HAVE_LIBDLD */
/* Define to 1 if you have the `ieee' library (-lieee). */
/* #undef HAVE_LIBIEEE */
/* Define to 1 if you have the <libintl.h> header file. */
/* #undef HAVE_LIBINTL_H */
/* Define if you have the readline library (-lreadline). */
/* #undef HAVE_LIBREADLINE */
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define to 1 if you have the `sendfile' library (-lsendfile). */
/* #undef HAVE_LIBSENDFILE */
/* Define to 1 if you have the <libutil.h> header file. */
/* #undef HAVE_LIBUTIL_H */
/* Define if you have the 'link' function. */
#define HAVE_LINK 1
/* Define to 1 if you have the `linkat' function. */
#define HAVE_LINKAT 1
/* Define to 1 if you have the <linux/can/bcm.h> header file. */
/* #undef HAVE_LINUX_CAN_BCM_H */
/* Define to 1 if you have the <linux/can.h> header file. */
#define HAVE_LINUX_CAN_H 1
/* Define if compiling using Linux 3.6 or later. */
#define HAVE_LINUX_CAN_RAW_FD_FRAMES 1
/* Define to 1 if you have the <linux/can/raw.h> header file. */
#define HAVE_LINUX_CAN_RAW_H 1
/* Define to 1 if you have the <linux/netlink.h> header file. */
#define HAVE_LINUX_NETLINK_H 1
/* Define to 1 if you have the <linux/tipc.h> header file. */
#define HAVE_LINUX_TIPC_H 1
/* Define to 1 if you have the `lockf' function. */
#define HAVE_LOCKF 1
/* Define to 1 if you have the `log1p' function. */
#define HAVE_LOG1P 1
/* Define to 1 if you have the `log2' function. */
#define HAVE_LOG2 1
/* Define this if you have the type long double. */
#define HAVE_LONG_DOUBLE 1
/* Define this if you have the type long long. */
#define HAVE_LONG_LONG 1
/* Define to 1 if you have the `lstat' function. */
#define HAVE_LSTAT 1
/* Define to 1 if you have the `lutimes' function. */
/* #undef HAVE_LUTIMES */
/* Define this if you have the makedev macro. */
#define HAVE_MAKEDEV 1
/* Define to 1 if you have the `mbrtowc' function. */
#define HAVE_MBRTOWC 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memrchr' function. */
#define HAVE_MEMRCHR 1
/* Define to 1 if you have the `mkdirat' function. */
#define HAVE_MKDIRAT 1
/* Define to 1 if you have the `mkfifo' function. */
#define HAVE_MKFIFO 1
/* Define to 1 if you have the `mkfifoat' function. */
/* #undef HAVE_MKFIFOAT */
/* Define to 1 if you have the `mknod' function. */
#define HAVE_MKNOD 1
/* Define to 1 if you have the `mknodat' function. */
#define HAVE_MKNODAT 1
/* Define to 1 if you have the `mktime' function. */
#define HAVE_MKTIME 1
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1
/* Define to 1 if you have the `mremap' function. */
#define HAVE_MREMAP 1
/* Define to 1 if you have the <ncurses.h> header file. */
/* #undef HAVE_NCURSES_H */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netpacket/packet.h> header file. */
#define HAVE_NETPACKET_PACKET_H 1
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the `nice' function. */
#define HAVE_NICE 1
/* Define to 1 if you have the `openat' function. */
#define HAVE_OPENAT 1
/* Define to 1 if you have the `openpty' function. */
/* #undef HAVE_OPENPTY */
/* Define if compiling using MacOS X 10.5 SDK or later. */
/* #undef HAVE_OSX105_SDK */
/* Define to 1 if you have the `pathconf' function. */
#define HAVE_PATHCONF 1
/* Define to 1 if you have the `pause' function. */
#define HAVE_PAUSE 1
/* Define to 1 if you have the `pipe2' function. */
#define HAVE_PIPE2 1
/* Define to 1 if you have the `plock' function. */
/* #undef HAVE_PLOCK */
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the `posix_fadvise' function. */
#define HAVE_POSIX_FADVISE 1
/* Define to 1 if you have the `posix_fallocate' function. */
#define HAVE_POSIX_FALLOCATE 1
/* Define to 1 if you have the `pread' function. */
#define HAVE_PREAD 1
/* Define if you have the 'prlimit' functions. */
#define HAVE_PRLIMIT 1
/* Define to 1 if you have the <process.h> header file. */
/* #undef HAVE_PROCESS_H */
/* Define if your compiler supports function prototype */
#define HAVE_PROTOTYPES 1
/* Define to 1 if you have the `pthread_atfork' function. */
#define HAVE_PTHREAD_ATFORK 1
/* Defined for Solaris 2.6 bug in pthread header. */
/* #undef HAVE_PTHREAD_DESTRUCTOR */
/* Define to 1 if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1
/* Define to 1 if you have the `pthread_init' function. */
/* #undef HAVE_PTHREAD_INIT */
/* Define to 1 if you have the `pthread_kill' function. */
#define HAVE_PTHREAD_KILL 1
/* Define to 1 if you have the `pthread_sigmask' function. */
#define HAVE_PTHREAD_SIGMASK 1
/* Define to 1 if you have the <pty.h> header file. */
/* #undef HAVE_PTY_H */
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
/* Define to 1 if you have the `pwrite' function. */
#define HAVE_PWRITE 1
/* Define if the libcrypto has RAND_egd */
/* #undef HAVE_RAND_EGD */
/* Define to 1 if you have the `readlink' function. */
#define HAVE_READLINK 1
/* Define to 1 if you have the `readlinkat' function. */
#define HAVE_READLINKAT 1
/* Define to 1 if you have the `readv' function. */
#define HAVE_READV 1
/* Define to 1 if you have the `realpath' function. */
#define HAVE_REALPATH 1
/* Define to 1 if you have the `renameat' function. */
#define HAVE_RENAMEAT 1
/* Define if readline supports append_history */
/* #undef HAVE_RL_APPEND_HISTORY */
/* Define if you have readline 2.1 */
/* #undef HAVE_RL_CALLBACK */
/* Define if you can turn off readline's signal handling. */
/* #undef HAVE_RL_CATCH_SIGNAL */
/* Define if you have readline 2.2 */
/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
/* Define if you have readline 4.2 */
/* #undef HAVE_RL_COMPLETION_MATCHES */
/* Define if you have rl_completion_suppress_append */
/* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_PRE_INPUT_HOOK */
/* Define to 1 if you have the `round' function. */
#define HAVE_ROUND 1
/* Define to 1 if you have the `sched_get_priority_max' function. */
#define HAVE_SCHED_GET_PRIORITY_MAX 1
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 1
/* Define to 1 if you have the `sched_rr_get_interval' function. */
#define HAVE_SCHED_RR_GET_INTERVAL 1
/* Define to 1 if you have the `sched_setaffinity' function. */
#define HAVE_SCHED_SETAFFINITY 1
/* Define to 1 if you have the `sched_setparam' function. */
#define HAVE_SCHED_SETPARAM 1
/* Define to 1 if you have the `sched_setscheduler' function. */
#define HAVE_SCHED_SETSCHEDULER 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `sem_getvalue' function. */
#define HAVE_SEM_GETVALUE 1
/* Define to 1 if you have the `sem_open' function. */
#define HAVE_SEM_OPEN 1
/* Define to 1 if you have the `sem_timedwait' function. */
#define HAVE_SEM_TIMEDWAIT 1
/* Define to 1 if you have the `sem_unlink' function. */
#define HAVE_SEM_UNLINK 1
/* Define to 1 if you have the `sendfile' function. */
#define HAVE_SENDFILE 1
/* Define to 1 if you have the `setegid' function. */
#define HAVE_SETEGID 1
/* Define to 1 if you have the `seteuid' function. */
#define HAVE_SETEUID 1
/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1
/* Define if you have the 'setgroups' function. */
#define HAVE_SETGROUPS 1
/* Define to 1 if you have the `sethostname' function. */
/* #undef HAVE_SETHOSTNAME */
/* Define to 1 if you have the `setitimer' function. */
#define HAVE_SETITIMER 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setpgid' function. */
#define HAVE_SETPGID 1
/* Define to 1 if you have the `setpgrp' function. */
#define HAVE_SETPGRP 1
/* Define to 1 if you have the `setpriority' function. */
#define HAVE_SETPRIORITY 1
/* Define to 1 if you have the `setregid' function. */
#define HAVE_SETREGID 1
/* Define to 1 if you have the `setresgid' function. */
#define HAVE_SETRESGID 1
/* Define to 1 if you have the `setresuid' function. */
#define HAVE_SETRESUID 1
/* Define to 1 if you have the `setreuid' function. */
#define HAVE_SETREUID 1
/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if you have the `setvbuf' function. */
#define HAVE_SETVBUF 1
/* Define to 1 if you have the <shadow.h> header file. */
/* #undef HAVE_SHADOW_H */
/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
/* Define to 1 if you have the `sigaltstack' function. */
#define HAVE_SIGALTSTACK 1
/* Define to 1 if you have the `siginterrupt' function. */
#define HAVE_SIGINTERRUPT 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the `sigpending' function. */
#define HAVE_SIGPENDING 1
/* Define to 1 if you have the `sigrelse' function. */
/* #undef HAVE_SIGRELSE */
/* Define to 1 if you have the `sigtimedwait' function. */
/* #undef HAVE_SIGTIMEDWAIT */
/* Define to 1 if you have the `sigwait' function. */
#define HAVE_SIGWAIT 1
/* Define to 1 if you have the `sigwaitinfo' function. */
/* #undef HAVE_SIGWAITINFO */
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define if sockaddr has sa_len member */
/* #undef HAVE_SOCKADDR_SA_LEN */
/* struct sockaddr_storage (sys/socket.h) */
#define HAVE_SOCKADDR_STORAGE 1
/* Define if you have the 'socketpair' function. */
#define HAVE_SOCKETPAIR 1
/* Define to 1 if you have the <spawn.h> header file. */
/* #undef HAVE_SPAWN_H */
/* Define if your compiler provides ssize_t */
#define HAVE_SSIZE_T 1
/* Define to 1 if you have the `statvfs' function. */
#define HAVE_STATVFS 1
/* Define if you have struct stat.st_mtim.tv_nsec */
/* #undef HAVE_STAT_TV_NSEC */
/* Define if you have struct stat.st_mtimensec */
/* #undef HAVE_STAT_TV_NSEC2 */
/* Define if your compiler supports variable length function prototypes (e.g.
void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
#define HAVE_STDARG_PROTOTYPES 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Has stdatomic.h, atomic_int and _Atomic void* types work */
#define HAVE_STD_ATOMIC 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the <stropts.h> header file. */
/* #undef HAVE_STROPTS_H */
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
/* Define to 1 if `st_flags' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_FLAGS */
/* Define to 1 if `st_gen' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_GEN */
/* Define to 1 if `st_rdev' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_RDEV 1
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#define HAVE_STRUCT_TM_TM_ZONE 1
/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
`HAVE_STRUCT_STAT_ST_BLOCKS' instead. */
#define HAVE_ST_BLOCKS 1
/* Define if you have the 'symlink' function. */
#define HAVE_SYMLINK 1
/* Define to 1 if you have the `symlinkat' function. */
#define HAVE_SYMLINKAT 1
/* Define to 1 if you have the `sync' function. */
#define HAVE_SYNC 1
/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1
/* Define to 1 if you have the <sysexits.h> header file. */
#define HAVE_SYSEXITS_H 1
/* Define to 1 if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define to 1 if you have the <sys/bsdtty.h> header file. */
/* #undef HAVE_SYS_BSDTTY_H */
/* Define to 1 if you have the <sys/devpoll.h> header file. */
/* #undef HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/endian.h> header file. */
#define HAVE_SYS_ENDIAN_H 1
/* Define to 1 if you have the <sys/epoll.h> header file. */
#define HAVE_SYS_EPOLL_H 1
/* Define to 1 if you have the <sys/event.h> header file. */
#define HAVE_SYS_EVENT_H 1
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/kern_control.h> header file. */
/* #undef HAVE_SYS_KERN_CONTROL_H */
/* Define to 1 if you have the <sys/loadavg.h> header file. */
/* #undef HAVE_SYS_LOADAVG_H */
/* Define to 1 if you have the <sys/lock.h> header file. */
/* #undef HAVE_SYS_LOCK_H */
/* Define to 1 if you have the <sys/mkdev.h> header file. */
/* #undef HAVE_SYS_MKDEV_H */
/* Define to 1 if you have the <sys/modem.h> header file. */
/* #undef HAVE_SYS_MODEM_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#define HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define HAVE_SYS_STATVFS_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1
/* Define to 1 if you have the <sys/sys_domain.h> header file. */
/* #undef HAVE_SYS_SYS_DOMAIN_H */
/* Define to 1 if you have the <sys/termio.h> header file. */
/* #undef HAVE_SYS_TERMIO_H */
/* Define to 1 if you have the <sys/times.h> header file. */
#define HAVE_SYS_TIMES_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <sys/xattr.h> header file. */
#define HAVE_SYS_XATTR_H 1
/* Define to 1 if you have the `tcgetpgrp' function. */
#define HAVE_TCGETPGRP 1
/* Define to 1 if you have the `tcsetpgrp' function. */
#define HAVE_TCSETPGRP 1
/* Define to 1 if you have the `tempnam' function. */
#define HAVE_TEMPNAM 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <term.h> header file. */
/* #undef HAVE_TERM_H */
/* Define to 1 if you have the `tgamma' function. */
#define HAVE_TGAMMA 1
/* Define to 1 if you have the `timegm' function. */
#define HAVE_TIMEGM 1
/* Define to 1 if you have the `times' function. */
#define HAVE_TIMES 1
/* Define to 1 if you have the `tmpfile' function. */
#define HAVE_TMPFILE 1
/* Define to 1 if you have the `tmpnam' function. */
#define HAVE_TMPNAM 1
/* Define to 1 if you have the `tmpnam_r' function. */
/* #undef HAVE_TMPNAM_R */
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead. */
#define HAVE_TM_ZONE 1
/* Define to 1 if you have the `truncate' function. */
#define HAVE_TRUNCATE 1
/* Define to 1 if you don't have `tm_zone' but do have the external array
`tzname'. */
/* #undef HAVE_TZNAME */
/* Define this if you have tcl and TCL_UTF_MAX==6 */
/* #undef HAVE_UCS4_TCL */
/* Define if your compiler provides uint32_t. */
#define HAVE_UINT32_T 1
/* Define if your compiler provides uint64_t. */
#define HAVE_UINT64_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `unlinkat' function. */
#define HAVE_UNLINKAT 1
/* Define to 1 if you have the `unsetenv' function. */
#define HAVE_UNSETENV 1
/* Define if you have a useable wchar_t type defined in wchar.h; useable means
wchar_t must be an unsigned type with at least 16 bits. (see
Include/unicodeobject.h). */
/* #undef HAVE_USABLE_WCHAR_T */
/* Define to 1 if you have the <util.h> header file. */
#define HAVE_UTIL_H 1
/* Define to 1 if you have the `utimensat' function. */
#define HAVE_UTIMENSAT 1
/* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if you have the `wait3' function. */
/* #undef HAVE_WAIT3 */
/* Define to 1 if you have the `wait4' function. */
#define HAVE_WAIT4 1
/* Define to 1 if you have the `waitid' function. */
#define HAVE_WAITID 1
/* Define to 1 if you have the `waitpid' function. */
#define HAVE_WAITPID 1
/* Define if the compiler provides a wchar.h header file. */
#define HAVE_WCHAR_H 1
/* Define to 1 if you have the `wcscoll' function. */
#define HAVE_WCSCOLL 1
/* Define to 1 if you have the `wcsftime' function. */
#define HAVE_WCSFTIME 1
/* Define to 1 if you have the `wcsxfrm' function. */
#define HAVE_WCSXFRM 1
/* Define to 1 if you have the `wmemcmp' function. */
#define HAVE_WMEMCMP 1
/* Define if tzset() actually switches the local timezone in a meaningful way.
*/
/* #undef HAVE_WORKING_TZSET */
/* Define to 1 if you have the `writev' function. */
#define HAVE_WRITEV 1
/* Define if the zlib library has inflateCopy */
#define HAVE_ZLIB_COPY 1
/* Define to 1 if you have the `_getpty' function. */
/* #undef HAVE__GETPTY */
/* Define if log1p(-0.) is 0. rather than -0. */
/* #undef LOG1P_DROPS_ZERO_SIGN */
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
/* #undef MAJOR_IN_MKDEV */
/* Define to 1 if `major', `minor', and `makedev' are declared in
<sysmacros.h>. */
#define MAJOR_IN_SYSMACROS 1
/* Define if mvwdelch in curses.h is an expression. */
/* #undef MVWDELCH_IS_EXPRESSION */
/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
/* #undef PACKAGE_VERSION */
/* Define if POSIX semaphores aren't enabled on your system */
/* #undef POSIX_SEMAPHORES_NOT_ENABLED */
/* Defined if PTHREAD_SCOPE_SYSTEM supported. */
/* #undef PTHREAD_SYSTEM_SCHED_SUPPORTED */
/* Define as the preferred size in bits of long digits */
/* #undef PYLONG_BITS_IN_DIGIT */
/* Define to printf format modifier for long long type */
#define PY_FORMAT_LONG_LONG "ll"
/* Define to printf format modifier for Py_ssize_t */
#define PY_FORMAT_SIZE_T "z"
/* Define if you want to build an interpreter with many run-time checks. */
/* #undef Py_DEBUG */
/* Defined if Python is built as a shared library. */
#define Py_ENABLE_SHARED 1
/* Define hash algorithm for str, bytes and memoryview. SipHash24: 1, FNV: 2,
externally defined: 0 */
/* #undef Py_HASH_ALGORITHM */
/* assume C89 semantics that RETSIGTYPE is always void */
#define RETSIGTYPE void
/* Define if setpgrp() must be called as setpgrp(0, 0). */
/* #undef SETPGRP_HAVE_ARG */
/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */
/* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */
/* The size of `double', as computed by sizeof. */
#define SIZEOF_DOUBLE 8
/* The size of `float', as computed by sizeof. */
#define SIZEOF_FLOAT 4
/* The size of `fpos_t', as computed by sizeof. */
#define SIZEOF_FPOS_T 8
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8
/* The size of `long double', as computed by sizeof. */
#define SIZEOF_LONG_DOUBLE 16
/* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
/* The size of `pid_t', as computed by sizeof. */
#define SIZEOF_PID_T 4
/* The size of `pthread_t', as computed by sizeof. */
#define SIZEOF_PTHREAD_T 8
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 8
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 8
/* The size of `uintptr_t', as computed by sizeof. */
#define SIZEOF_UINTPTR_T 8
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8
/* The size of `wchar_t', as computed by sizeof. */
#define SIZEOF_WCHAR_T 4
/* The size of `_Bool', as computed by sizeof. */
#define SIZEOF__BOOL 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
(which you can't on SCO ODT 3.0). */
#define SYS_SELECT_WITH_SYS_TIME 1
/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */
/* #undef TANH_PRESERVES_ZERO_SIGN */
/* Library needed by timemodule.c: librt may be needed for clock_gettime() */
/* #undef TIMEMODULE_LIB */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Define if you want to use computed gotos in ceval.c. */
#define USE_COMPUTED_GOTOS 1
/* Define to use the C99 inline keyword. */
#define USE_INLINE 1
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Define if a va_list is an array of some kind */
#define VA_LIST_IS_ARRAY 1
/* Define if you want SIGFPE handled (see Include/pyfpe.h). */
/* #undef WANT_SIGFPE_HANDLER */
/* Define if WINDOW in curses.h offers a field _flags. */
/* #undef WINDOW_HAS_FLAGS */
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic
linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).
Dyld is necessary to support frameworks. */
/* #undef WITH_DYLD */
/* Define to 1 if libintl is needed for locale functions. */
/* #undef WITH_LIBINTL */
/* Define if you want to produce an OpenStep/Rhapsody framework (shared
library plus accessory files). */
/* #undef WITH_NEXT_FRAMEWORK */
/* Define if you want to compile in Python-specific mallocs */
#define WITH_PYMALLOC 1
/* Define if you want to compile in rudimentary thread support */
#define WITH_THREAD 1
/* Define to profile with the Pentium timestamp counter */
/* #undef WITH_TSC */
/* Define if you want pymalloc to be disabled when running under valgrind */
/* #undef WITH_VALGRIND */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define if arithmetic is subject to x87-style double rounding issue */
/* #undef X87_DOUBLE_ROUNDING */
/* Define on OpenBSD to activate all library features */
/* #undef _BSD_SOURCE */
/* Define on Irix to enable u_int */
#define _BSD_TYPES 1
/* Define on Darwin to activate all library features */
#define _DARWIN_C_SOURCE 1
/* This must be set to 64 on some systems to enable large file support. */
#define _FILE_OFFSET_BITS 64
/* Define on Linux to activate all library features */
#define _GNU_SOURCE 1
/* Define to include mbstate_t for mbrtowc */
/* #undef _INCLUDE__STDC_A1_SOURCE */
/* This must be defined on some systems to enable large file support. */
#define _LARGEFILE_SOURCE 1
/* This must be defined on AIX systems to enable large file support. */
/* #undef _LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define on NetBSD to activate all library features */
#define _NETBSD_SOURCE 1
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to activate features from IEEE Stds 1003.1-2008 */
#define _POSIX_C_SOURCE 200809L
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define if you have POSIX threads, and your system does not define that. */
/* #undef _POSIX_THREADS */
/* Define to force use of thread-safe errno, h_errno, and other functions */
#define _REENTRANT 1
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT64_T */
/* Define to the level of X/Open that your system supports */
#define _XOPEN_SOURCE 700
/* Define to activate Unix95-and-earlier features */
#define _XOPEN_SOURCE_EXTENDED 1
/* Define on FreeBSD to activate all library features */
#define __BSD_VISIBLE 1
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
/* # undef __CHAR_UNSIGNED__ */
#endif
/* Define to 'long' if <time.h> doesn't define. */
/* #undef clock_t */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef int32_t */
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef int64_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef mode_t */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to empty if the keyword does not work. */
/* #undef signed */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/socket.h> does not define. */
/* #undef socklen_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint64_t */
/* Define to empty if the keyword does not work. */
/* #undef volatile */
/* Define the macros needed if on a UnixWare 7.x system. */
#if defined(__USLC__) && defined(__SCO_VERSION__)
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
#endif
#endif /*Py_PYCONFIG_H*/
``` | /content/code_sandbox/android/python35/include/pyconfig_x86_64.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 12,551 |
```objective-c
#ifndef Py_ERRORS_H
#define Py_ERRORS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Error objects */
#ifndef Py_LIMITED_API
/* PyException_HEAD defines the initial segment of every exception class. */
#define PyException_HEAD PyObject_HEAD PyObject *dict;\
PyObject *args; PyObject *traceback;\
PyObject *context; PyObject *cause;\
char suppress_context;
typedef struct {
PyException_HEAD
} PyBaseExceptionObject;
typedef struct {
PyException_HEAD
PyObject *msg;
PyObject *filename;
PyObject *lineno;
PyObject *offset;
PyObject *text;
PyObject *print_file_and_line;
} PySyntaxErrorObject;
typedef struct {
PyException_HEAD
PyObject *msg;
PyObject *name;
PyObject *path;
} PyImportErrorObject;
typedef struct {
PyException_HEAD
PyObject *encoding;
PyObject *object;
Py_ssize_t start;
Py_ssize_t end;
PyObject *reason;
} PyUnicodeErrorObject;
typedef struct {
PyException_HEAD
PyObject *code;
} PySystemExitObject;
typedef struct {
PyException_HEAD
PyObject *myerrno;
PyObject *strerror;
PyObject *filename;
PyObject *filename2;
#ifdef MS_WINDOWS
PyObject *winerror;
#endif
Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */
} PyOSErrorObject;
typedef struct {
PyException_HEAD
PyObject *value;
} PyStopIterationObject;
/* Compatibility typedefs */
typedef PyOSErrorObject PyEnvironmentErrorObject;
#ifdef MS_WINDOWS
typedef PyOSErrorObject PyWindowsErrorObject;
#endif
#endif /* !Py_LIMITED_API */
/* Error handling definitions */
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
#endif
PyAPI_FUNC(void) PyErr_SetString(
PyObject *exception,
const char *string /* decoded from utf-8 */
);
PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
PyAPI_FUNC(void) PyErr_Clear(void);
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);
PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
#if defined(__clang__) || \
(defined(__GNUC_MAJOR__) && \
((__GNUC_MAJOR__ >= 3) || \
(__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5)))
#define _Py_NO_RETURN __attribute__((__noreturn__))
#else
#define _Py_NO_RETURN
#endif
/* Defined in Python/pylifecycle.c */
PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
#define _PyErr_OCCURRED() PyErr_Occurred()
#else
#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
#endif
/* Error testing and normalization */
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
/* Traceback manipulation (PEP 3134) */
PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *);
/* Cause manipulation (PEP 3134) */
PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *);
PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *);
/* Context manipulation (PEP 3134) */
PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);
PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
#endif
/* */
#define PyExceptionClass_Check(x) \
(PyType_Check((x)) && \
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
#define PyExceptionInstance_Check(x) \
PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)
#define PyExceptionClass_Name(x) \
((char *)(((PyTypeObject*)(x))->tp_name))
#define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
/* Predefined exceptions */
PyAPI_DATA(PyObject *) PyExc_BaseException;
PyAPI_DATA(PyObject *) PyExc_Exception;
PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
PyAPI_DATA(PyObject *) PyExc_StopIteration;
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
PyAPI_DATA(PyObject *) PyExc_LookupError;
PyAPI_DATA(PyObject *) PyExc_AssertionError;
PyAPI_DATA(PyObject *) PyExc_AttributeError;
PyAPI_DATA(PyObject *) PyExc_BufferError;
PyAPI_DATA(PyObject *) PyExc_EOFError;
PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
PyAPI_DATA(PyObject *) PyExc_OSError;
PyAPI_DATA(PyObject *) PyExc_ImportError;
PyAPI_DATA(PyObject *) PyExc_IndexError;
PyAPI_DATA(PyObject *) PyExc_KeyError;
PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
PyAPI_DATA(PyObject *) PyExc_MemoryError;
PyAPI_DATA(PyObject *) PyExc_NameError;
PyAPI_DATA(PyObject *) PyExc_OverflowError;
PyAPI_DATA(PyObject *) PyExc_RuntimeError;
PyAPI_DATA(PyObject *) PyExc_RecursionError;
PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
PyAPI_DATA(PyObject *) PyExc_IndentationError;
PyAPI_DATA(PyObject *) PyExc_TabError;
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
PyAPI_DATA(PyObject *) PyExc_SystemError;
PyAPI_DATA(PyObject *) PyExc_SystemExit;
PyAPI_DATA(PyObject *) PyExc_TypeError;
PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
PyAPI_DATA(PyObject *) PyExc_UnicodeError;
PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
PyAPI_DATA(PyObject *) PyExc_ValueError;
PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
PyAPI_DATA(PyObject *) PyExc_BlockingIOError;
PyAPI_DATA(PyObject *) PyExc_BrokenPipeError;
PyAPI_DATA(PyObject *) PyExc_ChildProcessError;
PyAPI_DATA(PyObject *) PyExc_ConnectionError;
PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError;
PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError;
PyAPI_DATA(PyObject *) PyExc_ConnectionResetError;
PyAPI_DATA(PyObject *) PyExc_FileExistsError;
PyAPI_DATA(PyObject *) PyExc_FileNotFoundError;
PyAPI_DATA(PyObject *) PyExc_InterruptedError;
PyAPI_DATA(PyObject *) PyExc_IsADirectoryError;
PyAPI_DATA(PyObject *) PyExc_NotADirectoryError;
PyAPI_DATA(PyObject *) PyExc_PermissionError;
PyAPI_DATA(PyObject *) PyExc_ProcessLookupError;
PyAPI_DATA(PyObject *) PyExc_TimeoutError;
/* Compatibility aliases */
PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
PyAPI_DATA(PyObject *) PyExc_IOError;
#ifdef MS_WINDOWS
PyAPI_DATA(PyObject *) PyExc_WindowsError;
#endif
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
/* Predefined warning categories */
PyAPI_DATA(PyObject *) PyExc_Warning;
PyAPI_DATA(PyObject *) PyExc_UserWarning;
PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
PyAPI_DATA(PyObject *) PyExc_FutureWarning;
PyAPI_DATA(PyObject *) PyExc_ImportWarning;
PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
PyAPI_DATA(PyObject *) PyExc_BytesWarning;
PyAPI_DATA(PyObject *) PyExc_ResourceWarning;
/* Convenience functions */
PyAPI_FUNC(int) PyErr_BadArgument(void);
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects(
PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
PyObject *exc,
const char *filename /* decoded from the filesystem encoding */
);
#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
PyObject *, const Py_UNICODE *);
#endif /* MS_WINDOWS */
PyAPI_FUNC(PyObject *) PyErr_Format(
PyObject *exception,
const char *format, /* ASCII-encoded string */
...
);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
PyAPI_FUNC(PyObject *) PyErr_FormatV(
PyObject *exception,
const char *format,
va_list vargs);
#endif
#ifdef MS_WINDOWS
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
int ierr,
const char *filename /* decoded from the filesystem encoding */
);
#ifndef Py_LIMITED_API
/* XXX redeclare to use WSTRING */
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
int, const Py_UNICODE *);
#endif
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
PyObject *,int, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects(
PyObject *,int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
PyObject *exc,
int ierr,
const char *filename /* decoded from the filesystem encoding */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
PyObject *,int, const Py_UNICODE *);
#endif
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
#endif /* MS_WINDOWS */
PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *,
PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *,
PyObject *);
/* Export the old function so that the existing API remains available: */
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
/* Mask the old API with a call to the new API for code compiled under
Python 2.0: */
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
/* Function to create a new exception */
PyAPI_FUNC(PyObject *) PyErr_NewException(
const char *name, PyObject *base, PyObject *dict);
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
const char *name, const char *doc, PyObject *base, PyObject *dict);
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
/* In exceptions.c */
#ifndef Py_LIMITED_API
/* Helper that attempts to replace the current exception with one of the
* same type but with a prefix added to the exception text. The resulting
* exception description looks like:
*
* prefix (exc_type: original_exc_str)
*
* Only some exceptions can be safely replaced. If the function determines
* it isn't safe to perform the replacement, it will leave the original
* unmodified exception in place.
*
* Returns a borrowed reference to the new exception (if any), NULL if the
* existing exception was left in place.
*/
PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
const char *prefix_format, /* ASCII-encoded string */
...
);
#endif
/* In sigcheck.c or signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
/* In signalmodule.c */
#ifndef Py_LIMITED_API
int PySignal_SetWakeupFd(int fd);
#endif
/* Support for adding program text to SyntaxErrors */
PyAPI_FUNC(void) PyErr_SyntaxLocation(
const char *filename, /* decoded from the filesystem encoding */
int lineno);
PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
const char *filename, /* decoded from the filesystem encoding */
int lineno,
int col_offset);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
PyObject *filename,
int lineno,
int col_offset);
#endif
PyAPI_FUNC(PyObject *) PyErr_ProgramText(
const char *filename, /* decoded from the filesystem encoding */
int lineno);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
PyObject *filename,
int lineno);
#endif
/* The following functions are used to create and modify unicode
exceptions from C */
/* create a UnicodeDecodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
const char *encoding, /* UTF-8 encoded string */
const char *object,
Py_ssize_t length,
Py_ssize_t start,
Py_ssize_t end,
const char *reason /* UTF-8 encoded string */
);
/* create a UnicodeEncodeError object */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
const char *encoding, /* UTF-8 encoded string */
const Py_UNICODE *object,
Py_ssize_t length,
Py_ssize_t start,
Py_ssize_t end,
const char *reason /* UTF-8 encoded string */
);
#endif
/* create a UnicodeTranslateError object */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
const Py_UNICODE *object,
Py_ssize_t length,
Py_ssize_t start,
Py_ssize_t end,
const char *reason /* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
PyObject *object,
Py_ssize_t start,
Py_ssize_t end,
const char *reason /* UTF-8 encoded string */
);
#endif
/* get the encoding attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
/* get the object attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
/* get the value of the start attribute (the int * may not be NULL)
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
/* assign a new value to the start attribute
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
/* get the value of the end attribute (the int *may not be NULL)
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
/* assign a new value to the end attribute
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
/* get the value of the reason attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
/* assign a new value to the reason attribute
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
PyObject *exc,
const char *reason /* UTF-8 encoded string */
);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
PyObject *exc,
const char *reason /* UTF-8 encoded string */
);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
PyObject *exc,
const char *reason /* UTF-8 encoded string */
);
/* These APIs aren't really part of the error implementation, but
often needed to format error messages; the native C lib APIs are
not available on all platforms, which is why we provide emulations
for those platforms in Python/mysnprintf.c,
WARNING: The return value of snprintf varies across platforms; do
not rely on any particular behavior; eventually the C99 defn may
be reliable.
*/
#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
# define HAVE_SNPRINTF
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#endif
#include <stdarg.h>
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
#ifdef __cplusplus
}
#endif
#endif /* !Py_ERRORS_H */
``` | /content/code_sandbox/android/python35/include/pyerrors.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 3,816 |
```objective-c
/* Bytes (String) object interface */
#ifndef Py_BYTESOBJECT_H
#define Py_BYTESOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
/*
Type PyBytesObject represents a character string. An extra zero byte is
reserved at the end to ensure it is zero-terminated, but a size is
present so strings with null bytes in them can be represented. This
is an immutable object type.
There are functions to create new string objects, to test
an object for string-ness, and to get the
string value. The latter function returns a null pointer
if the object is not of the proper type.
There is a variant that takes an explicit size as well as a
variant that assumes a zero-terminated string. Note that none of the
functions should be applied to nil objects.
*/
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
This significantly speeds up dict lookups. */
#ifndef Py_LIMITED_API
typedef struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
char ob_sval[1];
/* Invariants:
* ob_sval contains space for 'ob_size+1' elements.
* ob_sval[ob_size] == 0.
* ob_shash is the hash of the string or -1 if not computed yet.
*/
} PyBytesObject;
#endif
PyAPI_DATA(PyTypeObject) PyBytes_Type;
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
#define PyBytes_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
PyAPI_FUNC(PyObject *) _PyBytes_Format(PyObject *, PyObject *);
#endif
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t,
const char *);
/* Macro, trading safety for speed */
#ifndef Py_LIMITED_API
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
(((PyBytesObject *)(op))->ob_sval))
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
#endif
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
x must be an iterable object. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
#endif
/* Provides access to the internal data buffer and size of a string
object or the default encoded version of an Unicode object. Passing
NULL as *len parameter will force the string buffer to be
0-terminated (passing a string with embedded NULL characters will
cause an exception). */
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
PyObject *obj, /* string or Unicode object */
char **s, /* pointer to buffer variable */
Py_ssize_t *len /* pointer to length variable or NULL
(only possible for 0-terminated
strings) */
);
/* Using the current locale, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
Py_ssize_t n_buffer,
char *digits,
Py_ssize_t n_digits,
Py_ssize_t min_width);
/* Using explicit passed-in values, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
Py_ssize_t n_buffer,
char *digits,
Py_ssize_t n_digits,
Py_ssize_t min_width,
const char *grouping,
const char *thousands_sep);
#endif
/* Flags used by string formatting */
#define F_LJUST (1<<0)
#define F_SIGN (1<<1)
#define F_BLANK (1<<2)
#define F_ALT (1<<3)
#define F_ZERO (1<<4)
#ifdef __cplusplus
}
#endif
#endif /* !Py_BYTESOBJECT_H */
``` | /content/code_sandbox/android/python35/include/bytesobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,124 |
```objective-c
/* Thread and interpreter state structures and their interfaces */
#ifndef Py_PYSTATE_H
#define Py_PYSTATE_H
#ifdef __cplusplus
extern "C" {
#endif
/* State shared between threads */
struct _ts; /* Forward */
struct _is; /* Forward */
#ifdef Py_LIMITED_API
typedef struct _is PyInterpreterState;
#else
typedef struct _is {
struct _is *next;
struct _ts *tstate_head;
PyObject *modules;
PyObject *modules_by_index;
PyObject *sysdict;
PyObject *builtins;
PyObject *importlib;
PyObject *codec_search_path;
PyObject *codec_search_cache;
PyObject *codec_error_registry;
int codecs_initialized;
int fscodec_initialized;
#ifdef HAVE_DLOPEN
int dlopenflags;
#endif
#ifdef WITH_TSC
int tscdump;
#endif
PyObject *builtins_copy;
} PyInterpreterState;
#endif
/* State unique per thread */
struct _frame; /* Avoid including frameobject.h */
#ifndef Py_LIMITED_API
/* Py_tracefunc return -1 when raising an exception, or 0 for success. */
typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
/* The following values are used for 'what' for tracefunc functions: */
#define PyTrace_CALL 0
#define PyTrace_EXCEPTION 1
#define PyTrace_LINE 2
#define PyTrace_RETURN 3
#define PyTrace_C_CALL 4
#define PyTrace_C_EXCEPTION 5
#define PyTrace_C_RETURN 6
#endif
#ifdef Py_LIMITED_API
typedef struct _ts PyThreadState;
#else
typedef struct _ts {
/* See Python/ceval.c for comments explaining most fields */
struct _ts *prev;
struct _ts *next;
PyInterpreterState *interp;
struct _frame *frame;
int recursion_depth;
char overflowed; /* The stack has overflowed. Allow 50 more calls
to handle the runtime error. */
char recursion_critical; /* The current calls must not cause
a stack overflow. */
/* 'tracing' keeps track of the execution depth when tracing/profiling.
This is to prevent the actual trace/profile code from being recorded in
the trace/profile. */
int tracing;
int use_tracing;
Py_tracefunc c_profilefunc;
Py_tracefunc c_tracefunc;
PyObject *c_profileobj;
PyObject *c_traceobj;
PyObject *curexc_type;
PyObject *curexc_value;
PyObject *curexc_traceback;
PyObject *exc_type;
PyObject *exc_value;
PyObject *exc_traceback;
PyObject *dict; /* Stores per-thread state */
int gilstate_counter;
PyObject *async_exc; /* Asynchronous exception to raise */
long thread_id; /* Thread id where this tstate was created */
int trash_delete_nesting;
PyObject *trash_delete_later;
/* Called when a thread state is deleted normally, but not when it
* is destroyed after fork().
* Pain: to prevent rare but fatal shutdown errors (issue 18808),
* Thread.join() must wait for the join'ed thread's tstate to be unlinked
* from the tstate chain. That happens at the end of a thread's life,
* in pystate.c.
* The obvious way doesn't quite work: create a lock which the tstate
* unlinking code releases, and have Thread.join() wait to acquire that
* lock. The problem is that we _are_ at the end of the thread's life:
* if the thread holds the last reference to the lock, decref'ing the
* lock will delete the lock, and that may trigger arbitrary Python code
* if there's a weakref, with a callback, to the lock. But by this time
* _PyThreadState_Current is already NULL, so only the simplest of C code
* can be allowed to run (in particular it must not be possible to
* release the GIL).
* So instead of holding the lock directly, the tstate holds a weakref to
* the lock: that's the value of on_delete_data below. Decref'ing a
* weakref is harmless.
* on_delete points to _threadmodule.c's static release_sentinel() function.
* After the tstate is unlinked, release_sentinel is called with the
* weakref-to-lock (on_delete_data) argument, and release_sentinel releases
* the indirectly held lock.
*/
void (*on_delete)(void *);
void *on_delete_data;
PyObject *coroutine_wrapper;
int in_coroutine_wrapper;
/* XXX signal handlers should also be here */
} PyThreadState;
#endif
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
PyAPI_FUNC(int) _PyState_AddModule(PyObject*, struct PyModuleDef*);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
/* New in 3.3 */
PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*);
PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*);
#endif
PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyState_ClearModules(void);
#endif
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);
PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *);
PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate);
#ifdef WITH_THREAD
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
PyAPI_FUNC(void) _PyGILState_Reinit(void);
#endif
PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *);
/* Variable and macro for in-line access to current thread state */
/* Assuming the current thread holds the GIL, this is the
PyThreadState for the current thread.
Issue #23644: pyatomic.h is incompatible with C++ (yet). Disable
PyThreadState_GET() optimization: declare it as an alias to
PyThreadState_Get(), as done for limited API. */
#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
#endif
#if defined(Py_DEBUG) || defined(Py_LIMITED_API) || defined(__cplusplus)
#define PyThreadState_GET() PyThreadState_Get()
#else
#define PyThreadState_GET() \
((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
#endif
typedef
enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
PyGILState_STATE;
#ifdef WITH_THREAD
/* Ensure that the current thread is ready to call the Python
C API, regardless of the current state of Python, or of its
thread lock. This may be called as many times as desired
by a thread so long as each call is matched with a call to
PyGILState_Release(). In general, other thread-state APIs may
be used between _Ensure() and _Release() calls, so long as the
thread-state is restored to its previous state before the Release().
For example, normal use of the Py_BEGIN_ALLOW_THREADS/
Py_END_ALLOW_THREADS macros are acceptable.
The return value is an opaque "handle" to the thread state when
PyGILState_Ensure() was called, and must be passed to
PyGILState_Release() to ensure Python is left in the same state. Even
though recursive calls are allowed, these handles can *not* be shared -
each unique call to PyGILState_Ensure must save the handle for its
call to PyGILState_Release.
When the function returns, the current thread will hold the GIL.
Failure is a fatal error.
*/
PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
/* Release any resources previously acquired. After this call, Python's
state will be the same as it was prior to the corresponding
PyGILState_Ensure() call (but generally this state will be unknown to
the caller, hence the use of the GILState API.)
Every call to PyGILState_Ensure must be matched by a call to
PyGILState_Release on the same thread.
*/
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
/* Helper/diagnostic function - get the current thread state for
this thread. May return NULL if no GILState API has been used
on the current thread. Note that the main thread always has such a
thread-state, even if no auto-thread-state call has been made
on the main thread.
*/
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
/* Helper/diagnostic function - return 1 if the current thread
* currently holds the GIL, 0 otherwise
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) PyGILState_Check(void);
#endif
#endif /* #ifdef WITH_THREAD */
/* The implementation of sys._current_frames() Returns a dict mapping
thread id to that thread's current frame.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
#endif
/* Routines for advanced debuggers, requested by David Beazley.
Don't use unless you know what you are doing! */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
#endif
/* hook for PyEval_GetFrame(), requested for Psyco */
#ifndef Py_LIMITED_API
PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame;
#endif
#ifdef __cplusplus
}
#endif
#endif /* !Py_PYSTATE_H */
``` | /content/code_sandbox/android/python35/include/pystate.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,288 |
```objective-c
#ifndef Py_ERRCODE_H
#define Py_ERRCODE_H
#ifdef __cplusplus
extern "C" {
#endif
/* Error codes passed around between file input, tokenizer, parser and
interpreter. This is necessary so we can turn them into Python
exceptions at a higher level. Note that some errors have a
slightly different meaning when passed from the tokenizer to the
parser than when passed from the parser to the interpreter; e.g.
the parser only returns E_EOF when it hits EOF immediately, and it
never returns E_OK. */
#define E_OK 10 /* No error */
#define E_EOF 11 /* End Of File */
#define E_INTR 12 /* Interrupted */
#define E_TOKEN 13 /* Bad token */
#define E_SYNTAX 14 /* Syntax error */
#define E_NOMEM 15 /* Ran out of memory */
#define E_DONE 16 /* Parsing complete */
#define E_ERROR 17 /* Execution error */
#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */
#define E_OVERFLOW 19 /* Node had too many children */
#define E_TOODEEP 20 /* Too many indentation levels */
#define E_DEDENT 21 /* No matching outer block for dedent */
#define E_DECODE 22 /* Error in decoding into Unicode */
#define E_EOFS 23 /* EOF in triple-quoted string */
#define E_EOLS 24 /* EOL in single-quoted string */
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
#define E_IDENTIFIER 26 /* Invalid characters in identifier */
#define E_BADSINGLE 27 /* Ill-formed single statement input */
#ifdef __cplusplus
}
#endif
#endif /* !Py_ERRCODE_H */
``` | /content/code_sandbox/android/python35/include/errcode.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 377 |
```objective-c
/* pyconfig.h. Generated from pyconfig.h.in by configure. */
/* pyconfig.h.in. Generated from configure.ac by autoheader. */
#ifndef Py_PYCONFIG_H
#define Py_PYCONFIG_H
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
support for AIX C++ shared extension modules. */
/* #undef AIX_GENUINE_CPLUSPLUS */
/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM
mixed-endian order (byte order 45670123) */
/* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most
significant byte first */
/* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the
least significant byte first */
/* #undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 */
/* Define if --enable-ipv6 is specified */
#define ENABLE_IPV6 1
/* Define if flock needs to be linked with bsd library. */
/* #undef FLOCK_NEEDS_LIBBSD */
/* Define if getpgrp() must be called as getpgrp(0). */
/* #undef GETPGRP_HAVE_ARG */
/* Define if gettimeofday() does not have second (timezone) argument This is
the case on Motorola V4 (R40V4.2) */
/* #undef GETTIMEOFDAY_NO_TZ */
/* Define to 1 if you have the `accept4' function. */
/* #undef HAVE_ACCEPT4 */
/* Define to 1 if you have the `acosh' function. */
#define HAVE_ACOSH 1
/* struct addrinfo (netdb.h) */
#define HAVE_ADDRINFO 1
/* Define to 1 if you have the `alarm' function. */
#define HAVE_ALARM 1
/* Define if aligned memory access is required */
#define HAVE_ALIGNED_REQUIRED 1
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define this if your time.h defines altzone. */
/* #undef HAVE_ALTZONE */
/* Define to 1 if you have the `asinh' function. */
#define HAVE_ASINH 1
/* Define to 1 if you have the <asm/types.h> header file. */
#define HAVE_ASM_TYPES_H 1
/* Define to 1 if you have the `atanh' function. */
#define HAVE_ATANH 1
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */
/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */
/* #undef HAVE_BLUETOOTH_BLUETOOTH_H */
/* Define to 1 if you have the <bluetooth.h> header file. */
/* #undef HAVE_BLUETOOTH_H */
/* Define if mbstowcs(NULL, "text", 0) does not return the number of wide
chars that would be converted. */
/* #undef HAVE_BROKEN_MBSTOWCS */
/* Define if nice() returns success/failure instead of the new priority. */
/* #undef HAVE_BROKEN_NICE */
/* Define if the system reports an invalid PIPE_BUF value. */
/* #undef HAVE_BROKEN_PIPE_BUF */
/* Define if poll() sets errno on invalid file descriptors. */
/* #undef HAVE_BROKEN_POLL */
/* Define if the Posix semaphores do not work on your system */
/* #undef HAVE_BROKEN_POSIX_SEMAPHORES */
/* Define if pthread_sigmask() does not work on your system. */
/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */
/* define to 1 if your sem_getvalue is broken. */
#define HAVE_BROKEN_SEM_GETVALUE 1
/* Define if `unsetenv` does not return an int. */
/* #undef HAVE_BROKEN_UNSETENV */
/* Has builtin atomics */
#define HAVE_BUILTIN_ATOMIC 1
/* Define this if you have the type _Bool. */
#define HAVE_C99_BOOL 1
/* Define to 1 if you have the 'chflags' function. */
/* #undef HAVE_CHFLAGS */
/* Define to 1 if you have the `chown' function. */
#define HAVE_CHOWN 1
/* Define if you have the 'chroot' function. */
#define HAVE_CHROOT 1
/* Define to 1 if you have the `clock' function. */
#define HAVE_CLOCK 1
/* Define to 1 if you have the `clock_getres' function. */
#define HAVE_CLOCK_GETRES 1
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* Define if the C compiler supports computed gotos. */
#define HAVE_COMPUTED_GOTOS 1
/* Define to 1 if you have the `confstr' function. */
/* #undef HAVE_CONFSTR */
/* Define to 1 if you have the <conio.h> header file. */
/* #undef HAVE_CONIO_H */
/* Define to 1 if you have the `copysign' function. */
#define HAVE_COPYSIGN 1
/* Define to 1 if you have the `ctermid' function. */
/* #undef HAVE_CTERMID */
/* Define if you have the 'ctermid_r' function. */
#define HAVE_CTERMID_R 1
/* Define to 1 if you have the <curses.h> header file. */
/* #undef HAVE_CURSES_H */
/* Define if you have the 'is_term_resized' function. */
/* #undef HAVE_CURSES_IS_TERM_RESIZED */
/* Define if you have the 'resizeterm' function. */
/* #undef HAVE_CURSES_RESIZETERM */
/* Define if you have the 'resize_term' function. */
/* #undef HAVE_CURSES_RESIZE_TERM */
/* Define to 1 if you have the declaration of `isfinite', and to 0 if you
don't. */
#define HAVE_DECL_ISFINITE 1
/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
*/
#define HAVE_DECL_ISINF 1
/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
*/
#define HAVE_DECL_ISNAN 1
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
*/
/* #undef HAVE_DECL_TZNAME */
/* Define to 1 if you have the device macros. */
#define HAVE_DEVICE_MACROS 1
/* Define to 1 if you have the /dev/ptc device file. */
/* #undef HAVE_DEV_PTC */
/* Define to 1 if you have the /dev/ptmx device file. */
/* #undef HAVE_DEV_PTMX */
/* Define to 1 if you have the <direct.h> header file. */
/* #undef HAVE_DIRECT_H */
/* Define to 1 if the dirent structure has a d_type field */
#define HAVE_DIRENT_D_TYPE 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define if you have the 'dirfd' function or macro. */
#define HAVE_DIRFD 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `dlopen' function. */
#define HAVE_DLOPEN 1
/* Define to 1 if you have the `dup2' function. */
#define HAVE_DUP2 1
/* Define to 1 if you have the `dup3' function. */
/* #undef HAVE_DUP3 */
/* Defined when any dynamic module loading is enabled. */
#define HAVE_DYNAMIC_LOADING 1
/* Define to 1 if you have the <endian.h> header file. */
#define HAVE_ENDIAN_H 1
/* Define if you have the 'epoll' functions. */
#define HAVE_EPOLL 1
/* Define if you have the 'epoll_create1' function. */
/* #undef HAVE_EPOLL_CREATE1 */
/* Define to 1 if you have the `erf' function. */
#define HAVE_ERF 1
/* Define to 1 if you have the `erfc' function. */
#define HAVE_ERFC 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the `execv' function. */
#define HAVE_EXECV 1
/* Define to 1 if you have the `expm1' function. */
#define HAVE_EXPM1 1
/* Define to 1 if you have the `faccessat' function. */
/* #undef HAVE_FACCESSAT */
/* Define if you have the 'fchdir' function. */
#define HAVE_FCHDIR 1
/* Define to 1 if you have the `fchmod' function. */
#define HAVE_FCHMOD 1
/* Define to 1 if you have the `fchmodat' function. */
#define HAVE_FCHMODAT 1
/* Define to 1 if you have the `fchown' function. */
#define HAVE_FCHOWN 1
/* Define to 1 if you have the `fchownat' function. */
#define HAVE_FCHOWNAT 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the 'fdatasync' function. */
#define HAVE_FDATASYNC 1
/* Define to 1 if you have the `fdopendir' function. */
#define HAVE_FDOPENDIR 1
/* Define to 1 if you have the `fexecve' function. */
/* #undef HAVE_FEXECVE */
/* Define to 1 if you have the `finite' function. */
#define HAVE_FINITE 1
/* Define to 1 if you have the `flock' function. */
#define HAVE_FLOCK 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if you have the `forkpty' function. */
/* #undef HAVE_FORKPTY */
/* Define to 1 if you have the `fpathconf' function. */
#define HAVE_FPATHCONF 1
/* Define to 1 if you have the `fseek64' function. */
/* #undef HAVE_FSEEK64 */
/* Define to 1 if you have the `fseeko' function. */
#define HAVE_FSEEKO 1
/* Define to 1 if you have the `fstatat' function. */
#define HAVE_FSTATAT 1
/* Define to 1 if you have the `fstatvfs' function. */
/* #undef HAVE_FSTATVFS */
/* Define if you have the 'fsync' function. */
#define HAVE_FSYNC 1
/* Define to 1 if you have the `ftell64' function. */
/* #undef HAVE_FTELL64 */
/* Define to 1 if you have the `ftello' function. */
#define HAVE_FTELLO 1
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the `futimens' function. */
/* #undef HAVE_FUTIMENS */
/* Define to 1 if you have the `futimes' function. */
/* #undef HAVE_FUTIMES */
/* Define to 1 if you have the `futimesat' function. */
/* #undef HAVE_FUTIMESAT */
/* Define to 1 if you have the `gai_strerror' function. */
#define HAVE_GAI_STRERROR 1
/* Define to 1 if you have the `gamma' function. */
/* #undef HAVE_GAMMA */
/* Define if we can use gcc inline assembler to get and set mc68881 fpcr */
/* #undef HAVE_GCC_ASM_FOR_MC68881 */
/* Define if we can use x64 gcc inline assembler */
/* #undef HAVE_GCC_ASM_FOR_X64 */
/* Define if we can use gcc inline assembler to get and set x87 control word
*/
/* #undef HAVE_GCC_ASM_FOR_X87 */
/* Define if your compiler provides __uint128_t */
/* #undef HAVE_GCC_UINT128_T */
/* Define if you have the getaddrinfo function. */
#define HAVE_GETADDRINFO 1
/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */
#define HAVE_GETC_UNLOCKED 1
/* Define to 1 if you have the `getentropy' function. */
/* #undef HAVE_GETENTROPY */
/* Define to 1 if you have the `getgrouplist' function. */
#define HAVE_GETGROUPLIST 1
/* Define to 1 if you have the `getgroups' function. */
#define HAVE_GETGROUPS 1
/* Define to 1 if you have the `gethostbyname' function. */
#define HAVE_GETHOSTBYNAME 1
/* Define this if you have some version of gethostbyname_r() */
/* #undef HAVE_GETHOSTBYNAME_R */
/* Define this if you have the 3-arg version of gethostbyname_r(). */
/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */
/* Define this if you have the 5-arg version of gethostbyname_r(). */
/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */
/* Define this if you have the 6-arg version of gethostbyname_r(). */
/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */
/* Define to 1 if you have the `getitimer' function. */
#define HAVE_GETITIMER 1
/* Define to 1 if you have the `getloadavg' function. */
#define HAVE_GETLOADAVG 1
/* Define to 1 if you have the `getlogin' function. */
#define HAVE_GETLOGIN 1
/* Define to 1 if you have the `getnameinfo' function. */
#define HAVE_GETNAMEINFO 1
/* Define if you have the 'getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getpeername' function. */
#define HAVE_GETPEERNAME 1
/* Define to 1 if you have the `getpgid' function. */
#define HAVE_GETPGID 1
/* Define to 1 if you have the `getpgrp' function. */
#define HAVE_GETPGRP 1
/* Define to 1 if you have the `getpid' function. */
#define HAVE_GETPID 1
/* Define to 1 if you have the `getpriority' function. */
#define HAVE_GETPRIORITY 1
/* Define to 1 if you have the `getpwent' function. */
#define HAVE_GETPWENT 1
/* Define to 1 if the Linux getrandom() syscall is available */
/* #undef HAVE_GETRANDOM_SYSCALL */
/* Define to 1 if you have the `getresgid' function. */
#define HAVE_GETRESGID 1
/* Define to 1 if you have the `getresuid' function. */
#define HAVE_GETRESUID 1
/* Define to 1 if you have the `getsid' function. */
/* #undef HAVE_GETSID */
/* Define to 1 if you have the `getspent' function. */
/* #undef HAVE_GETSPENT */
/* Define to 1 if you have the `getspnam' function. */
/* #undef HAVE_GETSPNAM */
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `getwd' function. */
/* #undef HAVE_GETWD */
/* Define if glibc has incorrect _FORTIFY_SOURCE wrappers for memmove and
bcopy. */
/* #undef HAVE_GLIBC_MEMMOVE_BUG */
/* Define to 1 if you have the <grp.h> header file. */
#define HAVE_GRP_H 1
/* Define if you have the 'hstrerror' function. */
#define HAVE_HSTRERROR 1
/* Define this if you have le64toh() */
#define HAVE_HTOLE64 1
/* Define to 1 if you have the `hypot' function. */
#define HAVE_HYPOT 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define to 1 if you have the `if_nameindex' function. */
/* #undef HAVE_IF_NAMEINDEX */
/* Define if you have the 'inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define if you have the 'inet_pton' function. */
#define HAVE_INET_PTON 1
/* Define to 1 if you have the `initgroups' function. */
#define HAVE_INITGROUPS 1
/* Define if your compiler provides int32_t. */
#define HAVE_INT32_T 1
/* Define if your compiler provides int64_t. */
#define HAVE_INT64_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
/* Define if gcc has the ipa-pure-const bug. */
/* #undef HAVE_IPA_PURE_CONST_BUG */
/* Define to 1 if you have the `kill' function. */
#define HAVE_KILL 1
/* Define to 1 if you have the `killpg' function. */
#define HAVE_KILLPG 1
/* Define if you have the 'kqueue' functions. */
#define HAVE_KQUEUE 1
/* Define to 1 if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1
/* Defined to enable large file support when an off_t is bigger than a long
and long long is available and at least as big as an off_t. You may need to
add some flags for configuration and compilation to enable this mode. (For
Solaris and Linux, the necessary defines are already defined.) */
/* #undef HAVE_LARGEFILE_SUPPORT */
/* Define to 1 if you have the 'lchflags' function. */
/* #undef HAVE_LCHFLAGS */
/* Define to 1 if you have the `lchmod' function. */
/* #undef HAVE_LCHMOD */
/* Define to 1 if you have the `lchown' function. */
#define HAVE_LCHOWN 1
/* Define to 1 if you have the `lgamma' function. */
#define HAVE_LGAMMA 1
/* Define to 1 if you have the `dl' library (-ldl). */
#define HAVE_LIBDL 1
/* Define to 1 if you have the `dld' library (-ldld). */
/* #undef HAVE_LIBDLD */
/* Define to 1 if you have the `ieee' library (-lieee). */
/* #undef HAVE_LIBIEEE */
/* Define to 1 if you have the <libintl.h> header file. */
/* #undef HAVE_LIBINTL_H */
/* Define if you have the readline library (-lreadline). */
/* #undef HAVE_LIBREADLINE */
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define to 1 if you have the `sendfile' library (-lsendfile). */
/* #undef HAVE_LIBSENDFILE */
/* Define to 1 if you have the <libutil.h> header file. */
/* #undef HAVE_LIBUTIL_H */
/* Define if you have the 'link' function. */
#define HAVE_LINK 1
/* Define to 1 if you have the `linkat' function. */
/* #undef HAVE_LINKAT */
/* Define to 1 if you have the <linux/can/bcm.h> header file. */
/* #undef HAVE_LINUX_CAN_BCM_H */
/* Define to 1 if you have the <linux/can.h> header file. */
/* #undef HAVE_LINUX_CAN_H */
/* Define if compiling using Linux 3.6 or later. */
/* #undef HAVE_LINUX_CAN_RAW_FD_FRAMES */
/* Define to 1 if you have the <linux/can/raw.h> header file. */
/* #undef HAVE_LINUX_CAN_RAW_H */
/* Define to 1 if you have the <linux/netlink.h> header file. */
#define HAVE_LINUX_NETLINK_H 1
/* Define to 1 if you have the <linux/tipc.h> header file. */
/* #undef HAVE_LINUX_TIPC_H */
/* Define to 1 if you have the `lockf' function. */
#define HAVE_LOCKF 1
/* Define to 1 if you have the `log1p' function. */
#define HAVE_LOG1P 1
/* Define to 1 if you have the `log2' function. */
#define HAVE_LOG2 1
/* Define this if you have the type long double. */
#define HAVE_LONG_DOUBLE 1
/* Define this if you have the type long long. */
#define HAVE_LONG_LONG 1
/* Define to 1 if you have the `lstat' function. */
#define HAVE_LSTAT 1
/* Define to 1 if you have the `lutimes' function. */
/* #undef HAVE_LUTIMES */
/* Define this if you have the makedev macro. */
#define HAVE_MAKEDEV 1
/* Define to 1 if you have the `mbrtowc' function. */
#define HAVE_MBRTOWC 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memrchr' function. */
#define HAVE_MEMRCHR 1
/* Define to 1 if you have the `mkdirat' function. */
#define HAVE_MKDIRAT 1
/* Define to 1 if you have the `mkfifo' function. */
/* #undef HAVE_MKFIFO */
/* Define to 1 if you have the `mkfifoat' function. */
/* #undef HAVE_MKFIFOAT */
/* Define to 1 if you have the `mknod' function. */
#define HAVE_MKNOD 1
/* Define to 1 if you have the `mknodat' function. */
/* #undef HAVE_MKNODAT */
/* Define to 1 if you have the `mktime' function. */
#define HAVE_MKTIME 1
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1
/* Define to 1 if you have the `mremap' function. */
#define HAVE_MREMAP 1
/* Define to 1 if you have the <ncurses.h> header file. */
/* #undef HAVE_NCURSES_H */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netpacket/packet.h> header file. */
#define HAVE_NETPACKET_PACKET_H 1
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the `nice' function. */
#define HAVE_NICE 1
/* Define to 1 if you have the `openat' function. */
#define HAVE_OPENAT 1
/* Define to 1 if you have the `openpty' function. */
/* #undef HAVE_OPENPTY */
/* Define if compiling using MacOS X 10.5 SDK or later. */
/* #undef HAVE_OSX105_SDK */
/* Define to 1 if you have the `pathconf' function. */
#define HAVE_PATHCONF 1
/* Define to 1 if you have the `pause' function. */
#define HAVE_PAUSE 1
/* Define to 1 if you have the `pipe2' function. */
#define HAVE_PIPE2 1
/* Define to 1 if you have the `plock' function. */
/* #undef HAVE_PLOCK */
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the `posix_fadvise' function. */
#define HAVE_POSIX_FADVISE 1
/* Define to 1 if you have the `posix_fallocate' function. */
#define HAVE_POSIX_FALLOCATE 1
/* Define to 1 if you have the `pread' function. */
#define HAVE_PREAD 1
/* Define if you have the 'prlimit' functions. */
/* #undef HAVE_PRLIMIT */
/* Define to 1 if you have the <process.h> header file. */
/* #undef HAVE_PROCESS_H */
/* Define if your compiler supports function prototype */
#define HAVE_PROTOTYPES 1
/* Define to 1 if you have the `pthread_atfork' function. */
/* #undef HAVE_PTHREAD_ATFORK */
/* Defined for Solaris 2.6 bug in pthread header. */
/* #undef HAVE_PTHREAD_DESTRUCTOR */
/* Define to 1 if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1
/* Define to 1 if you have the `pthread_init' function. */
/* #undef HAVE_PTHREAD_INIT */
/* Define to 1 if you have the `pthread_kill' function. */
#define HAVE_PTHREAD_KILL 1
/* Define to 1 if you have the `pthread_sigmask' function. */
#define HAVE_PTHREAD_SIGMASK 1
/* Define to 1 if you have the <pty.h> header file. */
/* #undef HAVE_PTY_H */
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
/* Define to 1 if you have the `pwrite' function. */
#define HAVE_PWRITE 1
/* Define if the libcrypto has RAND_egd */
/* #undef HAVE_RAND_EGD */
/* Define to 1 if you have the `readlink' function. */
#define HAVE_READLINK 1
/* Define to 1 if you have the `readlinkat' function. */
/* #undef HAVE_READLINKAT */
/* Define to 1 if you have the `readv' function. */
#define HAVE_READV 1
/* Define to 1 if you have the `realpath' function. */
#define HAVE_REALPATH 1
/* Define to 1 if you have the `renameat' function. */
#define HAVE_RENAMEAT 1
/* Define if readline supports append_history */
/* #undef HAVE_RL_APPEND_HISTORY */
/* Define if you have readline 2.1 */
/* #undef HAVE_RL_CALLBACK */
/* Define if you can turn off readline's signal handling. */
/* #undef HAVE_RL_CATCH_SIGNAL */
/* Define if you have readline 2.2 */
/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
/* Define if you have readline 4.2 */
/* #undef HAVE_RL_COMPLETION_MATCHES */
/* Define if you have rl_completion_suppress_append */
/* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_PRE_INPUT_HOOK */
/* Define to 1 if you have the `round' function. */
#define HAVE_ROUND 1
/* Define to 1 if you have the `sched_get_priority_max' function. */
#define HAVE_SCHED_GET_PRIORITY_MAX 1
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 1
/* Define to 1 if you have the `sched_rr_get_interval' function. */
#define HAVE_SCHED_RR_GET_INTERVAL 1
/* Define to 1 if you have the `sched_setaffinity' function. */
#define HAVE_SCHED_SETAFFINITY 1
/* Define to 1 if you have the `sched_setparam' function. */
#define HAVE_SCHED_SETPARAM 1
/* Define to 1 if you have the `sched_setscheduler' function. */
#define HAVE_SCHED_SETSCHEDULER 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `sem_getvalue' function. */
#define HAVE_SEM_GETVALUE 1
/* Define to 1 if you have the `sem_open' function. */
#define HAVE_SEM_OPEN 1
/* Define to 1 if you have the `sem_timedwait' function. */
#define HAVE_SEM_TIMEDWAIT 1
/* Define to 1 if you have the `sem_unlink' function. */
#define HAVE_SEM_UNLINK 1
/* Define to 1 if you have the `sendfile' function. */
#define HAVE_SENDFILE 1
/* Define to 1 if you have the `setegid' function. */
#define HAVE_SETEGID 1
/* Define to 1 if you have the `seteuid' function. */
#define HAVE_SETEUID 1
/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1
/* Define if you have the 'setgroups' function. */
#define HAVE_SETGROUPS 1
/* Define to 1 if you have the `sethostname' function. */
/* #undef HAVE_SETHOSTNAME */
/* Define to 1 if you have the `setitimer' function. */
#define HAVE_SETITIMER 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setpgid' function. */
#define HAVE_SETPGID 1
/* Define to 1 if you have the `setpgrp' function. */
#define HAVE_SETPGRP 1
/* Define to 1 if you have the `setpriority' function. */
#define HAVE_SETPRIORITY 1
/* Define to 1 if you have the `setregid' function. */
#define HAVE_SETREGID 1
/* Define to 1 if you have the `setresgid' function. */
#define HAVE_SETRESGID 1
/* Define to 1 if you have the `setresuid' function. */
#define HAVE_SETRESUID 1
/* Define to 1 if you have the `setreuid' function. */
#define HAVE_SETREUID 1
/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if you have the `setvbuf' function. */
#define HAVE_SETVBUF 1
/* Define to 1 if you have the <shadow.h> header file. */
/* #undef HAVE_SHADOW_H */
/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
/* Define to 1 if you have the `sigaltstack' function. */
#define HAVE_SIGALTSTACK 1
/* Define to 1 if you have the `siginterrupt' function. */
#define HAVE_SIGINTERRUPT 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the `sigpending' function. */
#define HAVE_SIGPENDING 1
/* Define to 1 if you have the `sigrelse' function. */
/* #undef HAVE_SIGRELSE */
/* Define to 1 if you have the `sigtimedwait' function. */
/* #undef HAVE_SIGTIMEDWAIT */
/* Define to 1 if you have the `sigwait' function. */
#define HAVE_SIGWAIT 1
/* Define to 1 if you have the `sigwaitinfo' function. */
/* #undef HAVE_SIGWAITINFO */
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define if sockaddr has sa_len member */
/* #undef HAVE_SOCKADDR_SA_LEN */
/* struct sockaddr_storage (sys/socket.h) */
#define HAVE_SOCKADDR_STORAGE 1
/* Define if you have the 'socketpair' function. */
#define HAVE_SOCKETPAIR 1
/* Define to 1 if you have the <spawn.h> header file. */
/* #undef HAVE_SPAWN_H */
/* Define if your compiler provides ssize_t */
#define HAVE_SSIZE_T 1
/* Define to 1 if you have the `statvfs' function. */
/* #undef HAVE_STATVFS */
/* Define if you have struct stat.st_mtim.tv_nsec */
/* #undef HAVE_STAT_TV_NSEC */
/* Define if you have struct stat.st_mtimensec */
/* #undef HAVE_STAT_TV_NSEC2 */
/* Define if your compiler supports variable length function prototypes (e.g.
void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
#define HAVE_STDARG_PROTOTYPES 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Has stdatomic.h, atomic_int and _Atomic void* types work */
#define HAVE_STD_ATOMIC 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the <stropts.h> header file. */
/* #undef HAVE_STROPTS_H */
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
/* Define to 1 if `st_flags' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_FLAGS */
/* Define to 1 if `st_gen' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_GEN */
/* Define to 1 if `st_rdev' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_RDEV 1
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#define HAVE_STRUCT_TM_TM_ZONE 1
/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
`HAVE_STRUCT_STAT_ST_BLOCKS' instead. */
#define HAVE_ST_BLOCKS 1
/* Define if you have the 'symlink' function. */
#define HAVE_SYMLINK 1
/* Define to 1 if you have the `symlinkat' function. */
/* #undef HAVE_SYMLINKAT */
/* Define to 1 if you have the `sync' function. */
#define HAVE_SYNC 1
/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1
/* Define to 1 if you have the <sysexits.h> header file. */
#define HAVE_SYSEXITS_H 1
/* Define to 1 if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define to 1 if you have the <sys/bsdtty.h> header file. */
/* #undef HAVE_SYS_BSDTTY_H */
/* Define to 1 if you have the <sys/devpoll.h> header file. */
/* #undef HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/endian.h> header file. */
#define HAVE_SYS_ENDIAN_H 1
/* Define to 1 if you have the <sys/epoll.h> header file. */
#define HAVE_SYS_EPOLL_H 1
/* Define to 1 if you have the <sys/event.h> header file. */
#define HAVE_SYS_EVENT_H 1
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/kern_control.h> header file. */
/* #undef HAVE_SYS_KERN_CONTROL_H */
/* Define to 1 if you have the <sys/loadavg.h> header file. */
/* #undef HAVE_SYS_LOADAVG_H */
/* Define to 1 if you have the <sys/lock.h> header file. */
/* #undef HAVE_SYS_LOCK_H */
/* Define to 1 if you have the <sys/mkdev.h> header file. */
/* #undef HAVE_SYS_MKDEV_H */
/* Define to 1 if you have the <sys/modem.h> header file. */
/* #undef HAVE_SYS_MODEM_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#define HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
/* #undef HAVE_SYS_STATVFS_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1
/* Define to 1 if you have the <sys/sys_domain.h> header file. */
/* #undef HAVE_SYS_SYS_DOMAIN_H */
/* Define to 1 if you have the <sys/termio.h> header file. */
/* #undef HAVE_SYS_TERMIO_H */
/* Define to 1 if you have the <sys/times.h> header file. */
#define HAVE_SYS_TIMES_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <sys/xattr.h> header file. */
/* #undef HAVE_SYS_XATTR_H */
/* Define to 1 if you have the `tcgetpgrp' function. */
#define HAVE_TCGETPGRP 1
/* Define to 1 if you have the `tcsetpgrp' function. */
#define HAVE_TCSETPGRP 1
/* Define to 1 if you have the `tempnam' function. */
#define HAVE_TEMPNAM 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <term.h> header file. */
/* #undef HAVE_TERM_H */
/* Define to 1 if you have the `tgamma' function. */
#define HAVE_TGAMMA 1
/* Define to 1 if you have the `timegm' function. */
/* #undef HAVE_TIMEGM */
/* Define to 1 if you have the `times' function. */
#define HAVE_TIMES 1
/* Define to 1 if you have the `tmpfile' function. */
#define HAVE_TMPFILE 1
/* Define to 1 if you have the `tmpnam' function. */
#define HAVE_TMPNAM 1
/* Define to 1 if you have the `tmpnam_r' function. */
/* #undef HAVE_TMPNAM_R */
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead. */
#define HAVE_TM_ZONE 1
/* Define to 1 if you have the `truncate' function. */
#define HAVE_TRUNCATE 1
/* Define to 1 if you don't have `tm_zone' but do have the external array
`tzname'. */
/* #undef HAVE_TZNAME */
/* Define this if you have tcl and TCL_UTF_MAX==6 */
/* #undef HAVE_UCS4_TCL */
/* Define if your compiler provides uint32_t. */
#define HAVE_UINT32_T 1
/* Define if your compiler provides uint64_t. */
#define HAVE_UINT64_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `unlinkat' function. */
#define HAVE_UNLINKAT 1
/* Define to 1 if you have the `unsetenv' function. */
#define HAVE_UNSETENV 1
/* Define if you have a useable wchar_t type defined in wchar.h; useable means
wchar_t must be an unsigned type with at least 16 bits. (see
Include/unicodeobject.h). */
/* #undef HAVE_USABLE_WCHAR_T */
/* Define to 1 if you have the <util.h> header file. */
#define HAVE_UTIL_H 1
/* Define to 1 if you have the `utimensat' function. */
/* #undef HAVE_UTIMENSAT */
/* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if you have the `wait3' function. */
#define HAVE_WAIT3 1
/* Define to 1 if you have the `wait4' function. */
/* #undef HAVE_WAIT4 */
/* Define to 1 if you have the `waitid' function. */
#define HAVE_WAITID 1
/* Define to 1 if you have the `waitpid' function. */
#define HAVE_WAITPID 1
/* Define if the compiler provides a wchar.h header file. */
#define HAVE_WCHAR_H 1
/* Define to 1 if you have the `wcscoll' function. */
#define HAVE_WCSCOLL 1
/* Define to 1 if you have the `wcsftime' function. */
#define HAVE_WCSFTIME 1
/* Define to 1 if you have the `wcsxfrm' function. */
#define HAVE_WCSXFRM 1
/* Define to 1 if you have the `wmemcmp' function. */
#define HAVE_WMEMCMP 1
/* Define if tzset() actually switches the local timezone in a meaningful way.
*/
/* #undef HAVE_WORKING_TZSET */
/* Define to 1 if you have the `writev' function. */
#define HAVE_WRITEV 1
/* Define if the zlib library has inflateCopy */
#define HAVE_ZLIB_COPY 1
/* Define to 1 if you have the `_getpty' function. */
/* #undef HAVE__GETPTY */
/* Define if log1p(-0.) is 0. rather than -0. */
/* #undef LOG1P_DROPS_ZERO_SIGN */
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
/* #undef MAJOR_IN_MKDEV */
/* Define to 1 if `major', `minor', and `makedev' are declared in
<sysmacros.h>. */
#define MAJOR_IN_SYSMACROS 1
/* Define if mvwdelch in curses.h is an expression. */
/* #undef MVWDELCH_IS_EXPRESSION */
/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
/* #undef PACKAGE_VERSION */
/* Define if POSIX semaphores aren't enabled on your system */
/* #undef POSIX_SEMAPHORES_NOT_ENABLED */
/* Defined if PTHREAD_SCOPE_SYSTEM supported. */
/* #undef PTHREAD_SYSTEM_SCHED_SUPPORTED */
/* Define as the preferred size in bits of long digits */
/* #undef PYLONG_BITS_IN_DIGIT */
/* Define to printf format modifier for long long type */
#define PY_FORMAT_LONG_LONG "ll"
/* Define to printf format modifier for Py_ssize_t */
#define PY_FORMAT_SIZE_T "z"
/* Define if you want to build an interpreter with many run-time checks. */
/* #undef Py_DEBUG */
/* Defined if Python is built as a shared library. */
#define Py_ENABLE_SHARED 1
/* Define hash algorithm for str, bytes and memoryview. SipHash24: 1, FNV: 2,
externally defined: 0 */
/* #undef Py_HASH_ALGORITHM */
/* assume C89 semantics that RETSIGTYPE is always void */
#define RETSIGTYPE void
/* Define if setpgrp() must be called as setpgrp(0, 0). */
/* #undef SETPGRP_HAVE_ARG */
/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */
/* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */
/* The size of `double', as computed by sizeof. */
#define SIZEOF_DOUBLE 8
/* The size of `float', as computed by sizeof. */
#define SIZEOF_FLOAT 4
/* The size of `fpos_t', as computed by sizeof. */
#define SIZEOF_FPOS_T 4
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `long double', as computed by sizeof. */
#define SIZEOF_LONG_DOUBLE 8
/* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 4
/* The size of `pid_t', as computed by sizeof. */
#define SIZEOF_PID_T 4
/* The size of `pthread_t', as computed by sizeof. */
#define SIZEOF_PTHREAD_T 4
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 4
/* The size of `uintptr_t', as computed by sizeof. */
#define SIZEOF_UINTPTR_T 4
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 4
/* The size of `wchar_t', as computed by sizeof. */
#define SIZEOF_WCHAR_T 4
/* The size of `_Bool', as computed by sizeof. */
#define SIZEOF__BOOL 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
(which you can't on SCO ODT 3.0). */
#define SYS_SELECT_WITH_SYS_TIME 1
/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */
/* #undef TANH_PRESERVES_ZERO_SIGN */
/* Library needed by timemodule.c: librt may be needed for clock_gettime() */
/* #undef TIMEMODULE_LIB */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Define if you want to use computed gotos in ceval.c. */
#define USE_COMPUTED_GOTOS 1
/* Define to use the C99 inline keyword. */
#define USE_INLINE 1
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Define if a va_list is an array of some kind */
/* #undef VA_LIST_IS_ARRAY */
/* Define if you want SIGFPE handled (see Include/pyfpe.h). */
/* #undef WANT_SIGFPE_HANDLER */
/* Define if WINDOW in curses.h offers a field _flags. */
/* #undef WINDOW_HAS_FLAGS */
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic
linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).
Dyld is necessary to support frameworks. */
/* #undef WITH_DYLD */
/* Define to 1 if libintl is needed for locale functions. */
/* #undef WITH_LIBINTL */
/* Define if you want to produce an OpenStep/Rhapsody framework (shared
library plus accessory files). */
/* #undef WITH_NEXT_FRAMEWORK */
/* Define if you want to compile in Python-specific mallocs */
#define WITH_PYMALLOC 1
/* Define if you want to compile in rudimentary thread support */
#define WITH_THREAD 1
/* Define to profile with the Pentium timestamp counter */
/* #undef WITH_TSC */
/* Define if you want pymalloc to be disabled when running under valgrind */
/* #undef WITH_VALGRIND */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define if arithmetic is subject to x87-style double rounding issue */
/* #undef X87_DOUBLE_ROUNDING */
/* Define on OpenBSD to activate all library features */
/* #undef _BSD_SOURCE */
/* Define on Irix to enable u_int */
#define _BSD_TYPES 1
/* Define on Darwin to activate all library features */
#define _DARWIN_C_SOURCE 1
/* This must be set to 64 on some systems to enable large file support. */
#define _FILE_OFFSET_BITS 64
/* Define on Linux to activate all library features */
#define _GNU_SOURCE 1
/* Define to include mbstate_t for mbrtowc */
/* #undef _INCLUDE__STDC_A1_SOURCE */
/* This must be defined on some systems to enable large file support. */
#define _LARGEFILE_SOURCE 1
/* This must be defined on AIX systems to enable large file support. */
/* #undef _LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define on NetBSD to activate all library features */
#define _NETBSD_SOURCE 1
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to activate features from IEEE Stds 1003.1-2008 */
#define _POSIX_C_SOURCE 200809L
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define if you have POSIX threads, and your system does not define that. */
/* #undef _POSIX_THREADS */
/* Define to force use of thread-safe errno, h_errno, and other functions */
#define _REENTRANT 1
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT64_T */
/* Define to the level of X/Open that your system supports */
#define _XOPEN_SOURCE 700
/* Define to activate Unix95-and-earlier features */
#define _XOPEN_SOURCE_EXTENDED 1
/* Define on FreeBSD to activate all library features */
#define __BSD_VISIBLE 1
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
/* # undef __CHAR_UNSIGNED__ */
#endif
/* Define to 'long' if <time.h> doesn't define. */
/* #undef clock_t */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef int32_t */
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef int64_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef mode_t */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to empty if the keyword does not work. */
/* #undef signed */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/socket.h> does not define. */
/* #undef socklen_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint64_t */
/* Define to empty if the keyword does not work. */
/* #undef volatile */
/* Define the macros needed if on a UnixWare 7.x system. */
#if defined(__USLC__) && defined(__SCO_VERSION__)
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
#endif
#endif /*Py_PYCONFIG_H*/
``` | /content/code_sandbox/android/python35/include/pyconfig_armeabi_v7a_hard.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 12,551 |
```objective-c
#ifndef Py_LIMITED_API
#ifndef PYCTYPE_H
#define PYCTYPE_H
#define PY_CTF_LOWER 0x01
#define PY_CTF_UPPER 0x02
#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
#define PY_CTF_DIGIT 0x04
#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
#define PY_CTF_SPACE 0x08
#define PY_CTF_XDIGIT 0x10
PyAPI_DATA(const unsigned int) _Py_ctype_table[256];
/* Unlike their C counterparts, the following macros are not meant to
* handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
* must be a signed/unsigned char. */
#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256];
PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256];
#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
#endif /* !PYCTYPE_H */
#endif /* !Py_LIMITED_API */
``` | /content/code_sandbox/android/python35/include/pyctype.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 440 |
```objective-c
#ifndef Py_PYTHON_H
#define Py_PYTHON_H
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
/* Include nearly all Python header files */
#include "patchlevel.h"
#include "pyconfig.h"
#include "pymacconfig.h"
#include <limits.h>
#ifndef UCHAR_MAX
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
#endif
#if UCHAR_MAX != 255
#error "Python's source code assumes C's unsigned char is an 8-bit type."
#endif
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
#define _SGI_MP_SOURCE
#endif
#include <stdio.h>
#ifndef NULL
# error "Python.h requires that stdio.h define NULL."
#endif
#include <string.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/* For size_t? */
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
/* CAUTION: Build setups should ensure that NDEBUG is defined on the
* compiler command line when building Python in release mode; else
* assert() calls won't be removed.
*/
#include <assert.h>
#include "pyport.h"
#include "pymacro.h"
#include "pyatomic.h"
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
*/
#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
#define PYMALLOC_DEBUG
#endif
#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
#endif
#include "pymath.h"
#include "pytime.h"
#include "pymem.h"
#include "object.h"
#include "objimpl.h"
#include "typeslots.h"
#include "pyhash.h"
#include "pydebug.h"
#include "bytearrayobject.h"
#include "bytesobject.h"
#include "unicodeobject.h"
#include "longobject.h"
#include "longintrepr.h"
#include "boolobject.h"
#include "floatobject.h"
#include "complexobject.h"
#include "rangeobject.h"
#include "memoryobject.h"
#include "tupleobject.h"
#include "listobject.h"
#include "dictobject.h"
#include "odictobject.h"
#include "enumobject.h"
#include "setobject.h"
#include "methodobject.h"
#include "moduleobject.h"
#include "funcobject.h"
#include "classobject.h"
#include "fileobject.h"
#include "pycapsule.h"
#include "traceback.h"
#include "sliceobject.h"
#include "cellobject.h"
#include "iterobject.h"
#include "genobject.h"
#include "descrobject.h"
#include "warnings.h"
#include "weakrefobject.h"
#include "structseq.h"
#include "namespaceobject.h"
#include "codecs.h"
#include "pyerrors.h"
#include "pystate.h"
#include "pyarena.h"
#include "modsupport.h"
#include "pythonrun.h"
#include "pylifecycle.h"
#include "ceval.h"
#include "sysmodule.h"
#include "intrcheck.h"
#include "import.h"
#include "abstract.h"
#include "bltinmodule.h"
#include "compile.h"
#include "eval.h"
#include "pyctype.h"
#include "pystrtod.h"
#include "pystrcmp.h"
#include "dtoa.h"
#include "fileutils.h"
#include "pyfpe.h"
#endif /* !Py_PYTHON_H */
``` | /content/code_sandbox/android/python35/include/Python.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 762 |
```objective-c
/* Issue #23644: <stdatomic.h> is incompatible with C++, see:
path_to_url */
#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H
#include "dynamic_annotations.h"
#include "pyconfig.h"
#if defined(HAVE_STD_ATOMIC)
#include <stdatomic.h>
#endif
/* This is modeled after the atomics interface from C1x, according to
* the draft at
* path_to_url
* Operations and types are named the same except with a _Py_ prefix
* and have the same semantics.
*
* Beware, the implementations here are deep magic.
*/
#if defined(HAVE_STD_ATOMIC)
typedef enum _Py_memory_order {
_Py_memory_order_relaxed = memory_order_relaxed,
_Py_memory_order_acquire = memory_order_acquire,
_Py_memory_order_release = memory_order_release,
_Py_memory_order_acq_rel = memory_order_acq_rel,
_Py_memory_order_seq_cst = memory_order_seq_cst
} _Py_memory_order;
typedef struct _Py_atomic_address {
_Atomic void *_value;
} _Py_atomic_address;
typedef struct _Py_atomic_int {
atomic_int _value;
} _Py_atomic_int;
#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
atomic_signal_fence(ORDER)
#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
atomic_thread_fence(ORDER)
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
atomic_store_explicit(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER)
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
atomic_load_explicit(&(ATOMIC_VAL)->_value, ORDER)
/* Use builtin atomic operations in GCC >= 4.7 */
#elif defined(HAVE_BUILTIN_ATOMIC)
typedef enum _Py_memory_order {
_Py_memory_order_relaxed = __ATOMIC_RELAXED,
_Py_memory_order_acquire = __ATOMIC_ACQUIRE,
_Py_memory_order_release = __ATOMIC_RELEASE,
_Py_memory_order_acq_rel = __ATOMIC_ACQ_REL,
_Py_memory_order_seq_cst = __ATOMIC_SEQ_CST
} _Py_memory_order;
typedef struct _Py_atomic_address {
void *_value;
} _Py_atomic_address;
typedef struct _Py_atomic_int {
int _value;
} _Py_atomic_int;
#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
__atomic_signal_fence(ORDER)
#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
__atomic_thread_fence(ORDER)
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
(assert((ORDER) == __ATOMIC_RELAXED \
|| (ORDER) == __ATOMIC_SEQ_CST \
|| (ORDER) == __ATOMIC_RELEASE), \
__atomic_store_n(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER))
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
(assert((ORDER) == __ATOMIC_RELAXED \
|| (ORDER) == __ATOMIC_SEQ_CST \
|| (ORDER) == __ATOMIC_ACQUIRE \
|| (ORDER) == __ATOMIC_CONSUME), \
__atomic_load_n(&(ATOMIC_VAL)->_value, ORDER))
#else
typedef enum _Py_memory_order {
_Py_memory_order_relaxed,
_Py_memory_order_acquire,
_Py_memory_order_release,
_Py_memory_order_acq_rel,
_Py_memory_order_seq_cst
} _Py_memory_order;
typedef struct _Py_atomic_address {
void *_value;
} _Py_atomic_address;
typedef struct _Py_atomic_int {
int _value;
} _Py_atomic_int;
/* Only support GCC (for expression statements) and x86 (for simple
* atomic semantics) for now */
#if defined(__GNUC__) && (defined(__i386__) || defined(__amd64))
static __inline__ void
_Py_atomic_signal_fence(_Py_memory_order order)
{
if (order != _Py_memory_order_relaxed)
__asm__ volatile("":::"memory");
}
static __inline__ void
_Py_atomic_thread_fence(_Py_memory_order order)
{
if (order != _Py_memory_order_relaxed)
__asm__ volatile("mfence":::"memory");
}
/* Tell the race checker about this operation's effects. */
static __inline__ void
_Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
{
(void)address; /* shut up -Wunused-parameter */
switch(order) {
case _Py_memory_order_release:
case _Py_memory_order_acq_rel:
case _Py_memory_order_seq_cst:
_Py_ANNOTATE_HAPPENS_BEFORE(address);
break;
case _Py_memory_order_relaxed:
case _Py_memory_order_acquire:
break;
}
switch(order) {
case _Py_memory_order_acquire:
case _Py_memory_order_acq_rel:
case _Py_memory_order_seq_cst:
_Py_ANNOTATE_HAPPENS_AFTER(address);
break;
case _Py_memory_order_relaxed:
case _Py_memory_order_release:
break;
}
}
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
__extension__ ({ \
__typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \
__typeof__(atomic_val->_value) new_val = NEW_VAL;\
volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \
_Py_memory_order order = ORDER; \
_Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \
\
/* Perform the operation. */ \
_Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \
switch(order) { \
case _Py_memory_order_release: \
_Py_atomic_signal_fence(_Py_memory_order_release); \
/* fallthrough */ \
case _Py_memory_order_relaxed: \
*volatile_data = new_val; \
break; \
\
case _Py_memory_order_acquire: \
case _Py_memory_order_acq_rel: \
case _Py_memory_order_seq_cst: \
__asm__ volatile("xchg %0, %1" \
: "+r"(new_val) \
: "m"(atomic_val->_value) \
: "memory"); \
break; \
} \
_Py_ANNOTATE_IGNORE_WRITES_END(); \
})
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
__extension__ ({ \
__typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \
__typeof__(atomic_val->_value) result; \
volatile __typeof__(result) *volatile_data = &atomic_val->_value; \
_Py_memory_order order = ORDER; \
_Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \
\
/* Perform the operation. */ \
_Py_ANNOTATE_IGNORE_READS_BEGIN(); \
switch(order) { \
case _Py_memory_order_release: \
case _Py_memory_order_acq_rel: \
case _Py_memory_order_seq_cst: \
/* Loads on x86 are not releases by default, so need a */ \
/* thread fence. */ \
_Py_atomic_thread_fence(_Py_memory_order_release); \
break; \
default: \
/* No fence */ \
break; \
} \
result = *volatile_data; \
switch(order) { \
case _Py_memory_order_acquire: \
case _Py_memory_order_acq_rel: \
case _Py_memory_order_seq_cst: \
/* Loads on x86 are automatically acquire operations so */ \
/* can get by with just a compiler fence. */ \
_Py_atomic_signal_fence(_Py_memory_order_acquire); \
break; \
default: \
/* No fence */ \
break; \
} \
_Py_ANNOTATE_IGNORE_READS_END(); \
result; \
})
#else /* !gcc x86 */
/* Fall back to other compilers and processors by assuming that simple
volatile accesses are atomic. This is false, so people should port
this. */
#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0)
#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0)
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
((ATOMIC_VAL)->_value = NEW_VAL)
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
((ATOMIC_VAL)->_value)
#endif /* !gcc x86 */
#endif
/* Standardized shortcuts. */
#define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \
_Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_seq_cst)
#define _Py_atomic_load(ATOMIC_VAL) \
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_seq_cst)
/* Python-local extensions */
#define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \
_Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_relaxed)
#define _Py_atomic_load_relaxed(ATOMIC_VAL) \
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed)
#endif /* Py_ATOMIC_H */
#endif /* Py_LIMITED_API */
``` | /content/code_sandbox/android/python35/include/pyatomic.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,022 |
```objective-c
#ifndef Py_AST_H
#define Py_AST_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
PyAPI_FUNC(mod_ty) PyAST_FromNode(
const node *n,
PyCompilerFlags *flags,
const char *filename, /* decoded from the filesystem encoding */
PyArena *arena);
PyAPI_FUNC(mod_ty) PyAST_FromNodeObject(
const node *n,
PyCompilerFlags *flags,
PyObject *filename,
PyArena *arena);
#ifdef __cplusplus
}
#endif
#endif /* !Py_AST_H */
``` | /content/code_sandbox/android/python35/include/ast.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 128 |
```objective-c
#ifndef Py_CODECREGISTRY_H
#define Py_CODECREGISTRY_H
#ifdef __cplusplus
extern "C" {
#endif
/* your_sha256_hash--------
Python Codec Registry and support functions
Written by Marc-Andre Lemburg (mal@lemburg.com).
your_sha256_hash-------- */
/* Register a new codec search function.
As side effect, this tries to load the encodings package, if not
yet done, to make sure that it is always first in the list of
search functions.
The search_function's refcount is incremented by this function. */
PyAPI_FUNC(int) PyCodec_Register(
PyObject *search_function
);
/* Codec registry lookup API.
Looks up the given encoding and returns a CodecInfo object with
function attributes which implement the different aspects of
processing the encoding.
The encoding string is looked up converted to all lower-case
characters. This makes encodings looked up through this mechanism
effectively case-insensitive.
If no codec is found, a KeyError is set and NULL returned.
As side effect, this tries to load the encodings package, if not
yet done. This is part of the lazy load strategy for the encodings
package.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
const char *encoding
);
PyAPI_FUNC(int) _PyCodec_Forget(
const char *encoding
);
#endif
/* Codec registry encoding check API.
Returns 1/0 depending on whether there is a registered codec for
the given encoding.
*/
PyAPI_FUNC(int) PyCodec_KnownEncoding(
const char *encoding
);
/* Generic codec based encoding API.
object is passed through the encoder function found for the given
encoding using the error handling method defined by errors. errors
may be NULL to use the default method defined for the codec.
Raises a LookupError in case no encoder can be found.
*/
PyAPI_FUNC(PyObject *) PyCodec_Encode(
PyObject *object,
const char *encoding,
const char *errors
);
/* Generic codec based decoding API.
object is passed through the decoder function found for the given
encoding using the error handling method defined by errors. errors
may be NULL to use the default method defined for the codec.
Raises a LookupError in case no encoder can be found.
*/
PyAPI_FUNC(PyObject *) PyCodec_Decode(
PyObject *object,
const char *encoding,
const char *errors
);
#ifndef Py_LIMITED_API
/* Text codec specific encoding and decoding API.
Checks the encoding against a list of codecs which do not
implement a str<->bytes encoding before attempting the
operation.
Please note that these APIs are internal and should not
be used in Python C extensions.
XXX (ncoghlan): should we make these, or something like them, public
in Python 3.5+?
*/
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
const char *encoding,
const char *alternate_command
);
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
PyObject *object,
const char *encoding,
const char *errors
);
PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
PyObject *object,
const char *encoding,
const char *errors
);
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
* is the only current API consumer.
*/
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
PyObject *codec_info,
const char *errors
);
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
PyObject *codec_info,
const char *errors
);
#endif
/* --- Codec Lookup APIs --------------------------------------------------
All APIs return a codec object with incremented refcount and are
based on _PyCodec_Lookup(). The same comments w/r to the encoding
name also apply to these APIs.
*/
/* Get an encoder function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_Encoder(
const char *encoding
);
/* Get a decoder function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_Decoder(
const char *encoding
);
/* Get a IncrementalEncoder object for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
const char *encoding,
const char *errors
);
/* Get a IncrementalDecoder object function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
const char *encoding,
const char *errors
);
/* Get a StreamReader factory function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
const char *encoding,
PyObject *stream,
const char *errors
);
/* Get a StreamWriter factory function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
const char *encoding,
PyObject *stream,
const char *errors
);
/* Unicode encoding error handling callback registry API */
/* Register the error handling callback function error under the given
name. This function will be called by the codec when it encounters
unencodable characters/undecodable bytes and doesn't know the
callback name, when name is specified as the error parameter
in the call to the encode/decode function.
Return 0 on success, -1 on error */
PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
/* Lookup the error handling callback function registered under the given
name. As a special case NULL can be passed, in which case
the error handling callback for "strict" will be returned. */
PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
/* raise exc as an exception */
PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
/* ignore the unicode error, skipping the faulty input */
PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
/* replace the unicode encode error with ? or U+FFFD */
PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
/* replace the unicode encode error with XML character references */
PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
/* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */
PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc);
PyAPI_DATA(const char *) Py_hexdigits;
#ifdef __cplusplus
}
#endif
#endif /* !Py_CODECREGISTRY_H */
``` | /content/code_sandbox/android/python35/include/codecs.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,438 |
```objective-c
#ifndef Py_LONGOBJECT_H
#define Py_LONGOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Long (arbitrary precision) integer object interface */
typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
PyAPI_DATA(PyTypeObject) PyLong_Type;
#define PyLong_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t);
PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t);
PyAPI_FUNC(PyObject *) PyLong_FromDouble(double);
PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
#endif
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
/* It may be useful in the future. I've added it in the PyInt -> PyLong
cleanup to keep the extra information. [CH] */
#define PyLong_AS_LONG(op) PyLong_AsLong(op)
/* Issue #1983: pid_t can be longer than a C long on some systems */
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
#define _Py_PARSE_PID "i"
#define PyLong_FromPid PyLong_FromLong
#define PyLong_AsPid PyLong_AsLong
#elif SIZEOF_PID_T == SIZEOF_LONG
#define _Py_PARSE_PID "l"
#define PyLong_FromPid PyLong_FromLong
#define PyLong_AsPid PyLong_AsLong
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG
#define _Py_PARSE_PID "L"
#define PyLong_FromPid PyLong_FromLongLong
#define PyLong_AsPid PyLong_AsLongLong
#else
#error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)"
#endif /* SIZEOF_PID_T */
#if SIZEOF_VOID_P == SIZEOF_INT
# define _Py_PARSE_INTPTR "i"
# define _Py_PARSE_UINTPTR "I"
#elif SIZEOF_VOID_P == SIZEOF_LONG
# define _Py_PARSE_INTPTR "l"
# define _Py_PARSE_UINTPTR "k"
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
# define _Py_PARSE_INTPTR "L"
# define _Py_PARSE_UINTPTR "K"
#else
# error "void* different in size from int, long and long long"
#endif /* SIZEOF_VOID_P */
/* Used by Python/mystrtoul.c. */
#ifndef Py_LIMITED_API
PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];
#endif
/* _PyLong_Frexp returns a double x and an exponent e such that the
true value is approximately equal to x * 2**e. e is >= 0. x is
0.0 if and only if the input is 0 (in which case, e and x are both
zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
possible if the number of bits doesn't fit into a Py_ssize_t, sets
OverflowError and returns -1.0 for x, 0 for e. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
#endif
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
#ifdef HAVE_LONG_LONG
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
#endif /* HAVE_LONG_LONG */
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int);
#endif
#ifndef Py_LIMITED_API
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
v must not be NULL, and must be a normalized long.
There are no error cases.
*/
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
/* _PyLong_NumBits. Return the number of bits needed to represent the
absolute value of a long. For example, this returns 1 for 1 and -1, 2
for 2 and -2, and 2 for 3 and -3. It returns 0 for 0.
v must not be NULL, and must be a normalized long.
(size_t)-1 is returned and OverflowError set if the true result doesn't
fit in a size_t.
*/
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
/* _PyLong_DivmodNear. Given integers a and b, compute the nearest
integer q to the exact quotient a / b, rounding to the nearest even integer
in the case of a tie. Return (q, r), where r = a - q*b. The remainder r
will satisfy abs(r) <= abs(b)/2, with equality possible only if q is
even.
*/
PyAPI_FUNC(PyObject *) _PyLong_DivmodNear(PyObject *, PyObject *);
/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
base 256, and return a Python int with the same numeric value.
If n is 0, the integer is 0. Else:
If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB;
else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the
LSB.
If is_signed is 0/false, view the bytes as a non-negative integer.
If is_signed is 1/true, view the bytes as a 2's-complement integer,
non-negative if bit 0x80 of the MSB is clear, negative if set.
Error returns:
+ Return NULL with the appropriate exception set if there's not
enough memory to create the Python int.
*/
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
const unsigned char* bytes, size_t n,
int little_endian, int is_signed);
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
v to a base-256 integer, stored in array bytes. Normally return 0,
return -1 on error.
If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at
bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and
the LSB at bytes[n-1].
If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes
are filled and there's nothing special about bit 0x80 of the MSB.
If is_signed is 1/true, bytes is filled with the 2's-complement
representation of v's value. Bit 0x80 of the MSB is the sign bit.
Error returns (-1):
+ is_signed is 0 and v < 0. TypeError is set in this case, and bytes
isn't altered.
+ n isn't big enough to hold the full mathematical value of v. For
example, if is_signed is 0 and there are more digits in the v than
fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
being large enough to hold a sign bit. OverflowError is set in this
case, but bytes holds the least-signficant n bytes of the true value.
*/
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
unsigned char* bytes, size_t n,
int little_endian, int is_signed);
/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
using the nb_int slot, if available. Raise TypeError if either the
nb_int slot is not available or the result of the call to nb_int
returns something not of type int.
*/
PyAPI_FUNC(PyLongObject *)_PyLong_FromNbInt(PyObject *);
/* _PyLong_Format: Convert the long to a string object with given base,
appending a base prefix of 0[box] if base is 2, 8 or 16. */
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base);
PyAPI_FUNC(int) _PyLong_FormatWriter(
_PyUnicodeWriter *writer,
PyObject *obj,
int base,
int alternate);
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter(
_PyUnicodeWriter *writer,
PyObject *obj,
PyObject *format_spec,
Py_ssize_t start,
Py_ssize_t end);
#endif /* Py_LIMITED_API */
/* These aren't really part of the int object, but they're handy. The
functions are in Python/mystrtoul.c.
*/
PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
/* For use by the gcd function in mathmodule.c */
PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
#ifdef __cplusplus
}
#endif
#endif /* !Py_LONGOBJECT_H */
``` | /content/code_sandbox/android/python35/include/longobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 2,318 |
```objective-c
/* Module object interface */
#ifndef Py_MODULEOBJECT_H
#define Py_MODULEOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_DATA(PyTypeObject) PyModule_Type;
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
PyAPI_FUNC(PyObject *) PyModule_NewObject(
PyObject *name
);
PyAPI_FUNC(PyObject *) PyModule_New(
const char *name /* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *);
#endif
PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
/* New in 3.5 */
PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*);
PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
#endif
typedef struct PyModuleDef_Base {
PyObject_HEAD
PyObject* (*m_init)(void);
Py_ssize_t m_index;
PyObject* m_copy;
} PyModuleDef_Base;
#define PyModuleDef_HEAD_INIT { \
PyObject_HEAD_INIT(NULL) \
NULL, /* m_init */ \
0, /* m_index */ \
NULL, /* m_copy */ \
}
struct PyModuleDef_Slot;
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
/* New in 3.5 */
typedef struct PyModuleDef_Slot{
int slot;
void *value;
} PyModuleDef_Slot;
#define Py_mod_create 1
#define Py_mod_exec 2
#ifndef Py_LIMITED_API
#define _Py_mod_LAST_SLOT 2
#endif
#endif /* New in 3.5 */
typedef struct PyModuleDef{
PyModuleDef_Base m_base;
const char* m_name;
const char* m_doc;
Py_ssize_t m_size;
PyMethodDef *m_methods;
struct PyModuleDef_Slot* m_slots;
traverseproc m_traverse;
inquiry m_clear;
freefunc m_free;
}PyModuleDef;
#ifdef __cplusplus
}
#endif
#endif /* !Py_MODULEOBJECT_H */
``` | /content/code_sandbox/android/python35/include/moduleobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 572 |
```objective-c
#ifndef Py_ITEROBJECT_H
#define Py_ITEROBJECT_H
/* Iterators (the basic kind, over a sequence) */
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type;
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
#ifdef __cplusplus
}
#endif
#endif /* !Py_ITEROBJECT_H */
``` | /content/code_sandbox/android/python35/include/iterobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 155 |
```objective-c
/* Auto-generated by Tools/scripts/generate_opcode_h.py */
#ifndef Py_OPCODE_H
#define Py_OPCODE_H
#ifdef __cplusplus
extern "C" {
#endif
/* Instruction opcodes for compiled code */
#define POP_TOP 1
#define ROT_TWO 2
#define ROT_THREE 3
#define DUP_TOP 4
#define DUP_TOP_TWO 5
#define NOP 9
#define UNARY_POSITIVE 10
#define UNARY_NEGATIVE 11
#define UNARY_NOT 12
#define UNARY_INVERT 15
#define BINARY_MATRIX_MULTIPLY 16
#define INPLACE_MATRIX_MULTIPLY 17
#define BINARY_POWER 19
#define BINARY_MULTIPLY 20
#define BINARY_MODULO 22
#define BINARY_ADD 23
#define BINARY_SUBTRACT 24
#define BINARY_SUBSCR 25
#define BINARY_FLOOR_DIVIDE 26
#define BINARY_TRUE_DIVIDE 27
#define INPLACE_FLOOR_DIVIDE 28
#define INPLACE_TRUE_DIVIDE 29
#define GET_AITER 50
#define GET_ANEXT 51
#define BEFORE_ASYNC_WITH 52
#define INPLACE_ADD 55
#define INPLACE_SUBTRACT 56
#define INPLACE_MULTIPLY 57
#define INPLACE_MODULO 59
#define STORE_SUBSCR 60
#define DELETE_SUBSCR 61
#define BINARY_LSHIFT 62
#define BINARY_RSHIFT 63
#define BINARY_AND 64
#define BINARY_XOR 65
#define BINARY_OR 66
#define INPLACE_POWER 67
#define GET_ITER 68
#define GET_YIELD_FROM_ITER 69
#define PRINT_EXPR 70
#define LOAD_BUILD_CLASS 71
#define YIELD_FROM 72
#define GET_AWAITABLE 73
#define INPLACE_LSHIFT 75
#define INPLACE_RSHIFT 76
#define INPLACE_AND 77
#define INPLACE_XOR 78
#define INPLACE_OR 79
#define BREAK_LOOP 80
#define WITH_CLEANUP_START 81
#define WITH_CLEANUP_FINISH 82
#define RETURN_VALUE 83
#define IMPORT_STAR 84
#define YIELD_VALUE 86
#define POP_BLOCK 87
#define END_FINALLY 88
#define POP_EXCEPT 89
#define HAVE_ARGUMENT 90
#define STORE_NAME 90
#define DELETE_NAME 91
#define UNPACK_SEQUENCE 92
#define FOR_ITER 93
#define UNPACK_EX 94
#define STORE_ATTR 95
#define DELETE_ATTR 96
#define STORE_GLOBAL 97
#define DELETE_GLOBAL 98
#define LOAD_CONST 100
#define LOAD_NAME 101
#define BUILD_TUPLE 102
#define BUILD_LIST 103
#define BUILD_SET 104
#define BUILD_MAP 105
#define LOAD_ATTR 106
#define COMPARE_OP 107
#define IMPORT_NAME 108
#define IMPORT_FROM 109
#define JUMP_FORWARD 110
#define JUMP_IF_FALSE_OR_POP 111
#define JUMP_IF_TRUE_OR_POP 112
#define JUMP_ABSOLUTE 113
#define POP_JUMP_IF_FALSE 114
#define POP_JUMP_IF_TRUE 115
#define LOAD_GLOBAL 116
#define CONTINUE_LOOP 119
#define SETUP_LOOP 120
#define SETUP_EXCEPT 121
#define SETUP_FINALLY 122
#define LOAD_FAST 124
#define STORE_FAST 125
#define DELETE_FAST 126
#define RAISE_VARARGS 130
#define CALL_FUNCTION 131
#define MAKE_FUNCTION 132
#define BUILD_SLICE 133
#define MAKE_CLOSURE 134
#define LOAD_CLOSURE 135
#define LOAD_DEREF 136
#define STORE_DEREF 137
#define DELETE_DEREF 138
#define CALL_FUNCTION_VAR 140
#define CALL_FUNCTION_KW 141
#define CALL_FUNCTION_VAR_KW 142
#define SETUP_WITH 143
#define EXTENDED_ARG 144
#define LIST_APPEND 145
#define SET_ADD 146
#define MAP_ADD 147
#define LOAD_CLASSDEREF 148
#define BUILD_LIST_UNPACK 149
#define BUILD_MAP_UNPACK 150
#define BUILD_MAP_UNPACK_WITH_CALL 151
#define BUILD_TUPLE_UNPACK 152
#define BUILD_SET_UNPACK 153
#define SETUP_ASYNC_WITH 154
/* EXCEPT_HANDLER is a special, implicit block type which is created when
entering an except handler. It is not an opcode but we define it here
as we want it to be available to both frameobject.c and ceval.c, while
remaining private.*/
#define EXCEPT_HANDLER 257
enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE,
PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN,
PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
#ifdef __cplusplus
}
#endif
#endif /* !Py_OPCODE_H */
``` | /content/code_sandbox/android/python35/include/opcode.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,161 |
```objective-c
#ifndef Py_PYFPE_H
#define Py_PYFPE_H
#ifdef __cplusplus
extern "C" {
#endif
/*
your_sha256_hash-----
| The Regents of the University of California. |
| All rights reserved. |
| |
| Permission to use, copy, modify, and distribute this software for |
| any purpose without fee is hereby granted, provided that this en- |
| tire notice is included in all copies of any software which is or |
| includes a copy or modification of this software and in all |
| copies of the supporting documentation for such software. |
| |
| This work was produced at the University of California, Lawrence |
| Livermore National Laboratory under contract no. W-7405-ENG-48 |
| between the U.S. Department of Energy and The Regents of the |
| University of California for the operation of UC LLNL. |
| |
| DISCLAIMER |
| |
| This software was prepared as an account of work sponsored by an |
| agency of the United States Government. Neither the United States |
| Government nor the University of California nor any of their em- |
| ployees, makes any warranty, express or implied, or assumes any |
| liability or responsibility for the accuracy, completeness, or |
| usefulness of any information, apparatus, product, or process |
| disclosed, or represents that its use would not infringe |
| privately-owned rights. Reference herein to any specific commer- |
| cial products, process, or service by trade name, trademark, |
| manufacturer, or otherwise, does not necessarily constitute or |
| imply its endorsement, recommendation, or favoring by the United |
| States Government or the University of California. The views and |
| opinions of authors expressed herein do not necessarily state or |
| reflect those of the United States Government or the University |
| of California, and shall not be used for advertising or product |
\ endorsement purposes. /
your_sha256_hash-----
*/
/*
* Define macros for handling SIGFPE.
* Lee Busby, LLNL, November, 1996
* busby1@llnl.gov
*
*********************************************
* Overview of the system for handling SIGFPE:
*
* This file (Include/pyfpe.h) defines a couple of "wrapper" macros for
* insertion into your Python C code of choice. Their proper use is
* discussed below. The file Python/pyfpe.c defines a pair of global
* variables PyFPE_jbuf and PyFPE_counter which are used by the signal
* handler for SIGFPE to decide if a particular exception was protected
* by the macros. The signal handler itself, and code for enabling the
* generation of SIGFPE in the first place, is in a (new) Python module
* named fpectl. This module is standard in every respect. It can be loaded
* either statically or dynamically as you choose, and like any other
* Python module, has no effect until you import it.
*
* In the general case, there are three steps toward handling SIGFPE in any
* Python code:
*
* 1) Add the *_PROTECT macros to your C code as required to protect
* dangerous floating point sections.
*
* 2) Turn on the inclusion of the code by adding the ``--with-fpectl''
* flag at the time you run configure. If the fpectl or other modules
* which use the *_PROTECT macros are to be dynamically loaded, be
* sure they are compiled with WANT_SIGFPE_HANDLER defined.
*
* 3) When python is built and running, import fpectl, and execute
* fpectl.turnon_sigfpe(). This sets up the signal handler and enables
* generation of SIGFPE whenever an exception occurs. From this point
* on, any properly trapped SIGFPE should result in the Python
* FloatingPointError exception.
*
* Step 1 has been done already for the Python kernel code, and should be
* done soon for the NumPy array package. Step 2 is usually done once at
* python install time. Python's behavior with respect to SIGFPE is not
* changed unless you also do step 3. Thus you can control this new
* facility at compile time, or run time, or both.
*
********************************
* Using the macros in your code:
*
* static PyObject *foobar(PyObject *self,PyObject *args)
* {
* ....
* PyFPE_START_PROTECT("Error in foobar", return 0)
* result = dangerous_op(somearg1, somearg2, ...);
* PyFPE_END_PROTECT(result)
* ....
* }
*
* If a floating point error occurs in dangerous_op, foobar returns 0 (NULL),
* after setting the associated value of the FloatingPointError exception to
* "Error in foobar". ``Dangerous_op'' can be a single operation, or a block
* of code, function calls, or any combination, so long as no alternate
* return is possible before the PyFPE_END_PROTECT macro is reached.
*
* The macros can only be used in a function context where an error return
* can be recognized as signaling a Python exception. (Generally, most
* functions that return a PyObject * will qualify.)
*
* Guido's original design suggestion for PyFPE_START_PROTECT and
* PyFPE_END_PROTECT had them open and close a local block, with a locally
* defined jmp_buf and jmp_buf pointer. This would allow recursive nesting
* of the macros. The Ansi C standard makes it clear that such local
* variables need to be declared with the "volatile" type qualifier to keep
* setjmp from corrupting their values. Some current implementations seem
* to be more restrictive. For example, the HPUX man page for setjmp says
*
* Upon the return from a setjmp() call caused by a longjmp(), the
* values of any non-static local variables belonging to the routine
* from which setjmp() was called are undefined. Code which depends on
* such values is not guaranteed to be portable.
*
* I therefore decided on a more limited form of nesting, using a counter
* variable (PyFPE_counter) to keep track of any recursion. If an exception
* occurs in an ``inner'' pair of macros, the return will apparently
* come from the outermost level.
*
*/
#ifdef WANT_SIGFPE_HANDLER
#include <signal.h>
#include <setjmp.h>
#include <math.h>
extern jmp_buf PyFPE_jbuf;
extern int PyFPE_counter;
extern double PyFPE_dummy(void *);
#define PyFPE_START_PROTECT(err_string, leave_stmt) \
if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \
PyErr_SetString(PyExc_FloatingPointError, err_string); \
PyFPE_counter = 0; \
leave_stmt; \
}
/*
* This (following) is a heck of a way to decrement a counter. However,
* unless the macro argument is provided, code optimizers will sometimes move
* this statement so that it gets executed *before* the unsafe expression
* which we're trying to protect. That pretty well messes things up,
* of course.
*
* If the expression(s) you're trying to protect don't happen to return a
* value, you will need to manufacture a dummy result just to preserve the
* correct ordering of statements. Note that the macro passes the address
* of its argument (so you need to give it something which is addressable).
* If your expression returns multiple results, pass the last such result
* to PyFPE_END_PROTECT.
*
* Note that PyFPE_dummy returns a double, which is cast to int.
* This seeming insanity is to tickle the Floating Point Unit (FPU).
* If an exception has occurred in a preceding floating point operation,
* some architectures (notably Intel 80x86) will not deliver the interrupt
* until the *next* floating point operation. This is painful if you've
* already decremented PyFPE_counter.
*/
#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v));
#else
#define PyFPE_START_PROTECT(err_string, leave_stmt)
#define PyFPE_END_PROTECT(v)
#endif
#ifdef __cplusplus
}
#endif
#endif /* !Py_PYFPE_H */
``` | /content/code_sandbox/android/python35/include/pyfpe.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,952 |
```objective-c
/* System module interface */
#ifndef Py_SYSMODULE_H
#define Py_SYSMODULE_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(PyObject *) PySys_GetObject(const char *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key);
#endif
PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *);
PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *);
PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...);
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...);
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *);
PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject *);
PyAPI_FUNC(int) PySys_HasWarnOptions(void);
PyAPI_FUNC(void) PySys_AddXOption(const wchar_t *);
PyAPI_FUNC(PyObject *) PySys_GetXOptions(void);
#ifndef Py_LIMITED_API
PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* !Py_SYSMODULE_H */
``` | /content/code_sandbox/android/python35/include/sysmodule.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 361 |
```objective-c
#ifndef Py_UNICODEOBJECT_H
#define Py_UNICODEOBJECT_H
#include <stdarg.h>
/*
Unicode implementation based on original code by Fredrik Lundh,
modified by Marc-Andre Lemburg (mal@lemburg.com) according to the
Unicode Integration Proposal. (See
path_to_url
Original header:
your_sha256_hash----
* Yet another Unicode string type for Python. This type supports the
* 16-bit Basic Multilingual Plane (BMP) only.
*
* Written by Fredrik Lundh, January 1999.
*
*
* fredrik@pythonware.com
* path_to_url
*
* your_sha256_hash----
* This Unicode String Type is
*
*
* By obtaining, using, and/or copying this software and/or its
* associated documentation, you agree that you have read, understood,
* and will comply with the following terms and conditions:
*
* Permission to use, copy, modify, and distribute this software and its
* associated documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appears in all
* copies, and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Secret Labs
* AB or the author not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission.
*
* SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* your_sha256_hash---- */
#include <ctype.h>
/* === Internal API ======================================================= */
/* --- Internal Unicode Format -------------------------------------------- */
/* Python 3.x requires unicode */
#define Py_USING_UNICODE
#ifndef SIZEOF_WCHAR_T
#error Must define SIZEOF_WCHAR_T
#endif
#define Py_UNICODE_SIZE SIZEOF_WCHAR_T
/* If wchar_t can be used for UCS-4 storage, set Py_UNICODE_WIDE.
Otherwise, Unicode strings are stored as UCS-2 (with limited support
for UTF-16) */
#if Py_UNICODE_SIZE >= 4
#define Py_UNICODE_WIDE
#endif
/* Set these flags if the platform has "wchar.h" and the
wchar_t type is a 16-bit unsigned type */
/* #define HAVE_WCHAR_H */
/* #define HAVE_USABLE_WCHAR_T */
/* Py_UNICODE was the native Unicode storage format (code unit) used by
Python and represents a single Unicode element in the Unicode type.
With PEP 393, Py_UNICODE is deprecated and replaced with a
typedef to wchar_t. */
#ifndef Py_LIMITED_API
#define PY_UNICODE_TYPE wchar_t
typedef wchar_t Py_UNICODE;
#endif
/* If the compiler provides a wchar_t type we try to support it
through the interface functions PyUnicode_FromWideChar(),
PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */
#ifdef HAVE_USABLE_WCHAR_T
# ifndef HAVE_WCHAR_H
# define HAVE_WCHAR_H
# endif
#endif
#if defined(MS_WINDOWS)
# define HAVE_MBCS
#endif
#ifdef HAVE_WCHAR_H
/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */
# ifdef _HAVE_BSDI
# include <time.h>
# endif
# include <wchar.h>
#endif
/* Py_UCS4 and Py_UCS2 are typedefs for the respective
unicode representations. */
#if SIZEOF_INT == 4
typedef unsigned int Py_UCS4;
#elif SIZEOF_LONG == 4
typedef unsigned long Py_UCS4;
#else
#error "Could not find a proper typedef for Py_UCS4"
#endif
#if SIZEOF_SHORT == 2
typedef unsigned short Py_UCS2;
#else
#error "Could not find a proper typedef for Py_UCS2"
#endif
typedef unsigned char Py_UCS1;
/* --- Internal Unicode Operations ---------------------------------------- */
/* Since splitting on whitespace is an important use case, and
whitespace in most situations is solely ASCII whitespace, we
optimize for the common case by using a quick look-up table
_Py_ascii_whitespace (see below) with an inlined check.
*/
#ifndef Py_LIMITED_API
#define Py_UNICODE_ISSPACE(ch) \
((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch)
#define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch)
#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch)
#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch)
#define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch)
#define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch)
#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch)
#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch)
#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
#define Py_UNICODE_ISALNUM(ch) \
(Py_UNICODE_ISALPHA(ch) || \
Py_UNICODE_ISDECIMAL(ch) || \
Py_UNICODE_ISDIGIT(ch) || \
Py_UNICODE_ISNUMERIC(ch))
#define Py_UNICODE_COPY(target, source, length) \
Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE))
#define Py_UNICODE_FILL(target, value, length) \
do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
} while (0)
/* macros to work with surrogates */
#define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF)
#define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF)
#define Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= (ch) && (ch) <= 0xDFFF)
/* Join two surrogate characters and return a single Py_UCS4 value. */
#define Py_UNICODE_JOIN_SURROGATES(high, low) \
(((((Py_UCS4)(high) & 0x03FF) << 10) | \
((Py_UCS4)(low) & 0x03FF)) + 0x10000)
/* high surrogate = top 10 bits added to D800 */
#define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10))
/* low surrogate = bottom 10 bits added to DC00 */
#define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch) & 0x3FF))
/* Check if substring matches at given offset. The offset must be
valid, and the substring must not be empty. */
#define Py_UNICODE_MATCH(string, offset, substring) \
((*((string)->wstr + (offset)) == *((substring)->wstr)) && \
((*((string)->wstr + (offset) + (substring)->wstr_length-1) == *((substring)->wstr + (substring)->wstr_length-1))) && \
!memcmp((string)->wstr + (offset), (substring)->wstr, (substring)->wstr_length*sizeof(Py_UNICODE)))
#endif /* Py_LIMITED_API */
#ifdef __cplusplus
extern "C" {
#endif
/* --- Unicode Type ------------------------------------------------------- */
#ifndef Py_LIMITED_API
/* ASCII-only strings created through PyUnicode_New use the PyASCIIObject
structure. state.ascii and state.compact are set, and the data
immediately follow the structure. utf8_length and wstr_length can be found
in the length field; the utf8 pointer is equal to the data pointer. */
typedef struct {
/* There are 4 forms of Unicode strings:
- compact ascii:
* structure = PyASCIIObject
* test: PyUnicode_IS_COMPACT_ASCII(op)
* kind = PyUnicode_1BYTE_KIND
* compact = 1
* ascii = 1
* ready = 1
* (length is the length of the utf8 and wstr strings)
* (data starts just after the structure)
* (since ASCII is decoded from UTF-8, the utf8 string are the data)
- compact:
* structure = PyCompactUnicodeObject
* test: PyUnicode_IS_COMPACT(op) && !PyUnicode_IS_ASCII(op)
* kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or
PyUnicode_4BYTE_KIND
* compact = 1
* ready = 1
* ascii = 0
* utf8 is not shared with data
* utf8_length = 0 if utf8 is NULL
* wstr is shared with data and wstr_length=length
if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2
or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_t)=4
* wstr_length = 0 if wstr is NULL
* (data starts just after the structure)
- legacy string, not ready:
* structure = PyUnicodeObject
* test: kind == PyUnicode_WCHAR_KIND
* length = 0 (use wstr_length)
* hash = -1
* kind = PyUnicode_WCHAR_KIND
* compact = 0
* ascii = 0
* ready = 0
* interned = SSTATE_NOT_INTERNED
* wstr is not NULL
* data.any is NULL
* utf8 is NULL
* utf8_length = 0
- legacy string, ready:
* structure = PyUnicodeObject structure
* test: !PyUnicode_IS_COMPACT(op) && kind != PyUnicode_WCHAR_KIND
* kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or
PyUnicode_4BYTE_KIND
* compact = 0
* ready = 1
* data.any is not NULL
* utf8 is shared and utf8_length = length with data.any if ascii = 1
* utf8_length = 0 if utf8 is NULL
* wstr is shared with data.any and wstr_length = length
if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2
or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4
* wstr_length = 0 if wstr is NULL
Compact strings use only one memory block (structure + characters),
whereas legacy strings use one block for the structure and one block
for characters.
Legacy strings are created by PyUnicode_FromUnicode() and
PyUnicode_FromStringAndSize(NULL, size) functions. They become ready
when PyUnicode_READY() is called.
See also _PyUnicode_CheckConsistency().
*/
PyObject_HEAD
Py_ssize_t length; /* Number of code points in the string */
Py_hash_t hash; /* Hash value; -1 if not set */
struct {
/*
SSTATE_NOT_INTERNED (0)
SSTATE_INTERNED_MORTAL (1)
SSTATE_INTERNED_IMMORTAL (2)
If interned != SSTATE_NOT_INTERNED, the two references from the
dictionary to this object are *not* counted in ob_refcnt.
*/
unsigned int interned:2;
/* Character size:
- PyUnicode_WCHAR_KIND (0):
* character type = wchar_t (16 or 32 bits, depending on the
platform)
- PyUnicode_1BYTE_KIND (1):
* character type = Py_UCS1 (8 bits, unsigned)
* all characters are in the range U+0000-U+00FF (latin1)
* if ascii is set, all characters are in the range U+0000-U+007F
(ASCII), otherwise at least one character is in the range
U+0080-U+00FF
- PyUnicode_2BYTE_KIND (2):
* character type = Py_UCS2 (16 bits, unsigned)
* all characters are in the range U+0000-U+FFFF (BMP)
* at least one character is in the range U+0100-U+FFFF
- PyUnicode_4BYTE_KIND (4):
* character type = Py_UCS4 (32 bits, unsigned)
* all characters are in the range U+0000-U+10FFFF
* at least one character is in the range U+10000-U+10FFFF
*/
unsigned int kind:3;
/* Compact is with respect to the allocation scheme. Compact unicode
objects only require one memory block while non-compact objects use
one block for the PyUnicodeObject struct and another for its data
buffer. */
unsigned int compact:1;
/* The string only contains characters in the range U+0000-U+007F (ASCII)
and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is
set, use the PyASCIIObject structure. */
unsigned int ascii:1;
/* The ready flag indicates whether the object layout is initialized
completely. This means that this is either a compact object, or
the data pointer is filled out. The bit is redundant, and helps
to minimize the test in PyUnicode_IS_READY(). */
unsigned int ready:1;
/* Padding to ensure that PyUnicode_DATA() is always aligned to
4 bytes (see issue #19537 on m68k). */
unsigned int :24;
} state;
wchar_t *wstr; /* wchar_t representation (null-terminated) */
} PyASCIIObject;
/* Non-ASCII strings allocated through PyUnicode_New use the
PyCompactUnicodeObject structure. state.compact is set, and the data
immediately follow the structure. */
typedef struct {
PyASCIIObject _base;
Py_ssize_t utf8_length; /* Number of bytes in utf8, excluding the
* terminating \0. */
char *utf8; /* UTF-8 representation (null-terminated) */
Py_ssize_t wstr_length; /* Number of code points in wstr, possible
* surrogates count as two code points. */
} PyCompactUnicodeObject;
/* Strings allocated through PyUnicode_FromUnicode(NULL, len) use the
PyUnicodeObject structure. The actual string data is initially in the wstr
block, and copied into the data block using _PyUnicode_Ready. */
typedef struct {
PyCompactUnicodeObject _base;
union {
void *any;
Py_UCS1 *latin1;
Py_UCS2 *ucs2;
Py_UCS4 *ucs4;
} data; /* Canonical, smallest-form Unicode buffer */
} PyUnicodeObject;
#endif
PyAPI_DATA(PyTypeObject) PyUnicode_Type;
PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
#define PyUnicode_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type)
/* Fast access macros */
#ifndef Py_LIMITED_API
#define PyUnicode_WSTR_LENGTH(op) \
(PyUnicode_IS_COMPACT_ASCII(op) ? \
((PyASCIIObject*)op)->length : \
((PyCompactUnicodeObject*)op)->wstr_length)
/* Returns the deprecated Py_UNICODE representation's size in code units
(this includes surrogate pairs as 2 units).
If the Py_UNICODE representation is not available, it will be computed
on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
#define PyUnicode_GET_SIZE(op) \
(assert(PyUnicode_Check(op)), \
(((PyASCIIObject *)(op))->wstr) ? \
PyUnicode_WSTR_LENGTH(op) : \
((void)PyUnicode_AsUnicode((PyObject *)(op)), \
assert(((PyASCIIObject *)(op))->wstr), \
PyUnicode_WSTR_LENGTH(op)))
#define PyUnicode_GET_DATA_SIZE(op) \
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
/* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE
representation on demand. Using this macro is very inefficient now,
try to port your code to use the new PyUnicode_*BYTE_DATA() macros or
use PyUnicode_WRITE() and PyUnicode_READ(). */
#define PyUnicode_AS_UNICODE(op) \
(assert(PyUnicode_Check(op)), \
(((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \
PyUnicode_AsUnicode((PyObject *)(op)))
#define PyUnicode_AS_DATA(op) \
((const char *)(PyUnicode_AS_UNICODE(op)))
/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */
/* Values for PyASCIIObject.state: */
/* Interning state. */
#define SSTATE_NOT_INTERNED 0
#define SSTATE_INTERNED_MORTAL 1
#define SSTATE_INTERNED_IMMORTAL 2
/* Return true if the string contains only ASCII characters, or 0 if not. The
string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be
ready. */
#define PyUnicode_IS_ASCII(op) \
(assert(PyUnicode_Check(op)), \
assert(PyUnicode_IS_READY(op)), \
((PyASCIIObject*)op)->state.ascii)
/* Return true if the string is compact or 0 if not.
No type checks or Ready calls are performed. */
#define PyUnicode_IS_COMPACT(op) \
(((PyASCIIObject*)(op))->state.compact)
/* Return true if the string is a compact ASCII string (use PyASCIIObject
structure), or 0 if not. No type checks or Ready calls are performed. */
#define PyUnicode_IS_COMPACT_ASCII(op) \
(((PyASCIIObject*)op)->state.ascii && PyUnicode_IS_COMPACT(op))
enum PyUnicode_Kind {
/* String contains only wstr byte characters. This is only possible
when the string was created with a legacy API and _PyUnicode_Ready()
has not been called yet. */
PyUnicode_WCHAR_KIND = 0,
/* Return values of the PyUnicode_KIND() macro: */
PyUnicode_1BYTE_KIND = 1,
PyUnicode_2BYTE_KIND = 2,
PyUnicode_4BYTE_KIND = 4
};
/* Return pointers to the canonical representation cast to unsigned char,
Py_UCS2, or Py_UCS4 for direct character access.
No checks are performed, use PyUnicode_KIND() before to ensure
these will work correctly. */
#define PyUnicode_1BYTE_DATA(op) ((Py_UCS1*)PyUnicode_DATA(op))
#define PyUnicode_2BYTE_DATA(op) ((Py_UCS2*)PyUnicode_DATA(op))
#define PyUnicode_4BYTE_DATA(op) ((Py_UCS4*)PyUnicode_DATA(op))
/* Return one of the PyUnicode_*_KIND values defined above. */
#define PyUnicode_KIND(op) \
(assert(PyUnicode_Check(op)), \
assert(PyUnicode_IS_READY(op)), \
((PyASCIIObject *)(op))->state.kind)
/* Return a void pointer to the raw unicode buffer. */
#define _PyUnicode_COMPACT_DATA(op) \
(PyUnicode_IS_ASCII(op) ? \
((void*)((PyASCIIObject*)(op) + 1)) : \
((void*)((PyCompactUnicodeObject*)(op) + 1)))
#define _PyUnicode_NONCOMPACT_DATA(op) \
(assert(((PyUnicodeObject*)(op))->data.any), \
((((PyUnicodeObject *)(op))->data.any)))
#define PyUnicode_DATA(op) \
(assert(PyUnicode_Check(op)), \
PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) : \
_PyUnicode_NONCOMPACT_DATA(op))
/* In the access macros below, "kind" may be evaluated more than once.
All other macro parameters are evaluated exactly once, so it is safe
to put side effects into them (such as increasing the index). */
/* Write into the canonical representation, this macro does not do any sanity
checks and is intended for usage in loops. The caller should cache the
kind and data pointers obtained from other macro calls.
index is the index in the string (starts at 0) and value is the new
code point value which should be written to that location. */
#define PyUnicode_WRITE(kind, data, index, value) \
do { \
switch ((kind)) { \
case PyUnicode_1BYTE_KIND: { \
((Py_UCS1 *)(data))[(index)] = (Py_UCS1)(value); \
break; \
} \
case PyUnicode_2BYTE_KIND: { \
((Py_UCS2 *)(data))[(index)] = (Py_UCS2)(value); \
break; \
} \
default: { \
assert((kind) == PyUnicode_4BYTE_KIND); \
((Py_UCS4 *)(data))[(index)] = (Py_UCS4)(value); \
} \
} \
} while (0)
/* Read a code point from the string's canonical representation. No checks
or ready calls are performed. */
#define PyUnicode_READ(kind, data, index) \
((Py_UCS4) \
((kind) == PyUnicode_1BYTE_KIND ? \
((const Py_UCS1 *)(data))[(index)] : \
((kind) == PyUnicode_2BYTE_KIND ? \
((const Py_UCS2 *)(data))[(index)] : \
((const Py_UCS4 *)(data))[(index)] \
) \
))
/* PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it
calls PyUnicode_KIND() and might call it twice. For single reads, use
PyUnicode_READ_CHAR, for multiple consecutive reads callers should
cache kind and use PyUnicode_READ instead. */
#define PyUnicode_READ_CHAR(unicode, index) \
(assert(PyUnicode_Check(unicode)), \
assert(PyUnicode_IS_READY(unicode)), \
(Py_UCS4) \
(PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \
((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \
(PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \
((const Py_UCS2 *)(PyUnicode_DATA((unicode))))[(index)] : \
((const Py_UCS4 *)(PyUnicode_DATA((unicode))))[(index)] \
) \
))
/* Returns the length of the unicode string. The caller has to make sure that
the string has it's canonical representation set before calling
this macro. Call PyUnicode_(FAST_)Ready to ensure that. */
#define PyUnicode_GET_LENGTH(op) \
(assert(PyUnicode_Check(op)), \
assert(PyUnicode_IS_READY(op)), \
((PyASCIIObject *)(op))->length)
/* Fast check to determine whether an object is ready. Equivalent to
PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any) */
#define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready)
/* PyUnicode_READY() does less work than _PyUnicode_Ready() in the best
case. If the canonical representation is not yet set, it will still call
_PyUnicode_Ready().
Returns 0 on success and -1 on errors. */
#define PyUnicode_READY(op) \
(assert(PyUnicode_Check(op)), \
(PyUnicode_IS_READY(op) ? \
0 : _PyUnicode_Ready((PyObject *)(op))))
/* Return a maximum character value which is suitable for creating another
string based on op. This is always an approximation but more efficient
than iterating over the string. */
#define PyUnicode_MAX_CHAR_VALUE(op) \
(assert(PyUnicode_IS_READY(op)), \
(PyUnicode_IS_ASCII(op) ? \
(0x7f) : \
(PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND ? \
(0xffU) : \
(PyUnicode_KIND(op) == PyUnicode_2BYTE_KIND ? \
(0xffffU) : \
(0x10ffffU)))))
#endif
/* --- Constants ---------------------------------------------------------- */
/* This Unicode character will be used as replacement character during
decoding if the errors argument is set to "replace". Note: the
Unicode character U+FFFD is the official REPLACEMENT CHARACTER in
Unicode 3.0. */
#define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UCS4) 0xFFFD)
/* === Public API ========================================================= */
/* --- Plain Py_UNICODE --------------------------------------------------- */
/* With PEP 393, this is the recommended way to allocate a new unicode object.
This function will allocate the object and its buffer in a single memory
block. Objects created using this function are not resizable. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_New(
Py_ssize_t size, /* Number of code points in the new string */
Py_UCS4 maxchar /* maximum code point value in the string */
);
#endif
/* Initializes the canonical string representation from the deprecated
wstr/Py_UNICODE representation. This function is used to convert Unicode
objects which were created using the old API to the new flexible format
introduced with PEP 393.
Don't call this function directly, use the public PyUnicode_READY() macro
instead. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyUnicode_Ready(
PyObject *unicode /* Unicode object */
);
#endif
/* Get a copy of a Unicode string. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyUnicode_Copy(
PyObject *unicode
);
#endif
/* Copy character from one unicode object into another, this function performs
character conversion when necessary and falls back to memcpy() if possible.
Fail if to is too small (smaller than *how_many* or smaller than
len(from)-from_start), or if kind(from[from_start:from_start+how_many]) >
kind(to), or if *to* has more than 1 reference.
Return the number of written character, or return -1 and raise an exception
on error.
Pseudo-code:
how_many = min(how_many, len(from) - from_start)
to[to_start:to_start+how_many] = from[from_start:from_start+how_many]
return how_many
Note: The function doesn't write a terminating null character.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
PyObject *to,
Py_ssize_t to_start,
PyObject *from,
Py_ssize_t from_start,
Py_ssize_t how_many
);
/* Unsafe version of PyUnicode_CopyCharacters(): don't check arguments and so
may crash if parameters are invalid (e.g. if the output string
is too short). */
PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters(
PyObject *to,
Py_ssize_t to_start,
PyObject *from,
Py_ssize_t from_start,
Py_ssize_t how_many
);
#endif
#ifndef Py_LIMITED_API
/* Fill a string with a character: write fill_char into
unicode[start:start+length].
Fail if fill_char is bigger than the string maximum character, or if the
string has more than 1 reference.
Return the number of written character, or return -1 and raise an exception
on error. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill(
PyObject *unicode,
Py_ssize_t start,
Py_ssize_t length,
Py_UCS4 fill_char
);
/* Unsafe version of PyUnicode_Fill(): don't check arguments and so may crash
if parameters are invalid (e.g. if length is longer than the string). */
PyAPI_FUNC(void) _PyUnicode_FastFill(
PyObject *unicode,
Py_ssize_t start,
Py_ssize_t length,
Py_UCS4 fill_char
);
#endif
/* Create a Unicode Object from the Py_UNICODE buffer u of the given
size.
u may be NULL which causes the contents to be undefined. It is the
user's responsibility to fill in the needed data afterwards. Note
that modifying the Unicode object contents after construction is
only allowed if u was set to NULL.
The buffer is copied into the new object. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
const Py_UNICODE *u, /* Unicode buffer */
Py_ssize_t size /* size of buffer */
);
#endif
/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */
PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize(
const char *u, /* UTF-8 encoded string */
Py_ssize_t size /* size of buffer */
);
/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated
UTF-8 encoded bytes. The size is determined with strlen(). */
PyAPI_FUNC(PyObject*) PyUnicode_FromString(
const char *u /* UTF-8 encoded string */
);
#ifndef Py_LIMITED_API
/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters.
Scan the string to find the maximum character. */
PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
int kind,
const void *buffer,
Py_ssize_t size);
/* Create a new string from a buffer of ASCII characters.
WARNING: Don't check if the string contains any non-ASCII character. */
PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII(
const char *buffer,
Py_ssize_t size);
#endif
PyAPI_FUNC(PyObject*) PyUnicode_Substring(
PyObject *str,
Py_ssize_t start,
Py_ssize_t end);
#ifndef Py_LIMITED_API
/* Compute the maximum character of the substring unicode[start:end].
Return 127 for an empty string. */
PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar (
PyObject *unicode,
Py_ssize_t start,
Py_ssize_t end);
#endif
/* Copy the string into a UCS4 buffer including the null character if copy_null
is set. Return NULL and raise an exception on error. Raise a ValueError if
the buffer is smaller than the string. Return buffer on success.
buflen is the length of the buffer in (Py_UCS4) characters. */
PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4(
PyObject *unicode,
Py_UCS4* buffer,
Py_ssize_t buflen,
int copy_null);
/* Copy the string into a UCS4 buffer. A new buffer is allocated using
* PyMem_Malloc; if this fails, NULL is returned with a memory error
exception set. */
PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode);
/* Return a read-only pointer to the Unicode object's internal
Py_UNICODE buffer.
If the wchar_t/Py_UNICODE representation is not yet available, this
function will calculate it. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
PyObject *unicode /* Unicode object */
);
#endif
/* Return a read-only pointer to the Unicode object's internal
Py_UNICODE buffer and save the length at size.
If the wchar_t/Py_UNICODE representation is not yet available, this
function will calculate it. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
PyObject *unicode, /* Unicode object */
Py_ssize_t *size /* location where to save the length */
);
#endif
/* Get the length of the Unicode object. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength(
PyObject *unicode
);
/* Get the number of Py_UNICODE units in the
string representation. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
PyObject *unicode /* Unicode object */
);
/* Read a character from the string. */
PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar(
PyObject *unicode,
Py_ssize_t index
);
/* Write a character to the string. The string must have been created through
PyUnicode_New, must not be shared, and must not have been hashed yet.
Return 0 on success, -1 on error. */
PyAPI_FUNC(int) PyUnicode_WriteChar(
PyObject *unicode,
Py_ssize_t index,
Py_UCS4 character
);
#ifndef Py_LIMITED_API
/* Get the maximum ordinal for a Unicode character. */
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
#endif
/* Resize an Unicode object. The length is the number of characters, except
if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length
is the number of Py_UNICODE characters.
*unicode is modified to point to the new (resized) object and 0
returned on success.
Try to resize the string in place (which is usually faster than allocating
a new string and copy characters), or create a new string.
Error handling is implemented as follows: an exception is set, -1
is returned and *unicode left untouched.
WARNING: The function doesn't check string content, the result may not be a
string in canonical representation. */
PyAPI_FUNC(int) PyUnicode_Resize(
PyObject **unicode, /* Pointer to the Unicode object */
Py_ssize_t length /* New length */
);
/* Coerce obj to an Unicode object and return a reference with
*incremented* refcount.
Coercion is done in the following way:
1. bytes, bytearray and other bytes-like objects are decoded
under the assumptions that they contain data using the UTF-8
encoding. Decoding is done in "strict" mode.
2. All other objects (including Unicode objects) raise an
exception.
The API returns NULL in case of an error. The caller is responsible
for decref'ing the returned objects.
*/
PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
PyObject *obj, /* Object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Coerce obj to an Unicode object and return a reference with
*incremented* refcount.
Unicode objects are passed back as-is (subclasses are converted to
true Unicode objects), all other objects are delegated to
PyUnicode_FromEncodedObject(obj, NULL, "strict") which results in
using UTF-8 encoding as basis for decoding the object.
The API returns NULL in case of an error. The caller is responsible
for decref'ing the returned objects.
*/
PyAPI_FUNC(PyObject*) PyUnicode_FromObject(
PyObject *obj /* Object */
);
PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(
const char *format, /* ASCII-encoded string */
va_list vargs
);
PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(
const char *format, /* ASCII-encoded string */
...
);
#ifndef Py_LIMITED_API
typedef struct {
PyObject *buffer;
void *data;
enum PyUnicode_Kind kind;
Py_UCS4 maxchar;
Py_ssize_t size;
Py_ssize_t pos;
/* minimum number of allocated characters (default: 0) */
Py_ssize_t min_length;
/* minimum character (default: 127, ASCII) */
Py_UCS4 min_char;
/* If non-zero, overallocate the buffer by 25% (default: 0). */
unsigned char overallocate;
/* If readonly is 1, buffer is a shared string (cannot be modified)
and size is set to 0. */
unsigned char readonly;
} _PyUnicodeWriter ;
/* Initialize a Unicode writer.
*
* By default, the minimum buffer size is 0 character and overallocation is
* disabled. Set min_length, min_char and overallocate attributes to control
* the allocation of the buffer. */
PyAPI_FUNC(void)
_PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
/* Prepare the buffer to write 'length' characters
with the specified maximum character.
Return 0 on success, raise an exception and return -1 on error. */
#define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \
(((MAXCHAR) <= (WRITER)->maxchar \
&& (LENGTH) <= (WRITER)->size - (WRITER)->pos) \
? 0 \
: (((LENGTH) == 0) \
? 0 \
: _PyUnicodeWriter_PrepareInternal((WRITER), (LENGTH), (MAXCHAR))))
/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro
instead. */
PyAPI_FUNC(int)
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
Py_ssize_t length, Py_UCS4 maxchar);
/* Append a Unicode character.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
_PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer,
Py_UCS4 ch
);
/* Append a Unicode string.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
_PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer,
PyObject *str /* Unicode string */
);
/* Append a substring of a Unicode string.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
_PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer,
PyObject *str, /* Unicode string */
Py_ssize_t start,
Py_ssize_t end
);
/* Append a ASCII-encoded byte string.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
_PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
const char *str, /* ASCII-encoded byte string */
Py_ssize_t len /* number of bytes, or -1 if unknown */
);
/* Append a latin1-encoded byte string.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
_PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer,
const char *str, /* latin1-encoded byte string */
Py_ssize_t len /* length in bytes */
);
/* Get the value of the writer as an Unicode string. Clear the
buffer of the writer. Raise an exception and return NULL
on error. */
PyAPI_FUNC(PyObject *)
_PyUnicodeWriter_Finish(_PyUnicodeWriter *writer);
/* Deallocate memory of a writer (clear its internal buffer). */
PyAPI_FUNC(void)
_PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
#endif
#ifndef Py_LIMITED_API
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter(
_PyUnicodeWriter *writer,
PyObject *obj,
PyObject *format_spec,
Py_ssize_t start,
Py_ssize_t end);
#endif
PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **);
PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **);
PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
const char *u /* UTF-8 encoded string */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void);
#endif
/* Use only if you know it's a string */
#define PyUnicode_CHECK_INTERNED(op) \
(((PyASCIIObject *)(op))->state.interned)
/* --- wchar_t support for platforms which support it --------------------- */
#ifdef HAVE_WCHAR_H
/* Create a Unicode Object from the wchar_t buffer w of the given
size.
The buffer is copied into the new object. */
PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar(
const wchar_t *w, /* wchar_t buffer */
Py_ssize_t size /* size of buffer */
);
/* Copies the Unicode Object contents into the wchar_t buffer w. At
most size wchar_t characters are copied.
Note that the resulting wchar_t string may or may not be
0-terminated. It is the responsibility of the caller to make sure
that the wchar_t string is 0-terminated in case this is required by
the application.
Returns the number of wchar_t characters copied (excluding a
possibly trailing 0-termination character) or -1 in case of an
error. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
PyObject *unicode, /* Unicode object */
wchar_t *w, /* wchar_t buffer */
Py_ssize_t size /* size of buffer */
);
/* Convert the Unicode object to a wide character string. The output string
always ends with a nul character. If size is not NULL, write the number of
wide characters (excluding the null character) into *size.
Returns a buffer allocated by PyMem_Malloc() (use PyMem_Free() to free it)
on success. On error, returns NULL, *size is undefined and raises a
MemoryError. */
PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString(
PyObject *unicode, /* Unicode object */
Py_ssize_t *size /* number of characters of the result */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind);
#endif
#endif
/* --- Unicode ordinals --------------------------------------------------- */
/* Create a Unicode Object from the given Unicode code point ordinal.
The ordinal must be in range(0x110000). A ValueError is
raised in case it is not.
*/
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
/* --- Free-list management ----------------------------------------------- */
/* Clear the free list used by the Unicode implementation.
This can be used to release memory used for objects on the free
list back to the Python memory allocator.
*/
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
/* === Builtin Codecs =====================================================
Many of these APIs take two arguments encoding and errors. These
parameters encoding and errors have the same semantics as the ones
of the builtin str() API.
Setting encoding to NULL causes the default encoding (UTF-8) to be used.
Error handling is set by errors which may also be set to NULL
meaning to use the default handling defined for the codec. Default
error handling for all builtin codecs is "strict" (ValueErrors are
raised).
The codecs all use a similar interface. Only deviation from the
generic ones are documented.
*/
/* --- Manage the default encoding ---------------------------------------- */
/* Returns a pointer to the default encoding (UTF-8) of the
Unicode object unicode and the size of the encoded representation
in bytes stored in *size.
In case of an error, no *size is set.
This function caches the UTF-8 encoded string in the unicodeobject
and subsequent calls will return the same string. The memory is released
when the unicodeobject is deallocated.
_PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to
support the previous internal function with the same behaviour.
*** This API is for interpreter INTERNAL USE ONLY and will likely
*** be removed or changed in the future.
*** If you need to access the Unicode object as UTF-8 bytes string,
*** please use PyUnicode_AsUTF8String() instead.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) PyUnicode_AsUTF8AndSize(
PyObject *unicode,
Py_ssize_t *size);
#define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize
#endif
/* Returns a pointer to the default encoding (UTF-8) of the
Unicode object unicode.
Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation
in the unicodeobject.
_PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to
support the previous internal function with the same behaviour.
Use of this API is DEPRECATED since no size information can be
extracted from the returned data.
*** This API is for interpreter INTERNAL USE ONLY and will likely
*** be removed or changed for Python 3.1.
*** If you need to access the Unicode object as UTF-8 bytes string,
*** please use PyUnicode_AsUTF8String() instead.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) PyUnicode_AsUTF8(PyObject *unicode);
#define _PyUnicode_AsString PyUnicode_AsUTF8
#endif
/* Returns "utf-8". */
PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);
/* --- Generic Codecs ----------------------------------------------------- */
/* Create a Unicode object by decoding the encoded string s of the
given size. */
PyAPI_FUNC(PyObject*) PyUnicode_Decode(
const char *s, /* encoded string */
Py_ssize_t size, /* size of buffer */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Decode a Unicode object unicode and return the result as Python
object. */
PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Decode a Unicode object unicode and return the result as Unicode
object. */
PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Encodes a Py_UNICODE buffer of the given size and returns a
Python string object. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_Encode(
const Py_UNICODE *s, /* Unicode char buffer */
Py_ssize_t size, /* number of Py_UNICODE chars to encode */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
#endif
/* Encodes a Unicode object and returns the result as Python
object. */
PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Encodes a Unicode object and returns the result as Python string
object. */
PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Encodes a Unicode object and returns the result as Unicode
object. */
PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
/* Build an encoding map. */
PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap(
PyObject* string /* 256 character map */
);
/* --- UTF-7 Codecs ------------------------------------------------------- */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7(
const char *string, /* UTF-7 encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful(
const char *string, /* UTF-7 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7(
PyObject *unicode, /* Unicode object */
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
const char *errors /* error handling */
);
#endif
/* --- UTF-8 Codecs ------------------------------------------------------- */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8(
const char *string, /* UTF-8 encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful(
const char *string, /* UTF-8 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String(
PyObject *unicode /* Unicode object */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String(
PyObject *unicode,
const char *errors);
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
#endif
/* --- UTF-32 Codecs ------------------------------------------------------ */
/* Decodes length bytes from a UTF-32 encoded buffer string and returns
the corresponding Unicode object.
errors (if non-NULL) defines the error handling. It defaults
to "strict".
If byteorder is non-NULL, the decoder starts decoding using the
given byte order:
*byteorder == -1: little endian
*byteorder == 0: native order
*byteorder == 1: big endian
In native mode, the first four bytes of the stream are checked for a
BOM mark. If found, the BOM mark is analysed, the byte order
adjusted and the BOM skipped. In the other modes, no BOM mark
interpretation is done. After completion, *byteorder is set to the
current byte order at the end of input data.
If byteorder is NULL, the codec starts in native order mode.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32(
const char *string, /* UTF-32 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
int *byteorder /* pointer to byteorder to use
0=native;-1=LE,1=BE; updated on
exit */
);
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful(
const char *string, /* UTF-32 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
int *byteorder, /* pointer to byteorder to use
0=native;-1=LE,1=BE; updated on
exit */
Py_ssize_t *consumed /* bytes consumed */
);
/* Returns a Python string using the UTF-32 encoding in native byte
order. The string always starts with a BOM mark. */
PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String(
PyObject *unicode /* Unicode object */
);
/* Returns a Python string object holding the UTF-32 encoded value of
the Unicode data.
If byteorder is not 0, output is written according to the following
byte order:
byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)
byteorder == 1: big endian
If byteorder is 0, the output string will always start with the
Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is
prepended.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32(
PyObject *object, /* Unicode object */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
#endif
/* --- UTF-16 Codecs ------------------------------------------------------ */
/* Decodes length bytes from a UTF-16 encoded buffer string and returns
the corresponding Unicode object.
errors (if non-NULL) defines the error handling. It defaults
to "strict".
If byteorder is non-NULL, the decoder starts decoding using the
given byte order:
*byteorder == -1: little endian
*byteorder == 0: native order
*byteorder == 1: big endian
In native mode, the first two bytes of the stream are checked for a
BOM mark. If found, the BOM mark is analysed, the byte order
adjusted and the BOM skipped. In the other modes, no BOM mark
interpretation is done. After completion, *byteorder is set to the
current byte order at the end of input data.
If byteorder is NULL, the codec starts in native order mode.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16(
const char *string, /* UTF-16 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
int *byteorder /* pointer to byteorder to use
0=native;-1=LE,1=BE; updated on
exit */
);
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful(
const char *string, /* UTF-16 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
int *byteorder, /* pointer to byteorder to use
0=native;-1=LE,1=BE; updated on
exit */
Py_ssize_t *consumed /* bytes consumed */
);
/* Returns a Python string using the UTF-16 encoding in native byte
order. The string always starts with a BOM mark. */
PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String(
PyObject *unicode /* Unicode object */
);
/* Returns a Python string object holding the UTF-16 encoded value of
the Unicode data.
If byteorder is not 0, output is written according to the following
byte order:
byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)
byteorder == 1: big endian
If byteorder is 0, the output string will always start with the
Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is
prepended.
Note that Py_UNICODE data is being interpreted as UTF-16 reduced to
UCS-2. This trick makes it possible to add full UTF-16 capabilities
at a later point without compromising the APIs.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16(
PyObject* unicode, /* Unicode object */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
#endif
/* --- Unicode-Escape Codecs ---------------------------------------------- */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
const char *string, /* Unicode-Escape encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString(
PyObject *unicode /* Unicode object */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
);
#endif
/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape(
const char *string, /* Raw-Unicode-Escape encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString(
PyObject *unicode /* Unicode object */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
);
#endif
/* --- Unicode Internal Codec ---------------------------------------------
Only for internal use in _codecsmodule.c */
#ifndef Py_LIMITED_API
PyObject *_PyUnicode_DecodeUnicodeInternal(
const char *string,
Py_ssize_t length,
const char *errors
);
#endif
/* --- Latin-1 Codecs -----------------------------------------------------
Note: Latin-1 corresponds to the first 256 Unicode ordinals.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1(
const char *string, /* Latin-1 encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String(
PyObject *unicode /* Unicode object */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String(
PyObject* unicode,
const char* errors);
PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
#endif
/* --- ASCII Codecs -------------------------------------------------------
Only 7-bit ASCII data is excepted. All other codes generate errors.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII(
const char *string, /* ASCII encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString(
PyObject *unicode /* Unicode object */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString(
PyObject* unicode,
const char* errors);
PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
#endif
/* --- Character Map Codecs -----------------------------------------------
This codec uses mappings to encode and decode characters.
Decoding mappings must map single string characters to single
Unicode characters, integers (which are then interpreted as Unicode
ordinals) or None (meaning "undefined mapping" and causing an
error).
Encoding mappings must map single Unicode characters to single
string characters, integers (which are then interpreted as Latin-1
ordinals) or None (meaning "undefined mapping" and causing an
error).
If a character lookup fails with a LookupError, the character is
copied as-is meaning that its ordinal value will be interpreted as
Unicode or Latin-1 ordinal resp. Because of this mappings only need
to contain those mappings which map characters to different code
points.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap(
const char *string, /* Encoded string */
Py_ssize_t length, /* size of string */
PyObject *mapping, /* character mapping
(char ordinal -> unicode ordinal) */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString(
PyObject *unicode, /* Unicode object */
PyObject *mapping /* character mapping
(unicode ordinal -> char ordinal) */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
PyObject *mapping, /* character mapping
(unicode ordinal -> char ordinal) */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
PyObject *unicode, /* Unicode object */
PyObject *mapping, /* character mapping
(unicode ordinal -> char ordinal) */
const char *errors /* error handling */
);
#endif
/* Translate a Py_UNICODE buffer of the given length by applying a
character mapping table to it and return the resulting Unicode
object.
The mapping table must map Unicode ordinal integers to Unicode
ordinal integers or None (causing deletion of the character).
Mapping tables may be dictionaries or sequences. Unmapped character
ordinals (ones which cause a LookupError) are left untouched and
are copied as-is.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
PyObject *table, /* Translate table */
const char *errors /* error handling */
);
#endif
#ifdef HAVE_MBCS
/* --- MBCS codecs for Windows -------------------------------------------- */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS(
const char *string, /* MBCS encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful(
const char *string, /* MBCS encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful(
int code_page, /* code page number */
const char *string, /* encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString(
PyObject *unicode /* Unicode object */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
#endif
PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage(
int code_page, /* code page number */
PyObject *unicode, /* Unicode object */
const char *errors /* error handling */
);
#endif /* HAVE_MBCS */
/* --- Decimal Encoder ---------------------------------------------------- */
/* Takes a Unicode string holding a decimal value and writes it into
an output buffer using standard ASCII digit codes.
The output buffer has to provide at least length+1 bytes of storage
area. The output string is 0-terminated.
The encoder converts whitespace to ' ', decimal characters to their
corresponding ASCII digit and all other Latin-1 characters except
\0 as-is. Characters outside this range (Unicode ordinals 1-256)
are treated as errors. This includes embedded NULL bytes.
Error handling is defined by the errors argument:
NULL or "strict": raise a ValueError
"ignore": ignore the wrong characters (these are not copied to the
output buffer)
"replace": replaces illegal characters with '?'
Returns 0 on success, -1 on failure.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
Py_UNICODE *s, /* Unicode buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
char *output, /* Output buffer; must have size >= length */
const char *errors /* error handling */
);
#endif
/* Transforms code points that have decimal digit property to the
corresponding ASCII digit code points.
Returns a new Unicode string on success, NULL on failure.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII(
Py_UNICODE *s, /* Unicode buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to transform */
);
#endif
/* Similar to PyUnicode_TransformDecimalToASCII(), but takes a PyObject
as argument instead of a raw buffer and length. This function additionally
transforms spaces to ASCII because this is what the callers in longobject,
floatobject, and complexobject did anyways. */
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII(
PyObject *unicode /* Unicode object */
);
#endif
/* --- Locale encoding --------------------------------------------------- */
/* Decode a string from the current locale encoding. The decoder is strict if
*surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape'
error handler (PEP 383) to escape undecodable bytes. If a byte sequence can
be decoded as a surrogate character and *surrogateescape* is not equal to
zero, the byte sequence is escaped using the 'surrogateescape' error handler
instead of being decoded. *str* must end with a null character but cannot
contain embedded null characters. */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocaleAndSize(
const char *str,
Py_ssize_t len,
const char *errors);
/* Similar to PyUnicode_DecodeLocaleAndSize(), but compute the string
length using strlen(). */
PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocale(
const char *str,
const char *errors);
/* Encode a Unicode object to the current locale encoding. The encoder is
strict is *surrogateescape* is equal to zero, otherwise the
"surrogateescape" error handler is used. Return a bytes object. The string
cannot contain embedded null characters. */
PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale(
PyObject *unicode,
const char *errors
);
/* --- File system encoding ---------------------------------------------- */
/* ParseTuple converter: encode str objects to bytes using
PyUnicode_EncodeFSDefault(); bytes objects are output as-is. */
PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*);
/* ParseTuple converter: decode bytes objects to unicode using
PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. */
PyAPI_FUNC(int) PyUnicode_FSDecoder(PyObject*, void*);
/* Decode a null-terminated string using Py_FileSystemDefaultEncoding
and the "surrogateescape" error handler.
If Py_FileSystemDefaultEncoding is not set, fall back to the locale
encoding.
Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault(
const char *s /* encoded string */
);
/* Decode a string using Py_FileSystemDefaultEncoding
and the "surrogateescape" error handler.
If Py_FileSystemDefaultEncoding is not set, fall back to the locale
encoding.
*/
PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize(
const char *s, /* encoded string */
Py_ssize_t size /* size */
);
/* Encode a Unicode object to Py_FileSystemDefaultEncoding with the
"surrogateescape" error handler, and return bytes.
If Py_FileSystemDefaultEncoding is not set, fall back to the locale
encoding.
*/
PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault(
PyObject *unicode
);
/* --- Methods & Slots ----------------------------------------------------
These are capable of handling Unicode objects and strings on input
(we refer to them as strings in the descriptions) and return
Unicode objects or integers as appropriate. */
/* Concat two strings giving a new Unicode string. */
PyAPI_FUNC(PyObject*) PyUnicode_Concat(
PyObject *left, /* Left string */
PyObject *right /* Right string */
);
/* Concat two strings and put the result in *pleft
(sets *pleft to NULL on error) */
PyAPI_FUNC(void) PyUnicode_Append(
PyObject **pleft, /* Pointer to left string */
PyObject *right /* Right string */
);
/* Concat two strings, put the result in *pleft and drop the right object
(sets *pleft to NULL on error) */
PyAPI_FUNC(void) PyUnicode_AppendAndDel(
PyObject **pleft, /* Pointer to left string */
PyObject *right /* Right string */
);
/* Split a string giving a list of Unicode strings.
If sep is NULL, splitting will be done at all whitespace
substrings. Otherwise, splits occur at the given separator.
At most maxsplit splits will be done. If negative, no limit is set.
Separators are not included in the resulting list.
*/
PyAPI_FUNC(PyObject*) PyUnicode_Split(
PyObject *s, /* String to split */
PyObject *sep, /* String separator */
Py_ssize_t maxsplit /* Maxsplit count */
);
/* Dito, but split at line breaks.
CRLF is considered to be one line break. Line breaks are not
included in the resulting list. */
PyAPI_FUNC(PyObject*) PyUnicode_Splitlines(
PyObject *s, /* String to split */
int keepends /* If true, line end markers are included */
);
/* Partition a string using a given separator. */
PyAPI_FUNC(PyObject*) PyUnicode_Partition(
PyObject *s, /* String to partition */
PyObject *sep /* String separator */
);
/* Partition a string using a given separator, searching from the end of the
string. */
PyAPI_FUNC(PyObject*) PyUnicode_RPartition(
PyObject *s, /* String to partition */
PyObject *sep /* String separator */
);
/* Split a string giving a list of Unicode strings.
If sep is NULL, splitting will be done at all whitespace
substrings. Otherwise, splits occur at the given separator.
At most maxsplit splits will be done. But unlike PyUnicode_Split
PyUnicode_RSplit splits from the end of the string. If negative,
no limit is set.
Separators are not included in the resulting list.
*/
PyAPI_FUNC(PyObject*) PyUnicode_RSplit(
PyObject *s, /* String to split */
PyObject *sep, /* String separator */
Py_ssize_t maxsplit /* Maxsplit count */
);
/* Translate a string by applying a character mapping table to it and
return the resulting Unicode object.
The mapping table must map Unicode ordinal integers to Unicode
ordinal integers or None (causing deletion of the character).
Mapping tables may be dictionaries or sequences. Unmapped character
ordinals (ones which cause a LookupError) are left untouched and
are copied as-is.
*/
PyAPI_FUNC(PyObject *) PyUnicode_Translate(
PyObject *str, /* String */
PyObject *table, /* Translate table */
const char *errors /* error handling */
);
/* Join a sequence of strings using the given separator and return
the resulting Unicode string. */
PyAPI_FUNC(PyObject*) PyUnicode_Join(
PyObject *separator, /* Separator string */
PyObject *seq /* Sequence object */
);
/* Return 1 if substr matches str[start:end] at the given tail end, 0
otherwise. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch(
PyObject *str, /* String */
PyObject *substr, /* Prefix or Suffix string */
Py_ssize_t start, /* Start index */
Py_ssize_t end, /* Stop index */
int direction /* Tail end: -1 prefix, +1 suffix */
);
/* Return the first position of substr in str[start:end] using the
given search direction or -1 if not found. -2 is returned in case
an error occurred and an exception is set. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_Find(
PyObject *str, /* String */
PyObject *substr, /* Substring to find */
Py_ssize_t start, /* Start index */
Py_ssize_t end, /* Stop index */
int direction /* Find direction: +1 forward, -1 backward */
);
/* Like PyUnicode_Find, but search for single character only. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar(
PyObject *str,
Py_UCS4 ch,
Py_ssize_t start,
Py_ssize_t end,
int direction
);
/* Count the number of occurrences of substr in str[start:end]. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_Count(
PyObject *str, /* String */
PyObject *substr, /* Substring to count */
Py_ssize_t start, /* Start index */
Py_ssize_t end /* Stop index */
);
/* Replace at most maxcount occurrences of substr in str with replstr
and return the resulting Unicode object. */
PyAPI_FUNC(PyObject *) PyUnicode_Replace(
PyObject *str, /* String */
PyObject *substr, /* Substring to find */
PyObject *replstr, /* Substring to replace */
Py_ssize_t maxcount /* Max. number of replacements to apply;
-1 = all */
);
/* Compare two strings and return -1, 0, 1 for less than, equal,
greater than resp.
Raise an exception and return -1 on error. */
PyAPI_FUNC(int) PyUnicode_Compare(
PyObject *left, /* Left string */
PyObject *right /* Right string */
);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyUnicode_CompareWithId(
PyObject *left, /* Left string */
_Py_Identifier *right /* Right identifier */
);
#endif
PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString(
PyObject *left,
const char *right /* ASCII-encoded string */
);
/* Rich compare two strings and return one of the following:
- NULL in case an exception was raised
- Py_True or Py_False for successfully comparisons
- Py_NotImplemented in case the type combination is unknown
Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in
case the conversion of the arguments to Unicode fails with a
UnicodeDecodeError.
Possible values for op:
Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE
*/
PyAPI_FUNC(PyObject *) PyUnicode_RichCompare(
PyObject *left, /* Left string */
PyObject *right, /* Right string */
int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */
);
/* Apply a argument tuple or dictionary to a format string and return
the resulting Unicode string. */
PyAPI_FUNC(PyObject *) PyUnicode_Format(
PyObject *format, /* Format string */
PyObject *args /* Argument tuple or dictionary */
);
/* Checks whether element is contained in container and return 1/0
accordingly.
element has to coerce to an one element Unicode string. -1 is
returned in case of an error. */
PyAPI_FUNC(int) PyUnicode_Contains(
PyObject *container, /* Container string */
PyObject *element /* Element string */
);
/* Checks whether argument is a valid identifier. */
PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
#ifndef Py_LIMITED_API
/* Externally visible for str.strip(unicode) */
PyAPI_FUNC(PyObject *) _PyUnicode_XStrip(
PyObject *self,
int striptype,
PyObject *sepobj
);
#endif
/* Using explicit passed-in values, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
see Objects/stringlib/localeutil.h */
#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping(
PyObject *unicode,
Py_ssize_t index,
Py_ssize_t n_buffer,
void *digits,
Py_ssize_t n_digits,
Py_ssize_t min_width,
const char *grouping,
PyObject *thousands_sep,
Py_UCS4 *maxchar);
#endif
/* === Characters Type APIs =============================================== */
/* Helper array used by Py_UNICODE_ISSPACE(). */
#ifndef Py_LIMITED_API
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
/* These should not be used directly. Use the Py_UNICODE_IS* and
Py_UNICODE_TO* macros instead.
These APIs are implemented in Objects/unicodectype.c.
*/
PyAPI_FUNC(int) _PyUnicode_IsLowercase(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsUppercase(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsTitlecase(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsXidStart(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsXidContinue(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsWhitespace(
const Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsLinebreak(
const Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_ToLowerFull(
Py_UCS4 ch, /* Unicode character */
Py_UCS4 *res
);
PyAPI_FUNC(int) _PyUnicode_ToTitleFull(
Py_UCS4 ch, /* Unicode character */
Py_UCS4 *res
);
PyAPI_FUNC(int) _PyUnicode_ToUpperFull(
Py_UCS4 ch, /* Unicode character */
Py_UCS4 *res
);
PyAPI_FUNC(int) _PyUnicode_ToFoldedFull(
Py_UCS4 ch, /* Unicode character */
Py_UCS4 *res
);
PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsCased(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_ToDigit(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(double) _PyUnicode_ToNumeric(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsDigit(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsNumeric(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsPrintable(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(int) _PyUnicode_IsAlpha(
Py_UCS4 ch /* Unicode character */
);
PyAPI_FUNC(size_t) Py_UNICODE_strlen(
const Py_UNICODE *u
);
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy(
Py_UNICODE *s1,
const Py_UNICODE *s2);
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat(
Py_UNICODE *s1, const Py_UNICODE *s2);
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy(
Py_UNICODE *s1,
const Py_UNICODE *s2,
size_t n);
PyAPI_FUNC(int) Py_UNICODE_strcmp(
const Py_UNICODE *s1,
const Py_UNICODE *s2
);
PyAPI_FUNC(int) Py_UNICODE_strncmp(
const Py_UNICODE *s1,
const Py_UNICODE *s2,
size_t n
);
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
const Py_UNICODE *s,
Py_UNICODE c
);
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
const Py_UNICODE *s,
Py_UNICODE c
);
PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
/* Create a copy of a unicode string ending with a nul character. Return NULL
and raise a MemoryError exception on memory allocation failure, otherwise
return a new allocated buffer (use PyMem_Free() to free the buffer). */
PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
PyObject *unicode
);
#endif /* Py_LIMITED_API */
#if defined(Py_DEBUG) && !defined(Py_LIMITED_API)
PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
PyObject *op,
int check_content);
#endif
/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
/* Clear all static strings. */
PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
#ifdef __cplusplus
}
#endif
#endif /* !Py_UNICODEOBJECT_H */
``` | /content/code_sandbox/android/python35/include/unicodeobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 18,193 |
```objective-c
#ifndef Py_ABSTRACTOBJECT_H
#define Py_ABSTRACTOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PY_SSIZE_T_CLEAN
#define PyObject_CallFunction _PyObject_CallFunction_SizeT
#define PyObject_CallMethod _PyObject_CallMethod_SizeT
#define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
#endif
/* Abstract Object Interface (many thanks to Jim Fulton) */
/*
PROPOSAL: A Generic Python Object Interface for Python C Modules
Problem
Python modules written in C that must access Python objects must do
so through routines whose interfaces are described by a set of
include files. Unfortunately, these routines vary according to the
object accessed. To use these routines, the C programmer must check
the type of the object being used and must call a routine based on
the object type. For example, to access an element of a sequence,
the programmer must determine whether the sequence is a list or a
tuple:
if(is_tupleobject(o))
e=gettupleitem(o,i)
else if(is_listitem(o))
e=getlistitem(o,i)
If the programmer wants to get an item from another type of object
that provides sequence behavior, there is no clear way to do it
correctly.
The persistent programmer may peruse object.h and find that the
_typeobject structure provides a means of invoking up to (currently
about) 41 special operators. So, for example, a routine can get an
item from any object that provides sequence behavior. However, to
use this mechanism, the programmer must make their code dependent on
the current Python implementation.
Also, certain semantics, especially memory management semantics, may
differ by the type of object being used. Unfortunately, these
semantics are not clearly described in the current include files.
An abstract interface providing more consistent semantics is needed.
Proposal
I propose the creation of a standard interface (with an associated
library of routines and/or macros) for generically obtaining the
services of Python objects. This proposal can be viewed as one
components of a Python C interface consisting of several components.
From the viewpoint of C access to Python services, we have (as
suggested by Guido in off-line discussions):
- "Very high level layer": two or three functions that let you exec or
eval arbitrary Python code given as a string in a module whose name is
given, passing C values in and getting C values out using
mkvalue/getargs style format strings. This does not require the user
to declare any variables of type "PyObject *". This should be enough
to write a simple application that gets Python code from the user,
execs it, and returns the output or errors. (Error handling must also
be part of this API.)
- "Abstract objects layer": which is the subject of this proposal.
It has many functions operating on objects, and lest you do many
things from C that you can also write in Python, without going
through the Python parser.
- "Concrete objects layer": This is the public type-dependent
interface provided by the standard built-in types, such as floats,
strings, and lists. This interface exists and is currently
documented by the collection of include files provided with the
Python distributions.
From the point of view of Python accessing services provided by C
modules:
- "Python module interface": this interface consist of the basic
routines used to define modules and their members. Most of the
current extensions-writing guide deals with this interface.
- "Built-in object interface": this is the interface that a new
built-in type must provide and the mechanisms and rules that a
developer of a new built-in type must use and follow.
This proposal is a "first-cut" that is intended to spur
discussion. See especially the lists of notes.
The Python C object interface will provide four protocols: object,
numeric, sequence, and mapping. Each protocol consists of a
collection of related operations. If an operation that is not
provided by a particular type is invoked, then a standard exception,
NotImplementedError is raised with a operation name as an argument.
In addition, for convenience this interface defines a set of
constructors for building objects of built-in types. This is needed
so new objects can be returned from C functions that otherwise treat
objects generically.
Memory Management
For all of the functions described in this proposal, if a function
retains a reference to a Python object passed as an argument, then the
function will increase the reference count of the object. It is
unnecessary for the caller to increase the reference count of an
argument in anticipation of the object's retention.
All Python objects returned from functions should be treated as new
objects. Functions that return objects assume that the caller will
retain a reference and the reference count of the object has already
been incremented to account for this fact. A caller that does not
retain a reference to an object that is returned from a function
must decrement the reference count of the object (using
DECREF(object)) to prevent memory leaks.
Note that the behavior mentioned here is different from the current
behavior for some objects (e.g. lists and tuples) when certain
type-specific routines are called directly (e.g. setlistitem). The
proposed abstraction layer will provide a consistent memory
management interface, correcting for inconsistent behavior for some
built-in types.
Protocols
your_sha256_hashxxxxxxxx*/
/* Object Protocol: */
/* Implemented elsewhere:
int PyObject_Print(PyObject *o, FILE *fp, int flags);
Print an object, o, on file, fp. Returns -1 on
error. The flags argument is used to enable certain printing
options. The only option currently supported is Py_Print_RAW.
(What should be said about Py_Print_RAW?)
*/
/* Implemented elsewhere:
int PyObject_HasAttrString(PyObject *o, const char *attr_name);
Returns 1 if o has the attribute attr_name, and 0 otherwise.
This is equivalent to the Python expression:
hasattr(o,attr_name).
This function always succeeds.
*/
/* Implemented elsewhere:
PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name);
Retrieve an attributed named attr_name form object o.
Returns the attribute value on success, or NULL on failure.
This is the equivalent of the Python expression: o.attr_name.
*/
/* Implemented elsewhere:
int PyObject_HasAttr(PyObject *o, PyObject *attr_name);
Returns 1 if o has the attribute attr_name, and 0 otherwise.
This is equivalent to the Python expression:
hasattr(o,attr_name).
This function always succeeds.
*/
/* Implemented elsewhere:
PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name);
Retrieve an attributed named attr_name form object o.
Returns the attribute value on success, or NULL on failure.
This is the equivalent of the Python expression: o.attr_name.
*/
/* Implemented elsewhere:
int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v);
Set the value of the attribute named attr_name, for object o,
to the value, v. Returns -1 on failure. This is
the equivalent of the Python statement: o.attr_name=v.
*/
/* Implemented elsewhere:
int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v);
Set the value of the attribute named attr_name, for object o,
to the value, v. Returns -1 on failure. This is
the equivalent of the Python statement: o.attr_name=v.
*/
/* implemented as a macro:
int PyObject_DelAttrString(PyObject *o, const char *attr_name);
Delete attribute named attr_name, for object o. Returns
-1 on failure. This is the equivalent of the Python
statement: del o.attr_name.
*/
#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL)
/* implemented as a macro:
int PyObject_DelAttr(PyObject *o, PyObject *attr_name);
Delete attribute named attr_name, for object o. Returns -1
on failure. This is the equivalent of the Python
statement: del o.attr_name.
*/
#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL)
/* Implemented elsewhere:
PyObject *PyObject_Repr(PyObject *o);
Compute the string representation of object, o. Returns the
string representation on success, NULL on failure. This is
the equivalent of the Python expression: repr(o).
Called by the repr() built-in function.
*/
/* Implemented elsewhere:
PyObject *PyObject_Str(PyObject *o);
Compute the string representation of object, o. Returns the
string representation on success, NULL on failure. This is
the equivalent of the Python expression: str(o).)
Called by the str() and print() built-in functions.
*/
/* Declared elsewhere
PyAPI_FUNC(int) PyCallable_Check(PyObject *o);
Determine if the object, o, is callable. Return 1 if the
object is callable and 0 otherwise.
This function always succeeds.
*/
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
PyObject *args, PyObject *kw);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func,
PyObject *result,
const char *where);
#endif
/*
Call a callable Python object, callable_object, with
arguments and keywords arguments. The 'args' argument can not be
NULL, but the 'kw' argument can be NULL.
*/
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
PyObject *args);
/*
Call a callable Python object, callable_object, with
arguments given by the tuple, args. If no arguments are
needed, then args may be NULL. Returns the result of the
call on success, or NULL on failure. This is the equivalent
of the Python expression: o(*args).
*/
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
const char *format, ...);
/*
Call a callable Python object, callable_object, with a
variable number of C arguments. The C arguments are described
using a mkvalue-style format string. The format may be NULL,
indicating that no arguments are provided. Returns the
result of the call on success, or NULL on failure. This is
the equivalent of the Python expression: o(*args).
*/
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o,
const char *method,
const char *format, ...);
/*
Call the method named m of object o with a variable number of
C arguments. The C arguments are described by a mkvalue
format string. The format may be NULL, indicating that no
arguments are provided. Returns the result of the call on
success, or NULL on failure. This is the equivalent of the
Python expression: o.method(args).
*/
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *o,
_Py_Identifier *method,
const char *format, ...);
/*
Like PyObject_CallMethod, but expect a _Py_Identifier* as the
method name.
*/
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
const char *format,
...);
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
const char *name,
const char *format,
...);
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *o,
_Py_Identifier *name,
const char *format,
...);
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
...);
/*
Call a callable Python object, callable_object, with a
variable number of C arguments. The C arguments are provided
as PyObject * values, terminated by a NULL. Returns the
result of the call on success, or NULL on failure. This is
the equivalent of the Python expression: o(*args).
*/
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
PyObject *method, ...);
PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *o,
struct _Py_Identifier *method,
...);
/*
Call the method named m of object o with a variable number of
C arguments. The C arguments are provided as PyObject *
values, terminated by NULL. Returns the result of the call
on success, or NULL on failure. This is the equivalent of
the Python expression: o.method(args).
*/
/* Implemented elsewhere:
long PyObject_Hash(PyObject *o);
Compute and return the hash, hash_value, of an object, o. On
failure, return -1. This is the equivalent of the Python
expression: hash(o).
*/
/* Implemented elsewhere:
int PyObject_IsTrue(PyObject *o);
Returns 1 if the object, o, is considered to be true, 0 if o is
considered to be false and -1 on failure. This is equivalent to the
Python expression: not not o
*/
/* Implemented elsewhere:
int PyObject_Not(PyObject *o);
Returns 0 if the object, o, is considered to be true, 1 if o is
considered to be false and -1 on failure. This is equivalent to the
Python expression: not o
*/
PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o);
/*
On success, returns a type object corresponding to the object
type of object o. On failure, returns NULL. This is
equivalent to the Python expression: type(o).
*/
PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o);
/*
Return the size of object o. If the object, o, provides
both sequence and mapping protocols, the sequence size is
returned. On error, -1 is returned. This is the equivalent
to the Python expression: len(o).
*/
/* For DLL compatibility */
#undef PyObject_Length
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o);
#define PyObject_Length PyObject_Size
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
#endif
/*
Guess the size of object o using len(o) or o.__length_hint__().
If neither of those return a non-negative value, then return the
default value. If one of the calls fails, this function returns -1.
*/
PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);
/*
Return element of o corresponding to the object, key, or NULL
on failure. This is the equivalent of the Python expression:
o[key].
*/
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v);
/*
Map the object, key, to the value, v. Returns
-1 on failure. This is the equivalent of the Python
statement: o[key]=v.
*/
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key);
/*
Remove the mapping for object, key, from the object *o.
Returns -1 on failure. This is equivalent to
the Python statement: del o[key].
*/
PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key);
/*
Delete the mapping for key from *o. Returns -1 on failure.
This is the equivalent of the Python statement: del o[key].
*/
/* old buffer API
FIXME: usage of these should all be replaced in Python itself
but for backwards compatibility we will implement them.
Their usage without a corresponding "unlock" mechansim
may create issues (but they would already be there). */
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
const char **buffer,
Py_ssize_t *buffer_len);
/*
Takes an arbitrary object which must support the (character,
single segment) buffer interface and returns a pointer to a
read-only memory location useable as character based input
for subsequent processing.
0 is returned on success. buffer and buffer_len are only
set in case no error occurs. Otherwise, -1 is returned and
an exception set.
*/
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
/*
Checks whether an arbitrary object supports the (character,
single segment) buffer interface. Returns 1 on success, 0
on failure.
*/
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
const void **buffer,
Py_ssize_t *buffer_len);
/*
Same as PyObject_AsCharBuffer() except that this API expects
(readable, single segment) buffer interface and returns a
pointer to a read-only memory location which can contain
arbitrary data.
0 is returned on success. buffer and buffer_len are only
set in case no error occurs. Otherwise, -1 is returned and
an exception set.
*/
PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
void **buffer,
Py_ssize_t *buffer_len);
/*
Takes an arbitrary object which must support the (writable,
single segment) buffer interface and returns a pointer to a
writable memory location in buffer of size buffer_len.
0 is returned on success. buffer and buffer_len are only
set in case no error occurs. Otherwise, -1 is returned and
an exception set.
*/
/* new buffer API */
#ifndef Py_LIMITED_API
#define PyObject_CheckBuffer(obj) \
(((obj)->ob_type->tp_as_buffer != NULL) && \
((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
/* Return 1 if the getbuffer function is available, otherwise
return 0 */
PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
/* This is a C-API version of the getbuffer function call. It checks
to make sure object has the required function pointer and issues the
call. Returns -1 and raises an error on failure and returns 0 on
success
*/
PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices);
/* Get the memory area pointed to by the indices for the buffer given.
Note that view->ndim is the assumed size of indices
*/
PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *);
/* Return the implied itemsize of the data-format area from a
struct-style description */
/* Implementation in memoryobject.c */
PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
Py_ssize_t len, char order);
PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
Py_ssize_t len, char order);
/* Copy len bytes of data from the contiguous chunk of memory
pointed to by buf into the buffer exported by obj. Return
0 on success and return -1 and raise a PyBuffer_Error on
error (i.e. the object does not have a buffer interface or
it is not working).
If fort is 'F', then if the object is multi-dimensional,
then the data will be copied into the array in
Fortran-style (first dimension varies the fastest). If
fort is 'C', then the data will be copied into the array
in C-style (last dimension varies the fastest). If fort
is 'A', then it does not matter and the copy will be made
in whatever way is more efficient.
*/
PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src);
/* Copy the data from the src buffer to the buffer of destination
*/
PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort);
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
Py_ssize_t *shape,
Py_ssize_t *strides,
int itemsize,
char fort);
/* Fill the strides array with byte-strides of a contiguous
(Fortran-style if fort is 'F' or C-style otherwise)
array of the given shape with the given number of bytes
per element.
*/
PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf,
Py_ssize_t len, int readonly,
int flags);
/* Fills in a buffer-info structure correctly for an exporter
that can only share a contiguous chunk of memory of
"unsigned bytes" of the given length. Returns 0 on success
and -1 (with raising an error) on error.
*/
PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
*/
#endif /* Py_LIMITED_API */
PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
PyObject *format_spec);
/*
Takes an arbitrary object and returns the result of
calling obj.__format__(format_spec).
*/
/* Iterators */
PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
/* Takes an object and returns an iterator for it.
This is typically a new iterator but if the argument
is an iterator, this returns itself. */
#define PyIter_Check(obj) \
((obj)->ob_type->tp_iternext != NULL && \
(obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
/* Takes an iterator object and calls its tp_iternext slot,
returning the next value. If the iterator is exhausted,
this returns NULL without setting an exception.
NULL with an exception means an error occurred. */
/* Number Protocol:*/
PyAPI_FUNC(int) PyNumber_Check(PyObject *o);
/*
Returns 1 if the object, o, provides numeric protocols, and
false otherwise.
This function always succeeds.
*/
PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2);
/*
Returns the result of adding o1 and o2, or null on failure.
This is the equivalent of the Python expression: o1+o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2);
/*
Returns the result of subtracting o2 from o1, or null on
failure. This is the equivalent of the Python expression:
o1-o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2);
/*
Returns the result of multiplying o1 and o2, or null on
failure. This is the equivalent of the Python expression:
o1*o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2);
/*
This is the equivalent of the Python expression: o1 @ o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2);
/*
Returns the result of dividing o1 by o2 giving an integral result,
or null on failure.
This is the equivalent of the Python expression: o1//o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2);
/*
Returns the result of dividing o1 by o2 giving a float result,
or null on failure.
This is the equivalent of the Python expression: o1/o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2);
/*
Returns the remainder of dividing o1 by o2, or null on
failure. This is the equivalent of the Python expression:
o1%o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2);
/*
See the built-in function divmod. Returns NULL on failure.
This is the equivalent of the Python expression:
divmod(o1,o2).
*/
PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
PyObject *o3);
/*
See the built-in function pow. Returns NULL on failure.
This is the equivalent of the Python expression:
pow(o1,o2,o3), where o3 is optional.
*/
PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o);
/*
Returns the negation of o on success, or null on failure.
This is the equivalent of the Python expression: -o.
*/
PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o);
/*
Returns the (what?) of o on success, or NULL on failure.
This is the equivalent of the Python expression: +o.
*/
PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o);
/*
Returns the absolute value of o, or null on failure. This is
the equivalent of the Python expression: abs(o).
*/
PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o);
/*
Returns the bitwise negation of o on success, or NULL on
failure. This is the equivalent of the Python expression:
~o.
*/
PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2);
/*
Returns the result of left shifting o1 by o2 on success, or
NULL on failure. This is the equivalent of the Python
expression: o1 << o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2);
/*
Returns the result of right shifting o1 by o2 on success, or
NULL on failure. This is the equivalent of the Python
expression: o1 >> o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2);
/*
Returns the result of bitwise and of o1 and o2 on success, or
NULL on failure. This is the equivalent of the Python
expression: o1&o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2);
/*
Returns the bitwise exclusive or of o1 by o2 on success, or
NULL on failure. This is the equivalent of the Python
expression: o1^o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);
/*
Returns the result of bitwise or on o1 and o2 on success, or
NULL on failure. This is the equivalent of the Python
expression: o1|o2.
*/
#define PyIndex_Check(obj) \
((obj)->ob_type->tp_as_number != NULL && \
(obj)->ob_type->tp_as_number->nb_index != NULL)
PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o);
/*
Returns the object converted to a Python int
or NULL with an error raised on failure.
*/
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc);
/*
Returns the object converted to Py_ssize_t by going through
PyNumber_Index first. If an overflow error occurs while
converting the int to Py_ssize_t, then the second argument
is the error-type to return. If it is NULL, then the overflow error
is cleared and the value is clipped.
*/
PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o);
/*
Returns the o converted to an integer object on success, or
NULL on failure. This is the equivalent of the Python
expression: int(o).
*/
PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o);
/*
Returns the o converted to a float object on success, or NULL
on failure. This is the equivalent of the Python expression:
float(o).
*/
/* In-place variants of (some of) the above number protocol functions */
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2);
/*
Returns the result of adding o2 to o1, possibly in-place, or null
on failure. This is the equivalent of the Python expression:
o1 += o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2);
/*
Returns the result of subtracting o2 from o1, possibly in-place or
null on failure. This is the equivalent of the Python expression:
o1 -= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2);
/*
Returns the result of multiplying o1 by o2, possibly in-place, or
null on failure. This is the equivalent of the Python expression:
o1 *= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2);
/*
This is the equivalent of the Python expression: o1 @= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
PyObject *o2);
/*
Returns the result of dividing o1 by o2 giving an integral result,
possibly in-place, or null on failure.
This is the equivalent of the Python expression:
o1 /= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
PyObject *o2);
/*
Returns the result of dividing o1 by o2 giving a float result,
possibly in-place, or null on failure.
This is the equivalent of the Python expression:
o1 /= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2);
/*
Returns the remainder of dividing o1 by o2, possibly in-place, or
null on failure. This is the equivalent of the Python expression:
o1 %= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
PyObject *o3);
/*
Returns the result of raising o1 to the power of o2, possibly
in-place, or null on failure. This is the equivalent of the Python
expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2);
/*
Returns the result of left shifting o1 by o2, possibly in-place, or
null on failure. This is the equivalent of the Python expression:
o1 <<= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2);
/*
Returns the result of right shifting o1 by o2, possibly in-place or
null on failure. This is the equivalent of the Python expression:
o1 >>= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2);
/*
Returns the result of bitwise and of o1 and o2, possibly in-place,
or null on failure. This is the equivalent of the Python
expression: o1 &= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2);
/*
Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
null on failure. This is the equivalent of the Python expression:
o1 ^= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2);
/*
Returns the result of bitwise or of o1 and o2, possibly in-place,
or null on failure. This is the equivalent of the Python
expression: o1 |= o2.
*/
PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base);
/*
Returns the integer n converted to a string with a base, with a base
marker of 0b, 0o or 0x prefixed if applicable.
If n is not an int object, it is converted with PyNumber_Index first.
*/
/* Sequence protocol:*/
PyAPI_FUNC(int) PySequence_Check(PyObject *o);
/*
Return 1 if the object provides sequence protocol, and zero
otherwise.
This function always succeeds.
*/
PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o);
/*
Return the size of sequence object o, or -1 on failure.
*/
/* For DLL compatibility */
#undef PySequence_Length
PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o);
#define PySequence_Length PySequence_Size
PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2);
/*
Return the concatenation of o1 and o2 on success, and NULL on
failure. This is the equivalent of the Python
expression: o1+o2.
*/
PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count);
/*
Return the result of repeating sequence object o count times,
or NULL on failure. This is the equivalent of the Python
expression: o1*count.
*/
PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i);
/*
Return the ith element of o, or NULL on failure. This is the
equivalent of the Python expression: o[i].
*/
PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2);
/*
Return the slice of sequence object o between i1 and i2, or
NULL on failure. This is the equivalent of the Python
expression: o[i1:i2].
*/
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v);
/*
Assign object v to the ith element of o. Returns
-1 on failure. This is the equivalent of the Python
statement: o[i]=v.
*/
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i);
/*
Delete the ith element of object v. Returns
-1 on failure. This is the equivalent of the Python
statement: del o[i].
*/
PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2,
PyObject *v);
/*
Assign the sequence object, v, to the slice in sequence
object, o, from i1 to i2. Returns -1 on failure. This is the
equivalent of the Python statement: o[i1:i2]=v.
*/
PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2);
/*
Delete the slice in sequence object, o, from i1 to i2.
Returns -1 on failure. This is the equivalent of the Python
statement: del o[i1:i2].
*/
PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o);
/*
Returns the sequence, o, as a tuple on success, and NULL on failure.
This is equivalent to the Python expression: tuple(o)
*/
PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o);
/*
Returns the sequence, o, as a list on success, and NULL on failure.
This is equivalent to the Python expression: list(o)
*/
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
/*
Return the sequence, o, as a list, unless it's already a
tuple or list. Use PySequence_Fast_GET_ITEM to access the
members of this list, and PySequence_Fast_GET_SIZE to get its length.
Returns NULL on failure. If the object does not support iteration,
raises a TypeError exception with m as the message text.
*/
#define PySequence_Fast_GET_SIZE(o) \
(PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o))
/*
Return the size of o, assuming that o was returned by
PySequence_Fast and is not NULL.
*/
#define PySequence_Fast_GET_ITEM(o, i)\
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
/*
Return the ith element of o, assuming that o was returned by
PySequence_Fast, and that i is within bounds.
*/
#define PySequence_ITEM(o, i)\
( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
/* Assume tp_as_sequence and sq_item exist and that i does not
need to be corrected for a negative index
*/
#define PySequence_Fast_ITEMS(sf) \
(PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \
: ((PyTupleObject *)(sf))->ob_item)
/* Return a pointer to the underlying item array for
an object retured by PySequence_Fast */
PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value);
/*
Return the number of occurrences on value on o, that is,
return the number of keys for which o[key]==value. On
failure, return -1. This is equivalent to the Python
expression: o.count(value).
*/
PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob);
/*
Return -1 if error; 1 if ob in seq; 0 if ob not in seq.
Use __contains__ if possible, else _PySequence_IterSearch().
*/
#ifndef Py_LIMITED_API
#define PY_ITERSEARCH_COUNT 1
#define PY_ITERSEARCH_INDEX 2
#define PY_ITERSEARCH_CONTAINS 3
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
PyObject *obj, int operation);
#endif
/*
Iterate over seq. Result depends on the operation:
PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
error.
PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of
obj in seq; set ValueError and return -1 if none found;
also return -1 on error.
PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on
error.
*/
/* For DLL-level backwards compatibility */
#undef PySequence_In
PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value);
/* For source-level backwards compatibility */
#define PySequence_In PySequence_Contains
/*
Determine if o contains value. If an item in o is equal to
X, return 1, otherwise return 0. On error, return -1. This
is equivalent to the Python expression: value in o.
*/
PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value);
/*
Return the first index for which o[i]=value. On error,
return -1. This is equivalent to the Python
expression: o.index(value).
*/
/* In-place versions of some of the above Sequence functions. */
PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2);
/*
Append o2 to o1, in-place when possible. Return the resulting
object, which could be o1, or NULL on failure. This is the
equivalent of the Python expression: o1 += o2.
*/
PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count);
/*
Repeat o1 by count, in-place when possible. Return the resulting
object, which could be o1, or NULL on failure. This is the
equivalent of the Python expression: o1 *= count.
*/
/* Mapping protocol:*/
PyAPI_FUNC(int) PyMapping_Check(PyObject *o);
/*
Return 1 if the object provides mapping protocol, and zero
otherwise.
This function always succeeds.
*/
PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o);
/*
Returns the number of keys in object o on success, and -1 on
failure. For objects that do not provide sequence protocol,
this is equivalent to the Python expression: len(o).
*/
/* For DLL compatibility */
#undef PyMapping_Length
PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
#define PyMapping_Length PyMapping_Size
/* implemented as a macro:
int PyMapping_DelItemString(PyObject *o, const char *key);
Remove the mapping for object, key, from the object *o.
Returns -1 on failure. This is equivalent to
the Python statement: del o[key].
*/
#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K))
/* implemented as a macro:
int PyMapping_DelItem(PyObject *o, PyObject *key);
Remove the mapping for object, key, from the object *o.
Returns -1 on failure. This is equivalent to
the Python statement: del o[key].
*/
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key);
/*
On success, return 1 if the mapping object has the key, key,
and 0 otherwise. This is equivalent to the Python expression:
key in o.
This function always succeeds.
*/
PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key);
/*
Return 1 if the mapping object has the key, key,
and 0 otherwise. This is equivalent to the Python expression:
key in o.
This function always succeeds.
*/
PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o);
/*
On success, return a list or tuple of the keys in object o.
On failure, return NULL.
*/
PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o);
/*
On success, return a list or tuple of the values in object o.
On failure, return NULL.
*/
PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o);
/*
On success, return a list or tuple of the items in object o,
where each item is a tuple containing a key-value pair.
On failure, return NULL.
*/
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o,
const char *key);
/*
Return element of o corresponding to the object, key, or NULL
on failure. This is the equivalent of the Python expression:
o[key].
*/
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key,
PyObject *value);
/*
Map the object, key, to the value, v. Returns
-1 on failure. This is the equivalent of the Python
statement: o[key]=v.
*/
PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass);
/* isinstance(object, typeorclass) */
PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass);
/* issubclass(object, typeorclass) */
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self);
PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]);
#endif
/* For internal use by buffer API functions */
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
const Py_ssize_t *shape);
PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
const Py_ssize_t *shape);
#ifdef __cplusplus
}
#endif
#endif /* Py_ABSTRACTOBJECT_H */
``` | /content/code_sandbox/android/python35/include/abstract.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 9,818 |
```objective-c
/* An arena-like memory interface for the compiler.
*/
#ifndef Py_LIMITED_API
#ifndef Py_PYARENA_H
#define Py_PYARENA_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _arena PyArena;
/* PyArena_New() and PyArena_Free() create a new arena and free it,
respectively. Once an arena has been created, it can be used
to allocate memory via PyArena_Malloc(). Pointers to PyObject can
also be registered with the arena via PyArena_AddPyObject(), and the
arena will ensure that the PyObjects stay alive at least until
PyArena_Free() is called. When an arena is freed, all the memory it
allocated is freed, the arena releases internal references to registered
PyObject*, and none of its pointers are valid.
XXX (tim) What does "none of its pointers are valid" mean? Does it
XXX mean that pointers previously obtained via PyArena_Malloc() are
XXX no longer valid? (That's clearly true, but not sure that's what
XXX the text is trying to say.)
PyArena_New() returns an arena pointer. On error, it
returns a negative number and sets an exception.
XXX (tim): Not true. On error, PyArena_New() actually returns NULL,
XXX and looks like it may or may not set an exception (e.g., if the
XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on
XXX and an exception is set; OTOH, if the internal
XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
XXX an exception is not set in that case).
*/
PyAPI_FUNC(PyArena *) PyArena_New(void);
PyAPI_FUNC(void) PyArena_Free(PyArena *);
/* Mostly like malloc(), return the address of a block of memory spanning
* `size` bytes, or return NULL (without setting an exception) if enough
* new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with
* size=0 does not guarantee to return a unique pointer (the pointer
* returned may equal one or more other pointers obtained from
* PyArena_Malloc()).
* Note that pointers obtained via PyArena_Malloc() must never be passed to
* the system free() or realloc(), or to any of Python's similar memory-
* management functions. PyArena_Malloc()-obtained pointers remain valid
* until PyArena_Free(ar) is called, at which point all pointers obtained
* from the arena `ar` become invalid simultaneously.
*/
PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size);
/* This routine isn't a proper arena allocation routine. It takes
* a PyObject* and records it so that it can be DECREFed when the
* arena is freed.
*/
PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);
#ifdef __cplusplus
}
#endif
#endif /* !Py_PYARENA_H */
#endif /* Py_LIMITED_API */
``` | /content/code_sandbox/android/python35/include/pyarena.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 678 |
```objective-c
#ifndef Py_PGEN_H
#define Py_PGEN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Parser generator interface */
extern grammar *meta_grammar(void);
struct _node;
extern grammar *pgen(struct _node *);
#ifdef __cplusplus
}
#endif
#endif /* !Py_PGEN_H */
``` | /content/code_sandbox/android/python35/include/pgen.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 65 |
```objective-c
/* simple namespace object interface */
#ifndef NAMESPACEOBJECT_H
#define NAMESPACEOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_DATA(PyTypeObject) _PyNamespace_Type;
PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds);
#ifdef __cplusplus
}
#endif
#endif /* !NAMESPACEOBJECT_H */
``` | /content/code_sandbox/android/python35/include/namespaceobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 71 |
```objective-c
/* Set object interface */
#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_LIMITED_API
/* There are three kinds of entries in the table:
1. Unused: key == NULL
2. Active: key != NULL and key != dummy
3. Dummy: key == dummy
The hash field of Unused slots have no meaning.
The hash field of Dummny slots are set to -1
meaning that dummy entries can be detected by
either entry->key==dummy or by entry->hash==-1.
*/
#define PySet_MINSIZE 8
typedef struct {
PyObject *key;
Py_hash_t hash; /* Cached hash code of the key */
} setentry;
/* The SetObject data structure is shared by set and frozenset objects.
Invariant for sets:
- hash is -1
Invariants for frozensets:
- data is immutable.
- hash is the hash of the frozenset or -1 if not computed yet.
*/
typedef struct {
PyObject_HEAD
Py_ssize_t fill; /* Number active and dummy entries*/
Py_ssize_t used; /* Number active entries */
/* The table contains mask + 1 slots, and that's a power of 2.
* We store the mask instead of the size because the mask is more
* frequently needed.
*/
Py_ssize_t mask;
/* The table points to a fixed-size smalltable for small tables
* or to additional malloc'ed memory for bigger tables.
* The table pointer is never NULL which saves us from repeated
* runtime null-tests.
*/
setentry *table;
Py_hash_t hash; /* Only used by frozenset objects */
Py_ssize_t finger; /* Search finger for pop() */
setentry smalltable[PySet_MINSIZE];
PyObject *weakreflist; /* List of weak references */
} PySetObject;
#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used)
PyAPI_DATA(PyObject *) _PySet_Dummy;
PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash);
PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
PyAPI_FUNC(int) PySet_ClearFreeList(void);
#endif /* Section excluded by Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PySet_Type;
PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
PyAPI_DATA(PyTypeObject) PySetIter_Type;
PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
PyAPI_FUNC(int) PySet_Clear(PyObject *set);
PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
#define PyAnySet_CheckExact(ob) \
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
#define PyAnySet_Check(ob) \
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
#define PySet_Check(ob) \
(Py_TYPE(ob) == &PySet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
#define PyFrozenSet_Check(ob) \
(Py_TYPE(ob) == &PyFrozenSet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
#ifdef __cplusplus
}
#endif
#endif /* !Py_SETOBJECT_H */
``` | /content/code_sandbox/android/python35/include/setobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 877 |
```objective-c
#ifndef Py_LIMITED_API
#ifndef Py_BYTES_CTYPE_H
#define Py_BYTES_CTYPE_H
/*
* The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
* methods of the given names, they operate on ASCII byte strings.
*/
extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
/* These store their len sized answer in the given preallocated *result arg. */
extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
/* The maketrans() static method. */
extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to);
/* Shared __doc__ strings. */
extern const char _Py_isspace__doc__[];
extern const char _Py_isalpha__doc__[];
extern const char _Py_isalnum__doc__[];
extern const char _Py_isdigit__doc__[];
extern const char _Py_islower__doc__[];
extern const char _Py_isupper__doc__[];
extern const char _Py_istitle__doc__[];
extern const char _Py_lower__doc__[];
extern const char _Py_upper__doc__[];
extern const char _Py_title__doc__[];
extern const char _Py_capitalize__doc__[];
extern const char _Py_swapcase__doc__[];
extern const char _Py_maketrans__doc__[];
/* this is needed because some docs are shared from the .o, not static */
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
#endif /* !Py_BYTES_CTYPE_H */
#endif /* !Py_LIMITED_API */
``` | /content/code_sandbox/android/python35/include/bytes_methods.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 552 |
```objective-c
#ifndef Py_FILEUTILS_H
#define Py_FILEUTILS_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
const char *arg,
size_t *size);
PyAPI_FUNC(char*) Py_EncodeLocale(
const wchar_t *text,
size_t *error_pos);
#ifndef Py_LIMITED_API
#ifdef MS_WINDOWS
struct _Py_stat_struct {
unsigned long st_dev;
__int64 st_ino;
unsigned short st_mode;
int st_nlink;
int st_uid;
int st_gid;
unsigned long st_rdev;
__int64 st_size;
time_t st_atime;
int st_atime_nsec;
time_t st_mtime;
int st_mtime_nsec;
time_t st_ctime;
int st_ctime_nsec;
unsigned long st_file_attributes;
};
#else
# define _Py_stat_struct stat
#endif
PyAPI_FUNC(int) _Py_fstat(
int fd,
struct _Py_stat_struct *status);
PyAPI_FUNC(int) _Py_fstat_noraise(
int fd,
struct _Py_stat_struct *status);
#endif /* Py_LIMITED_API */
PyAPI_FUNC(int) _Py_stat(
PyObject *path,
struct stat *status);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _Py_open(
const char *pathname,
int flags);
PyAPI_FUNC(int) _Py_open_noraise(
const char *pathname,
int flags);
#endif
PyAPI_FUNC(FILE *) _Py_wfopen(
const wchar_t *path,
const wchar_t *mode);
PyAPI_FUNC(FILE*) _Py_fopen(
const char *pathname,
const char *mode);
PyAPI_FUNC(FILE*) _Py_fopen_obj(
PyObject *path,
const char *mode);
PyAPI_FUNC(Py_ssize_t) _Py_read(
int fd,
void *buf,
size_t count);
PyAPI_FUNC(Py_ssize_t) _Py_write(
int fd,
const void *buf,
size_t count);
PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
int fd,
const void *buf,
size_t count);
#ifdef HAVE_READLINK
PyAPI_FUNC(int) _Py_wreadlink(
const wchar_t *path,
wchar_t *buf,
size_t bufsiz);
#endif
#ifdef HAVE_REALPATH
PyAPI_FUNC(wchar_t*) _Py_wrealpath(
const wchar_t *path,
wchar_t *resolved_path,
size_t resolved_path_size);
#endif
PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
wchar_t *buf,
size_t size);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
int *atomic_flag_works);
PyAPI_FUNC(int) _Py_dup(int fd);
#ifndef MS_WINDOWS
PyAPI_FUNC(int) _Py_get_blocking(int fd);
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
#endif /* !MS_WINDOWS */
#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900
/* A routine to check if a file descriptor is valid on Windows. Returns 0
* and sets errno to EBADF if it isn't. This is to avoid Assertions
* from various functions in the Windows CRT beginning with
* Visual Studio 2005
*/
int _PyVerify_fd(int fd);
#else
#define _PyVerify_fd(A) (1) /* dummy */
#endif
#endif /* Py_LIMITED_API */
#ifdef __cplusplus
}
#endif
#endif /* !Py_FILEUTILS_H */
``` | /content/code_sandbox/android/python35/include/fileutils.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 815 |
```objective-c
#ifndef Py_BITSET_H
#define Py_BITSET_H
#ifdef __cplusplus
extern "C" {
#endif
/* Bitset interface */
#define BYTE char
typedef BYTE *bitset;
bitset newbitset(int nbits);
void delbitset(bitset bs);
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
int addbit(bitset bs, int ibit); /* Returns 0 if already set */
int samebitset(bitset bs1, bitset bs2, int nbits);
void mergebitset(bitset bs1, bitset bs2, int nbits);
#define BITSPERBYTE (8*sizeof(BYTE))
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
#ifdef __cplusplus
}
#endif
#endif /* !Py_BITSET_H */
``` | /content/code_sandbox/android/python35/include/bitset.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 259 |
```objective-c
#ifndef Py_CURSES_H
#define Py_CURSES_H
#ifdef __APPLE__
/*
** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards
** against multiple definition of wchar_t.
*/
#ifdef _BSD_WCHAR_T_DEFINED_
#define _WCHAR_T
#endif
/* the following define is necessary for OS X 10.6; without it, the
Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
can't get at the WINDOW flags field. */
#define NCURSES_OPAQUE 0
#endif /* __APPLE__ */
#ifdef __FreeBSD__
/*
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
** against multiple definition of wchar_t and wint_t.
*/
#ifdef _XOPEN_SOURCE_EXTENDED
#ifndef __FreeBSD_version
#include <osreldate.h>
#endif
#if __FreeBSD_version >= 500000
#ifndef __wchar_t
#define __wchar_t
#endif
#ifndef __wint_t
#define __wint_t
#endif
#else
#ifndef _WCHAR_T
#define _WCHAR_T
#endif
#ifndef _WINT_T
#define _WINT_T
#endif
#endif
#endif
#endif
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#ifdef HAVE_TERM_H
/* for tigetstr, which is not declared in SysV curses */
#include <term.h>
#endif
#endif
#ifdef HAVE_NCURSES_H
/* configure was checking <curses.h>, but we will
use <ncurses.h>, which has all these features. */
#ifndef WINDOW_HAS_FLAGS
#define WINDOW_HAS_FLAGS 1
#endif
#ifndef MVWDELCH_IS_EXPRESSION
#define MVWDELCH_IS_EXPRESSION 1
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define PyCurses_API_pointers 4
/* Type declarations */
typedef struct {
PyObject_HEAD
WINDOW *win;
char *encoding;
} PyCursesWindowObject;
#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type)
#define PyCurses_CAPSULE_NAME "_curses._C_API"
#ifdef CURSES_MODULE
/* This section is used when compiling _cursesmodule.c */
#else
/* This section is used in modules that use the _cursesmodule API */
static void **PyCurses_API;
#define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0])
#define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;}
#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;}
#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;}
#define import_curses() \
PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);
#endif
/* general error messages */
static char *catchall_ERR = "curses function returned ERR";
static char *catchall_NULL = "curses function returned NULL";
/* Function Prototype Macros - They are ugly but very, very useful. ;-)
X - function name
TYPE - parameter Type
ERGSTR - format string for construction of the return value
PARSESTR - format string for argument parsing
*/
#define NoArgNoReturnFunction(X) \
static PyObject *PyCurses_ ## X (PyObject *self) \
{ \
PyCursesInitialised \
return PyCursesCheckERR(X(), # X); }
#define NoArgOrFlagNoReturnFunction(X) \
static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
{ \
int flag = 0; \
PyCursesInitialised \
switch(PyTuple_Size(args)) { \
case 0: \
return PyCursesCheckERR(X(), # X); \
case 1: \
if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \
if (flag) return PyCursesCheckERR(X(), # X); \
else return PyCursesCheckERR(no ## X (), # X); \
default: \
PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \
return NULL; } }
#define NoArgReturnIntFunction(X) \
static PyObject *PyCurses_ ## X (PyObject *self) \
{ \
PyCursesInitialised \
return PyLong_FromLong((long) X()); }
#define NoArgReturnStringFunction(X) \
static PyObject *PyCurses_ ## X (PyObject *self) \
{ \
PyCursesInitialised \
return PyBytes_FromString(X()); }
#define NoArgTrueFalseFunction(X) \
static PyObject *PyCurses_ ## X (PyObject *self) \
{ \
PyCursesInitialised \
if (X () == FALSE) { \
Py_INCREF(Py_False); \
return Py_False; \
} \
Py_INCREF(Py_True); \
return Py_True; }
#define NoArgNoReturnVoidFunction(X) \
static PyObject *PyCurses_ ## X (PyObject *self) \
{ \
PyCursesInitialised \
X(); \
Py_INCREF(Py_None); \
return Py_None; }
#ifdef __cplusplus
}
#endif
#endif /* !defined(Py_CURSES_H) */
``` | /content/code_sandbox/android/python35/include/py_curses.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,189 |
```objective-c
/* Module definition and import interface */
#ifndef Py_IMPORT_H
#define Py_IMPORT_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(void) _PyImportZip_Init(void);
PyMODINIT_FUNC PyInit_imp(void);
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
const char *name, /* UTF-8 encoded string */
PyObject *co
);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
const char *name, /* UTF-8 encoded string */
PyObject *co,
const char *pathname /* decoded from the filesystem encoding */
);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
const char *name, /* UTF-8 encoded string */
PyObject *co,
const char *pathname, /* decoded from the filesystem encoding */
const char *cpathname /* decoded from the filesystem encoding */
);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
PyObject *name,
PyObject *co,
PyObject *pathname,
PyObject *cpathname
);
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
PyObject *name
);
PyAPI_FUNC(PyObject *) PyImport_AddModule(
const char *name /* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
const char *name /* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
const char *name /* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
const char *name, /* UTF-8 encoded string */
PyObject *globals,
PyObject *locals,
PyObject *fromlist,
int level
);
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
PyObject *name,
PyObject *globals,
PyObject *locals,
PyObject *fromlist,
int level
);
#define PyImport_ImportModuleEx(n, g, l, f) \
PyImport_ImportModuleLevel(n, g, l, f, 0)
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
PyAPI_FUNC(void) PyImport_Cleanup(void);
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
PyObject *name
);
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
const char *name /* UTF-8 encoded string */
);
#ifndef Py_LIMITED_API
#ifdef WITH_THREAD
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
#else
#define _PyImport_AcquireLock()
#define _PyImport_ReleaseLock() 1
#endif
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
const char *name /* UTF-8 encoded string */
);
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
PyObject *mod,
const char *name /* UTF-8 encoded string */
);
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
struct _inittab {
const char *name; /* ASCII encoded string */
PyObject* (*initfunc)(void);
};
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
PyAPI_FUNC(int) PyImport_AppendInittab(
const char *name, /* ASCII encoded string */
PyObject* (*initfunc)(void)
);
#ifndef Py_LIMITED_API
struct _frozen {
const char *name; /* ASCII encoded string */
const unsigned char *code;
int size;
};
/* Embedding apps may change this pointer to point to their favorite
collection of frozen modules: */
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
#endif
#ifdef __cplusplus
}
#endif
#endif /* !Py_IMPORT_H */
``` | /content/code_sandbox/android/python35/include/import.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 957 |
```objective-c
/* Python version identification scheme.
When the major or minor version changes, the VERSION variable in
configure.ac must also be changed.
There is also (independent) API version information in modsupport.h.
*/
/* Values for PY_RELEASE_LEVEL */
#define PY_RELEASE_LEVEL_ALPHA 0xA
#define PY_RELEASE_LEVEL_BETA 0xB
#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */
#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */
/* Higher for patch releases */
/* Version parsed out into numeric values */
/*--start constants--*/
#define PY_MAJOR_VERSION 3
#define PY_MINOR_VERSION 5
#define PY_MICRO_VERSION 0
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0
/* Version as a string */
#define PY_VERSION "3.5.0"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
(PY_MINOR_VERSION << 16) | \
(PY_MICRO_VERSION << 8) | \
(PY_RELEASE_LEVEL << 4) | \
(PY_RELEASE_SERIAL << 0))
``` | /content/code_sandbox/android/python35/include/patchlevel.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 302 |
```objective-c
/* List object interface */
/*
Another generally useful object type is an list of object pointers.
This is a mutable type: the list items can be changed, and items can be
added or removed. Out-of-range indices or non-list objects are ignored.
*** WARNING *** PyList_SetItem does not increment the new item's reference
count, but does decrement the reference count of the item it replaces,
if not nil. It does *decrement* the reference count if it is *not*
inserted in the list. Similarly, PyList_GetItem does not increment the
returned item's reference count.
*/
#ifndef Py_LISTOBJECT_H
#define Py_LISTOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_LIMITED_API
typedef struct {
PyObject_VAR_HEAD
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
PyObject **ob_item;
/* ob_item contains space for 'allocated' elements. The number
* currently in use is ob_size.
* Invariants:
* 0 <= ob_size <= allocated
* len(list) == ob_size
* ob_item == NULL implies ob_size == allocated == 0
* list.sort() temporarily sets allocated to -1 to detect mutations.
*
* Items must normally not be NULL, except during construction when
* the list is not yet visible outside the function that builds it.
*/
Py_ssize_t allocated;
} PyListObject;
#endif
PyAPI_DATA(PyTypeObject) PyList_Type;
PyAPI_DATA(PyTypeObject) PyListIter_Type;
PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
PyAPI_DATA(PyTypeObject) PySortWrapper_Type;
#define PyList_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
PyAPI_FUNC(int) PyList_Sort(PyObject *);
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
PyAPI_FUNC(int) PyList_ClearFreeList(void);
PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
#endif
/* Macro, trading safety for speed */
#ifndef Py_LIMITED_API
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
#define PyList_GET_SIZE(op) Py_SIZE(op)
#define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item)
#endif
#ifdef __cplusplus
}
#endif
#endif /* !Py_LISTOBJECT_H */
``` | /content/code_sandbox/android/python35/include/listobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 741 |
```objective-c
#ifndef Py_COMPILE_H
#define Py_COMPILE_H
#ifndef Py_LIMITED_API
#include "code.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Public interface */
struct _node; /* Declare the existence of this type */
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
/* Future feature support */
typedef struct {
int ff_features; /* flags set by future statements */
int ff_lineno; /* line number of last future statement */
} PyFutureFeatures;
#define FUTURE_NESTED_SCOPES "nested_scopes"
#define FUTURE_GENERATORS "generators"
#define FUTURE_DIVISION "division"
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
#define FUTURE_WITH_STATEMENT "with_statement"
#define FUTURE_PRINT_FUNCTION "print_function"
#define FUTURE_UNICODE_LITERALS "unicode_literals"
#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
#define FUTURE_GENERATOR_STOP "generator_stop"
struct _mod; /* Declare the existence of this type */
#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
struct _mod *mod,
const char *filename, /* decoded from the filesystem encoding */
PyCompilerFlags *flags,
int optimize,
PyArena *arena);
PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
struct _mod *mod,
PyObject *filename,
PyCompilerFlags *flags,
int optimize,
PyArena *arena);
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
struct _mod * mod,
const char *filename /* decoded from the filesystem encoding */
);
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
struct _mod * mod,
PyObject *filename
);
/* _Py_Mangle is defined in compile.c */
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
#define PY_INVALID_STACK_EFFECT INT_MAX
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
#ifdef __cplusplus
}
#endif
#endif /* !Py_LIMITED_API */
/* These definitions must match corresponding definitions in graminit.h.
There's code in compile.c that checks that they are the same. */
#define Py_single_input 256
#define Py_file_input 257
#define Py_eval_input 258
#endif /* !Py_COMPILE_H */
``` | /content/code_sandbox/android/python35/include/compile.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 526 |
```objective-c
#ifndef Py_SLICEOBJECT_H
#define Py_SLICEOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
/* The unique ellipsis object "..." */
PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
#define Py_Ellipsis (&_Py_EllipsisObject)
/* Slice object interface */
/*
A slice object containing start, stop, and step data members (the
names are from range). After much talk with Guido, it was decided to
let these be any arbitrary python type. Py_None stands for omitted values.
*/
#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
PyObject *start, *stop, *step; /* not NULL */
} PySliceObject;
#endif
PyAPI_DATA(PyTypeObject) PySlice_Type;
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
PyObject* step);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
PyObject **start_ptr, PyObject **stop_ptr,
PyObject **step_ptr);
#endif
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop,
Py_ssize_t *step, Py_ssize_t *slicelength);
#ifdef __cplusplus
}
#endif
#endif /* !Py_SLICEOBJECT_H */
``` | /content/code_sandbox/android/python35/include/sliceobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 398 |
```objective-c
#ifndef Py_DICTOBJECT_H
#define Py_DICTOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Dictionary object type -- mapping from hashable object to object */
/* The distribution includes a separate file, Objects/dictnotes.txt,
describing explorations into dictionary design and optimization.
It covers typical dictionary use patterns, the parameters for
tuning dictionaries, and several ideas for possible optimizations.
*/
#ifndef Py_LIMITED_API
typedef struct _dictkeysobject PyDictKeysObject;
/* The ma_values pointer is NULL for a combined table
* or points to an array of PyObject* for a split table
*/
typedef struct {
PyObject_HEAD
Py_ssize_t ma_used;
PyDictKeysObject *ma_keys;
PyObject **ma_values;
} PyDictObject;
typedef struct {
PyObject_HEAD
PyDictObject *dv_dict;
} _PyDictViewObject;
#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PyDict_Type;
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
PyAPI_DATA(PyTypeObject) PyDictItems_Type;
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
#define PyDict_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type)
#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type)
#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type)
/* This excludes Values, since they are not sets. */
# define PyDictViewSet_Check(op) \
(PyDictKeys_Check(op) || PyDictItems_Check(op))
PyAPI_FUNC(PyObject *) PyDict_New(void);
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
Py_hash_t hash);
#endif
PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key);
PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
struct _Py_Identifier *key);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
PyObject *mp, PyObject *key, PyObject *defaultobj);
#endif
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key,
PyObject *item, Py_hash_t hash);
#endif
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(int) PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
#ifndef Py_LIMITED_API
PyDictKeysObject *_PyDict_NewKeysForClass(void);
PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
PyAPI_FUNC(int) _PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
PyObject *_PyDictView_New(PyObject *, PyTypeObject *);
#endif
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
PyObject *_PyDict_SizeOf(PyDictObject *);
PyObject *_PyDict_Pop(PyDictObject *, PyObject *, PyObject *);
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
PyAPI_FUNC(int) PyDict_ClearFreeList(void);
#endif
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
/* PyDict_Merge updates/merges from a mapping object (an object that
supports PyMapping_Keys() and PyObject_GetItem()). If override is true,
the last occurrence of a key wins, else the first. The Python
dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
*/
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
PyObject *other,
int override);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
#endif
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
iterable objects of length 2. If override is true, the last occurrence
of a key wins, else the first. The Python dict constructor dict(seq2)
is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
*/
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
PyObject *seq2,
int override);
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key);
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* !Py_DICTOBJECT_H */
``` | /content/code_sandbox/android/python35/include/dictobject.h | objective-c | 2016-08-07T05:00:51 | 2024-08-14T06:32:20 | UnrealEnginePython | 20tab/UnrealEnginePython | 2,715 | 1,475 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.