Add version "Luaj ${version}" into _VERSION field at build time.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/core"/>
|
||||
<classpathentry kind="src" path="src/debug"/>
|
||||
<classpathentry kind="src" path="src/j2me"/>
|
||||
<classpathentry kind="src" path="src/j2se"/>
|
||||
<classpathentry kind="src" path="src/debug"/>
|
||||
<classpathentry kind="src" path="src/sample"/>
|
||||
<classpathentry kind="src" path="src/script"/>
|
||||
<classpathentry kind="src" path="src/test/java"/>
|
||||
<classpathentry kind="src" path="src/test/res"/>
|
||||
<classpathentry kind="src" path="src/sample"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
|
||||
<classpathentry kind="var" path="WTK_HOME/lib/cldcapi11.jar"/>
|
||||
|
||||
@@ -2,3 +2,4 @@ bin
|
||||
target
|
||||
build
|
||||
luaj*.jar
|
||||
jit
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#Tue Oct 09 20:37:03 PDT 2007
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.3
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
||||
12
build.xml
12
build.xml
@@ -13,12 +13,21 @@
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="wtk-or-fail">
|
||||
<mkdir dir="build/core/src"/>
|
||||
<mkdir dir="build/core/classes"/>
|
||||
<mkdir dir="build/j2me/classes"/>
|
||||
<mkdir dir="build/j2se/classes"/>
|
||||
<mkdir dir="build/script/classes"/>
|
||||
<copy todir="build/core/src">
|
||||
<fileset dir="src/core"/>
|
||||
<filterchain>
|
||||
<tokenfilter>
|
||||
<replacestring from='"Luaj 0.0"' to='"Luaj ${version}"'/>
|
||||
</tokenfilter>
|
||||
</filterchain>
|
||||
</copy>
|
||||
<javac destdir="build/core/classes" encoding="utf-8" source="1.3" target="1.1" bootclasspathref="wtk-libs">
|
||||
<src path="src/core"/>
|
||||
<src path="build/core/src"/>
|
||||
<src path="src/debug"/>
|
||||
</javac>
|
||||
<javac destdir="build/j2me/classes" encoding="utf-8" source="1.3" target="1.1" bootclasspathref="wtk-libs">
|
||||
@@ -67,6 +76,7 @@
|
||||
|
||||
<target name="load-env">
|
||||
<property environment="env"/>
|
||||
<echo>WTK_HOME from env ${env.WTK_HOME}</echo>
|
||||
</target>
|
||||
|
||||
<target name="try-default-wtk-path" depends="load-env" unless="env.WTK_HOME">
|
||||
|
||||
@@ -92,7 +92,8 @@ public class BaseLib extends LFunction {
|
||||
globals.put( NAMES[i], new BaseLib(i) );
|
||||
next = new BaseLib(NEXT);
|
||||
inext = new BaseLib(INEXT);
|
||||
globals.put("_VERSION", new LString("Lua 5.1"));
|
||||
globals.put("_G", globals);
|
||||
globals.put("_VERSION", new LString(Lua._VERSION));
|
||||
}
|
||||
|
||||
private int id;
|
||||
|
||||
@@ -27,6 +27,8 @@ package org.luaj.vm;
|
||||
*
|
||||
*/
|
||||
public class Lua {
|
||||
/** version is supplied by ant build task */
|
||||
public static final String _VERSION = "Luaj 0.0";
|
||||
|
||||
/** use return values from previous op */
|
||||
public static final int LUA_MULTRET = -1;
|
||||
|
||||
@@ -112,7 +112,6 @@ public class LuaState extends Lua {
|
||||
*/
|
||||
protected LuaState() {
|
||||
_G = new LTable();
|
||||
_G.put("_G", _G);
|
||||
mainState = this;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.DiagnosticCollector;
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
@@ -19,16 +17,24 @@ import javax.tools.JavaCompiler.CompilationTask;
|
||||
|
||||
import org.luaj.compiler.LuaC;
|
||||
import org.luaj.debug.Print;
|
||||
import org.luaj.jit.JitPrototype.JitClosure;
|
||||
import org.luaj.platform.J2sePlatform;
|
||||
import org.luaj.vm.LClosure;
|
||||
import org.luaj.vm.LPrototype;
|
||||
import org.luaj.vm.LValue;
|
||||
import org.luaj.vm.LoadState;
|
||||
import org.luaj.vm.Lua;
|
||||
import org.luaj.vm.LuaState;
|
||||
import org.luaj.vm.Platform;
|
||||
import org.luaj.vm.LoadState.LuaCompiler;
|
||||
|
||||
public class LuaJit extends Lua {
|
||||
public class LuaJit extends Lua implements LuaCompiler {
|
||||
|
||||
private static LuaC luac;
|
||||
|
||||
public static void install() {
|
||||
luac = new LuaC();
|
||||
LoadState.compiler = new LuaJit();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
@@ -54,10 +60,14 @@ public class LuaJit extends Lua {
|
||||
}
|
||||
}
|
||||
|
||||
private static int counter = 0;
|
||||
private static int filenum = 0;
|
||||
|
||||
private static synchronized String filename() {
|
||||
return "LuaJit"+(counter++);
|
||||
return "LuaJit"+(filenum++);
|
||||
}
|
||||
|
||||
public LPrototype compile(int firstByte, InputStream stream, String name) throws IOException {
|
||||
return jitCompile( luac.compile(firstByte, stream, name) );
|
||||
}
|
||||
|
||||
public static LPrototype jitCompile( LPrototype p ) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.luaj.jit;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.luaj.jit.LuaJit;
|
||||
import org.luaj.vm.LPrototype;
|
||||
import org.luaj.vm.LuaJTest;
|
||||
import org.luaj.vm.LuaState;
|
||||
@@ -1 +1 @@
|
||||
version: 0.32
|
||||
version: 0.33
|
||||
|
||||
Reference in New Issue
Block a user