summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-07-13 03:29:24 +0000
committerMichi Henning <michi@zeroc.com>2004-07-13 03:29:24 +0000
commit86103da7a43352d98bae256d1ac3706829cefe45 (patch)
tree0368e13884371c1b623a3da0898ff8b684f864ad /cpp/src/slice2cs/Gen.cpp
parentAdded shell launch scripts for mono executables. (diff)
downloadice-86103da7a43352d98bae256d1ac3706829cefe45.tar.bz2
ice-86103da7a43352d98bae256d1ac3706829cefe45.tar.xz
ice-86103da7a43352d98bae256d1ac3706829cefe45.zip
Added work-around for broken Mono DefaultInvariant comparer.
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index df275353f44..429ce2c04c8 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -196,12 +196,32 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << sp << nl << "public override bool ice_isA(string s)";
_out << sb;
+ _out.zeroIndent();
+ _out << nl << "#if __MonoCS__ // Bug in Mono 1.0 DefaultInvariant";
+ _out.restoreIndent();
+ _out << nl << "return _System.Array.BinarySearch(__ids, s) >= 0;";
+ _out.zeroIndent();
+ _out << nl << "#else";
+ _out.restoreIndent();
_out << nl << "return _System.Array.BinarySearch(__ids, s, _System.Collections.Comparer.DefaultInvariant) >= 0;";
+ _out.zeroIndent();
+ _out << nl << "#endif";
+ _out.restoreIndent();
_out << eb;
_out << sp << nl << "public override bool ice_isA(string s, Ice.Current __current)";
_out << sb;
+ _out.zeroIndent();
+ _out << nl << "#if __MonoCS__ // Bug in Mono 1.0 DefaultInvariant";
+ _out.restoreIndent();
+ _out << nl << "return _System.Array.BinarySearch(__ids, s) >= 0;";
+ _out.zeroIndent();
+ _out << nl << "#else";
+ _out.restoreIndent();
_out << nl << "return _System.Array.BinarySearch(__ids, s, _System.Collections.Comparer.DefaultInvariant) >= 0;";
+ _out.zeroIndent();
+ _out << nl << "#endif";
+ _out.restoreIndent();
_out << eb;
_out << sp << nl << "public override string[] ice_ids()";
@@ -528,8 +548,18 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << sp << nl << "public override IceInternal.DispatchStatus "
<< "__dispatch(IceInternal.Incoming __in, Ice.Current __current)";
_out << sb;
+ _out.zeroIndent();
+ _out << nl << "#if __MonoCS__ // Bug in Mono 1.0 DefaultInvariant";
+ _out.restoreIndent();
+ _out << nl << "int pos = _System.Array.BinarySearch(__all, __current.operation);";
+ _out.zeroIndent();
+ _out << nl << "#else";
+ _out.restoreIndent();
_out << nl << "int pos = _System.Array.BinarySearch(__all, __current.operation, "
<< "_System.Collections.Comparer.DefaultInvariant);";
+ _out.zeroIndent();
+ _out << nl << "#endif";
+ _out.restoreIndent();
_out << nl << "if(pos < 0)";
_out << sb;
_out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";