converted my gen_utils.h fix to PyObjectPlus.h

Also added a fix for PyMarshal_WriteObjectToString

Now I just need to figure out linking of the gameengine on my imac.

Kent
This commit is contained in:
Kent Mein 2008-09-06 14:13:31 +00:00
parent 810f799660
commit 115cf18bed
25 changed files with 50 additions and 24 deletions

@ -45,6 +45,7 @@
Py_RETURN_NONE
Python 2.4 macro.
defined here until we switch to 2.4
also in PyObjectPlus.h for gameengine
*/
#ifndef Py_RETURN_NONE
#define Py_RETURN_NONE return Py_BuildValue("O", Py_None)

@ -50,7 +50,7 @@
#include "MT_Matrix4x4.h"
#include "BKE_utildefines.h"
#include "FloatValue.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -49,8 +49,7 @@
#include "BLI_arithb.h"
#include "MT_Matrix4x4.h"
#include "BKE_utildefines.h"
#include "gen_utils.h" /* python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -39,7 +39,6 @@ CPPFLAGS += -I$(OPENGL_HEADERS)
CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
CPPFLAGS += -I../../blender/python/api2_2x
CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO) -I$(NAN_MOTO)/include
CPPFLAGS += -I$(NAN_SOLID)/include
CPPFLAGS += -I$(NAN_BULLET2)/include

@ -36,7 +36,6 @@ include nan_compile.mk
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
CPPFLAGS += -I../../blender/python/api2_2x
CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I$(NAN_STRING)/include

@ -50,7 +50,6 @@
#include "stdlib.h"
#include "PyObjectPlus.h"
#include "STR_String.h"
#include "gen_utils.h"
/*------------------------------
* PyObjectPlus Type -- Every class, even the abstract one should have a Type
------------------------------*/

@ -43,6 +43,33 @@
* Python defines
------------------------------*/
/*
Py_RETURN_NONE
Python 2.4 macro.
defined here until we switch to 2.4
also in api2_2x/gen_utils.h
*/
#ifndef Py_RETURN_NONE
#define Py_RETURN_NONE return Py_BuildValue("O", Py_None)
#endif
#ifndef Py_RETURN_FALSE
#define Py_RETURN_FALSE return PyBool_FromLong(0)
#endif
#ifndef Py_RETURN_TRUE
#define Py_RETURN_TRUE return PyBool_FromLong(1)
#endif
/* for pre Py 2.5 */
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#else
/* Py 2.5 and later */
#define intargfunc ssizeargfunc
#define intintargfunc ssizessizeargfunc
#endif
// some basic python macros
#define Py_Return { Py_INCREF(Py_None); return Py_None;}

@ -44,7 +44,6 @@ CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
CPPFLAGS += -I../../blender/python/api2_2x
CPPFLAGS += $(NAN_SDLCFLAGS)
CPPFLAGS += -I../../kernel/gen_system

@ -27,7 +27,7 @@
*/
#include "SCA_ILogicBrick.h"
#include "gen_utils.h" /* python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -30,9 +30,10 @@
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
#include "PyObjectPlus.h"
#include <iostream>
#include "gen_utils.h" /* python stuff */
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -33,11 +33,11 @@
#include "SCA_LogicManager.h"
#include "SCA_ISensor.h"
#include "SCA_IActuator.h"
#include "PyObjectPlus.h"
#include "compile.h"
#include "eval.h"
#include <algorithm>
#include "gen_utils.h" /* python stuff */
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -717,7 +717,11 @@ void GPG_Application::stopEngine()
if (gameLogic) {
PyObject* pyGlobalDict = PyDict_GetItemString(PyModule_GetDict(gameLogic), "globalDict"); // Same as importing the module
if (pyGlobalDict) {
#ifdef Py_MARSHAL_VERSION
PyObject* pyGlobalDictMarshal = PyMarshal_WriteObjectToString( pyGlobalDict, 2); // Py_MARSHAL_VERSION == 2 as of Py2.5
#else
PyObject* pyGlobalDictMarshal = PyMarshal_WriteObjectToString( pyGlobalDict );
#endif
if (pyGlobalDictMarshal) {
m_pyGlobalDictString_Length = PyString_Size(pyGlobalDictMarshal);
PyObject_Print(pyGlobalDictMarshal, stderr, 0);

@ -15,8 +15,6 @@
#include "RAS_MeshObject.h"
#include "RAS_IRasterizer.h"
#include "gen_utils.h" /* python stuff */
#define spit(x) std::cout << x << std::endl;
#define SORT_UNIFORMS 1

@ -35,7 +35,7 @@
#include <math.h>
#include "KX_GameObject.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
STR_String KX_CameraActuator::X_AXIS_STRING = "x";
STR_String KX_CameraActuator::Y_AXIS_STRING = "y";

@ -27,7 +27,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
#include <Python.h>
#include "gen_utils.h"
#include "PyObjectPlus.h"
#include "KX_ConstraintWrapper.h"
#include "PHY_IPhysicsEnvironment.h"

@ -65,7 +65,7 @@ typedef unsigned long uint_ptr;
#include "SCA_IActuator.h"
#include "SCA_ISensor.h"
#include "gen_utils.h" /* python stuff */
#include "PyObjectPlus.h" /* python stuff */
// This file defines relationships between parents and children
// in the game engine.

@ -43,7 +43,7 @@
#include "KX_PyMath.h"
#include "KX_ConvertPhysicsObject.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
PyTypeObject KX_MeshProxy::Type = {
PyObject_HEAD_INIT(&PyType_Type)

@ -36,7 +36,7 @@
#include "KX_GameObject.h"
#include "KX_PythonInit.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -27,7 +27,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
#include <Python.h>
#include "gen_utils.h"
#include "PyObjectPlus.h"
#include "KX_PhysicsObjectWrapper.h"
#include "PHY_IPhysicsEnvironment.h"

@ -34,7 +34,7 @@
#include "PHY_IPhysicsController.h"
#include "PHY_IVehicle.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -68,7 +68,7 @@
#include "KX_PyMath.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
extern "C" {
#include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.

@ -39,7 +39,7 @@
#include "KX_GameObject.h"
#include "KX_IPhysicsController.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -37,7 +37,7 @@
#include "KX_SCA_ReplaceMeshActuator.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -42,7 +42,7 @@
#include <iostream>
#include "KX_GameObject.h"
#include "gen_utils.h" /* Python stuff */
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>

@ -1,7 +1,7 @@
#include <Python.h>
#include "gen_utils.h"
#include "PyObjectPlus.h"
#include "KX_VehicleWrapper.h"
#include "PHY_IPhysicsEnvironment.h"