summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp158
1 files changed, 81 insertions, 77 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 2aa48cb64b9..e1e48eff95f 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -227,11 +227,11 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
if(marshal)
{
- stream = streamingAPI ? "__outS" : "__os";
+ stream = streamingAPI ? "outS__" : "os__";
}
else
{
- stream = streamingAPI ? "__inS" : "__is";
+ stream = streamingAPI ? "inS__" : "is__";
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
@@ -361,7 +361,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
out << "(Ice.ReadObjectCallback)";
}
- out << "new __Patcher(" << patchParams << "));";
+ out << "new Patcher__(" << patchParams << "));";
}
}
break;
@@ -394,21 +394,21 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
string typeS = typeToString(type);
if(marshal)
{
- out << nl << typeS << "Helper.";
+ out << nl << typeS << "Helper.write";
if(!streamingAPI)
{
out << "__";
}
- out << "write(" << stream << ", " << param << ");";
+ out << "(" << stream << ", " << param << ");";
}
else
{
- out << nl << param << " = " << typeS << "Helper.";
+ out << nl << param << " = " << typeS << "Helper.read";
if(!streamingAPI)
{
out << "__";
}
- out << "read(" << stream << ')' << ';';
+ out << "(" << stream << ");";
}
return;
}
@@ -440,7 +440,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
out << "(Ice.ReadObjectCallback)";
}
- out << "new __Patcher(" << patchParams << "));";
+ out << "new Patcher__(" << patchParams << "));";
}
}
return;
@@ -451,13 +451,13 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(marshal)
{
- out << nl << param << ".__write(" << stream << ");";
+ out << nl << param << ".write__(" << stream << ");";
}
else
{
string typeS = typeToString(type);
out << nl << param << " = new " << typeS << "();";
- out << nl << param << ".__read(" << stream << ");";
+ out << nl << param << ".read__(" << stream << ");";
}
return;
}
@@ -523,11 +523,11 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
string stream;
if(marshal)
{
- stream = streamingAPI ? "__outS" : "__os";
+ stream = streamingAPI ? "outS__" : "os__";
}
else
{
- stream = streamingAPI ? "__inS" : "__is";
+ stream = streamingAPI ? "inS__" : "is__";
}
TypePtr type = seq->type();
@@ -553,26 +553,26 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
out << sb;
string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
- out << nl << stream << '.' << func << '(' << param << "[__ix]);";
+ out << nl << stream << '.' << func << '(' << param << "[ix__]);";
out << eb;
out << eb;
}
else
{
- out << nl << "int __lenx = " << stream << ".readSize();";
+ out << nl << "int lenx__ = " << stream << ".readSize();";
if(!streamingAPI)
{
if(builtin->isVariableLength())
{
- out << nl << stream << ".startSeq(__lenx, "
+ out << nl << stream << ".startSeq(lenx__, "
<< static_cast<unsigned>(builtin->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(__lenx, "
+ out << nl << stream << ".checkFixedSeq(lenx__, "
<< static_cast<unsigned>(builtin->minWireSize()) << ");";
}
}
@@ -581,42 +581,42 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(isArray)
{
- out << "Ice.Object[__lenx];";
+ out << "Ice.Object[lenx__];";
}
else
{
- out << typeToString(seq) << "(__lenx);";
+ out << typeToString(seq) << "(lenx__);";
}
- out << nl << "for(int __ix = 0; __ix < __lenx; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < lenx__; ++ix__)";
out << sb;
out << nl << stream << ".readObject(";
if(streamingAPI)
{
out << "(ReadObjectCallback)";
}
- out << "new IceInternal.SequencePatcher(" << param << ", typeof(Ice.Object), __ix));";
+ out << "new IceInternal.SequencePatcher(" << param << ", typeof(Ice.Object), ix__));";
}
else
{
if(isArray)
{
- out << "Ice.ObjectPrx[__lenx];";
+ out << "Ice.ObjectPrx[lenx__];";
}
else
{
- out << typeToString(seq) << "(__lenx);";
+ out << typeToString(seq) << "(lenx__);";
}
- out << nl << "for(int __ix = 0; __ix < __lenx; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < lenx__; ++ix__)";
out << sb;
if(isArray)
{
- out << nl << param << "[__ix] = " << stream << ".readProxy();";
+ out << nl << param << "[ix__] = " << stream << ".readProxy();";
}
else
{
- out << nl << "Ice.ObjectPrx __val = new Ice.ObjectPrxHelperBase();";
- out << nl << "__val = " << stream << ".readProxy();";
- out << nl << param << ".Add(__val);";
+ out << nl << "Ice.ObjectPrx val__ = new Ice.ObjectPrxHelperBase();";
+ out << nl << "val__ = " << stream << ".readProxy();";
+ out << nl << param << ".Add(val__);";
}
}
if(!streamingAPI && builtin->isVariableLength())
@@ -627,7 +627,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && builtin->isVariableLength())
{
- out << nl << stream << ".endSeq(__lenx);";
+ out << nl << stream << ".endSeq(lenx__);";
}
}
break;
@@ -674,41 +674,41 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
out << sb;
- out << nl << stream << ".writeObject(" << param << "[__ix]);";
+ out << nl << stream << ".writeObject(" << param << "[ix__]);";
out << eb;
out << eb;
}
else
{
out << sb;
- out << nl << "int __szx = " << stream << ".readSize();";
+ out << nl << "int szx__ = " << stream << ".readSize();";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "__szx");
+ out << toArrayAlloc(typeS + "[]", "szx__");
}
else
{
- out << fixId(seq->scoped()) << "(__szx)";
+ out << fixId(seq->scoped()) << "(szx__)";
}
out << ';';
- out << nl << "for(int __i = 0; __i < __szx; ++__i)";
+ out << nl << "for(int i__ = 0; i__ < szx__; ++i__)";
out << sb;
out << nl << "IceInternal.SequencePatcher spx = new IceInternal.SequencePatcher("
- << param << ", " << "typeof(" << typeS << "), __i);";
+ << param << ", " << "typeof(" << typeS << "), i__);";
out << nl << stream << ".readObject(";
if(streamingAPI)
{
@@ -723,7 +723,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(__szx);";
+ out << nl << stream << ".endSeq(szx__);";
}
out << eb;
}
@@ -742,52 +742,52 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
out << sb;
- out << nl << param << "[__ix].__write(" << stream << ");";
+ out << nl << param << "[ix__].write__(" << stream << ");";
out << eb;
out << eb;
}
else
{
out << sb;
- out << nl << "int __szx = " << stream << ".readSize();";
+ out << nl << "int szx__ = " << stream << ".readSize();";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "__szx");
+ out << toArrayAlloc(typeS + "[]", "szx__");
}
else
{
- out << fixId(seq->scoped()) << "(__szx)";
+ out << fixId(seq->scoped()) << "(szx__)";
}
out << ';';
- out << nl << "for(int __ix = 0; __ix < __szx; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
out << sb;
if(isArray)
{
if(st->hasMetaData("clr:class"))
{
- out << nl << param << "[__ix] = new " << typeS << "();";
+ out << nl << param << "[ix__] = new " << typeS << "();";
}
- out << nl << param << "[__ix].__read(" << stream << ");";
+ out << nl << param << "[ix__].read__(" << stream << ");";
}
else
{
- out << nl << typeS << " __val = new " << typeS << "();";
- out << nl << "__val.__read(" << stream << ");";
- out << nl << param << ".Add(__val);";
+ out << nl << typeS << " val__ = new " << typeS << "();";
+ out << nl << "val__.read__(" << stream << ");";
+ out << nl << param << ".Add(val__);";
}
if(!streamingAPI && type->isVariableLength())
{
@@ -797,7 +797,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(__szx);";
+ out << nl << stream << ".endSeq(szx__);";
}
out << eb;
}
@@ -816,35 +816,35 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << param << '.'<< limitID << ");";
- out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
out << sb;
- out << nl << stream << ".writeByte((byte)" << param << "[__ix]);";
+ out << nl << stream << ".writeByte((byte)" << param << "[ix__]);";
out << eb;
out << eb;
}
else
{
out << sb;
- out << nl << "int __szx = " << stream << ".readSize();";
+ out << nl << "int szx__ = " << stream << ".readSize();";
if(!streamingAPI)
{
- out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "__szx");
+ out << toArrayAlloc(typeS + "[]", "szx__");
}
else
{
- out << fixId(seq->scoped()) << "(__szx)";
+ out << fixId(seq->scoped()) << "(szx__)";
}
out << ';';
- out << nl << "for(int __ix = 0; __ix < __szx; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
out << sb;
if(isArray)
{
- out << nl << param << "[__ix] = (" << typeS << ')' << stream << ".readByte();";
+ out << nl << param << "[ix__] = (" << typeS << ')' << stream << ".readByte();";
}
else
{
@@ -867,13 +867,13 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
string func;
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
- {
- func = "__";
- }
if(marshal)
{
- func += "write";
+ func = "write";
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func += "__";
+ }
out << nl << "if(" << param << " == null)";
out << sb;
out << nl << stream << ".writeSize(0);";
@@ -881,43 +881,47 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
out << sb;
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[__ix]);";
+ out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[ix__]);";
out << eb;
out << eb;
}
else
{
- func += "read";
+ func = "read";
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func += "__";
+ }
out << sb;
- out << nl << "int __szx = " << stream << ".readSize();";
+ out << nl << "int szx__ = " << stream << ".readSize();";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "__szx");
+ out << toArrayAlloc(typeS + "[]", "szx__");
}
else
{
- out << fixId(seq->scoped()) << "(__szx)";
+ out << fixId(seq->scoped()) << "(szx__)";
}
out << ';';
- out << nl << "for(int __ix = 0; __ix < __szx; ++__ix)";
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
out << sb;
if(isArray)
{
- out << nl << param << "[__ix] = " << helperName << '.' << func << '(' << stream << ");";
+ out << nl << param << "[ix__] = " << helperName << '.' << func << '(' << stream << ");";
}
else
{
@@ -934,7 +938,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(__szx);";
+ out << nl << stream << ".endSeq(szx__);";
}
out << eb;
}