Fixed assembler issues on Windows platform.

This commit is contained in:
badvision 2016-11-04 22:41:24 -05:00
parent a544cae02c
commit ab5d3472c0
3 changed files with 14 additions and 2 deletions

View File

@ -89,6 +89,15 @@ public class AcmeCompiler implements CompileResult<File> {
ByteArrayOutputStream baosErr; ByteArrayOutputStream baosErr;
PrintStream err; PrintStream err;
private String normalizeWindowsPath(String path) {
if (path.contains("\\")) {
char firstLetter = path.toLowerCase().charAt(0);
return "/"+firstLetter+path.substring(1).replaceAll("\\\\", "/");
} else {
return path;
}
}
private void invokeAcme(File sourceFile, File workingDirectory) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IOException { private void invokeAcme(File sourceFile, File workingDirectory) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IOException {
String oldPath = System.getProperty("user.dir"); String oldPath = System.getProperty("user.dir");
redirectSystemOutput(); redirectSystemOutput();
@ -96,7 +105,7 @@ public class AcmeCompiler implements CompileResult<File> {
compiledAsset = File.createTempFile(sourceFile.getName(), "bin", sourceFile.getParentFile()); compiledAsset = File.createTempFile(sourceFile.getName(), "bin", sourceFile.getParentFile());
System.setProperty("user.dir", workingDirectory.getAbsolutePath()); System.setProperty("user.dir", workingDirectory.getAbsolutePath());
AcmeCrossAssembler acme = new AcmeCrossAssembler(); AcmeCrossAssembler acme = new AcmeCrossAssembler();
String[] params = {"--outfile", compiledAsset.getAbsolutePath(), "-f", "cbm", "--maxerrors","16",sourceFile.getAbsolutePath()}; String[] params = {"--outfile", normalizeWindowsPath(compiledAsset.getAbsolutePath()), "-f", "cbm", "--maxerrors","16",normalizeWindowsPath(sourceFile.getAbsolutePath())};
int status = acme.run("Acme", params); int status = acme.run("Acme", params);
successful = status == 0; successful = status == 0;
if (!successful) { if (!successful) {

View File

@ -1,7 +1,9 @@
package jace.assembly; package jace.assembly;
import org.ibex.nestedvm.UnixRuntime;
/* This file was generated from acme by Mips2Java on Tue Jul 14 00:46:52 CDT 2015 */ /* This file was generated from acme by Mips2Java on Tue Jul 14 00:46:52 CDT 2015 */
public final class AcmeCrossAssembler extends org.ibex.nestedvm.UnixRuntime { public final class AcmeCrossAssembler extends UnixRuntime {
/* program counter */ /* program counter */
private int pc = 0; private int pc = 0;

View File

@ -221,6 +221,7 @@ public class Program {
if (lastResult.isSuccessful()) { if (lastResult.isSuccessful()) {
getHandler().execute(lastResult); getHandler().execute(lastResult);
} else { } else {
lastResult.getOtherMessages().forEach(System.err::println);
getHandler().clean(lastResult); getHandler().clean(lastResult);
} }
} }