remove kwd argument for functions only with flag METH_VARARGS

This commit is contained in:
wmayer
2018-08-08 17:39:32 +02:00
parent e13c09235f
commit ddfa3c8843
12 changed files with 285 additions and 290 deletions

View File

@@ -499,23 +499,23 @@ ConsoleSingleton & ConsoleSingleton::Instance(void)
// ConsoleSingleton Methods // Methods structure
PyMethodDef ConsoleSingleton::Methods[] = {
{"PrintMessage", (PyCFunction) ConsoleSingleton::sPyMessage, 1,
{"PrintMessage", (PyCFunction) ConsoleSingleton::sPyMessage, METH_VARARGS,
"PrintMessage(string) -- Print a message to the output"},
{"PrintLog", (PyCFunction) ConsoleSingleton::sPyLog, 1,
{"PrintLog", (PyCFunction) ConsoleSingleton::sPyLog, METH_VARARGS,
"PrintLog(string) -- Print a log message to the output"},
{"PrintError" , (PyCFunction) ConsoleSingleton::sPyError, 1,
{"PrintError" , (PyCFunction) ConsoleSingleton::sPyError, METH_VARARGS,
"PrintError(string) -- Print an error message to the output"},
{"PrintWarning", (PyCFunction) ConsoleSingleton::sPyWarning, 1,
{"PrintWarning", (PyCFunction) ConsoleSingleton::sPyWarning, METH_VARARGS,
"PrintWarning -- Print a warning to the output"},
{"SetStatus", (PyCFunction) ConsoleSingleton::sPySetStatus, 1,
{"SetStatus", (PyCFunction) ConsoleSingleton::sPySetStatus, METH_VARARGS,
"Set the status for either Log, Msg, Wrn or Error for an observer"},
{"GetStatus", (PyCFunction) ConsoleSingleton::sPyGetStatus, 1,
{"GetStatus", (PyCFunction) ConsoleSingleton::sPyGetStatus, METH_VARARGS,
"Get the status for either Log, Msg, Wrn or Error for an observer"},
{NULL, NULL, 0, NULL} /* Sentinel */
};
PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args)
{
PyObject *output;
if (!PyArg_ParseTuple(args, "O", &output))
@@ -561,7 +561,7 @@ PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args, PyOb
return Py_None;
}
PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args)
{
PyObject *output;
if (!PyArg_ParseTuple(args, "O", &output))
@@ -607,7 +607,7 @@ PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args, PyOb
return Py_None;
}
PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args)
{
PyObject *output;
if (!PyArg_ParseTuple(args, "O", &output))
@@ -653,7 +653,7 @@ PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args, PyObje
return Py_None;
}
PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args)
{
PyObject *output;
if (!PyArg_ParseTuple(args, "O", &output))
@@ -699,7 +699,7 @@ PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args, PyObject
return Py_None;
}
PyObject *ConsoleSingleton::sPyGetStatus(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
PyObject *ConsoleSingleton::sPyGetStatus(PyObject * /*self*/, PyObject *args)
{
char *pstr1;
char *pstr2;
@@ -728,7 +728,7 @@ PyObject *ConsoleSingleton::sPyGetStatus(PyObject * /*self*/, PyObject *args, Py
}PY_CATCH;
}
PyObject *ConsoleSingleton::sPySetStatus(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
PyObject *ConsoleSingleton::sPySetStatus(PyObject * /*self*/, PyObject *args)
{
char *pstr1;
char *pstr2;

View File

@@ -562,12 +562,12 @@ public:
protected:
// python exports goes here +++++++++++++++++++++++++++++++++++++++++++
// static python wrapper of the exported functions
static PyObject *sPyLog (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sPyMessage (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sPyWarning (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sPyError (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sPySetStatus(PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sPyGetStatus(PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sPyLog (PyObject *self,PyObject *args);
static PyObject *sPyMessage (PyObject *self,PyObject *args);
static PyObject *sPyWarning (PyObject *self,PyObject *args);
static PyObject *sPyError (PyObject *self,PyObject *args);
static PyObject *sPySetStatus(PyObject *self,PyObject *args);
static PyObject *sPyGetStatus(PyObject *self,PyObject *args);
bool _bVerbose;
bool _bCanRefresh;

View File

@@ -100,12 +100,12 @@ protected:
//static double parse(const char*,bool &UsedUnit);
protected: // the python API wrapper methods
//static PyObject *sTranslateUnit (PyObject *self,PyObject *args,PyObject *kwd);
//static PyObject *sGetWithPrefs (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sParseQuantity (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sListSchemas (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sGetSchema (PyObject *self,PyObject *args,PyObject *kwd);
static PyObject *sSchemaTranslate (PyObject *self,PyObject *args,PyObject *kwd);
//static PyObject *sTranslateUnit (PyObject *self,PyObject *args);
//static PyObject *sGetWithPrefs (PyObject *self,PyObject *args);
static PyObject *sParseQuantity (PyObject *self,PyObject *args);
static PyObject *sListSchemas (PyObject *self,PyObject *args);
static PyObject *sGetSchema (PyObject *self,PyObject *args);
static PyObject *sSchemaTranslate (PyObject *self,PyObject *args);
};
} // namespace Base

View File

@@ -43,7 +43,7 @@ using namespace Base;
// UnitsApi Methods // Methods structure
PyMethodDef UnitsApi::Methods[] = {
//{"translateUnit", (PyCFunction) UnitsApi::sTranslateUnit ,1,
//{"translateUnit", (PyCFunction) UnitsApi::sTranslateUnit, METH_VARARGS,
// "translateUnit(string) -> double\n\n"
// "calculate a mathematical expression with units to a number. \n"
// "can be used for simple unit translation like: \n"
@@ -51,7 +51,7 @@ PyMethodDef UnitsApi::Methods[] = {
// " or for more complex espressions:\n"
// " translateUnit('sin(pi)/50.0 m/s^2')\n"
//},
//{"getWithPrefs", (PyCFunction) UnitsApi::sGetWithPrefs ,1,
//{"getWithPrefs", (PyCFunction) UnitsApi::sGetWithPrefs, METH_VARARGS,
// "getWithPrefs(type,[string|float|int]) -> double\n\n"
// "Translation to internal regarding user prefs \n"
// " That means if no unit is issued the user prefs are in \n"
@@ -68,7 +68,7 @@ PyMethodDef UnitsApi::Methods[] = {
// " Temperature \n"
//},
{"parseQuantity", (PyCFunction) UnitsApi::sParseQuantity ,1,
{"parseQuantity", (PyCFunction) UnitsApi::sParseQuantity, METH_VARARGS,
"parseQuantity(string) -> Base.Quantity()\n\n"
"calculate a mathematical expression with units to a quantity object. \n"
"can be used for simple unit translation like: \n"
@@ -76,15 +76,15 @@ PyMethodDef UnitsApi::Methods[] = {
"or for more complex espressions:\n"
"parseQuantity('sin(pi)/50.0 m/s^2')\n"
},
{"listSchemas", (PyCFunction) UnitsApi::sListSchemas ,1,
{"listSchemas", (PyCFunction) UnitsApi::sListSchemas, METH_VARARGS,
"listSchemas() -> a tuple of schemas\n\n"
"listSchemas(int) -> description of the given schema\n\n"
},
{"getSchema", (PyCFunction) UnitsApi::sGetSchema ,1,
{"getSchema", (PyCFunction) UnitsApi::sGetSchema, METH_VARARGS,
"getSchema() -> int\n\n"
"The int is the position of the tuple returned by listSchemas"
},
{"schemaTranslate", (PyCFunction) UnitsApi::sSchemaTranslate ,1,
{"schemaTranslate", (PyCFunction) UnitsApi::sSchemaTranslate, METH_VARARGS,
"schemaTranslate(Quantity, int) -> tuple\n\n"
"Translate a quantity to a given schema"
},
@@ -92,7 +92,7 @@ PyMethodDef UnitsApi::Methods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};
//PyObject* UnitsApi::sTranslateUnit(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
//PyObject* UnitsApi::sTranslateUnit(PyObject * /*self*/, PyObject *args)
//{
// char *pstr;
// if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
@@ -110,7 +110,7 @@ PyMethodDef UnitsApi::Methods[] = {
// }
//}
//
//PyObject* UnitsApi::sGetWithPrefs(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
//PyObject* UnitsApi::sGetWithPrefs(PyObject * /*self*/, PyObject *args)
//{
// char *type;
// PyObject *obj;
@@ -138,7 +138,7 @@ PyMethodDef UnitsApi::Methods[] = {
// }
//}
PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args)
{
char *pstr;
if (!PyArg_ParseTuple(args, "et", "utf-8", &pstr)) // convert args: Python->C
@@ -162,7 +162,7 @@ PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args,PyObject
return new QuantityPy(new Quantity(rtn));
}
PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args)
{
if (PyArg_ParseTuple(args, "")) {
int num = NumUnitSystemTypes;
@@ -190,7 +190,7 @@ PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args,PyObject *
return 0;
}
PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
@@ -198,7 +198,7 @@ PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args,PyObject * /*
return Py_BuildValue("i", static_cast<int>(actSystem));
}
PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args)
{
PyObject* q;
int index;