diff options
author | Benoit Foucher <benoit@zeroc.com> | 2010-01-06 12:43:48 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2010-01-06 12:43:48 +0100 |
commit | bc2e4034079842cde62b6b44c4bdcd6a954f4f46 (patch) | |
tree | 0afd6dbfade2a57978227193d5dccdc267e89d7b /cpp/src/Slice/PythonUtil.cpp | |
parent | bug 4495 - clean up book demos (diff) | |
download | ice-bc2e4034079842cde62b6b44c4bdcd6a954f4f46.tar.bz2 ice-bc2e4034079842cde62b6b44c4bdcd6a954f4f46.tar.xz ice-bc2e4034079842cde62b6b44c4bdcd6a954f4f46.zip |
Merged Mark's pythonami branch
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index c1d8cb26d96..5c92d4bd235 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -680,31 +680,76 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } } - _out << sp << nl << "def " << fixedOpName << "(self"; + comment = (*oli)->comment(); + if(!comment.empty()) + { + comment = "'''" + editComment(comment) + "'''"; + } + + _out << sp; + if(!comment.empty()) + { + _out << nl << comment; + } + _out << nl << "def " << fixedOpName << "(self"; if(!inParams.empty()) { _out << ", " << inParams; } _out << ", _ctx=None):"; _out.inc(); + _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams; + if(!inParams.empty() && inParams.find(',') == string::npos) + { + _out << ", "; + } + _out << "), _ctx))"; + _out.dec(); - comment = (*oli)->comment(); + // + // Async operations. + // + _out << sp; if(!comment.empty()) { - _out << nl << "'''" << editComment(comment) << "'''"; + _out << nl << comment; } - - _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams; + _out << nl << "def begin_" << (*oli)->name() << "(self"; + if(!inParams.empty()) + { + _out << ", " << inParams; + } + _out << ", _response=None, _ex=None, _sent=None, _ctx=None):"; + _out.inc(); + _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams; if(!inParams.empty() && inParams.find(',') == string::npos) { _out << ", "; } - _out << "), _ctx))"; + _out << "), _response, _ex, _sent, _ctx))"; + _out.dec(); + + _out << sp; + if(!comment.empty()) + { + _out << nl << comment; + } + _out << nl << "def end_" << (*oli)->name() << "(self, _r):"; + _out.inc(); + _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".end(self, _r)"; _out.dec(); + // + // Old AMI operations. + // if(p->hasMetaData("ami") || (*oli)->hasMetaData("ami")) { - _out << sp << nl << "def " << fixedOpName << "_async(self, _cb"; + _out << sp; + if(!comment.empty()) + { + _out << nl << comment; + } + _out << nl << "def " << fixedOpName << "_async(self, _cb"; if(!inParams.empty()) { _out << ", " << inParams; @@ -712,11 +757,6 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << ", _ctx=None):"; _out.inc(); - if(!comment.empty()) - { - _out << nl << "'''" << editComment(comment) << "'''"; - } - _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invokeAsync(self, (_cb, (" << inParams; if(!inParams.empty() && inParams.find(',') == string::npos) |