diff options
author | Michi Henning <michi@zeroc.com> | 2005-03-24 04:30:34 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-03-24 04:30:34 +0000 |
commit | 00be99a369f583b1146e07c89425153cfa93a7ab (patch) | |
tree | 7aa4882d47e931a9e32e5614ccf5a61c78c4c5f1 /cpp/src/slice2docbook/Main.cpp | |
parent | Added slice2cppe and slice2javae to "all" target for VC++ and fixed (diff) | |
download | ice-00be99a369f583b1146e07c89425153cfa93a7ab.tar.bz2 ice-00be99a369f583b1146e07c89425153cfa93a7ab.tar.xz ice-00be99a369f583b1146e07c89425153cfa93a7ab.zip |
Added -E option to Slice compilers.
Diffstat (limited to 'cpp/src/slice2docbook/Main.cpp')
-rw-r--r-- | cpp/src/slice2docbook/Main.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp index 8e89a9ab85e..0c2459a7591 100644 --- a/cpp/src/slice2docbook/Main.cpp +++ b/cpp/src/slice2docbook/Main.cpp @@ -27,6 +27,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" "-s, --stand-alone Create stand-alone docbook file.\n" "--no-globals Don't document the global module.\n" "--chapter Use \"chapter\" instead of \"section\" as\n" @@ -42,6 +43,7 @@ int main(int argc, char* argv[]) { string cppArgs; + bool preprocess; bool standAlone; bool noGlobals; bool chapter; @@ -110,6 +112,7 @@ main(int argc, char* argv[]) cppArgs += " -I" + *i; } } + preprocess = opts.isSet("-E"); standAlone = opts.isSet("s") || opts.isSet("stand-alone"); noGlobals = opts.isSet("no-globals"); chapter = opts.isSet("chapter"); @@ -160,8 +163,22 @@ main(int argc, char* argv[]) p->destroy(); return EXIT_FAILURE; } - - status = p->parse(cppHandle, debug); + if(preprocess) + { + char buf[4096]; + while(fgets(buf, sizeof(buf), cppHandle) != NULL) + { + if(fputs(buf, stdout) == EOF) + { + p->destroy(); + return EXIT_FAILURE; + } + } + } + else + { + status = p->parse(cppHandle, debug); + } if(!icecpp.close()) { @@ -170,7 +187,7 @@ main(int argc, char* argv[]) } } - if(status == EXIT_SUCCESS) + if(status == EXIT_SUCCESS && !preprocess) { Gen gen(argv[0], docbook, standAlone, noGlobals, chapter, noIndex); if(!gen) |