[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src python_class.h,1.7,1.8 python_cla
From: |
Alexandre Courbot <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src python_class.h,1.7,1.8 python_class.cc,1.6,1.7 main.cc,1.40,1.41 |
Date: |
Sun, 07 Apr 2002 07:56:34 -0400 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv14969/src
Modified Files:
python_class.h python_class.cc main.cc
Log Message:
FIXED python class bug that prevented -c option to perform correctly.
Index: python_class.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/python_class.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** python_class.h 7 Apr 2002 09:51:28 -0000 1.7
--- python_class.h 7 Apr 2002 11:56:29 -0000 1.8
***************
*** 50,54 ****
* @return true in case of success, false otherwise.
*/
! static bool init ();
/**
--- 50,54 ----
* @return true in case of success, false otherwise.
*/
! static void init ();
/**
***************
*** 126,129 ****
--- 126,130 ----
static void put_tuple (PyObject * tuple, ogzstream & file);
+ static PyObject *module;
private:
/**
***************
*** 132,137 ****
*/
static char *python::ptr_to_string (char *c, void *ptr, int sz);
-
- static PyObject *module;
};
--- 133,136 ----
Index: python_class.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/python_class.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** python_class.cc 7 Apr 2002 09:51:28 -0000 1.6
--- python_class.cc 7 Apr 2002 11:56:29 -0000 1.7
***************
*** 33,83 ****
/*
- * SWIG init prototypes. Should we use dynamic linking???
- */
- extern "C"
- {
- /**
- * SWIG init prototype.
- *
- */
- void initadonthellc (void);
- }
-
- /*
* Start Python
*/
! bool python::init ()
{
Py_Initialize ();
-
- // Initialise the import path.
- // Shared modules path
- insert_path (DATA_DIR"/modules");
-
- // Game specific path
- string t = game::game_data_dir () + "/scripts/modules";
- insert_path ((char *) t.c_str ());
- t = game::game_data_dir () + "/scripts";
- insert_path ((char *) t.c_str ());
-
- // Initialise SWIG module. This should go if we ever switch
- // to dynamic linking
- initadonthellc ();
-
- module = import_module ("adonthell");
- if (!module) return false;
-
- data::globals = PyModule_GetDict (module);
-
- return true;
}
void python::cleanup ()
! {
! // Cleanup the global namespace of python interpreter
! // Note that we don't have to DECREF data::globals, because they're a
! // borrowed reference of py_module.
! Py_DECREF (module);
!
Py_Finalize ();
}
--- 33,45 ----
/*
* Start Python
*/
! void python::init ()
{
Py_Initialize ();
}
void python::cleanup ()
! {
Py_Finalize ();
}
Index: main.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/main.cc,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** main.cc 7 Apr 2002 09:51:28 -0000 1.40
--- main.cc 7 Apr 2002 11:56:29 -0000 1.41
***************
*** 39,42 ****
--- 39,78 ----
using namespace std;
+ /*
+ * SWIG init prototypes. Should we use dynamic linking???
+ */
+ extern "C"
+ {
+ /**
+ * SWIG init prototype.
+ *
+ */
+ void initadonthellc (void);
+ }
+
+ bool init_python()
+ {
+ // Initialise the import path.
+ // Shared modules path
+ python::insert_path (DATA_DIR"/modules");
+
+ // Game specific path
+ string t = game::game_data_dir () + "/scripts/modules";
+ python::insert_path ((char *) t.c_str ());
+ t = game::game_data_dir () + "/scripts";
+ python::insert_path ((char *) t.c_str ());
+
+ // Initialise SWIG module. This should go if we ever switch
+ // to dynamic linking
+ initadonthellc ();
+
+ python::module = python::import_module ("adonthell");
+ if (!python::module) return false;
+
+ data::globals = PyModule_GetDict (python::module);
+
+ return true;
+ }
+
/**
* Game's main function.
***************
*** 51,55 ****
*
*/
-
int main(int argc, char * argv[])
{
--- 87,90 ----
***************
*** 87,90 ****
--- 122,126 ----
python::init ();
+ init_python();
// init the game data
data::engine = new adonthell;
***************
*** 116,119 ****
--- 152,159 ----
// shutdown python
+ // Cleanup the global namespace of python interpreter
+ // Note that we don't have to DECREF data::globals, because they're a
+ // borrowed reference of py_module.
+ Py_DECREF (python::module);
python::cleanup ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src python_class.h,1.7,1.8 python_class.cc,1.6,1.7 main.cc,1.40,1.41,
Alexandre Courbot <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit callbacks.cc,1.31,NONE callbacks.h,1.14,NONE circle.cc,1.17,NONE circle.h,1.7,NONE crcle_callbacks.cc,1.9,NONE crcle_callbacks.h,1.5,NONE crcle_interface.cc,1.19,NONE crcle_interface.h,1.4,NONE dbg_callbacks.cc,1.6,NONE dbg_callbacks.h,1.5,NONE dbg_interface.cc,1.6,NONE dbg_interface.h,1.3,NONE debug.cc,1.18,NONE debug.h,1.6,NONE dlgcompile.cc,1.38,NONE dlgcompile.h,1.10,NONE dlgnode.cc,1.12,NONE dlgnode.h,1.16,NONE events.cc,1.14,NONE events.h,1.4,NONE function.cc,1.9,NONE function.h,1.11,NONE geometrie.cc,1.4,NONE geometrie.h,1.4,NONE graph.cc,1.62,NONE graph.h,1.11,NONE interface.cc,1.28,NONE interface.h,1.5,NONE main.h,1.26,NONE preset.cc,1.7,NONE preset.h,1.5,NONE ps_callbacks.cc,1.6,NONE ps_callbacks.h,1.1,NONE ps_dlg.cc,1.10,NONE ps_dlg.h,1.4,NONE ps_interface.cc,1.13,NONE ps_interface.h,1.3,NONE pset_callbacks.cc,1.2,NONE pset_callbacks.h,1.1,NONE pset_interface.cc,1.5,NONE pset_interface.h,1.1,NONE run.cc,1.37,NONE run.h,1.12,NONE run_callbacks.cc,1.11,NONE run_callbacks.h,1.5,NONE run_interface.cc,1.8,NONE run_interface.h,1.3,NONE
- Next by Date:
[Adonthell-commits] CVS: adonthell/po Makefile.in.in,1.2,1.3
- Previous by thread:
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit callbacks.cc,1.31,NONE callbacks.h,1.14,NONE circle.cc,1.17,NONE circle.h,1.7,NONE crcle_callbacks.cc,1.9,NONE crcle_callbacks.h,1.5,NONE crcle_interface.cc,1.19,NONE crcle_interface.h,1.4,NONE dbg_callbacks.cc,1.6,NONE dbg_callbacks.h,1.5,NONE dbg_interface.cc,1.6,NONE dbg_interface.h,1.3,NONE debug.cc,1.18,NONE debug.h,1.6,NONE dlgcompile.cc,1.38,NONE dlgcompile.h,1.10,NONE dlgnode.cc,1.12,NONE dlgnode.h,1.16,NONE events.cc,1.14,NONE events.h,1.4,NONE function.cc,1.9,NONE function.h,1.11,NONE geometrie.cc,1.4,NONE geometrie.h,1.4,NONE graph.cc,1.62,NONE graph.h,1.11,NONE interface.cc,1.28,NONE interface.h,1.5,NONE main.h,1.26,NONE preset.cc,1.7,NONE preset.h,1.5,NONE ps_callbacks.cc,1.6,NONE ps_callbacks.h,1.1,NONE ps_dlg.cc,1.10,NONE ps_dlg.h,1.4,NONE ps_interface.cc,1.13,NONE ps_interface.h,1.3,NONE pset_callbacks.cc,1.2,NONE pset_callbacks.h,1.1,NONE pset_interface.cc,1.5,NONE pset_interface.h,1.1,NONE run.cc,1.37,NONE run.h,1.12,NONE run_callbacks.cc,1.11,NONE run_callbacks.h,1.5,NONE run_interface.cc,1.8,NONE run_interface.h,1.3,NONE
- Next by thread:
[Adonthell-commits] CVS: adonthell/po Makefile.in.in,1.2,1.3
- Index(es):