From: pcm <pcm...@us...> - 2005-05-11 18:05:53
|
Update of /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13039/src/gov/nasa/jpf Modified Files: JPF.java Log Message: * some more script fixes (*.bat) NOT tested yet * improvised check for unknown '-' options prior to starting the VM. NOTE - this requires all known options to be consumed (nullified) before this is done, so the check should be the very last thing before the Search is set off Index: JPF.java =================================================================== RCS file: /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/JPF.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- JPF.java 26 Apr 2005 19:43:55 -0000 1.1.1.1 +++ JPF.java 11 May 2005 18:05:34 -0000 1.2 @@ -170,10 +170,30 @@ return false; } + /** + * this assumes that we have checked and 'consumed' (nullified) all known + * options, so we just have to check for any '-' option prior to the + * target class name + */ + static void checkUnknownArgs (String[] args) { + for ( int i=0; i<args.length; i++) { + if (args[i] != null) { + if (args[i].charAt(0) == '-') { + Debug.println(Debug.ERROR, "! Warning - unknown command line option: " + args[i]); + } + else { + // this is supposed to be the target class name - everything that follows + // is supposed to be processed by the program under test + break; + } + } + } + } + public static void printBanner (Config config) { System.out.print("Java Pathfinder Model Checker v"); System.out.print(config.getString("jpf.version", "3.1x")); - System.out.println(" - (C) 1999-2004 RIACS/NASA Ames Research Center"); + System.out.println(" - (C) 1999-2005 RIACS/NASA Ames Research Center"); } public static void main(String[] args) { @@ -194,6 +214,8 @@ } if (conf.getTargetArg() != null) { + checkUnknownArgs(args); + JPF jpf = new JPF(conf); jpf.run(); } @@ -273,26 +295,6 @@ return null; } - /** - * Do whatever has to be done with the options before we create the JPF - * object, esp. banner or usage printing. Return 'false' if there is no need - * for further processing - */ - boolean processOptions() { - - if (config.hasArg("-d(ump(-config)?)?")) { - config.printContents(new PrintWriter(System.out)); - } - - if ((config.getArgs() == null) || config.hasArg("-h(elp)?")) { - showUsage(); - return false; - } - - // do we have an application or path file specifier - return config.hasArg("[~-][a-zA-Z0-9_]*"); - } - static void showUsage() { System.out .println("Usage: \"java [<vm-option>..] gov.nasa.jpf.JPF [<jpf-option>..] [<app> [<app-arg>..]]"); |