From: Peter S. <sch...@us...> - 2007-01-08 11:19:46
|
Update of /cvsroot/plb4jedit/plb4jedit/Plb/src/java/net/sf/plb4jedit/plb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23254/Plb/src/java/net/sf/plb4jedit/plb Modified Files: PLBCompiler.java ProcessRunner.java Log Message: debug infos Index: PLBCompiler.java =================================================================== RCS file: /cvsroot/plb4jedit/plb4jedit/Plb/src/java/net/sf/plb4jedit/plb/PLBCompiler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PLBCompiler.java 5 Jan 2007 17:48:11 -0000 1.2 +++ PLBCompiler.java 8 Jan 2007 11:19:40 -0000 1.3 @@ -31,7 +31,6 @@ public PLBCompiler() throws IOException { tmp = File.createTempFile("PLBCompiler",".log"); - tmp.deleteOnExit(); plbEnv = new Properties(); } @@ -51,7 +50,7 @@ } } - public void compile(File plbSource) throws Exception { + public int compile(File plbSource) throws Exception { if (plbSource == null || !plbSource.exists()) { throw new IllegalArgumentException("PLB Source does not exist "); } @@ -61,21 +60,29 @@ String[] cmd; int i = -1; + final int ANZ_OPTS=14; if (StringUtils.isNotBlank(plbwinINIFile)) { - cmd = new String[14]; + cmd = new String[ANZ_OPTS+3]; cmd[++i] = plbEnv.getProperty("RSI_PLBCMD","plb"); cmd[++i] = "-h"; cmd[++i] = "-i"; cmd[++i] = plbwinINIFile; } else { - cmd = new String[11]; + cmd = new String[ANZ_OPTS]; cmd[++i] = plbEnv.getProperty("RSI_PLBCMD","plb"); } cmd[++i] = "plbcmp"; cmd[++i] = plbSource.getAbsolutePath(); cmd[++i] = plbEnv.getProperty("RSI_PLCDIR") + File.separator + StringUtils.replace(name, ".dbs", ".plc"); - cmd[++i] = "-EP"; - cmd[++i] = "\"x header\""; + cmd[++i] = "-E=dbs"; + cmd[++i] = "E"; + cmd[++i] = "P"; + if (File.separator.equals("/")) { + cmd[++i] = "\"x header\""; + } else { + cmd[++i] = "\"x header\""; + } + cmd[++i] = "99999"; cmd[++i] = "S"; cmd[++i] = "ZH"; cmd[++i] = "ZT"; @@ -83,7 +90,10 @@ cmd[++i] = "ZV"; PrintStream devnull = new PrintStream(tmp); - ProcessRunner.exec(cmd, plbEnv, workingDir, devnull, devnull); + if (!Boolean.parseBoolean(plbEnv.getProperty("RSI_DEBUG","false"))) { + tmp.deleteOnExit(); + } + return ProcessRunner.exec(cmd, plbEnv, workingDir, devnull, devnull); } public void analyzeListing(File plbSource) throws Exception { @@ -123,7 +133,10 @@ for (int i = 0; i < args.length; i++) { System.out.println("Compiling " + args[i]); File plbSource = new File(args[i]); - compiler.compile(plbSource); + int returnCode = compiler.compile(plbSource); + if (returnCode != 0) { + System.err.println("PLB Compiler returned errorcode '" + returnCode + "'"); + } compiler.analyzeListing(plbSource); } } Index: ProcessRunner.java =================================================================== RCS file: /cvsroot/plb4jedit/plb4jedit/Plb/src/java/net/sf/plb4jedit/plb/ProcessRunner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ProcessRunner.java 5 Jan 2007 16:58:13 -0000 1.1 +++ ProcessRunner.java 8 Jan 2007 11:19:40 -0000 1.2 @@ -16,10 +16,11 @@ */ public class ProcessRunner { + private ProcessRunner() { // avoid instances of this class } - + /** * execute a command via {@link Runtime.exec(String command, String envp[], File dir)} avoiding * some <a href="http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html">traps</a> @@ -75,7 +76,7 @@ environment = new String[0]; } - if (false) { + if (Boolean.parseBoolean(envp.getProperty("RSI_DEBUG","false"))) { System.out.println("++++++++++++++ ProcessRunner debug information ++++++++++++++:"); if (workingDir != null) { System.out.println("Working directory="+workingDir.getAbsolutePath()+"\nEnvironment:"); |