First steps getting PLASMA compiler to run inside PackPartitiions.

This commit is contained in:
Martin Haye 2016-01-18 17:59:54 -08:00
parent 4a410c8a07
commit 26bc00f3af
5 changed files with 36 additions and 4 deletions

1
.gitignore vendored
View File

@ -34,7 +34,6 @@ mg
/Platform/Apple/tools/PLASMA/src/plvm
/Platform/Apple/tools/PLASMA/src/PLVM02.SYSTEM.sys
/Platform/Apple/tools/PLASMA/src/*#*
/Platform/Apple/tools/PLASMA/src/plasm.jar
# Ignore other auto-generated files
/Platform/Apple/virtual/src/plasma/gen_*.pl?

View File

@ -34,7 +34,7 @@ $(PLASM): $(SRCS) $(INCS)
cc $(SRCS) -o $(PLASM)
$(JAR): $(SRCS) $(INCS)
docker run -t -v "$(shell pwd):/project" mhaye/nestedvm:v3 /bin/bash -c "cd /project && nestedvm-c2jar $(JAR) plasma.Plasma $(SRCS)"
docker run -t -v "$(shell pwd):/project" mhaye/nestedvm:v4 /bin/bash -c "cd /project && nestedvm-c2jar $(JAR) plasma.Plasma $(SRCS)"
$(PLVM): plvm.c
cc plvm.c -o $(PLVM)

Binary file not shown.

View File

@ -28,11 +28,13 @@ dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.lz4-1.1.1.jar=/Users/mhaye/LL/repo/Platform/Apple/tools/PackPartitions/lib/lz4-1.1.1.jar
file.reference.plasm.jar=../PLASMA/src/plasm.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.lz4-1.1.1.jar}:\
${libs.groovy-all.classpath}
${libs.groovy-all.classpath}:\
${file.reference.plasm.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -18,6 +18,8 @@ package org.demo
import java.nio.ByteBuffer
import java.nio.channels.Channels
import net.jpountz.lz4.LZ4Factory
import java.nio.charset.StandardCharsets
import plasma.Plasma
/**
*
@ -909,7 +911,7 @@ class PackPartitions
def outBuf = ByteBuffer.allocate(50000)
if (binaryStubsOnly)
return outBuf
def stream = new File(path).withInputStream { stream ->
new File(path).withInputStream { stream ->
while (true) {
def got = stream.read(inBuf)
if (got < 0) break
@ -1266,6 +1268,33 @@ class PackPartitions
stream.write(it.buf.data, 0, it.buf.len)
}
}
def compileModule(moduleName, codeDir)
{
def prevStdin = System.in
def prevStdout = System.out
try
{
println "old user.dir=${System.getProperty('user.dir')}"
System.setProperty("user.dir", new File(codeDir).getAbsolutePath())
println "new user.dir=${System.getProperty('user.dir')}"
def codeFile = new File(codeDir + moduleName + ".pla")
codeFile.withInputStream { inStream ->
System.in = inStream
def acmeFile = new File(codeDir + "build/" + moduleName + ".b")
acmeFile.withOutputStream { outStream ->
System.out = new PrintStream(outStream)
String[] args = new String[1]
args[0] = "-AM"
def result = Plasma.main(args)
println("result=$result")
}
}
} finally {
System.in = prevStdin
System.out = prevStdout
}
}
def readAllCode()
{
@ -1274,6 +1303,8 @@ class PackPartitions
readCode("fontEngine", "src/font/build/fontEngine.b")
readCode("tileEngine", "src/tile/build/tile.b")
compileModule("gameloop", "src/plasma/")
readModule("gameloop", "src/plasma/build/gameloop.b")
readModule("globalScripts", "src/plasma/build/globalScripts.b")
readModule("combat", "src/plasma/build/combat.b")