Changes made for the following:

1) Platform.java stays as abstract class with, but default implementation is removed. Stays in org.luaj.vm package
2) org.luaj.platform package is created to hold concrete Platform implementations
3) Platform.newLuaState() method is introduced to instantiate the LuaState. Other constructors are privatized.
4) Following Platform implementations are created:
        J2sePlatform
        J2meMidp20Cldc11Platform
        J2meMidp10Cldc10Platform
 5) All clients of luaj-vm are changed to include startup code that looks something like this:
        Platform.setInstance( new J2meMidp20Cldc11Platform() );
        LuaState state = Platform.getInstance().newLuaState();
This commit is contained in:
Shu Lei
2007-12-19 21:44:15 +00:00
parent bcf7dd1c66
commit 9f9f31b969
20 changed files with 602 additions and 574 deletions

View File

@@ -24,21 +24,33 @@ package org.luaj.debug;
import java.io.IOException;
import java.io.InputStream;
import org.luaj.debug.DebugLuaState;
import junit.framework.TestCase;
import org.luaj.TestPlatform;
import org.luaj.compiler.LuaC;
import org.luaj.vm.DebugNetSupport;
import org.luaj.vm.LClosure;
import org.luaj.vm.LPrototype;
import org.luaj.vm.LValue;
import org.luaj.vm.LoadState;
import org.luaj.vm.LPrototype;
import junit.framework.TestCase;
import org.luaj.vm.LuaState;
import org.luaj.vm.Platform;
public class DebugStackStateTest extends TestCase {
public void testDebugStackState() throws InterruptedException, IOException {
String script = "/test6.luac";
String script = "/test6.lua";
// set up the vm
final DebugLuaState state = new DebugLuaState();
System.setProperty(Platform.PROPERTY_LUAJ_DEBUG, "true");
Platform.setInstance(new TestPlatform() {
public DebugNetSupport getDebugSupport() throws IOException {
return null;
}
});
final DebugLuaState state = (DebugLuaState) Platform.newLuaState();
LuaC.install();
InputStream is = getClass().getResourceAsStream( script );
LPrototype p = LoadState.undump(state, is, script);