diff options
Diffstat (limited to 'cpp/src/slice2docbook/Main.cpp')
-rw-r--r-- | cpp/src/slice2docbook/Main.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp index 4850ec97814..4f0f063526b 100644 --- a/cpp/src/slice2docbook/Main.cpp +++ b/cpp/src/slice2docbook/Main.cpp @@ -27,12 +27,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" "-s, --stand-alone Create stand-alone docbook file.\n" "--chapter Use \"chapter\" instead of \"section\" as\n" " top-level element.\n" - "--noindex Suppress generation of index pages.\n" - "--sort-fields Sort fields of structures, classes, and exceptions.\n" + "--noindex Suppress generation of index pages.\n" + "--sort-fields Sort fields of structures, classes, and exceptions.\n" "-d, --debug Print debug messages.\n" "--ice Permit `Ice' prefix (for building Ice source code only)\n" ; @@ -64,21 +64,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; @@ -86,19 +86,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); } optargs = opts.argVec("I"); for(i = optargs.begin(); i != optargs.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::addQuotes(*i); } bool preprocess = opts.isSet("E"); @@ -119,9 +119,9 @@ main(int argc, char* argv[]) if(args.empty()) { - cerr << argv[0] << ": no docbook file specified" << endl; - usage(argv[0]); - return EXIT_FAILURE; + cerr << argv[0] << ": no docbook file specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; } string docbook(args[0]); @@ -129,20 +129,20 @@ main(int argc, char* argv[]) string::size_type pos = docbook.rfind('.'); if(pos != string::npos) { - suffix = docbook.substr(pos); - transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower); + suffix = docbook.substr(pos); + transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower); } if(suffix != ".sgml") { - cerr << argv[0] << ": docbook file must end with `.sgml'" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": docbook file must end with `.sgml'" << endl; + return EXIT_FAILURE; } if(args.size() < 2) { - cerr << argv[0] << ": no input file" << endl; - usage(argv[0]); - return EXIT_FAILURE; + cerr << argv[0] << ": no input file" << endl; + usage(argv[0]); + return EXIT_FAILURE; } UnitPtr p = Unit::createUnit(true, false, ice, caseSensitive); @@ -151,47 +151,47 @@ main(int argc, char* argv[]) for(vector<string>::size_type idx = 1; idx < args.size(); ++idx) { - Preprocessor icecpp(argv[0], args[idx], cppArgs); - FILE* cppHandle = icecpp.preprocess(true); - - if(cppHandle == 0) - { - p->destroy(); - return EXIT_FAILURE; - } - if(preprocess) - { - char buf[4096]; - while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL) - { - if(fputs(buf, stdout) == EOF) - { - p->destroy(); - return EXIT_FAILURE; - } - } - } - else - { - status = p->parse(cppHandle, debug); - } - - if(!icecpp.close()) - { - p->destroy(); - return EXIT_FAILURE; - } + Preprocessor icecpp(argv[0], args[idx], cppArgs); + FILE* cppHandle = icecpp.preprocess(true); + + if(cppHandle == 0) + { + p->destroy(); + return EXIT_FAILURE; + } + if(preprocess) + { + char buf[4096]; + while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL) + { + if(fputs(buf, stdout) == EOF) + { + p->destroy(); + return EXIT_FAILURE; + } + } + } + else + { + status = p->parse(cppHandle, debug); + } + + if(!icecpp.close()) + { + p->destroy(); + return EXIT_FAILURE; + } } if(status == EXIT_SUCCESS && !preprocess) { - Gen gen(argv[0], docbook, standAlone, chapter, noIndex, sortFields); - if(!gen) - { - p->destroy(); - return EXIT_FAILURE; - } - gen.generate(p); + Gen gen(argv[0], docbook, standAlone, chapter, noIndex, sortFields); + if(!gen) + { + p->destroy(); + return EXIT_FAILURE; + } + gen.generate(p); } p->destroy(); |