Cleanup: Python GPU: change prefix 'bpygpu_' to 'py_' in static functions
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
* Use with PyArg_ParseTuple's "O&" formatting.
|
||||
* \{ */
|
||||
|
||||
static int bpygpu_parse_component_type(const char *str, int length)
|
||||
static int py_parse_component_type(const char *str, int length)
|
||||
{
|
||||
if (length == 2) {
|
||||
switch (*((ushort *)str)) {
|
||||
@@ -83,7 +83,7 @@ static int bpygpu_parse_component_type(const char *str, int length)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int bpygpu_parse_fetch_mode(const char *str, int length)
|
||||
static int py_parse_fetch_mode(const char *str, int length)
|
||||
{
|
||||
#define MATCH_ID(id) \
|
||||
if (length == strlen(STRINGIFY(id))) { \
|
||||
@@ -102,7 +102,7 @@ static int bpygpu_parse_fetch_mode(const char *str, int length)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int bpygpu_ParseVertCompType(PyObject *o, void *p)
|
||||
static int py_ParseVertCompType(PyObject *o, void *p)
|
||||
{
|
||||
Py_ssize_t length;
|
||||
const char *str = _PyUnicode_AsStringAndSize(o, &length);
|
||||
@@ -112,7 +112,7 @@ static int bpygpu_ParseVertCompType(PyObject *o, void *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int comp_type = bpygpu_parse_component_type(str, length);
|
||||
const int comp_type = py_parse_component_type(str, length);
|
||||
if (comp_type == -1) {
|
||||
PyErr_Format(PyExc_ValueError, "unknown component type: '%s", str);
|
||||
return 0;
|
||||
@@ -122,7 +122,7 @@ static int bpygpu_ParseVertCompType(PyObject *o, void *p)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int bpygpu_ParseVertFetchMode(PyObject *o, void *p)
|
||||
static int py_ParseVertFetchMode(PyObject *o, void *p)
|
||||
{
|
||||
Py_ssize_t length;
|
||||
const char *str = _PyUnicode_AsStringAndSize(o, &length);
|
||||
@@ -132,7 +132,7 @@ static int bpygpu_ParseVertFetchMode(PyObject *o, void *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int fetch_mode = bpygpu_parse_fetch_mode(str, length);
|
||||
const int fetch_mode = py_parse_fetch_mode(str, length);
|
||||
if (fetch_mode == -1) {
|
||||
PyErr_Format(PyExc_ValueError, "unknown type literal: '%s'", str);
|
||||
return 0;
|
||||
@@ -148,7 +148,7 @@ static int bpygpu_ParseVertFetchMode(PyObject *o, void *p)
|
||||
/** \name VertFormat Type
|
||||
* \{ */
|
||||
|
||||
static PyObject *bpygpu_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
|
||||
static PyObject *py_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
|
||||
{
|
||||
if (PyTuple_GET_SIZE(args) || (kwds && PyDict_Size(kwds))) {
|
||||
PyErr_SetString(PyExc_ValueError, "This function takes no arguments");
|
||||
@@ -158,7 +158,7 @@ static PyObject *bpygpu_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *arg
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
bpygpu_VertFormat_attr_add_doc,
|
||||
py_VertFormat_attr_add_doc,
|
||||
".. method:: attr_add(id, comp_type, len, fetch_mode)\n"
|
||||
"\n"
|
||||
" Add a new attribute to the format.\n"
|
||||
@@ -177,7 +177,7 @@ PyDoc_STRVAR(
|
||||
" converted to a normal 4 byte float when used.\n"
|
||||
" Possible values are `FLOAT`, `INT`, `INT_TO_FLOAT_UNIT` and `INT_TO_FLOAT`.\n"
|
||||
" :type fetch_mode: `str`\n");
|
||||
static PyObject *bpygpu_VertFormat_attr_add(BPyGPUVertFormat *self, PyObject *args, PyObject *kwds)
|
||||
static PyObject *py_VertFormat_attr_add(BPyGPUVertFormat *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
struct {
|
||||
const char *id;
|
||||
@@ -197,10 +197,10 @@ static PyObject *bpygpu_VertFormat_attr_add(BPyGPUVertFormat *self, PyObject *ar
|
||||
kwds,
|
||||
&_parser,
|
||||
¶ms.id,
|
||||
bpygpu_ParseVertCompType,
|
||||
py_ParseVertCompType,
|
||||
¶ms.comp_type,
|
||||
¶ms.len,
|
||||
bpygpu_ParseVertFetchMode,
|
||||
py_ParseVertFetchMode,
|
||||
¶ms.fetch_mode)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -210,31 +210,31 @@ static PyObject *bpygpu_VertFormat_attr_add(BPyGPUVertFormat *self, PyObject *ar
|
||||
return PyLong_FromLong(attr_id);
|
||||
}
|
||||
|
||||
static struct PyMethodDef bpygpu_VertFormat_methods[] = {
|
||||
static struct PyMethodDef py_VertFormat_methods[] = {
|
||||
{"attr_add",
|
||||
(PyCFunction)bpygpu_VertFormat_attr_add,
|
||||
(PyCFunction)py_VertFormat_attr_add,
|
||||
METH_VARARGS | METH_KEYWORDS,
|
||||
bpygpu_VertFormat_attr_add_doc},
|
||||
py_VertFormat_attr_add_doc},
|
||||
{NULL, NULL, 0, NULL},
|
||||
};
|
||||
|
||||
static void bpygpu_VertFormat_dealloc(BPyGPUVertFormat *self)
|
||||
static void py_VertFormat_dealloc(BPyGPUVertFormat *self)
|
||||
{
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(bpygpu_VertFormat_doc,
|
||||
PyDoc_STRVAR(py_VertFormat_doc,
|
||||
".. class:: GPUVertFormat()\n"
|
||||
"\n"
|
||||
" This object contains information about the structure of a vertex buffer.\n");
|
||||
PyTypeObject BPyGPUVertFormat_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUVertFormat",
|
||||
.tp_basicsize = sizeof(BPyGPUVertFormat),
|
||||
.tp_dealloc = (destructor)bpygpu_VertFormat_dealloc,
|
||||
.tp_dealloc = (destructor)py_VertFormat_dealloc,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_doc = bpygpu_VertFormat_doc,
|
||||
.tp_methods = bpygpu_VertFormat_methods,
|
||||
.tp_new = bpygpu_VertFormat_new,
|
||||
.tp_doc = py_VertFormat_doc,
|
||||
.tp_methods = py_VertFormat_methods,
|
||||
.tp_new = py_VertFormat_new,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
Reference in New Issue
Block a user