|
From: <cr...@us...> - 2008-11-09 13:57:39
|
Revision: 4693
http://jnode.svn.sourceforge.net/jnode/?rev=4693&view=rev
Author: crawley
Date: 2008-11-09 13:57:29 +0000 (Sun, 09 Nov 2008)
Log Message:
-----------
Changing commands to use 'execute()' and PrintWriters + API ripple
Modified Paths:
--------------
trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java
trunk/core/src/core/org/jnode/vm/Vm.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsAllocator.java
trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java
trunk/core/src/core/org/jnode/vm/scheduler/VmProcessor.java
trunk/core/src/core/org/jnode/vm/x86/VmX86Processor.java
trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java
trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/system/bus/SMBusCommand.java
trunk/shell/src/shell/org/jnode/shell/command/log4j/Log4jCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/HaltCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/RebootCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/CpuIDCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/KdbCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/LsIRQCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/VmInfoCommand.java
trunk/shell/src/shell/org/jnode/shell/command/unix/UnixTestCommand.java
Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -25,6 +25,7 @@
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.net.URL;
@@ -40,11 +41,12 @@
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
+
import org.apache.tools.ant.Project;
import org.jnode.assembler.Label;
import org.jnode.assembler.NativeStream;
+import org.jnode.assembler.UnresolvedObjectRefException;
import org.jnode.assembler.NativeStream.ObjectRef;
-import org.jnode.assembler.UnresolvedObjectRefException;
import org.jnode.assembler.x86.X86BinaryAssembler;
import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.PluginException;
@@ -626,10 +628,11 @@
log("Boot heap size " + (bootHeapSize >>> 10) + "K bitmap size "
+ (bootHeapBitmapSize >>> 10) + "K");
log("Shared statics");
- clsMgr.getSharedStatics().dumpStatistics(System.out);
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
+ clsMgr.getSharedStatics().dumpStatistics(out);
log("Isolated statics");
- clsMgr.getIsolatedStatics().dumpStatistics(System.out);
- vm.dumpStatistics(System.out);
+ clsMgr.getIsolatedStatics().dumpStatistics(out);
+ vm.dumpStatistics(out);
logStatistics(os);
Modified: trunk/core/src/core/org/jnode/vm/Vm.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/Vm.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/Vm.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
@@ -411,7 +411,7 @@
}
}
- public void dumpStatistics(PrintStream out) {
+ public void dumpStatistics(PrintWriter out) {
if (statistics != null) {
final Statistic[] stats = getStatistics();
for (int i = 0; i < stats.length; i++) {
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmStatics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmStatics.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmStatics.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.classmgr;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import java.nio.ByteOrder;
import org.jnode.assembler.Label;
@@ -365,7 +365,7 @@
return true;
}
- public final void dumpStatistics(PrintStream out) {
+ public final void dumpStatistics(PrintWriter out) {
allocator.dumpStatistics(out);
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsAllocator.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsAllocator.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsAllocator.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.classmgr;
-import java.io.PrintStream;
+import java.io.PrintWriter;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -95,7 +95,7 @@
return types.length;
}
- public final void dumpStatistics(PrintStream out) {
+ public final void dumpStatistics(PrintWriter out) {
out.println(" #static int fields " + typeCounter[TYPE_INT]);
out.println(" #static long fields " + typeCounter[TYPE_LONG]);
out.println(" #methods " + typeCounter[TYPE_METHOD_CODE]);
Modified: trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.memmgr;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.jnode.vm.Unsafe;
import org.jnode.vm.VmMagic;
@@ -333,7 +333,7 @@
/**
* Print the statics on this object on out.
*/
- public abstract void dumpStatistics(PrintStream out);
+ public abstract void dumpStatistics(PrintWriter out);
public abstract GCStatistics getStatistics();
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.memmgr.def;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.jnode.vm.MemoryBlockManager;
import org.jnode.vm.VmArchitecture;
@@ -408,7 +408,7 @@
/**
* Print the statics on this object on out.
*/
- public void dumpStatistics(PrintStream out) {
+ public void dumpStatistics(PrintWriter out) {
out.println("WriteBarrier: " + getWriteBarrier());
}
Modified: trunk/core/src/core/org/jnode/vm/scheduler/VmProcessor.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/VmProcessor.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/scheduler/VmProcessor.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.scheduler;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.jnode.util.NumberUtils;
import org.jnode.vm.CpuID;
@@ -655,7 +655,7 @@
*
* @param out
*/
- public abstract void dumpStatistics(PrintStream out);
+ public abstract void dumpStatistics(PrintWriter out);
/**
* Gets the isolates statics table of the current thread.
Modified: trunk/core/src/core/org/jnode/vm/x86/VmX86Processor.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/VmX86Processor.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/core/org/jnode/vm/x86/VmX86Processor.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.x86;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.jnode.system.BootLog;
import org.jnode.system.ResourceManager;
@@ -387,7 +387,7 @@
return perfCounters;
}
- public void dumpStatistics(PrintStream out) {
+ public void dumpStatistics(PrintWriter out) {
out.println("Type : " + (bootProcessor ? "BSP" : (logical ? "AP-logical" : "AP")));
out.println("CPUID : " + getCPUID());
out.println("fxSave/Res : " + fxSaveCounter + "/" + fxRestoreCounter
Modified: trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java
===================================================================
--- trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,7 +21,7 @@
package org.jnode.vm.memmgr.mmtk;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -178,17 +178,15 @@
/**
* @see org.jnode.vm.memmgr.VmHeapManager#dumpStatistics(java.io.PrintStream)
*/
- public void dumpStatistics(PrintStream out) {
- // TODO Auto-generated method stub
-
+ public void dumpStatistics(PrintWriter out) {
+ // Default behavior is to do nothing
}
/**
* @see org.jnode.vm.memmgr.VmHeapManager#gc()
*/
public void gc() {
- // TODO Auto-generated method stub
-
+ // Default behavior is to do nothing
}
/**
Modified: trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACommand.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -1,5 +1,7 @@
package org.jnode.driver.video.vesa;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.nio.ByteBuffer;
import javax.naming.NameNotFoundException;
@@ -115,7 +117,8 @@
biosMemory.position(pos);
}
- VmProcessor.current().dumpStatistics(System.out);
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
+ VmProcessor.current().dumpStatistics(out);
System.out.println("after dumpStatistics");
if (pmInfoBlock != null) {
System.out.println("step4");
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,8 +21,6 @@
package org.jnode.shell.command.driver;
-import java.io.InputStream;
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.TreeMap;
@@ -37,7 +35,6 @@
import org.jnode.driver.DriverException;
import org.jnode.naming.InitialNaming;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.DeviceArgument;
import org.jnode.shell.syntax.EnumArgument;
@@ -77,8 +74,9 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) throws Exception {
+ public void execute() throws Exception {
+ PrintWriter out = getOutput().getPrintWriter();
+ PrintWriter err = getError().getPrintWriter();
if (ARG_ACTION.isSet()) {
if (!ARG_DEVICE.isSet()) {
err.println("No target device specified");
@@ -153,7 +151,7 @@
* @param out
* @param dev
*/
- protected void showDevice(PrintStream out, Device dev) {
+ protected void showDevice(PrintWriter out, Device dev) {
final String prefix = " ";
out.println("Device: " + dev.getId());
final String drvClassName = dev.getDriverClassName();
@@ -192,7 +190,7 @@
* @param out
* @throws NameNotFoundException
*/
- protected void showDevices(PrintStream out) throws NameNotFoundException {
+ protected void showDevices(PrintWriter out) throws NameNotFoundException {
// Create a sorted list
final TreeMap<String, Device> tm = new TreeMap<String, Device>();
final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,8 +21,6 @@
package org.jnode.shell.command.driver.system.acpi;
-import java.io.InputStream;
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Collection;
@@ -31,7 +29,6 @@
import org.jnode.driver.DeviceUtils;
import org.jnode.driver.system.acpi.AcpiAPI;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FlagArgument;
@@ -60,9 +57,9 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) throws ApiNotFoundException {
+ public void execute() throws ApiNotFoundException {
final Collection<Device> acpiDevs = DeviceUtils.getDevicesByAPI(AcpiAPI.class);
+ PrintWriter out = getOutput().getPrintWriter();
if (acpiDevs.isEmpty()) {
out.println("No ACPI devices are registered");
exit(1);
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/system/bus/SMBusCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/system/bus/SMBusCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/system/bus/SMBusCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -22,15 +22,13 @@
package org.jnode.shell.command.driver.system.bus;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import javax.naming.NameNotFoundException;
import org.jnode.driver.bus.smbus.SMBusControler;
import org.jnode.naming.InitialNaming;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
/**
* @author Francois-Frederic Ozog
@@ -46,10 +44,9 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
+ public void execute() {
SMBusControler smbusctrl = null;
-
+ PrintWriter out = getOutput().getPrintWriter();
try {
smbusctrl = InitialNaming.lookup(SMBusControler.NAME);
} catch (NameNotFoundException ex) {
Modified: trunk/shell/src/shell/org/jnode/shell/command/log4j/Log4jCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/log4j/Log4jCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/log4j/Log4jCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -24,8 +24,6 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
@@ -35,7 +33,6 @@
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FileArgument;
import org.jnode.shell.syntax.FlagArgument;
@@ -81,8 +78,7 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) throws IOException {
+ public void execute() throws IOException {
if (ARG_FILE.isSet()) {
// Set configuration from a file
final File configFile = ARG_FILE.getValue();
@@ -93,7 +89,7 @@
props.load(fis);
PropertyConfigurator.configure(props);
} catch (FileNotFoundException ex) {
- err.println("Cannot open configuration file '" +
+ getError().getPrintWriter().println("Cannot open configuration file '" +
configFile + "': " + ex.getMessage());
exit(1);
} finally {
@@ -114,7 +110,7 @@
String level = (logger.getLevel() == null) ?
("(" + logger.getEffectiveLevel().toString() + ")") :
logger.getLevel().toString();
- out.println(logger.getName() + ": " + level);
+ getOutput().getPrintWriter().println(logger.getName() + ": " + level);
}
} else if (FLAG_SET_LEVEL.isSet()) {
// Change the logging level for a specified logger or the root logger
Modified: trunk/shell/src/shell/org/jnode/shell/command/plugin/HaltCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/plugin/HaltCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/plugin/HaltCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,11 +21,7 @@
package org.jnode.shell.command.plugin;
-import java.io.InputStream;
-import java.io.PrintStream;
-
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.vm.VmSystem;
/**
@@ -44,8 +40,7 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
+ public void execute() {
VmSystem.halt(false);
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,8 +21,7 @@
package org.jnode.shell.command.plugin;
-import java.io.InputStream;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
@@ -42,7 +41,6 @@
import org.jnode.plugin.PluginRegistry;
import org.jnode.plugin.URLPluginLoader;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FlagArgument;
import org.jnode.shell.syntax.PluginArgument;
@@ -74,7 +72,7 @@
private final StringArgument ARG_VERSION =
new StringArgument("version", Argument.OPTIONAL, "plugin version");
- private PrintStream out;
+ private PrintWriter out;
private PluginManager mgr;
@@ -91,9 +89,8 @@
/**
* Execute this command
*/
- public void execute(CommandLine commandLine, InputStream in, PrintStream out,
- PrintStream err) throws Exception {
- this.out = out;
+ public void execute() throws Exception {
+ this.out = getOutput().getPrintWriter();
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
Modified: trunk/shell/src/shell/org/jnode/shell/command/plugin/RebootCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/plugin/RebootCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/plugin/RebootCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,11 +21,7 @@
package org.jnode.shell.command.plugin;
-import java.io.InputStream;
-import java.io.PrintStream;
-
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.vm.VmSystem;
/**
@@ -42,8 +38,7 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
+ public void execute() {
VmSystem.halt(true);
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/system/CpuIDCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/system/CpuIDCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/system/CpuIDCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,11 +21,9 @@
package org.jnode.shell.command.system;
-import java.io.InputStream;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.vm.scheduler.VmProcessor;
/**
@@ -44,10 +42,10 @@
/**
* Execute this command
*/
- public void execute(CommandLine cmdLine, InputStream in, PrintStream out, PrintStream err) {
+ public void execute() {
final VmProcessor cpu = VmProcessor.current();
+ PrintWriter out = getOutput().getPrintWriter();
out.println(cpu.getCPUID());
out.println(cpu.getPerformanceCounters());
}
-
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/system/KdbCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/system/KdbCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/system/KdbCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -18,14 +18,11 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
package org.jnode.shell.command.system;
-import java.io.InputStream;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FlagArgument;
import org.jnode.vm.Unsafe;
@@ -55,8 +52,8 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
+ public void execute() {
+ PrintWriter out = getOutput().getPrintWriter();
if (FLAG_OFF.isSet()) {
Unsafe.setKdbEnabled(false);
out.println("KDB disabled");
Modified: trunk/shell/src/shell/org/jnode/shell/command/system/LsIRQCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/system/LsIRQCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/system/LsIRQCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,11 +21,7 @@
package org.jnode.shell.command.system;
-import java.io.InputStream;
-import java.io.PrintStream;
-
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.vm.scheduler.IRQManager;
import org.jnode.vm.scheduler.VmProcessor;
@@ -43,13 +39,12 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
+ public void execute() {
final VmProcessor proc = VmProcessor.current();
final IRQManager irqMgr = proc.getIRQManager();
final int max = irqMgr.getNumIRQs();
for (int i = 0; i < max; i++) {
- out.println("IRQ" + i + "\t" + irqMgr.getIrqCount(i) + "\t"
+ getOutput().getPrintWriter().println("IRQ" + i + "\t" + irqMgr.getIrqCount(i) + "\t"
+ irqMgr.getHandlerInfo(i));
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/system/VmInfoCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/system/VmInfoCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/system/VmInfoCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -21,12 +21,10 @@
package org.jnode.shell.command.system;
-import java.io.InputStream;
-import java.io.PrintStream;
+import java.io.PrintWriter;
import java.util.List;
import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.CommandLine;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FlagArgument;
import org.jnode.vm.Vm;
@@ -51,10 +49,10 @@
}
@Override
- public void execute(CommandLine commandLine, InputStream in,
- PrintStream out, PrintStream err) {
+ public void execute() {
final Vm vm = Vm.getVm();
if (vm != null && !vm.isBootstrap()) {
+ PrintWriter out = getOutput().getPrintWriter();
out.println("JNode VM " + vm.getVersion());
vm.dumpStatistics(out);
vm.getSharedStatics().dumpStatistics(out);
Modified: trunk/shell/src/shell/org/jnode/shell/command/unix/UnixTestCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/unix/UnixTestCommand.java 2008-11-09 13:23:28 UTC (rev 4692)
+++ trunk/shell/src/shell/org/jnode/shell/command/unix/UnixTestCommand.java 2008-11-09 13:57:29 UTC (rev 4693)
@@ -22,8 +22,8 @@
package org.jnode.shell.command.unix;
import java.io.File;
-import java.io.InputStream;
import java.io.PrintStream;
+import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Stack;
@@ -50,8 +50,7 @@
this.kind = kind;
}
}
-
- private PrintStream err;
+
private boolean bracketted;
private int pos;
private String[] args;
@@ -117,9 +116,10 @@
OPERATOR_MAP.put(")", new Operator(OP_RPAREN, 6, OP_SPECIAL));
}
- public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err)
+ public void execute()
throws Exception {
boolean res = false;
+ CommandLine commandLine = getCommandLine();
String commandName = commandLine.getCommandName();
bracketted = (commandName != null && commandName.equals("["));
args = commandLine.getArguments();
@@ -156,7 +156,7 @@
exit(1);
}
} catch (SyntaxErrorException ex) {
- err.println(ex.getMessage());
+ getError().getPrintWriter().println(ex.getMessage());
exit(2);
}
}
@@ -324,6 +324,7 @@
}
private void processAsOptions(String[] args) throws SyntaxErrorException {
+ PrintWriter err = getError().getPrintWriter();
for (String option : args) {
if (option.equals("--help")) {
err.println("Don't panic!");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|