Mercurial > fife-parpg
annotate engine/swigwrappers/python/fife.i.templ @ 697:ecaa4d98f05f tip
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
* Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring.
* GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass.
* The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class.
* The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged.
* Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author | M. George Hansen <technopolitica@gmail.com> |
---|---|
date | Sat, 18 Jun 2011 00:28:40 -1000 |
parents | 883dbf45afc9 |
children |
rev | line source |
---|---|
691
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
1 %{ |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
2 /** |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
3 * This is a workaround for a minor swig bug when building on gcc 4.6.1 and above. |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
4 * Prior to gcc 4.6.1 the STL headers like vector, string, etc. used to |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
5 * automatically pull in the cstddef header but starting with gcc 4.6.1 they no |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
6 * longer do. This leads to swig generated a file that does not compile so we |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
7 * explicitly include cstddef so the swig generated file will compile. |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
8 */ |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
9 #include <cstddef> |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
10 %} |
883dbf45afc9
Fixed a bug that caused the generated SWIG interface file for fife to not compile when building with gcc 4.6.1 fixes[t:546]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
684
diff
changeset
|
11 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 %module(directors="1") fife |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 %include "std_string.i" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 %include "std_vector.i" |
112
98541d3b9220
* add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
15 %include "std_pair.i" |
98541d3b9220
* add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
16 %include "std_list.i" |
98541d3b9220
* add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
17 %include "std_map.i" |
98541d3b9220
* add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
18 %include "std_set.i" |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 %include "typemaps.i" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 %include "exception.i" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 /** |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 * Some materials to understand exception handling: |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 * Basics about python exceptions: |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 * http://docs.python.org/tut/node10.html |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 * Python exception handling in C APIs |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 * http://docs.python.org/api/exceptions.html |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 * http://docs.python.org/api/exceptionHandling.html |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 * SWIG exception handling |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 * http://www.swig.org/Doc1.3/Customization.html#exception |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 * http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_exception_specifications |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 * http://www.swig.org/Doc1.3/Python.html#Python_nn36 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 %feature("autodoc", "1"); // 0 == no param types, 1 == show param types |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 |
649
b9c132cb6ea4
* Fixed the non standard integer definitions in DeviceCaps
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
638
diff
changeset
|
38 %{ |
b9c132cb6ea4
* Fixed the non standard integer definitions in DeviceCaps
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
638
diff
changeset
|
39 #include "util/base/fife_stdint.h" |
b9c132cb6ea4
* Fixed the non standard integer definitions in DeviceCaps
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
638
diff
changeset
|
40 %} |
b9c132cb6ea4
* Fixed the non standard integer definitions in DeviceCaps
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
638
diff
changeset
|
41 |
632
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
42 /** |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
43 * Integer definitions (See swigs stdint.i implementation) |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
44 * |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
45 */ |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
46 |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
47 /* Signed. */ |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
48 typedef signed char int8_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
49 typedef short int int16_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
50 typedef int int32_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
51 #if defined(SWIGWORDSIZE64) |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
52 typedef long int int64_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
53 #else |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
54 typedef long long int int64_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
55 #endif |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
56 |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
57 /* Unsigned. */ |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
58 typedef unsigned char uint8_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
59 typedef unsigned short int uint16_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
60 typedef unsigned int uint32_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
61 #if defined(SWIGWORDSIZE64) |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
62 typedef unsigned long int uint64_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
63 #else |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
64 typedef unsigned long long int uint64_t; |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
65 #endif |
a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
167
diff
changeset
|
66 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
67 namespace std { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 %template(StringVector) vector<std::string>; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
69 %template(UintVector) vector<unsigned int>; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
70 %template(IntVector) vector<int>; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 %template(FloatVector) vector<float>; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 %template(DoubleVector) vector<double>; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 %template(BoolVector) vector<bool>; |
112
98541d3b9220
* add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
74 |
638
980c02db2f56
* Fixed a swig template that got missed in a previous commit
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
632
diff
changeset
|
75 %template(Uint16Uint16Pair) pair<uint16_t, uint16_t>; |
980c02db2f56
* Fixed a swig template that got missed in a previous commit
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
632
diff
changeset
|
76 %template(Uint16Uint16PairVector) vector<std::pair<uint16_t, uint16_t> >; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 }; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 %{ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 #include "util/base/exception.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 static void handleDirectorException() { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 PyObject* exception = NULL; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 PyObject* value = NULL; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 PyObject* traceback = NULL; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 PyErr_Fetch(&exception, &value, &traceback); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 PyErr_NormalizeException(&exception, &value, &traceback); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 if (exception) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 PySys_SetObject("last_type", exception); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 PySys_SetObject("last_value", value); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 PySys_SetObject("last_traceback", traceback); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 PyObject* d = PyModule_GetDict (PyImport_AddModule ("__main__")); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 PyDict_SetItemString(d, "exc_type", exception); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
94 PyDict_SetItemString(d, "exc_value", value); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
95 PyDict_SetItemString(d, "exc_traceback", traceback ? traceback : Py_None); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
97 char buf[1024]; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 sprintf (buf, "\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 import traceback\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 s = \"\"\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 for filename, line, function, text in traceback.extract_tb(exc_traceback):\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 s = s + ' File \"%%s\", line %%d, in %%s\\n %%s' %% (filename, line, function, text)\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 if s[-1] != '\\n': s = s + '\\n'\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 for l in traceback.format_exception_only(exc_type, exc_value):\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 s = s + ' ' + l\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
106 if s[-1] != '\\n': s = s + '\\n'\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 print s\n\ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 "); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 PyObject* e = PyRun_String(buf, Py_file_input, d, d); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 if (!e) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
111 PyErr_Print(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
112 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
113 Py_XDECREF(e); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
114 Py_XDECREF(d); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 Py_XDECREF(exception); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 Py_XDECREF(value); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 Py_XDECREF(traceback); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 #define _FIFE_EXC_HANDLER(_fife_exc_type, _converted_type) \ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 catch (FIFE::_fife_exc_type& _e) { \ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 PyErr_Clear(); \ |
684
4f36c890b1dd
* Merged the 0.3.3dev branche changes to the trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
649
diff
changeset
|
124 SWIG_exception(_converted_type, _e.what()); \ |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
125 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 #define _FIFE_DIRECTOR_EXC_HANDLER() \ |
167
10a5f9e6c03f
* Fixed a few thousand warnings made by swigwrapper in MSVC.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
112
diff
changeset
|
128 catch (Swig::DirectorException &) { \ |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 PyErr_Clear(); \ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 SWIG_exception(SWIG_RuntimeError, "Catched director exception"); \ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 %} |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
133 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
134 %feature("director:except") { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
135 if ($$error != NULL) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
136 handleDirectorException(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
137 throw Swig::DirectorMethodException(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
138 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
139 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
140 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
141 %exception { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
142 try { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
143 $$action |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
144 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
145 _FIFE_DIRECTOR_EXC_HANDLER() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
146 _FIFE_EXC_HANDLER(Exception, SWIG_RuntimeError) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
147 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
148 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
149 $inclusions |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
150 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
151 %include engine/swigwrappers/python/extensions.i.templ |