rename and negate DISABLE_PYTHON --> WITH_PYTHON
[blender.git] / source / gameengine / Expressions / Value.h
index 29ef19b46c972019fceefc19d6ae8dd745b2c289..e6ea431ec1c4bada2eb09e345658fe6c021a2f88 100644 (file)
@@ -13,7 +13,7 @@
  *
  */
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(FREE_WINDOWS)
 #pragma warning (disable:4786)
 #endif //WIN32
 
 #include <map>         // array functionality for the propertylist
 #include "STR_String.h"        // STR_String class
 
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
 #ifndef GEN_NO_ASSERT
 #undef  assert
 #define        assert(exp)                     ((void)NULL)
@@ -173,6 +177,13 @@ public:
        virtual ~CAction(){
        };
        virtual void Execute() const =0;
+       
+       
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CAction"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
 };
 
 //
@@ -186,19 +197,14 @@ public:
 
 
 
-#ifndef NO_EXP_PYTHON_EMBEDDING
 #include "PyObjectPlus.h"
+#ifdef WITH_PYTHON
 #include "object.h"
+#endif
 class CValue  : public PyObjectPlus
-#else
-class CValue  
-#endif //NO_EXP_PYTHON_EMBEDDING
-
 
 {
-#ifndef NO_EXP_PYTHON_EMBEDDING
 Py_Header;
-#endif //NO_EXP_PYTHON_EMBEDDING
 public:
        enum AllocationTYPE {
                STACKVALUE              = 0,
@@ -213,38 +219,25 @@ public:
 
 
        // Construction / Destruction
-#ifndef NO_EXP_PYTHON_EMBEDDING
+       CValue();
 
-       CValue(PyTypeObject *T = &Type);
+#ifdef WITH_PYTHON
        //static PyObject*      PyMake(PyObject*,PyObject*);
        virtual PyObject *py_repr(void)
        {
-               return PyString_FromString((const char*)GetText());
+               return PyUnicode_FromString((const char*)GetText());
        }
 
-
-
-       virtual PyObject*                       py_getattro(PyObject *attr);
-       virtual PyObject*                       py_getattro_dict();
        virtual PyObject*       ConvertValueToPython() {
                return NULL;
        }
 
        virtual CValue* ConvertPythonToValue(PyObject* pyobj, const char *error_prefix);
-
-
-       virtual int                             py_delattro(PyObject *attr);
-       virtual int                             py_setattro(PyObject *attr, PyObject* value);
        
        static PyObject * pyattr_get_name(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
        
        virtual PyObject* ConvertKeysToPython( void );
-       
-       KX_PYMETHOD_NOARGS(CValue,GetName);
-
-#else
-       CValue();
-#endif //NO_EXP_PYTHON_EMBEDDING
+#endif // WITH_PYTHON
 
        
        
@@ -415,13 +408,8 @@ public:                                                                                                                                                                                                    \
 class CPropValue : public CValue
 {
 public:
-
-#ifndef NO_EXP_PYTHON_EMBEDDING        
-       CPropValue(PyTypeObject* T=&Type) :
-         CValue(T),
-#else
        CPropValue() :
-#endif //NO_EXP_PYTHON_EMBEDDING
+         CValue(),
                m_strNewName()
 
        {
@@ -444,6 +432,13 @@ public:
        
 protected:
        STR_String                                      m_strNewName;                               // Identification
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CPropValue"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
 };
 
 #endif // !defined _VALUEBASECLASS_H