summaryrefslogtreecommitdiff
path: root/cpp/src/slice2freeze/Main.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-03-24 04:30:34 +0000
committerMichi Henning <michi@zeroc.com>2005-03-24 04:30:34 +0000
commit00be99a369f583b1146e07c89425153cfa93a7ab (patch)
tree7aa4882d47e931a9e32e5614ccf5a61c78c4c5f1 /cpp/src/slice2freeze/Main.cpp
parentAdded slice2cppe and slice2javae to "all" target for VC++ and fixed (diff)
downloadice-00be99a369f583b1146e07c89425153cfa93a7ab.tar.bz2
ice-00be99a369f583b1146e07c89425153cfa93a7ab.tar.xz
ice-00be99a369f583b1146e07c89425153cfa93a7ab.zip
Added -E option to Slice compilers.
Diffstat (limited to 'cpp/src/slice2freeze/Main.cpp')
-rw-r--r--cpp/src/slice2freeze/Main.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index 716ada2ec6d..22bce317e9f 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -58,6 +58,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"
"--include-dir DIR Use DIR as the header include directory in source files.\n"
"--dll-export SYMBOL Use SYMBOL for DLL exports.\n"
"--dict NAME,KEY,VALUE Create a Freeze dictionary with the name NAME,\n"
@@ -963,6 +964,7 @@ main(int argc, char* argv[])
string headerExtension;
string sourceExtension;
vector<string> includePaths;
+ bool preprocess;
string include;
string dllExport;
vector<Dict> dicts;
@@ -980,6 +982,7 @@ main(int argc, char* argv[])
opts.addOpt("D", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
opts.addOpt("U", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
opts.addOpt("I", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
+ opts.addOpt("E");
opts.addOpt("", "include-dir", IceUtil::Options::NeedArg);
opts.addOpt("", "dll-export", IceUtil::Options::NeedArg);
opts.addOpt("", "dict", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat);
@@ -1040,6 +1043,7 @@ main(int argc, char* argv[])
cppArgs += " -I" + *i;
}
}
+ preprocess= opts.isSet("E");
if(opts.isSet("include-dir"))
{
include = opts.optArg("include-dir");
@@ -1302,8 +1306,23 @@ main(int argc, char* argv[])
u->destroy();
return EXIT_FAILURE;
}
-
- status = u->parse(cppHandle, debug);
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, sizeof(buf), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+ status = u->parse(cppHandle, debug);
+ }
if(!icecpp.close())
{
@@ -1312,7 +1331,7 @@ main(int argc, char* argv[])
}
}
- if(status == EXIT_SUCCESS)
+ if(status == EXIT_SUCCESS && !preprocess)
{
u->mergeModules();
u->sort();