summaryrefslogtreecommitdiff
path: root/cpp/src/slice2freeze/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2freeze/Main.cpp')
-rw-r--r--cpp/src/slice2freeze/Main.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index cbffb460a3f..4978f0a699a 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -12,9 +12,9 @@
#include <IceUtil/CtrlCHandler.h>
#include <IceUtil/StaticMutex.h>
#include <Slice/Preprocessor.h>
-#include <Slice/Util.h>
#include <Slice/CPlusPlusUtil.h>
#include <Slice/FileTracker.h>
+#include <Slice/Util.h>
#include <IceUtil/OutputUtil.h>
#include <IceUtil/StringUtil.h>
#include <cstring>
@@ -702,8 +702,7 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di
else
{
C << nl << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << " __lowerCaseIndex = __index;";
- C << nl << "std::transform(__lowerCaseIndex.begin(), __lowerCaseIndex.end(), __lowerCaseIndex.begin(), tolower);";
+ << " __lowerCaseIndex = IceUtilInternal::toLower(__index);";
valueS = "__lowerCaseIndex";
}
@@ -1012,10 +1011,9 @@ writeDict(const string& n, const UnitPtr& u, const Dict& dict, Output& H, Output
}
if(containsSequence)
{
- cerr << n << ": warning: use of sequences in dictionary keys has been deprecated";
+ getErrorStream() << n << ": warning: use of sequences in dictionary keys has been deprecated";
}
-
if(index.caseSensitive == false)
{
//
@@ -1089,10 +1087,9 @@ writeDict(const string& n, const UnitPtr& u, const Dict& dict, Output& H, Output
}
if(containsSequence)
{
- cerr << n << ": warning: use of sequences in dictionary keys has been deprecated";
+ getErrorStream() << n << ": warning: use of sequences in dictionary keys has been deprecated";
}
-
if(index.caseSensitive == false)
{
//
@@ -1237,8 +1234,7 @@ writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& member
}
else
{
- C << nl << typeToString(memberType, false) << " __lowerCaseIndex = __index;";
- C << nl << "std::transform(__lowerCaseIndex.begin(), __lowerCaseIndex.end(), __lowerCaseIndex.begin(), tolower);";
+ C << nl << typeToString(memberType, false) << " __lowerCaseIndex = IceUtilInternal::toLower(__index);";
valueS = "__lowerCaseIndex";
}
@@ -1445,6 +1441,7 @@ gen(const string& name, const UnitPtr& u, const vector<string>& includePaths, co
}
CPP << "\n#include <Ice/BasicStream.h>";
+ CPP << "\n#include <IceUtil/StringUtil.h>";
CPP << "\n#include <";
if(include.size())
{
@@ -1506,11 +1503,14 @@ main(int argc, char* argv[])
vector<string> args;
try
{
+#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600)
+ IceUtil::DummyBCC dummy;
+#endif
args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtilInternal::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
+ cerr << argv[0] << ": error: " << e.reason << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1650,8 +1650,8 @@ main(int argc, char* argv[])
{
if(s != "sort")
{
- cerr << argv[0] << ": " << *i
- << ": nothing or ',sort' expected after value-type" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": nothing or ',sort' expected after value-type"
+ << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1663,8 +1663,8 @@ main(int argc, char* argv[])
s.erase(0, pos + 1);
if(sort != "sort")
{
- cerr << argv[0] << ": " << *i
- << ": nothing or ',sort' expected after value-type" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": nothing or ',sort' expected after value-type"
+ << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1675,21 +1675,21 @@ main(int argc, char* argv[])
if(dict.name.empty())
{
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(dict.key.empty())
{
- cerr << argv[0] << ": " << *i << ": no key specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no key specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(dict.value.empty())
{
- cerr << argv[0] << ": " << *i << ": no value specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no value specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1734,28 +1734,29 @@ main(int argc, char* argv[])
if(index.name.empty())
{
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(index.type.empty())
{
- cerr << argv[0] << ": " << *i << ": no type specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no type specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(index.member.empty())
{
- cerr << argv[0] << ": " << *i << ": no member specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no member specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(caseString != "case-sensitive" && caseString != "case-insensitive")
{
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or "
+ << "`case-insensitive'" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1815,7 +1816,7 @@ main(int argc, char* argv[])
}
else
{
- cerr << argv[0] << ": " << *i << ": syntax error" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": syntax error" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1853,7 +1854,7 @@ main(int argc, char* argv[])
}
else
{
- cerr << argv[0] << ": " << *i << ": syntax error" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": syntax error" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1863,7 +1864,7 @@ main(int argc, char* argv[])
if(dictName.empty())
{
- cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": no dictionary specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1875,7 +1876,7 @@ main(int argc, char* argv[])
{
if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
{
- cerr << argv[0] << ": --dict-index " << *i
+ getErrorStream() << argv[0] << ": error: --dict-index " << *i
<< ": this dict-index is defined twice" << endl;
return EXIT_FAILURE;
}
@@ -1886,7 +1887,7 @@ main(int argc, char* argv[])
}
if(!found)
{
- cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
+ getErrorStream() << argv[0] << ": error: " << *i << ": unknown dictionary" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1902,14 +1903,14 @@ main(int argc, char* argv[])
if(dicts.empty() && indices.empty())
{
- cerr << argv[0] << ": no Freeze types specified" << endl;
+ getErrorStream() << argv[0] << ": error: no Freeze types specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(args.empty())
{
- cerr << argv[0] << ": no file name base specified" << endl;
+ getErrorStream() << argv[0] << ": error: no file name base specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
@@ -1991,7 +1992,7 @@ main(int argc, char* argv[])
// created files.
FileTracker::instance()->cleanup();
u->destroy();
- cerr << argv[0] << ": " << ex << endl;
+ getErrorStream() << argv[0] << ": error: " << ex << endl;
return EXIT_FAILURE;
}
catch(const Slice::FileException& ex)
@@ -2000,12 +2001,12 @@ main(int argc, char* argv[])
// created files.
FileTracker::instance()->cleanup();
u->destroy();
- cerr << argv[0] << ": " << ex.reason() << endl;
+ getErrorStream() << argv[0] << ": error: " << ex.reason() << endl;
return EXIT_FAILURE;
}
catch(...)
{
- cerr << argv[0] << ": unknown exception" << endl;
+ getErrorStream() << argv[0] << ": error: unknown exception" << endl;
FileTracker::instance()->cleanup();
u->destroy();
return EXIT_FAILURE;