* Added 'extern' to PyTypeObject declarations in some headers.
This commit is contained in:
@@ -176,10 +176,10 @@ void BPY_Err_Handle(Text *text)
|
|||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
tb = PySys_GetObject("last_traceback");
|
tb = PySys_GetObject("last_traceback");
|
||||||
|
|
||||||
if (!tb) {
|
if (!tb) {
|
||||||
printf("\nCan't get traceback\n");
|
printf("\nCan't get traceback\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(tb);
|
Py_INCREF(tb);
|
||||||
|
|
||||||
@@ -193,9 +193,9 @@ void BPY_Err_Handle(Text *text)
|
|||||||
v = PyObject_GetAttrString(tb, "tb_next");
|
v = PyObject_GetAttrString(tb, "tb_next");
|
||||||
|
|
||||||
if (v == Py_None || strcmp(PyString_AsString(traceback_getFilename(v)),
|
if (v == Py_None || strcmp(PyString_AsString(traceback_getFilename(v)),
|
||||||
GetName(text))) {
|
GetName(text))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_DECREF(tb);
|
Py_DECREF(tb);
|
||||||
tb = v;
|
tb = v;
|
||||||
@@ -210,7 +210,7 @@ void BPY_Err_Handle(Text *text)
|
|||||||
Py_DECREF(tb);
|
Py_DECREF(tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -293,7 +293,7 @@ void BPY_free_compiled_text(struct Text* text)
|
|||||||
Py_DECREF((PyObject*) text->compiled);
|
Py_DECREF((PyObject*) text->compiled);
|
||||||
text->compiled = NULL;
|
text->compiled = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -317,7 +317,7 @@ void BPY_clear_bad_scriptlinks(struct Text *byebye)
|
|||||||
|
|
||||||
allqueue(REDRAWBUTSSCRIPT, 0);
|
allqueue(REDRAWBUTSSCRIPT, 0);
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -338,7 +338,7 @@ void BPY_do_all_scripts(short event)
|
|||||||
|
|
||||||
BPY_do_pyscript (&(G.scene->id), event);
|
BPY_do_pyscript (&(G.scene->id), event);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -373,7 +373,7 @@ void BPY_do_pyscript(struct ID *id, short event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -389,7 +389,7 @@ void BPY_free_scriptlink(struct ScriptLink *slink)
|
|||||||
if(slink->scripts) MEM_freeN(slink->scripts);
|
if(slink->scripts) MEM_freeN(slink->scripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -415,7 +415,7 @@ void BPY_copy_scriptlink(struct ScriptLink *scriptlink)
|
|||||||
memcpy(scriptlink->flag, tmp, sizeof(short)*scriptlink->totscript);
|
memcpy(scriptlink->flag, tmp, sizeof(short)*scriptlink->totscript);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -448,36 +448,36 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
|
|||||||
|
|
||||||
if (!text->compiled) { /* if it wasn't already compiled, do it now */
|
if (!text->compiled) { /* if it wasn't already compiled, do it now */
|
||||||
|
|
||||||
#ifdef BLENDER_SANDBOX_MODE
|
/*#ifdef BLENDER_SANDBOX_MODE
|
||||||
|
|
||||||
/* IGNORE THIS ALL FOR A WHILE, IT'S VERY INCOMPLETE AND WILL CHANGE
|
// IGNORE THIS ALL FOR A WHILE, IT'S VERY INCOMPLETE AND WILL CHANGE
|
||||||
* CONSIDERABLY IN THE NEXT COMMIT. THE ifdef won't stay, either. */
|
// CONSIDERABLY IN THE NEXT COMMIT. THE ifdef won't stay, either.
|
||||||
|
|
||||||
/* The import statement is a security risk, so we don't allow it in
|
// The import statement is a security risk, so we don't allow it in
|
||||||
* SANDBOX MODE. Instead, we import all needed modules ourselves and
|
// SANDBOX MODE. Instead, we import all needed modules ourselves and
|
||||||
* substitute all 'import' and '__import__' statements in the code by
|
// substitute all 'import' and '__import__' statements in the code by
|
||||||
* '#mport' and '#_import__', resp., making their lines become comments
|
// '#mport' and '#_import__', resp., making their lines become comments
|
||||||
* in Python (to let scripts run without import errors). */
|
// in Python (to let scripts run without import errors).
|
||||||
|
|
||||||
/* Disable importing only for the safest sandbox mode */
|
// Disable importing only for the safest sandbox mode
|
||||||
|
|
||||||
txt_move_bof(text, 0); /* move to the beginning of the script */
|
txt_move_bof(text, 0); // move to the beginning of the script
|
||||||
|
|
||||||
/* Search all occurrences of 'import' in the script */
|
// Search all occurrences of 'import' in the script
|
||||||
/* XXX Also check for from ... import ... */
|
// XXX Also check for from ... import ...
|
||||||
while (txt_find_string (text, "import")) {
|
while (txt_find_string (text, "import")) {
|
||||||
char *line = text->sell->line;
|
char *line = text->sell->line;
|
||||||
|
|
||||||
if (text->curc > 1) /* is it '__import__' ? */
|
if (text->curc > 1) // is it '__import__' ?
|
||||||
if (strncmp (&line[text->curc - 2],
|
if (strncmp (&line[text->curc - 2],
|
||||||
"__import__", 10) == 0) text->curc -= 2;
|
"__import__", 10) == 0) text->curc -= 2;
|
||||||
|
|
||||||
line[text->curc] = '#'; /* change them to '#mport' or '#_import__' */
|
line[text->curc] = '#'; // change them to '#mport' or '#_import__'
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif */
|
||||||
|
|
||||||
buf = txt_to_buf(text);
|
buf = txt_to_buf(text);
|
||||||
|
|
||||||
text->compiled = Py_CompileString(buf, GetName(text), Py_file_input);
|
text->compiled = Py_CompileString(buf, GetName(text), Py_file_input);
|
||||||
|
|
||||||
@@ -485,15 +485,16 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
|
|||||||
|
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
BPY_free_compiled_text(text);
|
BPY_free_compiled_text(text);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef BLENDER_SANDBOX_MODE
|
|
||||||
//save the script as a dict entry and call the eval code for it
|
/*#ifdef BLENDER_SANDBOX_MODE
|
||||||
//then return
|
//save the script as a dict entry and call the eval code for it
|
||||||
PyDict_SetItemString(globaldict, "_SB_code", text->compiled);
|
//then return
|
||||||
#endif
|
PyDict_SetItemString(globaldict, "_SB_code", text->compiled);
|
||||||
|
#endif */
|
||||||
|
|
||||||
return PyEval_EvalCode(text->compiled, globaldict, globaldict);
|
return PyEval_EvalCode(text->compiled, globaldict, globaldict);
|
||||||
}
|
}
|
||||||
@@ -528,7 +529,7 @@ void ReleaseGlobalDictionary (PyObject * dict)
|
|||||||
PyDict_Clear (dict);
|
PyDict_Clear (dict);
|
||||||
Py_DECREF (dict); /* Release dictionary. */
|
Py_DECREF (dict); /* Release dictionary. */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -547,6 +548,5 @@ void DoAllScriptsFromList (ListBase *list, short event)
|
|||||||
id = id->next;
|
id = id->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#include "gen_utils.h"
|
#include "gen_utils.h"
|
||||||
|
|
||||||
/* The Camera PyType Object defined in Camera.c */
|
/* The Camera PyType Object defined in Camera.c */
|
||||||
PyTypeObject Camera_Type;
|
extern PyTypeObject Camera_Type;
|
||||||
|
|
||||||
#define BPy_Camera_Check(v) \
|
#define BPy_Camera_Check(v) \
|
||||||
((v)->ob_type == &Camera_Type) /* for type checking */
|
((v)->ob_type == &Camera_Type) /* for type checking */
|
||||||
|
@@ -115,16 +115,15 @@ static void exit_pydraw(SpaceText *st)
|
|||||||
static void exec_callback(SpaceText *st, PyObject *callback, PyObject *args)
|
static void exec_callback(SpaceText *st, PyObject *callback, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *result = PyObject_CallObject (callback, args);
|
PyObject *result = PyObject_CallObject (callback, args);
|
||||||
printf ("In exec_callback\n");
|
|
||||||
if (result==NULL) {
|
if (result == NULL) {
|
||||||
printf("In exec_callback, result == NULL\n");
|
st->text->compiled = NULL;
|
||||||
st->text->compiled= NULL;
|
PyErr_Print ();
|
||||||
PyErr_Print();
|
exit_pydraw (st);
|
||||||
exit_pydraw(st);
|
|
||||||
}
|
}
|
||||||
printf ("In exec_callback 2\n");
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF (result);
|
||||||
Py_DECREF(args);
|
Py_DECREF (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BPY_spacetext_do_pywin_draw, the static spacetext_do_pywin_buttons and
|
/* BPY_spacetext_do_pywin_draw, the static spacetext_do_pywin_buttons and
|
||||||
@@ -165,7 +164,7 @@ static void spacetext_do_pywin_buttons(SpaceText *st, unsigned short event)
|
|||||||
|
|
||||||
void BPY_spacetext_do_pywin_event(SpaceText *st, unsigned short event, short val)
|
void BPY_spacetext_do_pywin_event(SpaceText *st, unsigned short event, short val)
|
||||||
{
|
{
|
||||||
if (event==QKEY && G.qual & (LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
|
if (event == QKEY && G.qual & (LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
|
||||||
exit_pydraw(st);
|
exit_pydraw(st);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ typedef struct {
|
|||||||
|
|
||||||
} C_Image;
|
} C_Image;
|
||||||
|
|
||||||
PyTypeObject Image_Type; /* The Image PyType Object */
|
extern PyTypeObject Image_Type; /* The Image PyType Object */
|
||||||
|
|
||||||
#define C_Image_Check(v) ((v)->ob_type == &Image_Type) /* for type checking */
|
#define C_Image_Check(v) ((v)->ob_type == &Image_Type) /* for type checking */
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ typedef struct {
|
|||||||
|
|
||||||
} C_Material;
|
} C_Material;
|
||||||
|
|
||||||
PyTypeObject Material_Type; /* The Material PyType Object */
|
extern PyTypeObject Material_Type; /* The Material PyType Object */
|
||||||
|
|
||||||
#define C_Material_Check(v) \
|
#define C_Material_Check(v) \
|
||||||
((v)->ob_type == &Material_Type) /* for type checking */
|
((v)->ob_type == &Material_Type) /* for type checking */
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
/* The Object PyType Object defined in Object.c */
|
/* The Object PyType Object defined in Object.c */
|
||||||
PyTypeObject Object_Type;
|
extern PyTypeObject Object_Type;
|
||||||
|
|
||||||
#define C_Object_Check(v) \
|
#define C_Object_Check(v) \
|
||||||
((v)->ob_type == &Object_Type) /* for type checking */
|
((v)->ob_type == &Object_Type) /* for type checking */
|
||||||
|
Reference in New Issue
Block a user