formatting edits only to use more consisted style

This commit is contained in:
2011-12-26 12:26:11 +00:00
parent f48fb385ea
commit e17fd46c71
18 changed files with 1841 additions and 1824 deletions

View File

@@ -59,7 +59,7 @@ extern char build_system[];
static PyTypeObject BlenderAppType;
static PyStructSequence_Field app_info_fields[]= {
static PyStructSequence_Field app_info_fields[] = {
{(char *)"version", (char *)"The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{(char *)"version_string", (char *)"The Blender version formatted as a string"},
{(char *)"version_char", (char *)"The Blender version character (for minor releases)"},
@@ -83,11 +83,11 @@ static PyStructSequence_Field app_info_fields[]= {
{NULL}
};
static PyStructSequence_Desc app_info_desc= {
static PyStructSequence_Desc app_info_desc = {
(char *)"bpy.app", /* name */
(char *)"This module contains application values that remain unchanged during runtime.", /* doc */
app_info_fields, /* fields */
(sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1
(sizeof(app_info_fields) / sizeof(PyStructSequence_Field)) - 1
};
#define DO_EXPAND(VAL) VAL ## 1
@@ -96,9 +96,9 @@ static PyStructSequence_Desc app_info_desc= {
static PyObject *make_app_info(void)
{
PyObject *app_info;
int pos= 0;
int pos = 0;
app_info= PyStructSequence_New(&BlenderAppType);
app_info = PyStructSequence_New(&BlenderAppType);
if (app_info == NULL) {
return NULL;
}
@@ -110,8 +110,11 @@ static PyObject *make_app_info(void)
#define SetObjItem(obj) \
PyStructSequence_SET_ITEM(app_info, pos++, obj)
SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
SetObjItem(Py_BuildValue("(iii)",
BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)",
BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
#if defined(BLENDER_VERSION_CHAR) && EXPAND(BLENDER_VERSION_CHAR) != 1
SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR));
#else
@@ -170,7 +173,7 @@ static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)
static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
int param= PyObject_IsTrue(value);
int param = PyObject_IsTrue(value);
if (param < 0) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
@@ -193,14 +196,14 @@ static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(cl
static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
int param= PyLong_AsSsize_t(value);
int param = PyLong_AsSsize_t(value);
if (param == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
return -1;
}
G.rt= param;
G.rt = param;
return 0;
}
@@ -229,7 +232,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl
}
static PyGetSetDef bpy_app_getsets[]= {
static PyGetSetDef bpy_app_getsets[] = {
{(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, NULL},
{(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL},
{(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)bpy_app_tempdir_doc, NULL},
@@ -242,7 +245,7 @@ static void py_struct_seq_getset_init(void)
/* tricky dynamic members, not to py-spec! */
PyGetSetDef *getset;
for (getset= bpy_app_getsets; getset->name; getset++) {
for (getset = bpy_app_getsets; getset->name; getset++) {
PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, PyDescr_NewGetSet(&BlenderAppType, getset));
}
}
@@ -255,12 +258,12 @@ PyObject *BPY_app_struct(void)
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
ret= make_app_info();
ret = make_app_info();
/* prevent user from creating new instances */
BlenderAppType.tp_init= NULL;
BlenderAppType.tp_new= NULL;
BlenderAppType.tp_hash= (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
BlenderAppType.tp_init = NULL;
BlenderAppType.tp_new = NULL;
BlenderAppType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
/* kindof a hack ontop of PyStructSequence */
py_struct_seq_getset_init();