private static void printOutputHelp(PrintStream ps) {
   ps.println("No " + outputFileOpt.getArgDescription() + " specified !");
   ps.println(
       "Please provide an "
           + outputFileOpt.getArgDescription()
           + " by using the option : "
           + outputFileOpt.getPrototype());
   ps.println();
   printHelp(ps);
 }
 public static void printExecutableHelp(final PrintStream ps) {
   ps.println(
       "No "
           + executableOpt.getArgDescription()
           + "defined. Please use "
           + executableOpt.getPrototype()
           + " option !");
   ps.println();
   printHelp(ps);
 }
 private static void printMissingInputFileHelp(PrintStream ps) {
   ps.println(
       "Specifyed "
           + inputFileOpt.getArgDescription()
           + " : \""
           + inputFileOpt.getValue(cmdLine)
           + "\" is not valid !");
   ps.println();
   printHelp(ps);
 }
 private static void printDependencyWhileCompilingHelp(PrintStream ps) {
   ps.println(
       "Option "
           + dependencyFileOpt.getPrototype()
           + " is not compatible with "
           + compileOpt.getPrototype());
   ps.println();
   printHelp(ps);
 }
 private static void printUsage(final PrintStream ps) {
   ps.println(
       "Usage: "
           + getProgramName()
           + " ACTION "
           + inputFileOpt.getPrototype()
           + outputFileOpt.getPrototype()
           + " [OPTIONS]+");
   ps.println(
       "  where <ACTION> is either "
           + preprocessOpt.getPrototype()
           + " or "
           + compileOpt.getPrototype());
   ps.println(
       "  and <"
           + inputFileOpt.getArgDescription()
           + "> is the name of the file to"
           + " be compiled, ");
   ps.println(
       "  and <"
           + outputFileOpt.getArgDescription()
           + "> is the name of the output file to be created.");
 }
  /**
   * @param args
   * @throws InvalidCommandLineException
   */
  public void run(String[] args) {
    int dot = args[0].lastIndexOf(java.io.File.pathSeparatorChar);
    if (dot == -1) {
      executableOpt =
          new CmdArgument(
              ID_PREFIX + "Executable",
              null,
              "executable",
              "The path of the compiler executable, or simply its name if it ",
              "EXECUTABLE",
              null,
              false);
    } else {
      executableOpt =
          new CmdArgument(
              ID_PREFIX + "Executable",
              args[0].substring(+1, args[0].length()),
              "executable",
              "The path of the compiler executable, or simply its name if it ",
              "EXECUTABLE",
              null,
              false);
    }

    options.addOptions(
        executableOpt,
        helpOpt,
        preprocessOpt,
        compileOpt,
        inputFileOpt,
        outputFileOpt,
        flagsOpt,
        defineOpt,
        includeDirOpt,
        preIncludeFileOpt,
        dependencyFileOpt);
    try {
      cmdLine = CommandLine.parseArgs(options, false, args);
    } catch (InvalidCommandLineException e) {
      System.out.println(e.getMessage());
      System.out.println();
      printHelp(System.out);
      System.exit(-1);
    }
    // If help is asked, print it and exit.
    if (helpOpt.isPresent(cmdLine)) {
      printHelp(System.out);
      System.exit(0);
    }
    // If two actions are specified exit.
    if (compileOpt.isPresent(cmdLine) && preprocessOpt.isPresent(cmdLine)) {
      printActionHelp(System.out);
      System.exit(-1);
    }
    // If no action are specified exit.
    if (!compileOpt.isPresent(cmdLine) && !preprocessOpt.isPresent(cmdLine)) {
      printActionHelp(System.out);
      System.exit(-1);
    }
    if (!inputFileOpt.isPresent(cmdLine)) {
      printInputHelp(System.out);
      System.exit(-1);
    }
    if (!outputFileOpt.isPresent(cmdLine)) {
      printOutputHelp(System.out);
      System.exit(-1);
    }
    if (!(new File(inputFileOpt.getValue(cmdLine))).isFile()) {
      printMissingInputFileHelp(System.out);
      System.exit(-1);
    }

    if (preprocessOpt.isPresent(cmdLine)) {
      executor.preprocess(cmdLine);
      System.exit(0);
    }

    if (dependencyFileOpt.isPresent(cmdLine)) {
      printDependencyWhileCompilingHelp(System.out);
      System.exit(-1);
    }
    if (compileOpt.isPresent(cmdLine)) {
      executor.compile(cmdLine);
      System.exit(0);
    }
  }