summaryrefslogtreecommitdiff
path: root/cpp/src/slice2py/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2py/Main.cpp')
-rw-r--r--cpp/src/slice2py/Main.cpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp
index dcb1fd7b5d4..c0ff6b7dce0 100644
--- a/cpp/src/slice2py/Main.cpp
+++ b/cpp/src/slice2py/Main.cpp
@@ -369,7 +369,7 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
@@ -407,21 +407,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -429,19 +429,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -481,86 +481,86 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr u = Unit::createUnit(false, all, ice, caseSensitive);
- int parseStatus = u->parse(cppHandle, debug);
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- string base = icecpp.getBaseName();
- string::size_type pos = base.find_last_of("/\\");
- if(pos != string::npos)
- {
- base.erase(0, pos + 1);
- }
-
- //
- // Append the suffix "_ice" to the filename in order to avoid any conflicts
- // with Slice module names. For example, if the file Test.ice defines a
- // Slice module named "Test", then we couldn't create a Python package named
- // "Test" and also call the generated file "Test.py".
- //
- string file = prefix + base + "_ice.py";
- if(!output.empty())
- {
- file = output + '/' + file;
- }
-
- IceUtil::Output out;
- out.open(file.c_str());
- if(!out)
- {
- cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
-
- printHeader(out);
- out << "\n# Generated from file `" << base << ".ice'\n";
-
- //
- // Generate the Python mapping.
- //
- generate(u, all, checksum, includePaths, out);
-
- //
- // Create or update the Python package hierarchy.
- //
- if(!noPackage)
- {
- PackageVisitor visitor(argv[0], prefix + base + "_ice", output);
- u->visit(&visitor, false);
- }
- }
-
- u->destroy();
- }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr u = Unit::createUnit(false, all, ice, caseSensitive);
+ int parseStatus = u->parse(cppHandle, debug);
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ string base = icecpp.getBaseName();
+ string::size_type pos = base.find_last_of("/\\");
+ if(pos != string::npos)
+ {
+ base.erase(0, pos + 1);
+ }
+
+ //
+ // Append the suffix "_ice" to the filename in order to avoid any conflicts
+ // with Slice module names. For example, if the file Test.ice defines a
+ // Slice module named "Test", then we couldn't create a Python package named
+ // "Test" and also call the generated file "Test.py".
+ //
+ string file = prefix + base + "_ice.py";
+ if(!output.empty())
+ {
+ file = output + '/' + file;
+ }
+
+ IceUtil::Output out;
+ out.open(file.c_str());
+ if(!out)
+ {
+ cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ printHeader(out);
+ out << "\n# Generated from file `" << base << ".ice'\n";
+
+ //
+ // Generate the Python mapping.
+ //
+ generate(u, all, checksum, includePaths, out);
+
+ //
+ // Create or update the Python package hierarchy.
+ //
+ if(!noPackage)
+ {
+ PackageVisitor visitor(argv[0], prefix + base + "_ice", output);
+ u->visit(&visitor, false);
+ }
+ }
+
+ u->destroy();
+ }
}
return status;