URL handler: add requested signal names to logging set

This commit is contained in:
BigEd 2010-11-06 17:55:36 +00:00
parent 758d53bf5b
commit 678acd6dc5
2 changed files with 18 additions and 8 deletions

View File

@ -78,10 +78,11 @@ function setup(){
function setup_part2(){
frame = document.getElementById('frame');
statbox = document.getElementById('status');
setupParams();
updateExpertMode(expertMode);
// load the circuit before acting on URL parameters
setupNodes();
setupTransistors();
setupParams();
updateExpertMode(expertMode);
detectOldBrowser();
setStatus('loading graphics...');
setTimeout(setup_part3, 0);
@ -151,6 +152,8 @@ function setupParams(){
// user interface mode control
if(name=="loglevel" && parseInt(value)!=NaN){
updateLoglevel(value);
} else if(name=="logmore" && value!=""){
updateLogList(value);
} else if(name=="expert" && value.indexOf("t")==0){
updateExpertMode(true);
} else if(name=="headlesssteps" && parseInt(value)!=NaN){

View File

@ -157,7 +157,7 @@ function initChip(){
refresh();
cycle = 0;
trace = Array();
initLogbox(logThese);
updateLogList();
chipStatus();
if(ctrace)console.log('initChip done after', now()-start);
}
@ -172,15 +172,22 @@ function signalSet(n){
return signals;
}
function updateLogList(){
function updateLogList(names){
// user supplied a list of signals, which we append to the set defined by loglevel
logThese = signalSet(loglevel);
var tmplist = document.getElementById('LogThese').value.split(/[\s,]+/);
for(var i=0;i<tmplist.length;i++){
if(typeof names == "undefined")
// this is a UI call - read the text input
names = document.getElementById('LogThese').value;
else
// this is an URL call - update the text input box
document.getElementById('LogThese').value = names;
names = names.split(/[\s,]+/);
for(var i=0;i<names.length;i++){
// could be a signal name, a node number, or a special name
if(typeof busToString(tmplist[i]) != "undefined")
logThese.push(tmplist[i]);
if(typeof busToString(names[i]) != "undefined")
logThese.push(names[i]);
}
console.log(logThese);
initLogbox(logThese);
}