From: <jo...@us...> - 2008-04-16 18:27:05
|
Revision: 243 http://mspsim.svn.sourceforge.net/mspsim/?rev=243&view=rev Author: joxe Date: 2008-04-16 11:26:57 -0700 (Wed, 16 Apr 2008) Log Message: ----------- added window commands. Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandContext.java mspsim/se/sics/mspsim/cli/CommandHandler.java mspsim/se/sics/mspsim/cli/ExecCommand.java mspsim/se/sics/mspsim/cli/MiscCommands.java mspsim/se/sics/mspsim/cli/WindowTarget.java Modified: mspsim/se/sics/mspsim/cli/CommandContext.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandContext.java 2008-04-16 16:42:52 UTC (rev 242) +++ mspsim/se/sics/mspsim/cli/CommandContext.java 2008-04-16 18:26:57 UTC (rev 243) @@ -164,7 +164,7 @@ } public int executeCommand(String command) { - return commandHandler.executeCommand(command); + return commandHandler.executeCommand(command, this); } public String toString() { Modified: mspsim/se/sics/mspsim/cli/CommandHandler.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandHandler.java 2008-04-16 16:42:52 UTC (rev 242) +++ mspsim/se/sics/mspsim/cli/CommandHandler.java 2008-04-16 18:26:57 UTC (rev 243) @@ -80,7 +80,7 @@ } if (line != null && line.length() > 0) { lastLine = line; - executeCommand(line); + executeCommand(line, null); } } catch (IOException e) { e.printStackTrace(err); @@ -90,8 +90,11 @@ } } - public int executeCommand(String commandLine) { + public int executeCommand(String commandLine, CommandContext context) { String[][] parts; + PrintStream out = context == null ? this.out : context.out; + PrintStream err = context == null ? this.err : context.err; + try { parts = CommandParser.parseCommandLine(commandLine); } catch (Exception e) { Modified: mspsim/se/sics/mspsim/cli/ExecCommand.java =================================================================== --- mspsim/se/sics/mspsim/cli/ExecCommand.java 2008-04-16 16:42:52 UTC (rev 242) +++ mspsim/se/sics/mspsim/cli/ExecCommand.java 2008-04-16 18:26:57 UTC (rev 243) @@ -85,7 +85,9 @@ } public void lineRead(String line) { + System.out.println("Exec: sending a line: " + line); output.println(line); + output.flush(); } public void stopCommand(CommandContext context) { Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2008-04-16 16:42:52 UTC (rev 242) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2008-04-16 18:26:57 UTC (rev 243) @@ -232,7 +232,7 @@ @Override public void stopCommand(CommandContext context) { isRunning = false; - context.out.println("[repeat exit: " + commandLine + ']'); + context.err.println("[repeat exit: " + commandLine + ']'); context.exit(0); } }); Modified: mspsim/se/sics/mspsim/cli/WindowTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-04-16 16:42:52 UTC (rev 242) +++ mspsim/se/sics/mspsim/cli/WindowTarget.java 2008-04-16 18:26:57 UTC (rev 243) @@ -22,8 +22,9 @@ } @Override - public void lineRead(String line) { - if (line != null && line.startsWith("#!")) { + public void lineRead(String line) { + if (line == null) return; + if (line.startsWith("#!")) { line = line.substring(2); String[] parts = CommandParser.parseLine(line); String cmd = parts[0]; @@ -48,7 +49,7 @@ } else if (dataHandler != null) { dataHandler.handleCommand(parts); } - } else { + } else if (!line.startsWith("#")){ if (dataHandler != null) { dataHandler.lineRead(line); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |