|
|
|
@ -68,6 +68,30 @@ Compile.prototype.newTempDir = function () {
|
|
|
|
|
Compile.prototype.writeFile = Promise.denodeify(fs.writeFile);
|
|
|
|
|
Compile.prototype.stat = Promise.denodeify(fs.stat);
|
|
|
|
|
|
|
|
|
|
Compile.prototype.convert6g = function (code) {
|
|
|
|
|
var re = /^[0-9]+\s*\(([^:]+):([0-9]+)\)\s*([A-Z]+)(.*)/;
|
|
|
|
|
var prevLine = null;
|
|
|
|
|
var file = null
|
|
|
|
|
return code.split('\n').map(function (line) {
|
|
|
|
|
var match = line.match(re);
|
|
|
|
|
if (match) {
|
|
|
|
|
var res = "";
|
|
|
|
|
if (file == null) {
|
|
|
|
|
res += "\t.file 1 \"" + match[1] + "\"\n";
|
|
|
|
|
file = match[1];
|
|
|
|
|
}
|
|
|
|
|
if (prevLine != match[2]) {
|
|
|
|
|
res += "\t.loc 1 " + match[2] + "\n";
|
|
|
|
|
prevLine = match[2];
|
|
|
|
|
}
|
|
|
|
|
return res + "\t" + match[3].toLowerCase() + match[4];
|
|
|
|
|
} else
|
|
|
|
|
return null;
|
|
|
|
|
}).filter(function (x) {
|
|
|
|
|
return x;
|
|
|
|
|
}).join("\n");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Compile.prototype.getRemote = function (compiler) {
|
|
|
|
|
var compilerInfo = this.compilersById[compiler];
|
|
|
|
|
if (!compilerInfo) return false;
|
|
|
|
@ -163,6 +187,11 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
|
|
|
|
|
result.asm = "<Compilation failed>";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (compilerInfo.is6g) {
|
|
|
|
|
result.asm = self.convert6g(result.stdout);
|
|
|
|
|
result.stdout = "";
|
|
|
|
|
return Promise.resolve(result);
|
|
|
|
|
}
|
|
|
|
|
return self.stat(outputFilename).then(function (stat) {
|
|
|
|
|
if (stat.size >= maxSize) {
|
|
|
|
|
result.asm = "<No output: generated assembly was too large (" + stat.size + " > " + maxSize + " bytes)>";
|
|
|
|
|