Added breakpoints and added LESS

This commit is contained in:
2015-04-28 03:14:01 -04:00
parent fbf975b4ec
commit e24ffd6854
7 changed files with 106 additions and 25 deletions

View File

@@ -1 +1,28 @@
.code{font-family:"DejaVu Sans Mono",Consolas,monospace;width:100%;border-radius:4px;padding:4px;border-color:#ddd;max-height:300px;overflow-y:auto}.brad{font-family:"Courier New",Courier,monospace;font-size:26pt;color:#166d00}.brad :hover{text-decoration:none}nav{background-color:#d8d8d8}.lbl{font-weight:bold;margin-bottom:4px}.btm-btn{margin-bottom:4px;margin-top:-14px}
.code {
font-family: "DejaVu Sans Mono", Consolas, monospace;
width: 100%;
border-radius: 4px;
padding: 4px;
border-color: #ddd;
max-height: 300px;
overflow-y: auto;
}
.brad {
font-family: "Courier New", Courier, monospace;
font-size: 26pt;
color: #166d00;
}
.brad :hover {
text-decoration: none;
}
nav {
background-color: #d8d8d8;
}
.lbl {
font-weight: bold;
margin-bottom: 4px;
}
.btm-btn {
margin-bottom: 4px;
margin-top: -10px;
}

View File

@@ -29,5 +29,8 @@ nav {
.btm-btn {
margin-bottom: 4px;
margin-top: -14px;
margin-top: -10px;
}
.no_disp {
}

View File

@@ -4,7 +4,7 @@ var INT_MIN = 0x80000000;
var INT_MAX = 0x7FFFFFFF;
function log(message) {
if (verbose) console.log(message);
if (verbose) $("#internals").val($("#internals").val() + "\n" + message);
}
function c0_assertion_failure(val) {
@@ -500,7 +500,7 @@ function run_vm(vm) {
}
var val = vm.step();
if (val !== undefined) return val;
if (val !== undefined) return vm;
if (verbose) {
console.log("Machine vm:");

View File

@@ -43,5 +43,27 @@ $("#run").click(function() {
$("#output").val("");
var file = parser.parse($("#bytecode").val());
c0vm.execute(file, callbacks, true);
state = c0vm.execute(file, callbacks, true);
state = c0vm.initialize_vm(file, callbacks, true);
});
$("#break").click(function() {
var input = $("#breakpoints").val().replace(/(\r\n|\n|\r)/gm,"");
var temp = input.split(",");
for (a in temp) {
temp2 = temp[a].split(" ");
state.set_breakpoint(parseInt(temp2[0], 10), parseInt(temp2[1], 10));
}
$("#output").val("");
$("#breakpoints").val("");
$("#internals").val("");
});
$("#continue").click(function () {
c0vm.run_vm(state);
});
$("#step").click(function () {
state.step();
});

View File

@@ -332,7 +332,7 @@ var INT_MIN = 0x80000000;
var INT_MAX = 0x7FFFFFFF;
function log(message) {
if (verbose) console.log(message);
if (verbose) $("#internals").val($("#internals").val() + "\n" + message);
}
function c0_assertion_failure(val) {
@@ -828,7 +828,7 @@ function run_vm(vm) {
}
var val = vm.step();
if (val !== undefined) return val;
if (val !== undefined) return vm;
if (verbose) {
console.log("Machine vm:");
@@ -908,7 +908,29 @@ $("#run").click(function() {
$("#output").val("");
var file = parser.parse($("#bytecode").val());
c0vm.execute(file, callbacks, true);
state = c0vm.execute(file, callbacks, true);
state = c0vm.initialize_vm(file, callbacks, true);
});
$("#break").click(function() {
var input = $("#breakpoints").val().replace(/(\r\n|\n|\r)/gm,"");
var temp = input.split(",");
for (a in temp) {
temp2 = temp[a].split(" ");
state.set_breakpoint(parseInt(temp2[0], 10), parseInt(temp2[1], 10));
}
$("#output").val("");
$("#breakpoints").val("");
$("#internals").val("");
});
$("#continue").click(function () {
c0vm.run_vm(state);
});
$("#step").click(function () {
state.step();
});
},{"./bytecode-parser":2,"./c0ffi.js":3,"./c0vm.js":4}],6:[function(require,module,exports){

View File

@@ -7,8 +7,6 @@ html
href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css")
link(rel="stylesheet" href="/css/site.css")
link(rel="stylesheet" href="/css/sh_emacs.min.css")
block head
body

View File

@@ -3,9 +3,6 @@ extends base
block head
title c0db
link(rel="stylesheet" href="/css/codemirror.css")
block nav
+navbar("home")
@@ -19,20 +16,32 @@ block body
button(onclick="compile()" type="button").btn.btn-default.btm-btn.pull-right Compile
#codearea
textarea.code.formControl.sh_c(rows="12" id="inputCode")
.col-md-6
p.lbl.
Bytecode
textarea.code.formControl.sh_c(rows="12" id="bytecode")
 
form
.form-group
label(for="bytecode") Bytecode
button(type="button")#run.btn.btn-default.btm-btn.pull-right Run
textarea.code.formControl.sh_c(rows="12" id="bytecode")
.row
.col-md-12
p.lbl.
Output
button(type="button")#run.btn.btn-default.btm-btn.pull-right Run
textarea#output.panel.panel-default.code
 
.col-md-3
form
.form-group
label(for="output") Output
button(type="button")#continue.no_disp.btn.btn-default.btm-btn.pull-right Continue
button(type="button")#step.no_disp.btn.btn-default.btm-btn.pull-right Step
textarea.code.sh_c(id="output")
.col-md-6
form
.form-group
label(for="internals") Stack Output
button(type="button")#download.btn.btn-default.btm-btn.pull-right Download
textarea.code.sh_c(rows="12" id="internals")
.col-md-3
form
.form-group
label(for="breakpoints") Breakpoints
button(type="button")#break.btn.btn-default.btm-btn.pull-right Save
textarea.code.sh_c(id="breakpoints")
block script
script(type="text/javascript" src="js/codemirror-compressed.js")