diff options
author | Michi Henning <michi@zeroc.com> | 2003-05-19 00:54:05 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-05-19 00:54:05 +0000 |
commit | d48f77a15aa2184d048b664d8d0287bfc430e0f8 (patch) | |
tree | bd51fe2f8a8d97a0bd3fa78788e154a89450a7cd /cpp/src/Slice/JavaUtil.cpp | |
parent | Use %x to display the date (diff) | |
download | ice-d48f77a15aa2184d048b664d8d0287bfc430e0f8.tar.bz2 ice-d48f77a15aa2184d048b664d8d0287bfc430e0f8.tar.xz ice-d48f77a15aa2184d048b664d8d0287bfc430e0f8.zip |
- Fixed a bug in the code generator for dictionaries with class values.
- Added more support for Java slicing.
- Changed config/Make.rules: "make depend" was calling slice2cpp with
ICECPPFLAGS, not SLICE2CPPFLAGS. This meant that "make depend" was
invoking slice2cpp with options that were potentially different from
those passed for normal compilation of slice files, which could lead to
inconsistencies.
Diffstat (limited to 'cpp/src/Slice/JavaUtil.cpp')
-rw-r--r-- | cpp/src/Slice/JavaUtil.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index b7e5a44ee35..3b4c45f0d7c 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -455,7 +455,8 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, bool marshal, int& iter, bool holder, - const list<string>& metaData) + const list<string>& metaData, + const string& patchParams) { string stream = marshal ? "__os" : "__is"; string v; @@ -577,7 +578,14 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - out << nl << v << " = " << stream << ".readObject(\"\", null);"; + if(holder) + { + out << nl << stream << ".readObject(" << param << ".getPatcher());"; + } + else + { + out << nl << stream << ".readObject(new Patcher(" << patchParams << "));"; + } } break; } @@ -627,16 +635,14 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, else { string typeS = typeToString(type, TypeModeIn, scope); - ClassDefPtr def = cl->definition(); - if(def && !def->isAbstract()) - { - out << nl << v << " = (" << typeS << ')' << stream << ".readObject(" << typeS << ".ice_staticId(), " - << typeS << ".ice_factory());"; - } - else - { - out << nl << v << " = (" << typeS << ')' << stream << ".readObject(\"\", null);"; - } + if(holder) + { + out << nl << stream << ".readObject(" << param << ".getPatcher());"; + } + else + { + out << nl << stream << ".readObject(new Patcher(" << patchParams << "));"; + } } return; } @@ -781,7 +787,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << sb; out << nl << stream << ".writeSize(" << v << ".size());"; ostringstream o; - o << "__i" << iter; + o << "__i" << iter << ends; string it = o.str(); iter++; out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();"; @@ -859,6 +865,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { o << "[]"; } + o << ends; switch(b->kind()) { case Builtin::KindByte: @@ -967,7 +974,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { out << nl << stream << ".writeSize(" << v << ".size());"; ostringstream o; - o << "__i" << iter; + o << "__i" << iter << ends; iter++; string it = o.str(); out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();"; @@ -1119,7 +1126,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, << "++)"; out << sb; ostringstream o; - o << v << "[__i" << iter << "]"; + o << v << "[__i" << iter << "]" << ends; iter++; writeMarshalUnmarshalCode(out, scope, seq->type(), o.str(), true, iter, false); out << eb; @@ -1139,9 +1146,12 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, << "++)"; out << sb; ostringstream o; - o << v << "[__i" << iter << "]"; + o << v << "[__i" << iter << "]" << ends; + ostringstream patchParams; + patchParams << v << ", __i" << iter << ends; + writeMarshalUnmarshalCode(out, scope, seq->type(), o.str(), false, iter, false, + list<string>(), patchParams.str()); iter++; - writeMarshalUnmarshalCode(out, scope, seq->type(), o.str(), false, iter, false); out << eb; } } @@ -1495,7 +1505,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out, out << sb; out << nl << stream << ".startWriteSequence(" << name << ", " << v << ".size());"; ostringstream o; - o << "__i" << iter; + o << "__i" << iter << ends; string it = o.str(); iter++; out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();"; @@ -1574,6 +1584,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out, { o << "[]"; } + o << ends; switch(b->kind()) { case Builtin::KindByte: @@ -1684,7 +1695,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out, { out << nl << stream << ".startWriteSequence(" << name << ", " << v << ".size());"; ostringstream o; - o << "__i" << iter; + o << "__i" << iter << ends; iter++; string it = o.str(); out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();"; @@ -1840,7 +1851,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out, << "++)"; out << sb; ostringstream o; - o << v << "[__i" << iter << "]"; + o << v << "[__i" << iter << "]" << ends; iter++; writeGenericMarshalUnmarshalCode(out, scope, seq->type(), "\"e\"", o.str(), true, iter, false); out << eb; @@ -1861,7 +1872,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out, << "++)"; out << sb; ostringstream o; - o << v << "[__i" << iter << "]"; + o << v << "[__i" << iter << "]" << ends; iter++; writeGenericMarshalUnmarshalCode(out, scope, seq->type(), "\"e\"", o.str(), false, iter, false); out << eb; |