summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-09-24 03:35:38 +0000
committerMichi Henning <michi@zeroc.com>2004-09-24 03:35:38 +0000
commit54b1c16933f2fd8d6eb6328d32edccd3ff76e863 (patch)
tree5a16960039e88308ccc1f55a40ee95ced90c3adb /cpp/src
parentAdded book demos. (diff)
downloadice-54b1c16933f2fd8d6eb6328d32edccd3ff76e863.tar.bz2
ice-54b1c16933f2fd8d6eb6328d32edccd3ff76e863.tar.xz
ice-54b1c16933f2fd8d6eb6328d32edccd3ff76e863.zip
Changed prefix escape for .NET framework methods. Fixed a few bugs in
slice2vb code generator.
Diffstat (limited to 'cpp/src')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp5
-rwxr-xr-xcpp/src/Slice/VbUtil.cpp22
-rwxr-xr-xcpp/src/slice2vb/Gen.cpp27
3 files changed, 31 insertions, 23 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index c5c94d78366..9e9220c9597 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -60,8 +60,9 @@ lookupKwd(const string& name)
};
found = binary_search(&memberList[0],
&memberList[sizeof(memberList) / sizeof(*memberList)],
- name);
- return found ? "_cs_" + name : name;
+ name,
+ Slice::CICompare());
+ return found ? "_Ice_" + name : name;
}
//
diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp
index ef139252589..c5f6e3c428d 100755
--- a/cpp/src/Slice/VbUtil.cpp
+++ b/cpp/src/Slice/VbUtil.cpp
@@ -71,7 +71,7 @@ lookupKwd(const string& name)
&memberList[sizeof(memberList) / sizeof(*memberList)],
name,
Slice::CICompare());
- return found ? "_vb_" + name : name;
+ return found ? "_Ice_" + name : name;
}
//
@@ -552,7 +552,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(isArray)
{
- out << "Ice.Object(__len) {}";
+ out << "Ice.Object(__len - 1) {}";
}
else
{
@@ -569,7 +569,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(isArray)
{
- out << "Ice.ObjectPrx(__len) {}";
+ out << "Ice.ObjectPrx(__len - 1) {}";
}
else
{
@@ -632,14 +632,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "For __block As Integer = 0 To 1";
+ out << nl << "For __block As Integer = 0 To 0";
out.inc();
out << nl << "Dim sz As Integer = " << stream << ".readSize()";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ')';
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "sz") << " {}";
+ out << toArrayAlloc(typeS + "()", "sz - 1") << " {}";
}
else
{
@@ -675,14 +675,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "For __block As Integer = 0 To 1";
+ out << nl << "For __block As Integer = 0 To 0";
out.inc();
out << nl << "Dim sz As Integer = " << stream << ".readSize()";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ')';
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "sz") << " {}";
+ out << toArrayAlloc(typeS + "()", "sz - 1") << " {}";
}
else
{
@@ -720,14 +720,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "For __block As Integer = 0 To 1";
+ out << nl << "For __block As Integer = 0 To 0";
out.inc();
out << nl << "Dim sz As Integer = " << stream << ".readSize()";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ')';
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "sz") << " {}";
+ out << toArrayAlloc(typeS + "()", "sz - 1") << " {}";
}
else
{
@@ -775,14 +775,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
string func = ProxyPtr::dynamicCast(type) ? "__read" : "read";
- out << nl << "For __block As Integer = 0 To 1";
+ out << nl << "For __block As Integer = 0 To 0";
out.inc();
out << nl << "Dim sz As Integer = " << stream << ".readSize()";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ")";
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "sz") << " {}";
+ out << toArrayAlloc(typeS + "()", "sz - 1") << " {}";
}
else
{
diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp
index 48894beb618..cd4dae81962 100755
--- a/cpp/src/slice2vb/Gen.cpp
+++ b/cpp/src/slice2vb/Gen.cpp
@@ -127,8 +127,12 @@ Slice::VbVisitor::writeInheritedOperations(const ClassDefPtr& p)
_out << nl << "End " << vbOp;
_out << sp << nl << "Public MustOverride " << vbOp << ' ' << fixId(name)
- << spar << params << "ByVal __current As Ice.Current" << epar
- << " Implements " << fixId(containingClass->scope()) << "_" << containingClass->name()
+ << spar << params << "ByVal __current As Ice.Current" << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements " << fixId(containingClass->scope()) << "_" << containingClass->name()
<< "Operations." << fixId(name);
}
else
@@ -694,7 +698,7 @@ Slice::VbVisitor::getParams(const OperationPtr& op)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string param = ((*q)->isOutParam() ? "ByRef " : "ByVal ")
+ string param = ((*q)->isOutParam() ? "<_System.Runtime.InteropServices.Out()> ByRef " : "ByVal ")
+ fixId((*q)->name()) + " As " + typeToString((*q)->type());
params.push_back(param);
}
@@ -1306,14 +1310,16 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
vector<string> params;
vector<string> args;
- TypePtr ret = p->returnType();
- string retS = typeToString(ret);
+ TypePtr ret;
+ string retS;
if(!amd)
{
params = getParams(p);
args = getArgs(p);
name = fixId(name);
+ ret = p->returnType();
+ retS = typeToString(ret);
}
else
{
@@ -1426,7 +1432,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out << sp << nl << "Public Function ToArray() As " << s << "()";
_out.inc();
- _out << nl << "Dim __a() As " << s << " = New " << s << "(InnerList.Count) {}";
+ _out << nl << "Dim __a() As " << s << " = New " << s << "(InnerList.Count - 1) {}";
_out << nl << "InnerList.CopyTo(__a)";
_out << nl << "Return __a";
_out.dec();
@@ -2543,10 +2549,10 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out << nl << "Return False";
_out.dec();
_out << nl << "End If";
- _out << nl << "Dim __klhs() As " << ks << " = New " << ks << "(Count) {}";
+ _out << nl << "Dim __klhs() As " << ks << " = New " << ks << "(Count - 1) {}";
_out << nl << "Keys.CopyTo(__klhs, 0)";
_out << nl << "_System.Array.Sort(__klhs)";
- _out << nl << "Dim __krhs() As " << ks << " = New " << ks << "(CType(other, " << name << ").Count) {}";
+ _out << nl << "Dim __krhs() As " << ks << " = New " << ks << "(CType(other, " << name << ").Count - 1) {}";
_out << nl << "CType(other, " << name << ").Keys.CopyTo(__krhs, 0)";
_out << nl << "_System.Array.Sort(__krhs)";
_out << nl << "For i As Integer = 0 To Count - 1";
@@ -2558,10 +2564,10 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out << nl << "End If";
_out.dec();
_out << nl << "Next";
- _out << nl << "Dim __vlhs() As " << vs << " = New " << vs << "(Count) {}";
+ _out << nl << "Dim __vlhs() As " << vs << " = New " << vs << "(Count - 1) {}";
_out << nl << "Values.CopyTo(__vlhs, 0)";
_out << nl << "_System.Array.Sort(__vlhs)";
- _out << nl << "Dim __vrhs() As " << vs << " = New " << vs << "(CType(other, " << name << ").Count) {}";
+ _out << nl << "Dim __vrhs() As " << vs << " = New " << vs << "(CType(other, " << name << ").Count - 1) {}";
_out << nl << "CType(other, " << name << ").Values.CopyTo(__vrhs, 0)";
_out << nl << "_System.Array.Sort(__vrhs)";
_out << nl << "For i As Integer = 0 To Count - 1";
@@ -3969,6 +3975,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
vector<string> params;
vector<string> args;
TypePtr ret;
+
if(amd)
{
name = name + "_async";