diff options
Diffstat (limited to 'cpp/src/slice2java/Main.cpp')
-rw-r--r-- | cpp/src/slice2java/Main.cpp | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index b2014f0e247..6daeac74c03 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -30,12 +30,12 @@ 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" "--tie Generate TIE classes.\n" "--impl Generate sample implementations.\n" "--impl-tie Generate sample TIE implementations.\n" - "--depend Generate Makefile dependencies.\n" + "--depend Generate Makefile dependencies.\n" "-d, --debug Print debug messages.\n" "--ice Permit `Ice' prefix (for building Ice source code only)\n" "--checksum CLASS Generate checksums for Slice definitions into CLASS.\n" @@ -75,20 +75,20 @@ main(int argc, char* argv[]) catch(const IceUtil::BadOptException& e) { cerr << argv[0] << ": " << e.reason << endl; - usage(argv[0]); - return EXIT_FAILURE; + 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; @@ -96,19 +96,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"); @@ -157,101 +157,101 @@ main(int argc, char* argv[]) for(i = args.begin(); i != args.end(); ++i) { - if(depend) - { - Preprocessor icecpp(argv[0], *i, cppArgs); - icecpp.printMakefileDependencies(Preprocessor::Java); - } - else - { - Preprocessor icecpp(argv[0], *i, cppArgs); - FILE* cppHandle = icecpp.preprocess(false); - - if(cppHandle == 0) - { - 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 p = Unit::createUnit(false, false, ice, caseSensitive, globalMetadata); - int parseStatus = p->parse(cppHandle, debug, Ice); - - if(!icecpp.close()) - { - p->destroy(); - return EXIT_FAILURE; - } - - if(parseStatus == EXIT_FAILURE) - { - status = EXIT_FAILURE; - } - else - { - Gen gen(argv[0], icecpp.getBaseName(), includePaths, output); - if(!gen) - { - p->destroy(); - return EXIT_FAILURE; - } - gen.generate(p, stream); - if(tie) - { - gen.generateTie(p); - } - if(impl) - { - gen.generateImpl(p); - } - if(implTie) - { - gen.generateImplTie(p); - } - if(!checksumClass.empty()) - { - // - // Calculate checksums for the Slice definitions in the unit. - // - ChecksumMap m = createChecksums(p); - copy(m.begin(), m.end(), inserter(checksums, checksums.begin())); - } - } - p->destroy(); - } - } + if(depend) + { + Preprocessor icecpp(argv[0], *i, cppArgs); + icecpp.printMakefileDependencies(Preprocessor::Java); + } + else + { + Preprocessor icecpp(argv[0], *i, cppArgs); + FILE* cppHandle = icecpp.preprocess(false); + + if(cppHandle == 0) + { + 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 p = Unit::createUnit(false, false, ice, caseSensitive, globalMetadata); + int parseStatus = p->parse(cppHandle, debug, Ice); + + if(!icecpp.close()) + { + p->destroy(); + return EXIT_FAILURE; + } + + if(parseStatus == EXIT_FAILURE) + { + status = EXIT_FAILURE; + } + else + { + Gen gen(argv[0], icecpp.getBaseName(), includePaths, output); + if(!gen) + { + p->destroy(); + return EXIT_FAILURE; + } + gen.generate(p, stream); + if(tie) + { + gen.generateTie(p); + } + if(impl) + { + gen.generateImpl(p); + } + if(implTie) + { + gen.generateImplTie(p); + } + if(!checksumClass.empty()) + { + // + // Calculate checksums for the Slice definitions in the unit. + // + ChecksumMap m = createChecksums(p); + copy(m.begin(), m.end(), inserter(checksums, checksums.begin())); + } + } + p->destroy(); + } + } } if(!checksumClass.empty()) { - // - // Look for the Java2 metadata. - // - bool java2 = false; - for(StringList::iterator p = globalMetadata.begin(); p != globalMetadata.end(); ++p) - { - if((*p) == "java:java2") - { - java2 = true; - break; - } - } - Gen::writeChecksumClass(checksumClass, output, checksums, java2); + // + // Look for the Java2 metadata. + // + bool java2 = false; + for(StringList::iterator p = globalMetadata.begin(); p != globalMetadata.end(); ++p) + { + if((*p) == "java:java2") + { + java2 = true; + break; + } + } + Gen::writeChecksumClass(checksumClass, output, checksums, java2); } return status; |