* Added 'extern' to PyTypeObject declarations in some headers.

This commit is contained in:
2003-06-09 20:07:43 +00:00
parent c7c5fd1451
commit 84bd226fa3
6 changed files with 56 additions and 57 deletions

View File

@@ -448,34 +448,34 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
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
* CONSIDERABLY IN THE NEXT COMMIT. THE ifdef won't stay, either. */
// IGNORE THIS ALL FOR A WHILE, IT'S VERY INCOMPLETE AND WILL CHANGE
// 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
* SANDBOX MODE. Instead, we import all needed modules ourselves and
* substitute all 'import' and '__import__' statements in the code by
* '#mport' and '#_import__', resp., making their lines become comments
* in Python (to let scripts run without import errors). */
// The import statement is a security risk, so we don't allow it in
// SANDBOX MODE. Instead, we import all needed modules ourselves and
// substitute all 'import' and '__import__' statements in the code by
// '#mport' and '#_import__', resp., making their lines become comments
// 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 */
/* XXX Also check for from ... import ... */
// Search all occurrences of 'import' in the script
// XXX Also check for from ... import ...
while (txt_find_string (text, "import")) {
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],
"__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);
@@ -489,11 +489,12 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
}
}
#ifdef BLENDER_SANDBOX_MODE
/*#ifdef BLENDER_SANDBOX_MODE
//save the script as a dict entry and call the eval code for it
//then return
PyDict_SetItemString(globaldict, "_SB_code", text->compiled);
#endif
#endif */
return PyEval_EvalCode(text->compiled, globaldict, globaldict);
}
@@ -549,4 +550,3 @@ void DoAllScriptsFromList (ListBase *list, short event)
return;
}

View File

@@ -40,7 +40,7 @@
#include "gen_utils.h"
/* The Camera PyType Object defined in Camera.c */
PyTypeObject Camera_Type;
extern PyTypeObject Camera_Type;
#define BPy_Camera_Check(v) \
((v)->ob_type == &Camera_Type) /* for type checking */

View File

@@ -115,16 +115,15 @@ static void exit_pydraw(SpaceText *st)
static void exec_callback(SpaceText *st, PyObject *callback, PyObject *args)
{
PyObject *result = PyObject_CallObject (callback, args);
printf ("In exec_callback\n");
if (result==NULL) {
printf("In exec_callback, result == NULL\n");
st->text->compiled= NULL;
PyErr_Print();
exit_pydraw(st);
if (result == NULL) {
st->text->compiled = NULL;
PyErr_Print ();
exit_pydraw (st);
}
printf ("In exec_callback 2\n");
Py_XDECREF(result);
Py_DECREF(args);
Py_XDECREF (result);
Py_DECREF (args);
}
/* 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)
{
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);
return;
}

View File

@@ -45,7 +45,7 @@ typedef struct {
} 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 */

View File

@@ -48,7 +48,7 @@ typedef struct {
} C_Material;
PyTypeObject Material_Type; /* The Material PyType Object */
extern PyTypeObject Material_Type; /* The Material PyType Object */
#define C_Material_Check(v) \
((v)->ob_type == &Material_Type) /* for type checking */

View File

@@ -57,7 +57,7 @@
#include "modules.h"
/* The Object PyType Object defined in Object.c */
PyTypeObject Object_Type;
extern PyTypeObject Object_Type;
#define C_Object_Check(v) \
((v)->ob_type == &Object_Type) /* for type checking */