mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* server/server.cpp, server/CommClient.h, client/ClientConnection.h,
tools/cycmd.cpp: Switched to using skstream library for socket comms instead of hand rolled fstream based version. * ALL FILES: Fixed use of std namespace throughout all code. This server is now ISO C++ compliand and builds with gcc 3.0. Al Riddoch <alriddoch@zepler.org>
This commit is contained in:
parent
182369f6a4
commit
dcc3dfa85a
46 changed files with 360 additions and 311 deletions
|
|
@ -27,11 +27,12 @@ bool PythonMindScript::Operation(const std::string & op_type,
|
|||
const RootOperation & op,
|
||||
oplist & ret_list, RootOperation * sub_op)
|
||||
{
|
||||
debug( cout << "Got script object for " << endl << flush;);
|
||||
debug( std::cout << "Got script object for " << std::endl << std::flush;);
|
||||
std::string op_name = op_type+"_operation";
|
||||
// Construct apropriate python object thingies from op
|
||||
if (!PyObject_HasAttrString(scriptObject, (char *)(op_name.c_str()))) {
|
||||
debug( cout << "No method found for " << op_name << endl << flush;);
|
||||
debug( std::cout << "No method found for " << op_name << std::endl
|
||||
<< std::flush;);
|
||||
return false;
|
||||
}
|
||||
RootOperationObject * py_op = newAtlasRootOperation(NULL);
|
||||
|
|
@ -56,33 +57,38 @@ bool PythonMindScript::Operation(const std::string & op_type,
|
|||
delete py_op->operation;
|
||||
Py_DECREF(py_op);
|
||||
if (ret != NULL) {
|
||||
debug( cout << "Called python method " << op_name << endl << flush;);
|
||||
debug( std::cout << "Called python method " << op_name << std::endl
|
||||
<< std::flush;);
|
||||
if (PyOperation_Check(ret)) {
|
||||
RootOperationObject * op = (RootOperationObject*)ret;
|
||||
if (op->operation != NULL) {
|
||||
ret_list.push_back(op->operation);
|
||||
op->own = 0;
|
||||
} else {
|
||||
debug( cout << "Method returned invalid op" << endl << flush;);
|
||||
debug( std::cout << "Method returned invalid op" << std::endl
|
||||
<< std::flush;);
|
||||
}
|
||||
} else if (PyOplist_Check(ret)) {
|
||||
OplistObject * op = (OplistObject*)ret;
|
||||
if (op->ops != NULL) {
|
||||
ret_list = *op->ops;
|
||||
} else {
|
||||
debug(cout << "Method returned invalid oplist" <<endl<< flush;);
|
||||
debug(std::cout << "Method returned invalid oplist" << std::endl
|
||||
<< std::flush;);
|
||||
}
|
||||
} else {
|
||||
debug( cout << "Method returned invalid object" << endl << flush;);
|
||||
debug( std::cout << "Method returned invalid object" << std::endl << std::flush;);
|
||||
}
|
||||
|
||||
Py_DECREF(ret);
|
||||
return true;
|
||||
} else {
|
||||
if (PyErr_Occurred() == NULL) {
|
||||
debug( cout << "No method to be found for " << endl << flush;);
|
||||
debug( std::cout << "No method to be found for " << std::endl
|
||||
<< std::flush;);
|
||||
} else {
|
||||
cerr << "Reporting python error for " << endl << flush;
|
||||
std::cerr << "Reporting python error for " << std::endl
|
||||
<< std::flush;
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue