diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-03-26 09:20:32 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-03-26 09:20:32 +0000 |
commit | 4f29224efebd15e75c32eb3cced99d46a3d667d3 (patch) | |
tree | bdadbdb21cb204b92f1a356ecde02a0d6a688dd9 /cpp | |
parent | Fixed build to not build the customEvictor demo on Mac OS X (diff) | |
download | ice-4f29224efebd15e75c32eb3cced99d46a3d667d3.tar.bz2 ice-4f29224efebd15e75c32eb3cced99d46a3d667d3.tar.xz ice-4f29224efebd15e75c32eb3cced99d46a3d667d3.zip |
Temporary fix to get slice2cppe to generate the old marshal/unmarshal code.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Slice/CPlusPlusUtil.h | 8 | ||||
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 110 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 48 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 32 | ||||
-rw-r--r-- | cpp/src/slice2freeze/Main.cpp | 10 |
5 files changed, 133 insertions, 75 deletions
diff --git a/cpp/include/Slice/CPlusPlusUtil.h b/cpp/include/Slice/CPlusPlusUtil.h index 7fb3f900a4c..368fe2612f7 100644 --- a/cpp/include/Slice/CPlusPlusUtil.h +++ b/cpp/include/Slice/CPlusPlusUtil.h @@ -35,13 +35,15 @@ SLICE_API std::string operationModeToString(Operation::Mode); SLICE_API std::string fixKwd(const std::string&); -SLICE_API void writeMarshalUnmarshalCode(::IceUtil::Output&, const TypePtr&, const std::string&, bool, +SLICE_API void writeMarshalUnmarshalCode(bool, ::IceUtil::Output&, const TypePtr&, const std::string&, bool, const std::string& = "", bool = true, const StringList& = StringList(), bool = false); -SLICE_API void writeMarshalCode(::IceUtil::Output&, const ParamDeclList&, const TypePtr&, + +SLICE_API void writeMarshalCode(bool, ::IceUtil::Output&, const ParamDeclList&, const TypePtr&, const StringList&, bool = false); -SLICE_API void writeUnmarshalCode(::IceUtil::Output&, const ParamDeclList&, const TypePtr&, +SLICE_API void writeUnmarshalCode(bool, ::IceUtil::Output&, const ParamDeclList&, const TypePtr&, const StringList&, bool = false); + SLICE_API void writeAllocateCode(::IceUtil::Output&, const ParamDeclList&, const TypePtr&, const StringList&, bool = false, bool = false); SLICE_API void writeStreamMarshalUnmarshalCode(::IceUtil::Output&, const TypePtr&, const std::string&, bool, diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index ece0f582523..1de5af9b7fa 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -580,7 +580,7 @@ Slice::fixKwd(const string& name) } void -Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& param, bool marshal, +Slice::writeMarshalUnmarshalCode(bool iceE, Output& out, const TypePtr& type, const string& param, bool marshal, const string& str, bool pointer, const StringList& metaData, bool inParam) { string fixedParam = fixKwd(param); @@ -635,7 +635,14 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& string scope = fixKwd(cl->scope()); if(marshal) { - out << nl << stream << deref << "write(::Ice::ObjectPtr(::IceInternal::upCast(" << fixedParam << ".get())));"; + if(iceE) + { + out << nl << scope << "__write(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; + } + else + { + out << nl << stream << deref << "write(::Ice::ObjectPtr(::IceInternal::upCast(" << fixedParam << ".get())));"; + } } else { @@ -652,7 +659,14 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& string scope = fixKwd(px->_class()->scope()); if(marshal) { - out << nl << stream << deref << "write(::Ice::ObjectPrx(::IceInternal::upCast(" << fixedParam << ".get())));"; + if(iceE) + { + out << nl << scope << "__write(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; + } + else + { + out << nl << stream << deref << "write(::Ice::ObjectPrx(::IceInternal::upCast(" << fixedParam << ".get())));"; + } } else { @@ -706,8 +720,17 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& seqType = findMetaData(l, false); if(seqType.empty()) { - out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " - << fixedParam << ".first, " << fixedParam << ".second);"; + if(iceE) + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " + << fixedParam << ".first, " << fixedParam << ".second, " << scope + << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " + << fixedParam << ".first, " << fixedParam << ".second);"; + } } else { @@ -717,7 +740,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& out << nl << "for(int __i_" << fixedParam << " = 0; __i_" << fixedParam << " < __sz_" << fixedParam << "; ++__i_" << fixedParam << ")"; out << sb; - writeMarshalUnmarshalCode(out, seq->type(), fixedParam + ".first[__i_" + fixedParam + "]", + writeMarshalUnmarshalCode(iceE, out, seq->type(), fixedParam + ".first[__i_" + fixedParam + "]", true); out << eb; } @@ -753,7 +776,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& << fixedParam << ".first; ___" << fixedParam << " != " << fixedParam << ".second; ++___" << fixedParam << ")"; out << sb; - writeMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true, "", true, l, false); + writeMarshalUnmarshalCode(iceE, out, seq->type(), "(*___" + fixedParam + ")", true, "", true, l, false); out << eb; } else if(!seqType.empty()) @@ -763,7 +786,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& out << nl << "for(__p_" << fixedParam << " = " << fixedParam << ".begin(); __p_" << fixedParam << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")"; out << sb; - writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", true); + writeMarshalUnmarshalCode(iceE, out, seq->type(), "(*__p_" + fixedParam + ")", true); out << eb; } else @@ -775,8 +798,16 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& seqType = findMetaData(l, false); if(!seqType.empty()) { - out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " << fixedParam - << ");"; + if(iceE) + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " << fixedParam + << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " << fixedParam + << ");"; + } } else if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) @@ -787,8 +818,17 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& out << eb; out << nl << "else"; out << sb; - out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", &" - << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size());"; + if(iceE) + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", &" + << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size(), " << scope + << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", &" + << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size());"; + } out << eb; } else if(builtin->kind() == Builtin::KindBool) @@ -824,8 +864,16 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if(seqType.empty()) { out << nl << typeToString(type, false) << " ___" << fixedParam << ";"; - out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", ___" - << fixedParam << ");"; + if(iceE) + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", ___" + << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", ___" + << fixedParam << ");"; + } } else { @@ -833,7 +881,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& StringList l; l.push_back("cpp:type:" + seqType); out << nl << seqType << " ___" << fixedParam << ";"; - writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, l, false); + writeMarshalUnmarshalCode(iceE, out, seq, "___" + fixedParam, false, "", true, l, false); } } else if(builtin->kind() == Builtin::KindByte) @@ -878,7 +926,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& { md.push_back("cpp:type:" + seqType.substr(strlen("range:"))); } - writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, md, false); + writeMarshalUnmarshalCode(iceE, out, seq, "___" + fixedParam, false, "", true, md, false); out << nl << fixedParam << ".first = ___" << fixedParam << ".begin();"; out << nl << fixedParam << ".second = ___" << fixedParam << ".end();"; } @@ -904,7 +952,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& out << nl << "for(__p_" << fixedParam << " = " << fixedParam << ".begin(); __p_" << fixedParam << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")"; out << sb; - writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", false); + writeMarshalUnmarshalCode(iceE, out, seq->type(), "(*__p_" + fixedParam + ")", false); if(seq->type()->isVariableLength()) { if(!SequencePtr::dynamicCast(seq->type())) @@ -929,8 +977,16 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if(!seqType.empty() || !builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) { - out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " - << fixedParam << ");"; + if(iceE) + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " + << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " + << fixedParam << ");"; + } } else if(builtin->kind() == Builtin::KindByte) { @@ -976,8 +1032,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if(dict) { string scope = fixKwd(dict->scope()); - string funcDict = (marshal ? "write" : "read") + fixKwd(dict->name()) + "("; - out << nl << scope << "__" << funcDict << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " + << fixedParam << ", " << scope << "__U__" << fixKwd(dict->name()) << "());"; return; } @@ -989,32 +1045,32 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& } void -Slice::writeMarshalCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData, +Slice::writeMarshalCode(bool iceE, Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData, bool inParam) { for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p) { - writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), true, "", true, (*p)->getMetaData(), + writeMarshalUnmarshalCode(iceE, out, (*p)->type(), fixKwd((*p)->name()), true, "", true, (*p)->getMetaData(), inParam); } if(ret) { - writeMarshalUnmarshalCode(out, ret, "__ret", true, "", true, metaData, false); + writeMarshalUnmarshalCode(iceE, out, ret, "__ret", true, "", true, metaData, false); } } void -Slice::writeUnmarshalCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData, +Slice::writeUnmarshalCode(bool iceE, Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData, bool inParam) { for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p) { - writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), false, "", true, (*p)->getMetaData(), + writeMarshalUnmarshalCode(iceE, out, (*p)->type(), fixKwd((*p)->name()), false, "", true, (*p)->getMetaData(), inParam); } if(ret) { - writeMarshalUnmarshalCode(out, ret, "__ret", false, "", true, metaData, false); + writeMarshalUnmarshalCode(iceE, out, ret, "__ret", false, "", true, metaData, false); } } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 3fd6f47e11a..ff87d2871cb 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -692,7 +692,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__os->startWriteSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(false, C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); } C << nl << "__os->endWriteSlice();"; if(base) @@ -711,7 +711,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__is->startReadSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(false, C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); } C << nl << "__is->endReadSlice();"; if(base) @@ -1015,7 +1015,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(false, C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); } C << eb; @@ -1023,7 +1023,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(false, C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); } C << eb; @@ -1151,7 +1151,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "__os->writeSize(size);"; C << nl << "for(" << name << "::const_iterator p = v.begin(); p != v.end(); ++p)"; C << sb; - writeMarshalUnmarshalCode(C, type, "(*p)", true); + writeMarshalUnmarshalCode(false, C, type, "(*p)", true); C << eb; C << eb; @@ -1172,7 +1172,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) } C << nl << "for(" << name << "::iterator p = v.begin(); p != v.end(); ++p)"; C << sb; - writeMarshalUnmarshalCode(C, type, "(*p)", false); + writeMarshalUnmarshalCode(false, C, type, "(*p)", false); // // After unmarshaling each element, check that there are still enough bytes left in the stream @@ -1249,7 +1249,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "__os->writeSize(size);"; C << nl << "for(int i = 0; i < size; ++i)"; C << sb; - writeMarshalUnmarshalCode(C, type, "begin[i]", true); + writeMarshalUnmarshalCode(false, C, type, "begin[i]", true); C << eb; C << eb; @@ -1270,7 +1270,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "v.resize(sz);"; C << nl << "for(int i = 0; i < sz; ++i)"; C << sb; - writeMarshalUnmarshalCode(C, type, "v[i]", false); + writeMarshalUnmarshalCode(false, C, type, "v[i]", false); // // After unmarshaling each element, check that there are still enough bytes left in the stream @@ -1364,8 +1364,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << scoped << "::const_iterator p;"; C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; - writeMarshalUnmarshalCode(C, keyType, "p->first", true); - writeMarshalUnmarshalCode(C, valueType, "p->second", true); + writeMarshalUnmarshalCode(false, C, keyType, "p->first", true); + writeMarshalUnmarshalCode(false, C, valueType, "p->second", true); C << eb; C << eb; @@ -1378,9 +1378,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << sb; C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;"; const string pf = string("const_cast<") + ks + "&>(pair.first)"; - writeMarshalUnmarshalCode(C, keyType, pf, false); + writeMarshalUnmarshalCode(false, C, keyType, pf, false); C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);"; - writeMarshalUnmarshalCode(C, valueType, "__i->second", false); + writeMarshalUnmarshalCode(false, C, valueType, "__i->second", false); C << eb; C << eb; @@ -2270,7 +2270,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl << "::IceInternal::BasicStream* __os = __og.os();"; - writeMarshalCode(C, inParams, 0, StringList(), true); + writeMarshalCode(false, C, inParams, 0, StringList(), true); if(p->sendsClasses()) { C << nl << "__os->writePendingObjects();"; @@ -2345,7 +2345,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) C << nl << fixKwd((*opi)->name()) << " = new " << fixKwd(st->scoped()) << ";"; } } - writeUnmarshalCode(C, outParams, ret, p->getMetaData()); + writeUnmarshalCode(false, C, outParams, ret, p->getMetaData()); if(p->returnsClasses()) { C << nl << "__is->readPendingObjects();"; @@ -3124,7 +3124,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) DataMemberList::const_iterator q; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(false, C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); } C << nl << "__os->endWriteSlice();"; emitUpcall(base, "::__write(__os);"); @@ -3140,7 +3140,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "__is->startReadSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(false, C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); } C << nl << "__is->endReadSlice();"; emitUpcall(base, "::__read(__is, true);"); @@ -3512,7 +3512,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << nl << "::IceInternal::BasicStream* __os = __inS.os();"; } writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true); - writeUnmarshalCode(C, inParams, 0, StringList(), true); + writeUnmarshalCode(false, C, inParams, 0, StringList(), true); if(p->sendsClasses()) { C << nl << "__is->readPendingObjects();"; @@ -3529,7 +3529,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << retS << " __ret = "; } C << fixKwd(name) << args << ';'; - writeMarshalCode(C, outParams, ret, p->getMetaData()); + writeMarshalCode(false, C, outParams, ret, p->getMetaData()); if(p->returnsClasses()) { C << nl << "__os->writePendingObjects();"; @@ -3558,7 +3558,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << nl << "::IceInternal::BasicStream* __is = __inS.is();"; } writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true); - writeUnmarshalCode(C, inParams, 0, StringList(), true); + writeUnmarshalCode(false, C, inParams, 0, StringList(), true); if(p->sendsClasses()) { C << nl << "__is->readPendingObjects();"; @@ -4715,7 +4715,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl << "__prepare(__prx, " << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);"; - writeMarshalCode(C, inParams, 0, StringList(), true); + writeMarshalCode(false, C, inParams, 0, StringList(), true); if(p->sendsClasses()) { C << nl << "__os->writePendingObjects();"; @@ -4768,10 +4768,10 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) C << eb; C << eb; - writeUnmarshalCode(C, outParams, 0, StringList(), true); + writeUnmarshalCode(false, C, outParams, 0, StringList(), true); if(ret) { - writeMarshalUnmarshalCode(C, ret, "__ret", false, "", true, p->getMetaData(), true); + writeMarshalUnmarshalCode(false, C, ret, "__ret", false, "", true, p->getMetaData(), true); } if(p->returnsClasses()) { @@ -4977,10 +4977,10 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl << "::IceInternal::BasicStream* __os = this->__os();"; - writeMarshalCode(C, outParams, 0, StringList(), true); + writeMarshalCode(false, C, outParams, 0, StringList(), true); if(ret) { - writeMarshalUnmarshalCode(C, ret, "__ret", true, "", true, p->getMetaData(), true); + writeMarshalUnmarshalCode(false, C, ret, "__ret", true, "", true, p->getMetaData(), true); } if(p->returnsClasses()) { diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index d627a568e38..917eb1479c8 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -636,7 +636,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__os->startWriteSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(true, C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); } C << nl << "__os->endWriteSlice();"; if(base) @@ -655,7 +655,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__is->startReadSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(true, C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); } C << nl << "__is->endReadSlice();"; if(base) @@ -824,7 +824,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(true, C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); } C << eb; @@ -832,7 +832,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); + writeMarshalUnmarshalCode(true, C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); } C << eb; } @@ -888,7 +888,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "__os->writeSize(size);"; C << nl << "for(" << name << "::const_iterator p = v.begin(); p != v.end(); ++p)"; C << sb; - writeMarshalUnmarshalCode(C, type, "(*p)", true); + writeMarshalUnmarshalCode(true, C, type, "(*p)", true); C << eb; C << eb; @@ -909,7 +909,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) } C << nl << "for(" << name << "::iterator p = v.begin(); p != v.end(); ++p)"; C << sb; - writeMarshalUnmarshalCode(C, type, "(*p)", false); + writeMarshalUnmarshalCode(true, C, type, "(*p)", false); // // After unmarshaling each element, check that there are still enough bytes left in the stream @@ -952,7 +952,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "__os->writeSize(size);"; C << nl << "for(int i = 0; i < size; ++i)"; C << sb; - writeMarshalUnmarshalCode(C, type, "begin[i]", true); + writeMarshalUnmarshalCode(true, C, type, "begin[i]", true); C << eb; C << eb; @@ -973,7 +973,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "v.resize(sz);"; C << nl << "for(int i = 0; i < sz; ++i)"; C << sb; - writeMarshalUnmarshalCode(C, type, "v[i]", false); + writeMarshalUnmarshalCode(true, C, type, "v[i]", false); // // After unmarshaling each element, check that there are still enough bytes left in the stream @@ -1038,8 +1038,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << scoped << "::const_iterator p;"; C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; - writeMarshalUnmarshalCode(C, keyType, "p->first", true); - writeMarshalUnmarshalCode(C, valueType, "p->second", true); + writeMarshalUnmarshalCode(true, C, keyType, "p->first", true); + writeMarshalUnmarshalCode(true, C, valueType, "p->second", true); C << eb; C << eb; @@ -1052,9 +1052,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << sb; C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;"; string pf = string("const_cast<") + ks + "&>(pair.first)"; - writeMarshalUnmarshalCode(C, keyType, pf, false); + writeMarshalUnmarshalCode(true, C, keyType, pf, false); C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);"; - writeMarshalUnmarshalCode(C, valueType, "__i->second", false); + writeMarshalUnmarshalCode(true, C, valueType, "__i->second", false); C << eb; C << eb; } @@ -1519,7 +1519,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl << "::IceInternal::BasicStream* __os = __outS.stream();"; - writeMarshalCode(C, inParams, 0, StringList(), true); + writeMarshalCode(true, C, inParams, 0, StringList(), true); C << eb; C << nl << "catch(const ::Ice::LocalException& __ex)"; C << sb; @@ -1584,7 +1584,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; writeAllocateCode(C, ParamDeclList(), ret, p->getMetaData(), _useWstring); - writeUnmarshalCode(C, outParams, ret, p->getMetaData()); + writeUnmarshalCode(true, C, outParams, ret, p->getMetaData()); if(ret) { C << nl << "return __ret;"; @@ -2313,7 +2313,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) } writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true); - writeUnmarshalCode(C, inParams, 0, StringList(), true); + writeUnmarshalCode(true, C, inParams, 0, StringList(), true); writeAllocateCode(C, outParams, 0, StringList(), _useWstring); if(!throws.empty()) { @@ -2326,7 +2326,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << retS << " __ret = "; } C << fixKwd(name) << args << ';'; - writeMarshalCode(C, outParams, ret, p->getMetaData()); + writeMarshalCode(true, C, outParams, ret, p->getMetaData()); if(!throws.empty()) { C << eb; diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index bb52497625b..09f07da1963 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -217,7 +217,7 @@ writeCodecC(const TypePtr& type, const StringList& metaData, const string& name, { C << nl << "stream.startWriteEncaps();"; } - writeMarshalUnmarshalCode(C, type, "v", true, "stream", false, metaData); + writeMarshalUnmarshalCode(false, C, type, "v", true, "stream", false, metaData); if(type->usesClasses()) { C << nl << "stream.writePendingObjects();"; @@ -245,7 +245,7 @@ writeCodecC(const TypePtr& type, const StringList& metaData, const string& name, { C << nl << "stream.startReadEncaps();"; } - writeMarshalUnmarshalCode(C, type, "v", false, "stream", false, metaData); + writeMarshalUnmarshalCode(false, C, type, "v", false, "stream", false, metaData); if(type->usesClasses()) { C << nl << "stream.readPendingObjects();"; @@ -592,7 +592,7 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di valueS = "__lowerCaseIndex"; } - writeMarshalUnmarshalCode(C, indexTypes[i].type, valueS, true, "__stream", false, indexTypes[i].metaData); + writeMarshalUnmarshalCode(false, C, indexTypes[i].type, valueS, true, "__stream", false, indexTypes[i].metaData); C << nl << "::std::vector<Ice::Byte>(__stream.b.begin(), __stream.b.end()).swap(__bytes);"; } C << eb; @@ -615,7 +615,7 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di C << nl << "__stream.b.resize(__bytes.size());"; C << nl << "::memcpy(&__stream.b[0], &__bytes[0], __bytes.size());"; C << nl << "__stream.i = __stream.b.begin();"; - writeMarshalUnmarshalCode(C, indexTypes[i].type, "__index", false, "__stream", false, + writeMarshalUnmarshalCode(false, C, indexTypes[i].type, "__index", false, "__stream", false, indexTypes[i].metaData); } C << eb; @@ -1066,7 +1066,7 @@ writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& member valueS = "__lowerCaseIndex"; } - writeMarshalUnmarshalCode(C, memberType, valueS, true, "__stream", false); + writeMarshalUnmarshalCode(false, C, memberType, valueS, true, "__stream", false); if(memberType->usesClasses()) { C << nl << "__stream.writePendingObjects();"; |