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/slice2vb/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/slice2vb/Main.cpp')
-rw-r--r-- | cpp/src/slice2vb/Main.cpp | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/cpp/src/slice2vb/Main.cpp b/cpp/src/slice2vb/Main.cpp index c17777909a4..b5714591ac9 100644 --- a/cpp/src/slice2vb/Main.cpp +++ b/cpp/src/slice2vb/Main.cpp @@ -26,6 +26,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" "--output-dir DIR Create files in the directory DIR.\n" "--tie Generate TIE classes.\n" "--impl Generate sample implementations.\n" @@ -44,6 +45,7 @@ main(int argc, char* argv[]) { string cppArgs; vector<string> includePaths; + bool preprocess; string output; bool tie; bool impl; @@ -118,6 +120,7 @@ main(int argc, char* argv[]) cppArgs += " -I" + *i; } } + preprocess = opts.isSet("E"); if(opts.isSet("output-dir")) { output = opts.optArg("output-dir"); @@ -165,46 +168,65 @@ main(int argc, char* argv[]) return EXIT_FAILURE; } - UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive); - int parseStatus = p->parse(cppHandle, debug); - - if(!icecpp.close()) - { - return EXIT_FAILURE; - } - - if(parseStatus == EXIT_FAILURE) + if(preprocess) { - status = EXIT_FAILURE; + char buf[4096]; + while(fgets(buf, sizeof(buf), cppHandle) != NULL) + { + if(fputs(buf, stdout) == EOF) + { + return EXIT_FAILURE; + } + } + if(!icecpp.close()) + { + return EXIT_FAILURE; + } } else { - Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream); - if(!gen) + UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive); + int parseStatus = p->parse(cppHandle, debug); + + if(!icecpp.close()) { p->destroy(); return EXIT_FAILURE; - } - gen.generate(p); - if(tie) - { - gen.generateTie(p); - } - if(impl) + } + + if(parseStatus == EXIT_FAILURE) { - gen.generateImpl(p); + status = EXIT_FAILURE; } - if(implTie) + else { - gen.generateImplTie(p); + Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream); + if(!gen) + { + p->destroy(); + return EXIT_FAILURE; + } + gen.generate(p); + if(tie) + { + gen.generateTie(p); + } + if(impl) + { + gen.generateImpl(p); + } + if(implTie) + { + gen.generateImplTie(p); + } + if(checksum) + { + gen.generateChecksums(p); + } } - if(checksum) - { - gen.generateChecksums(p); - } - } - p->destroy(); + p->destroy(); + } } } |