1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-22 14:33:51 +00:00

clear error markers when build, error, unchanged; hack for dumpMemory() to work

This commit is contained in:
Steven Hugg 2018-06-29 22:42:21 -06:00
parent 9b41ae022a
commit d146a7adee
4 changed files with 36 additions and 29 deletions

View File

@ -83,6 +83,9 @@ div.mem_info {
z-index: 12; z-index: 12;
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace; font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
font-size: 12pt; font-size: 12pt;
-webkit-box-shadow: 3px 3px 5px rgba(0,0,0,.5);
-moz-box-shadow: 3px 3px 5px rgba(0,0,0,.5);
box-shadow: 3px 3px 5px rgba(0,0,0,.5);
} }
.btn_group { .btn_group {
border-radius:6px; border-radius:6px;

View File

@ -162,7 +162,7 @@ function CodeProject(worker, platform_id, platform, store) {
self.callbackBuildStatus(false); self.callbackBuildStatus(false);
if (e.data && !e.data.unchanged) { if (e.data && !e.data.unchanged) {
processBuildResult(e.data); processBuildResult(e.data);
self.callbackBuildResult(e.data); self.callbackBuildResult(e.data); // call with data when changed
} }
}; };

View File

@ -120,6 +120,8 @@ function initProject() {
toolbar.addClass("is-busy"); toolbar.addClass("is-busy");
} else { } else {
toolbar.removeClass("is-busy"); toolbar.removeClass("is-busy");
toolbar.removeClass("has-errors"); // may be added in next callback
getActiveEditor().clearErrors(); // TODO: add current line marker
} }
$('#compile_spinner').css('visibility', busy ? 'visible' : 'hidden'); $('#compile_spinner').css('visibility', busy ? 'visible' : 'hidden');
}; };
@ -202,8 +204,8 @@ function SourceEditor(path) {
self.markErrors = function(errors) { self.markErrors = function(errors) {
// TODO: move cursor to error line if offscreen? // TODO: move cursor to error line if offscreen?
self.clearErrors();
toolbar.addClass("has-errors"); toolbar.addClass("has-errors");
editor.clearGutter("gutter-info");
var numLines = editor.lineCount(); var numLines = editor.lineCount();
for (var info of errors) { for (var info of errors) {
var line = info.line-1; var line = info.line-1;
@ -212,6 +214,10 @@ function SourceEditor(path) {
} }
} }
self.clearErrors = function() {
editor.clearGutter("gutter-info");
}
self.updateListing = function(sourcefile) { self.updateListing = function(sourcefile) {
// update editor annotations // update editor annotations
// TODO: do incrementally for performance // TODO: do incrementally for performance
@ -460,7 +466,7 @@ function getCurrentFilename() {
} }
function _shareFile(e) { function _shareFile(e) {
if (current_output == null) { if (current_output == null) { // TODO
alert("Please fix errors before sharing."); alert("Please fix errors before sharing.");
return true; return true;
} }
@ -493,7 +499,7 @@ function _resetPreset(e) {
} }
function _downloadROMImage(e) { function _downloadROMImage(e) {
if (current_output == null) { if (current_output == null) { // TODO
alert("Please fix errors before downloading ROM."); alert("Please fix errors before downloading ROM.");
return true; return true;
} }
@ -560,8 +566,11 @@ function setCode(text) {
} }
function setCompileOutput(data) { function setCompileOutput(data) {
// TODO: kills current selection var sed = getActiveEditor();
// TODO: use current_project // errors?
if (data.errors && data.errors.length > 0) {
sed.markErrors(data.errors);
} else {
// choose first listing (TODO:support multiple source files) // choose first listing (TODO:support multiple source files)
sourcefile = null; sourcefile = null;
assemblyfile = null; assemblyfile = null;
@ -579,14 +588,9 @@ function setCompileOutput(data) {
if (!sourcefile) sourcefile = new SourceFile(); if (!sourcefile) sourcefile = new SourceFile();
symbolmap = data.symbolmap; symbolmap = data.symbolmap;
addr2symbol = invertMap(symbolmap); addr2symbol = invertMap(symbolmap);
addr2symbol[0x10000] = '__END__'; // TODO? if (!addr2symbol[0x0]) addr2symbol[0x0] = '__START__'; // needed for ...
addr2symbol[0x10000] = '__END__'; // needed for dump memory to work
compparams = data.params; compparams = data.params;
var sed = getActiveEditor();
// errors?
if (data.errors && data.errors.length > 0) {
sed.markErrors(data.errors);
current_output = null;
} else {
// load ROM // load ROM
// TODO: don't have to compare anymore; worker does it // TODO: don't have to compare anymore; worker does it
var rom = data.output; var rom = data.output;
@ -602,7 +606,6 @@ function setCompileOutput(data) {
if (!userPaused) resume(); if (!userPaused) resume();
current_output = rom; current_output = rom;
//resetProfiler(); //resetProfiler();
toolbar.removeClass("has-errors");
} catch (e) { } catch (e) {
console.log(e); // TODO: show error console.log(e); // TODO: show error
toolbar.addClass("has-errors"); toolbar.addClass("has-errors");
@ -794,8 +797,8 @@ function updateDisassembly() {
} }
} }
} }
// fall through to platform disassembler? // TODO: fall through to platform disassembler?
if (platform.disassemble) { else if (platform.disassemble) {
var curline = 0; var curline = 0;
var selline = 0; var selline = 0;
// TODO: not perfect disassembler // TODO: not perfect disassembler

View File

@ -212,5 +212,6 @@ describe('Worker', function() {
var msgs = [m, m, m2]; var msgs = [m, m, m2];
doBuild(msgs, done, 8192, [1,1], 0); doBuild(msgs, done, 8192, [1,1], 0);
}); });
// TODO: test if compile, errors, then compile same file
}); });