Commit ccbcc4a0 authored by Guilhem Saurel's avatar Guilhem Saurel

[Python2] fix compilation

parent dab6fee6
......@@ -25,7 +25,13 @@ namespace debug {
std::map<std::string, ofstreamShrPtr> mapOfFiles_;
PyObject* addLoggerFileOutputStream(PyObject* m, PyObject* args) {
PyObject* addLoggerFileOutputStream(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename)) return NULL;
std::string sfilename(filename);
......@@ -42,7 +48,13 @@ PyObject* addLoggerFileOutputStream(PyObject* m, PyObject* args) {
return Py_BuildValue("");
}
PyObject* closeLoggerFileOutputStream(PyObject* m, PyObject* /*args */) {
PyObject* closeLoggerFileOutputStream(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject*
#else
PyObject*, PyObject*
#endif
) {
try {
for (std::map<std::string, ofstreamShrPtr>::iterator it = mapOfFiles_.begin(); it != mapOfFiles_.end(); ++it) {
it->second->close();
......@@ -52,7 +64,13 @@ PyObject* closeLoggerFileOutputStream(PyObject* m, PyObject* /*args */) {
return Py_BuildValue("");
}
PyObject* addLoggerCoutOutputStream(PyObject* m, PyObject* /*args*/) {
PyObject* addLoggerCoutOutputStream(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject*
#else
PyObject*, PyObject*
#endif
) {
try {
dgADD_OSTREAM_TO_RTLOG(std::cout);
}
......@@ -60,7 +78,13 @@ PyObject* addLoggerCoutOutputStream(PyObject* m, PyObject* /*args*/) {
return Py_BuildValue("");
}
PyObject* realTimeLoggerDestroy(PyObject* m, PyObject* /*args*/) {
PyObject* realTimeLoggerDestroy(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject*
#else
PyObject*, PyObject*
#endif
) {
try {
RealTimeLogger::destroy();
}
......@@ -68,7 +92,13 @@ PyObject* realTimeLoggerDestroy(PyObject* m, PyObject* /*args*/) {
return Py_BuildValue("");
}
PyObject* realTimeLoggerSpinOnce(PyObject* m, PyObject* /*args*/) {
PyObject* realTimeLoggerSpinOnce(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject*
#else
PyObject*, PyObject*
#endif
) {
try {
RealTimeLogger::instance().spinOnce();
}
......@@ -76,7 +106,13 @@ PyObject* realTimeLoggerSpinOnce(PyObject* m, PyObject* /*args*/) {
return Py_BuildValue("");
}
PyObject* realTimeLoggerInstance(PyObject* m, PyObject* /*args*/) {
PyObject* realTimeLoggerInstance(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject*
#else
PyObject*, PyObject*
#endif
) {
try {
RealTimeLogger::instance();
}
......
......@@ -17,7 +17,13 @@ namespace python {
/**
\brief plug a signal into another one.
*/
PyObject* plug(PyObject* m, PyObject* args) {
PyObject* plug(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* objOut = NULL;
PyObject* objIn = NULL;
void* pObjOut;
......@@ -65,7 +71,13 @@ PyObject* plug(PyObject* m, PyObject* args) {
return Py_BuildValue("");
}
PyObject* enableTrace(PyObject* m, PyObject* args) {
PyObject* enableTrace(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* boolean;
char* filename = NULL;
......@@ -140,7 +152,7 @@ void initwrap(void)
Py_XDECREF(st->dgpyError);
Py_CLEAR(st->dgpyError);
Py_DECREF(module);
return NULL;
INITERROR;
}
#if PY_MAJOR_VERSION >= 3
......
......@@ -37,7 +37,13 @@ namespace entity {
/**
\brief Create an instance of Entity
*/
PyObject* create(PyObject* m, PyObject* args) {
PyObject* create(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
char* className = NULL;
char* instanceName = NULL;
......@@ -69,7 +75,13 @@ PyObject* create(PyObject* m, PyObject* args) {
/**
\brief Get name of entity
*/
PyObject* getName(PyObject* m, PyObject* args) {
PyObject* getName(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
void* pointer = NULL;
std::string name;
......@@ -93,7 +105,13 @@ PyObject* getName(PyObject* m, PyObject* args) {
/**
\brief Get class name of entity
*/
PyObject* getClassName(PyObject* m, PyObject* args) {
PyObject* getClassName(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
void* pointer = NULL;
std::string name;
......@@ -117,7 +135,13 @@ PyObject* getClassName(PyObject* m, PyObject* args) {
/**
\brief Check if the entity has a signal with the given name
*/
PyObject* hasSignal(PyObject* m, PyObject* args) {
PyObject* hasSignal(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
char* name = NULL;
PyObject* object = NULL;
void* pointer = NULL;
......@@ -147,7 +171,13 @@ PyObject* hasSignal(PyObject* m, PyObject* args) {
/**
\brief Get a signal by name
*/
PyObject* getSignal(PyObject* m, PyObject* args) {
PyObject* getSignal(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
char* name = NULL;
PyObject* object = NULL;
void* pointer = NULL;
......@@ -173,7 +203,13 @@ PyObject* getSignal(PyObject* m, PyObject* args) {
return PyCapsule_New((void*)signal, "dynamic_graph.Signal", NULL);
}
PyObject* listSignals(PyObject* m, PyObject* args) {
PyObject* listSignals(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
......@@ -298,7 +334,13 @@ PyObject* listCommands(PyObject* /*self*/, PyObject* args) {
}
return result;
}
PyObject* getCommandDocstring(PyObject* m, PyObject* args) {
PyObject* getCommandDocstring(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
char* commandName;
if (!PyArg_ParseTuple(args, "Os", &object, &commandName)) {
......@@ -328,7 +370,13 @@ PyObject* getCommandDocstring(PyObject* m, PyObject* args) {
return Py_BuildValue("s", docstring.c_str());
}
PyObject* getDocString(PyObject* m, PyObject* args) {
PyObject* getDocString(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) {
return NULL;
......@@ -353,7 +401,13 @@ PyObject* getDocString(PyObject* m, PyObject* args) {
return NULL;
}
PyObject* display(PyObject* m, PyObject* args) {
PyObject* display(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
/* Retrieve the entity instance. */
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object) || (!PyCapsule_CheckExact(object))) {
......@@ -374,7 +428,13 @@ PyObject* display(PyObject* m, PyObject* args) {
/**
\brief Set verbosity Level
*/
PyObject* setLoggerVerbosityLevel(PyObject* m, PyObject* args) {
PyObject* setLoggerVerbosityLevel(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
PyObject* objectVerbosityLevel = NULL;
if (!PyArg_ParseTuple(args, "OO", &object, &objectVerbosityLevel)) return NULL;
......@@ -430,7 +490,13 @@ PyObject* setLoggerVerbosityLevel(PyObject* m, PyObject* args) {
/**
\brief Get verbosity Level
*/
PyObject* getLoggerVerbosityLevel(PyObject* m, PyObject* args) {
PyObject* getLoggerVerbosityLevel(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -456,7 +522,13 @@ PyObject* getLoggerVerbosityLevel(PyObject* m, PyObject* args) {
/**
\brief Get stream print period
*/
PyObject* getStreamPrintPeriod(PyObject* m, PyObject* args) {
PyObject* getStreamPrintPeriod(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -481,7 +553,13 @@ PyObject* getStreamPrintPeriod(PyObject* m, PyObject* args) {
/**
\brief Set print period
*/
PyObject* setStreamPrintPeriod(PyObject* m, PyObject* args) {
PyObject* setStreamPrintPeriod(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
double streamPrintPeriod = 0;
if (!PyArg_ParseTuple(args, "Od", &object, &streamPrintPeriod)) return NULL;
......@@ -515,7 +593,13 @@ PyObject* setStreamPrintPeriod(PyObject* m, PyObject* args) {
/**
\brief Get stream print period
*/
PyObject* getTimeSample(PyObject* m, PyObject* args) {
PyObject* getTimeSample(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -540,7 +624,13 @@ PyObject* getTimeSample(PyObject* m, PyObject* args) {
/**
\brief Set time sample
*/
PyObject* setTimeSample(PyObject* m, PyObject* args) {
PyObject* setTimeSample(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PyObject* object = NULL;
double timeSample;
if (!PyArg_ParseTuple(args, "Od", &object, &timeSample)) return NULL;
......
......@@ -12,7 +12,13 @@ namespace python {
namespace pool {
PyObject* writeGraph(PyObject* m, PyObject* args) {
PyObject* writeGraph(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename)) return NULL;
try {
......@@ -25,7 +31,13 @@ PyObject* writeGraph(PyObject* m, PyObject* args) {
/**
\brief Get list of entities
*/
PyObject* getEntityList(PyObject* m, PyObject* args) {
PyObject* getEntityList(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
if (!PyArg_ParseTuple(args, "")) return NULL;
std::vector<std::string> entityNames;
......
......@@ -57,7 +57,9 @@ PythonSignalContainer* getPythonSignalContainer() {
const std::string instanceName = "python_signals";
const std::string className = "PythonSignalContainer";
Entity* obj;
#if PY_MAJOR_VERSION >= 3
PyObject* m = PyState_FindModule(&dynamicgraph::python::dynamicGraphModuleDef);
#endif
if (PoolStorage::getInstance()->existEntity(instanceName, obj)) {
if (obj->getClassName() != className) {
std::string msg("Found an object named " + std::string(instanceName) +
......@@ -84,7 +86,13 @@ PythonSignalContainer* getPythonSignalContainer() {
/**
\brief Create an instance of SignalWrapper
*/
PyObject* createSignalWrapper(PyObject* m, PyObject* args) {
PyObject* createSignalWrapper(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
PythonSignalContainer* psc = getPythonSignalContainer();
if (psc == NULL) return NULL;
......@@ -141,7 +149,13 @@ PyObject* getTime(PyObject* /*self*/, PyObject* args) {
return Py_BuildValue("i", time);
}
PyObject* setTime(PyObject* m, PyObject* args) {
PyObject* setTime(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
int time;
......@@ -158,7 +172,13 @@ PyObject* setTime(PyObject* m, PyObject* args) {
return Py_BuildValue("");
}
PyObject* display(PyObject* m, PyObject* args) {
PyObject* display(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -176,7 +196,13 @@ PyObject* display(PyObject* m, PyObject* args) {
return Py_BuildValue("s", oss.str().c_str());
}
PyObject* displayDependencies(PyObject* m, PyObject* args) {
PyObject* displayDependencies(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
int time;
......@@ -194,7 +220,13 @@ PyObject* displayDependencies(PyObject* m, PyObject* args) {
return Py_BuildValue("s", oss.str().c_str());
}
PyObject* getValue(PyObject* m, PyObject* args) {
PyObject* getValue(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -288,7 +320,13 @@ PyObject* getValue(PyObject* m, PyObject* args) {
return Py_BuildValue("s", valueString.c_str());
}
PyObject* getName(PyObject* m, PyObject* args) {
PyObject* getName(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -306,7 +344,13 @@ PyObject* getName(PyObject* m, PyObject* args) {
return Py_BuildValue("s", name.c_str());
}
PyObject* getClassName(PyObject* m, PyObject* args) {
PyObject* getClassName(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -324,7 +368,13 @@ PyObject* getClassName(PyObject* m, PyObject* args) {
return Py_BuildValue("s", name.c_str());
}
PyObject* setValue(PyObject* m, PyObject* args) {
PyObject* setValue(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
char* valueString = NULL;
......@@ -345,7 +395,13 @@ PyObject* setValue(PyObject* m, PyObject* args) {
return Py_BuildValue("");
}
PyObject* recompute(PyObject* m, PyObject* args) {
PyObject* recompute(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
unsigned int time;
......@@ -361,7 +417,13 @@ PyObject* recompute(PyObject* m, PyObject* args) {
return Py_BuildValue("");
}
PyObject* unplug(PyObject* m, PyObject* args) {
PyObject* unplug(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -376,7 +438,13 @@ PyObject* unplug(PyObject* m, PyObject* args) {
return Py_BuildValue("");
}
PyObject* isPlugged(PyObject* m, PyObject* args) {
PyObject* isPlugged(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......@@ -395,7 +463,13 @@ PyObject* isPlugged(PyObject* m, PyObject* args) {
return PyBool_FromLong(0);
}
PyObject* getPlugged(PyObject* m, PyObject* args) {
PyObject* getPlugged(
#if PY_MAJOR_VERSION >= 3
PyObject* m, PyObject* args
#else
PyObject*, PyObject* args
#endif
) {
void* pointer = NULL;
PyObject* object = NULL;
if (!PyArg_ParseTuple(args, "O", &object)) return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment