The Component printBuffer should only be used by Component static functions
This commit is contained in:
parent
9f99649a87
commit
061c839a33
27 changed files with 344 additions and 265 deletions
|
|
@ -79,7 +79,7 @@ l.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
l.Cb=function(a,b,c){switch(b){case "clear":return this.na[b]||(this.na[b]=c,c.onclick=function(a){return function(){a.na.print&&(a.na.print.value="")}}(this)),!0;case "print":return this.na[b]||(this.na[b]=c,this.Ca=function(a){this.O(a,this.type);return!0},c.value="",this.print=function(a){return function(b){wb(a,b)}}(c),this.O=function(a,b){return function(a,c){a||(a="");c!=Lb.Ce||"..."!=a.slice(-3)?(c&&(a=c+": "+a),wb(b,a+"\n")):xb(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
l.Cb=function(a,b,c){switch(b){case "clear":return this.na[b]||(this.na[b]=c,c.onclick=function(a){return function(){a.na.print&&(a.na.print.value="")}}(this)),!0;case "print":return this.na[b]||(this.na[b]=c,this.Ca=function(a){this.O(a,this.type);return!0},c.value="",this.print=function(a){return function(b){wb(a,b)}}(c),this.O=function(a,b){return function(a,c){a||(a="");c!=Lb.Ce||"..."!=a.slice(-3)?(c&&(a=c+": "+a),wb(b,a+"\n")):xb(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
||||||
l.print=function(){};l.O=function(){};l.status=function(a){this.O(this.type+": "+a)};l.Ca=function(a,b,c){if(!b){var d=zb("Computer",this.id);if(d&&d.ca.Tf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||lb((c?c+": ":"")+a);return!0};function Mb(a,b){a.ca.error=!0;a.Ca(b)}function Nb(a,b){b&&(a.ca.ready?b():a.rg=b);return a.ca.ready}function Ob(a,b){a.ca.error||(a.ca.ready=!1!==b,a.ca.ready&&(b=a.rg,a.rg=null,b&&b()))}
|
l.print=function(){};l.O=function(){};l.status=function(a){this.O(this.type+": "+a)};l.Ca=function(a,b,c){if(!b){var d=zb("Computer",this.id);if(d&&d.ca.Tf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||lb((c?c+": ":"")+a);return!0};function Mb(a,b){a.ca.error=!0;a.Ca(b)}function Nb(a,b){b&&(a.ca.ready?b():a.rg=b);return a.ca.ready}function Ob(a,b){a.ca.error||(a.ca.ready=!1!==b,a.ca.ready&&(b=a.rg,a.rg=null,b&&b()))}
|
||||||
function Pb(a,b){a.ca.qf&&(b?a.ca.eh=!0:void 0===b&&a.O(a.toString()+" busy"));return a.ca.qf}function Qb(a,b){if(a.ca.eh)return a.ca.qf=!1,a.ca.eh=!1;if(a.ca.error)return a.O(a.toString()+" error"),!1;a.ca.qf=b;return a.ca.qf}l.Xb=function(){return this.ca.dc=!0};l.Wb=function(a,b){b&&(this.ca.dc=!1);return!0};function t(a,b){if(a.ba){a===a.ba?b|=0:b=b||a.ic;var c=a.ba.ic&b;return!!b&&c===b||!!(c&a.ba.zl)}return!1}function Rb(a,b,c,d){a.ba&&(!0===c||t(a,c|0))&&a.ba.message(b,d)}
|
function Pb(a,b){a.ca.qf&&(b?a.ca.eh=!0:void 0===b&&a.O(a.toString()+" busy"));return a.ca.qf}function Qb(a,b){if(a.ca.eh)return a.ca.qf=!1,a.ca.eh=!1;if(a.ca.error)return a.O(a.toString()+" error"),!1;a.ca.qf=b;return a.ca.qf}l.Xb=function(){return this.ca.dc=!0};l.Wb=function(a,b){b&&(this.ca.dc=!1);return!0};function t(a,b){if(a.ba){a===a.ba?b|=0:b=b||a.ic;var c=a.ba.ic&b;return!!b&&c===b||!!(c&a.ba.zl)}return!1}function Rb(a,b,c,d){a.ba&&(!0===c||t(a,c|0))&&a.ba.message(b,d)}
|
||||||
function w(a,b,c,d,e,f,g){a.ba&&(!0===g?g=0:null==g&&(g=a.ic),Sb(a.ba,a,b,c,d,e,f,g))}var Lb={Vp:"notice",gq:"warning",ERROR:"error",Ce:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
function w(a,b,c,d,e,f,g){a.ba&&(!0===g?g=0:null==g&&(g=a.ic),Sb(a.ba,a,b,c,d,e,f,g))}var Lb={ERROR:"error",Vp:"notice",Ce:"progress",SCRIPT:"script",gq:"warning"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var ub=window?window.PCjs.Machines:{},rb=window?window.PCjs.Components:[],Gb=window?window.PCjs.Commands:{},Ib=["hold","sleep","wait"],Jb={alert:function(a){lb(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Kb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var ub=window?window.PCjs.Machines:{},rb=window?window.PCjs.Components:[],Gb=window?window.PCjs.Commands:{},Ib=["hold","sleep","wait"],Jb={alert:function(a){lb(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Kb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ function lb(a){for(var b=!0,c=mb[a];c&&c.length;){var d=c.splice(0,1)[0],e=d[0],
|
||||||
l.toString=function(){return this.name?this.name:this.id||this.type};
|
l.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
l.yb=function(a,b,c){switch(b){case "clear":return this.ja[b]||(this.ja[b]=c,c.onclick=function(a){return function(){a.ja.print&&(a.ja.print.value="")}}(this)),!0;case "print":return this.ja[b]||(this.ja[b]=c,this.ua=function(a){this.ub(a,this.type);return!0},c.value="",this.print=function(a){return function(b){cb(a,b)}}(c),this.ub=function(a,b){return function(a,c){a||(a="");c!=qb.$d||"..."!=a.slice(-3)?(c&&(a=c+": "+a),cb(b,a+"\n")):db(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
l.yb=function(a,b,c){switch(b){case "clear":return this.ja[b]||(this.ja[b]=c,c.onclick=function(a){return function(){a.ja.print&&(a.ja.print.value="")}}(this)),!0;case "print":return this.ja[b]||(this.ja[b]=c,this.ua=function(a){this.ub(a,this.type);return!0},c.value="",this.print=function(a){return function(b){cb(a,b)}}(c),this.ub=function(a,b){return function(a,c){a||(a="");c!=qb.$d||"..."!=a.slice(-3)?(c&&(a=c+": "+a),cb(b,a+"\n")):db(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
||||||
l.print=function(){};l.ub=function(){};l.status=function(a){this.ub(this.type+": "+a)};l.ua=function(a,b,c){if(!b){var d=fb("Computer",this.id);if(d&&d.Z.jf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function rb(a,b){a.Z.error=!0;a.ua(b)}function sb(a,b){b&&(a.Z.ready?b():a.Hf=b);return a.Z.ready}function tb(a,b){a.Z.error||(a.Z.ready=!1!==b,a.Z.ready&&(b=a.Hf,a.Hf=null,b&&b()))}
|
l.print=function(){};l.ub=function(){};l.status=function(a){this.ub(this.type+": "+a)};l.ua=function(a,b,c){if(!b){var d=fb("Computer",this.id);if(d&&d.Z.jf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function rb(a,b){a.Z.error=!0;a.ua(b)}function sb(a,b){b&&(a.Z.ready?b():a.Hf=b);return a.Z.ready}function tb(a,b){a.Z.error||(a.Z.ready=!1!==b,a.Z.ready&&(b=a.Hf,a.Hf=null,b&&b()))}
|
||||||
function ub(a,b){if(a.Z.pg)return a.Z.zf=!1,a.Z.pg=!1;if(a.Z.error)return a.ub(a.toString()+" error"),!1;a.Z.zf=b;return a.Z.zf}l.Pb=function(){return this.Z.Zb=!0};l.Ob=function(a,b){b&&(this.Z.Zb=!1);return!0};var qb={xo:"notice",Io:"warning",ERROR:"error",$d:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
function ub(a,b){if(a.Z.pg)return a.Z.zf=!1,a.Z.pg=!1;if(a.Z.error)return a.ub(a.toString()+" error"),!1;a.Z.zf=b;return a.Z.zf}l.Pb=function(){return this.Z.Zb=!0};l.Ob=function(a,b){b&&(this.Z.Zb=!1);return!0};var qb={ERROR:"error",xo:"notice",$d:"progress",SCRIPT:"script",Io:"warning"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var ab=window?window.PCjs.Machines:{},Za=window?window.PCjs.Components:[],mb=window?window.PCjs.Commands:{},nb=["hold","sleep","wait"],ob={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},pb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var ab=window?window.PCjs.Machines:{},Za=window?window.PCjs.Components:[],mb=window?window.PCjs.Commands:{},nb=["hold","sleep","wait"],ob={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},pb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
|
|
@ -1887,10 +1887,10 @@ class C1PDebugger extends Component {
|
||||||
return;
|
return;
|
||||||
if (!DEBUG && (addrEnd - addr) > 0x100) {
|
if (!DEBUG && (addrEnd - addr) > 0x100) {
|
||||||
/*
|
/*
|
||||||
* Limiting the amount of disassembled code to 1 page in non-DEBUG builds is partly to
|
* Limiting the amount of disassembled code to one "memory page" in non-DEBUG builds is partly
|
||||||
* prevent the user from wedging their browser, but also a recognition that, in non-DEBUG builds,
|
* to prevent the user from wedging their browser, but also a recognition that, in non-DEBUG builds,
|
||||||
* Component.println() also keeps its output buffer truncated to 8K, which is only enough for
|
* the println() output buffer is truncated to 8K, which is only enough for about two pages of
|
||||||
* about 2 pages of disassembled code anyway.
|
* disassembled code anyway.
|
||||||
*/
|
*/
|
||||||
this.println("range too large");
|
this.println("range too large");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -271,14 +271,34 @@ class Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component.print(s)
|
||||||
|
*
|
||||||
|
* Components that inherit from this class should use this.print(), rather than Component.print(), because
|
||||||
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
|
*
|
||||||
|
* @this {Component}
|
||||||
|
* @param {string} s
|
||||||
|
*/
|
||||||
|
static print(s)
|
||||||
|
{
|
||||||
|
if (!COMPILED) {
|
||||||
|
var i = s.lastIndexOf('\n');
|
||||||
|
if (i >= 0) {
|
||||||
|
Component.println(s.substr(0, i));
|
||||||
|
s = s.substr(i + 1);
|
||||||
|
}
|
||||||
|
Component.printBuffer += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component.println(s, type, id)
|
* Component.println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
* Components that inherit from this class should use this.println(), rather than Component.println(), because
|
||||||
*
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
* Components that inherit from this class should use the instance method, this.println(), rather than Component.println(),
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
* because if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the class
|
|
||||||
* method would improperly affect any other machines loaded on the same page).
|
|
||||||
*
|
*
|
||||||
* @param {string} [s] is the message text
|
* @param {string} [s] is the message text
|
||||||
* @param {string} [type] is the message type
|
* @param {string} [type] is the message type
|
||||||
|
|
@ -287,7 +307,9 @@ class Component {
|
||||||
static println(s, type, id)
|
static println(s, type, id)
|
||||||
{
|
{
|
||||||
if (!COMPILED) {
|
if (!COMPILED) {
|
||||||
|
s = Component.printBuffer + (s || "");
|
||||||
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
||||||
|
Component.printBuffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,9 +431,6 @@ class Component {
|
||||||
*/
|
*/
|
||||||
static replaceControl(control, sSearch, sReplace)
|
static replaceControl(control, sSearch, sReplace)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
|
||||||
*/
|
|
||||||
var sText = control.value;
|
var sText = control.value;
|
||||||
var i = sText.lastIndexOf(sSearch);
|
var i = sText.lastIndexOf(sSearch);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
@ -419,6 +438,9 @@ class Component {
|
||||||
} else {
|
} else {
|
||||||
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
||||||
|
*/
|
||||||
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
||||||
control.value = sText;
|
control.value = sText;
|
||||||
control.scrollTop = control.scrollHeight;
|
control.scrollTop = control.scrollHeight;
|
||||||
|
|
@ -683,7 +705,7 @@ class Component {
|
||||||
* ^J ^M ^K ^I ^H ^L
|
* ^J ^M ^K ^I ^H ^L
|
||||||
*
|
*
|
||||||
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
||||||
* is the ASCII code in hex. For ESC, that would \x1B.
|
* is the ASCII code in hex. For ESC, that would be \x1B.
|
||||||
*
|
*
|
||||||
* @param {string} sScript
|
* @param {string} sScript
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -781,7 +803,7 @@ class Component {
|
||||||
* instead, but it's a bit too confusing mingling script output in a window that
|
* instead, but it's a bit too confusing mingling script output in a window that
|
||||||
* already mingles Debugger and machine output.
|
* already mingles Debugger and machine output.
|
||||||
*/
|
*/
|
||||||
Component.println('script: ' + aTokens.join(' '));
|
Component.println(aTokens.join(' '), Component.TYPE.SCRIPT);
|
||||||
|
|
||||||
var fnCallReady = null;
|
var fnCallReady = null;
|
||||||
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
||||||
|
|
@ -1063,8 +1085,6 @@ class Component {
|
||||||
/**
|
/**
|
||||||
* print(s)
|
* print(s)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -1073,19 +1093,12 @@ class Component {
|
||||||
*/
|
*/
|
||||||
print(s)
|
print(s)
|
||||||
{
|
{
|
||||||
var i = s.lastIndexOf('\n');
|
Component.print(s);
|
||||||
if (i >= 0) {
|
|
||||||
Component.println(s.substr(0, i));
|
|
||||||
s = s.substr(i + 1);
|
|
||||||
}
|
|
||||||
Component.printBuffer += s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* println(s, type, id)
|
* println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -1096,8 +1109,7 @@ class Component {
|
||||||
*/
|
*/
|
||||||
println(s, type, id)
|
println(s, type, id)
|
||||||
{
|
{
|
||||||
Component.println(Component.printBuffer + s, type, id || this.id);
|
Component.println(s, type, id || this.id);
|
||||||
Component.printBuffer = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1375,15 +1387,16 @@ class Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the standard TYPE values you can pass as the second argument to println(); in reality,
|
* These are the standard TYPE values you can pass as an optional argument to println(); in reality,
|
||||||
* you can pass anything you want, because they are just tacked onto the message as a prefix, with the
|
* you can pass anything you want, because they are simply prepended to the message, although PROGRESS
|
||||||
* exception of PROGRESS, which will suppress the message unless we're in DEBUG or INIT mode.
|
* messages may also be merged with earlier similar messages to keep the output buffer under control.
|
||||||
*/
|
*/
|
||||||
Component.TYPE = {
|
Component.TYPE = {
|
||||||
NOTICE: "notice",
|
|
||||||
WARNING: "warning",
|
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
PROGRESS: "progress"
|
NOTICE: "notice",
|
||||||
|
PROGRESS: "progress",
|
||||||
|
SCRIPT: "script",
|
||||||
|
WARNING: "warning"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -660,7 +660,7 @@ class Str {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace(sFind, sReplace, s)
|
* replace(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
||||||
* the search string is NOT a RegExp; specifically:
|
* the search string is NOT a RegExp; specifically:
|
||||||
|
|
@ -675,36 +675,36 @@ class Str {
|
||||||
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
||||||
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
||||||
*
|
*
|
||||||
* Similar to the JavaScript replace() method, this replaces only one occurrence (ie, the FIRST occurrence);
|
* Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence
|
||||||
* it might be nice to add options to replace the LAST occurrence and/or ALL occurrences, but we'll revisit
|
* (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL
|
||||||
* that later.
|
* occurrences, but we'll revisit that later.
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replace(sFind, sReplace, s)
|
static replace(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var i = s.indexOf(sFind);
|
var i = s.indexOf(sSearch);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
s = s.substr(0, i) + sReplace + s.substr(i + sFind.length);
|
s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaceAll(sFind, sReplace, s)
|
* replaceAll(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replaceAll(sFind, sReplace, s)
|
static replaceAll(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var a = {};
|
var a = {};
|
||||||
a[sFind] = sReplace;
|
a[sSearch] = sReplace;
|
||||||
return Str.replaceArray(a, s);
|
return Str.replaceArray(a, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2402,14 +2402,34 @@ class Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component.print(s)
|
||||||
|
*
|
||||||
|
* Components that inherit from this class should use this.print(), rather than Component.print(), because
|
||||||
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
|
*
|
||||||
|
* @this {Component}
|
||||||
|
* @param {string} s
|
||||||
|
*/
|
||||||
|
static print(s)
|
||||||
|
{
|
||||||
|
if (!COMPILED) {
|
||||||
|
var i = s.lastIndexOf('\n');
|
||||||
|
if (i >= 0) {
|
||||||
|
Component.println(s.substr(0, i));
|
||||||
|
s = s.substr(i + 1);
|
||||||
|
}
|
||||||
|
Component.printBuffer += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component.println(s, type, id)
|
* Component.println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
* Components that inherit from this class should use this.println(), rather than Component.println(), because
|
||||||
*
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
* Components that inherit from this class should use the instance method, this.println(), rather than Component.println(),
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
* because if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the class
|
|
||||||
* method would improperly affect any other machines loaded on the same page).
|
|
||||||
*
|
*
|
||||||
* @param {string} [s] is the message text
|
* @param {string} [s] is the message text
|
||||||
* @param {string} [type] is the message type
|
* @param {string} [type] is the message type
|
||||||
|
|
@ -2418,7 +2438,9 @@ class Component {
|
||||||
static println(s, type, id)
|
static println(s, type, id)
|
||||||
{
|
{
|
||||||
if (!COMPILED) {
|
if (!COMPILED) {
|
||||||
|
s = Component.printBuffer + (s || "");
|
||||||
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
||||||
|
Component.printBuffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2540,9 +2562,6 @@ class Component {
|
||||||
*/
|
*/
|
||||||
static replaceControl(control, sSearch, sReplace)
|
static replaceControl(control, sSearch, sReplace)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
|
||||||
*/
|
|
||||||
var sText = control.value;
|
var sText = control.value;
|
||||||
var i = sText.lastIndexOf(sSearch);
|
var i = sText.lastIndexOf(sSearch);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
@ -2550,6 +2569,9 @@ class Component {
|
||||||
} else {
|
} else {
|
||||||
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
||||||
|
*/
|
||||||
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
||||||
control.value = sText;
|
control.value = sText;
|
||||||
control.scrollTop = control.scrollHeight;
|
control.scrollTop = control.scrollHeight;
|
||||||
|
|
@ -2814,7 +2836,7 @@ class Component {
|
||||||
* ^J ^M ^K ^I ^H ^L
|
* ^J ^M ^K ^I ^H ^L
|
||||||
*
|
*
|
||||||
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
||||||
* is the ASCII code in hex. For ESC, that would \x1B.
|
* is the ASCII code in hex. For ESC, that would be \x1B.
|
||||||
*
|
*
|
||||||
* @param {string} sScript
|
* @param {string} sScript
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -2912,7 +2934,7 @@ class Component {
|
||||||
* instead, but it's a bit too confusing mingling script output in a window that
|
* instead, but it's a bit too confusing mingling script output in a window that
|
||||||
* already mingles Debugger and machine output.
|
* already mingles Debugger and machine output.
|
||||||
*/
|
*/
|
||||||
Component.println('script: ' + aTokens.join(' '));
|
Component.println(aTokens.join(' '), Component.TYPE.SCRIPT);
|
||||||
|
|
||||||
var fnCallReady = null;
|
var fnCallReady = null;
|
||||||
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
||||||
|
|
@ -3194,8 +3216,6 @@ class Component {
|
||||||
/**
|
/**
|
||||||
* print(s)
|
* print(s)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3204,19 +3224,12 @@ class Component {
|
||||||
*/
|
*/
|
||||||
print(s)
|
print(s)
|
||||||
{
|
{
|
||||||
var i = s.lastIndexOf('\n');
|
Component.print(s);
|
||||||
if (i >= 0) {
|
|
||||||
Component.println(s.substr(0, i));
|
|
||||||
s = s.substr(i + 1);
|
|
||||||
}
|
|
||||||
Component.printBuffer += s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* println(s, type, id)
|
* println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3227,8 +3240,7 @@ class Component {
|
||||||
*/
|
*/
|
||||||
println(s, type, id)
|
println(s, type, id)
|
||||||
{
|
{
|
||||||
Component.println(Component.printBuffer + s, type, id || this.id);
|
Component.println(s, type, id || this.id);
|
||||||
Component.printBuffer = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3506,15 +3518,16 @@ class Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the standard TYPE values you can pass as the second argument to println(); in reality,
|
* These are the standard TYPE values you can pass as an optional argument to println(); in reality,
|
||||||
* you can pass anything you want, because they are just tacked onto the message as a prefix, with the
|
* you can pass anything you want, because they are simply prepended to the message, although PROGRESS
|
||||||
* exception of PROGRESS, which will suppress the message unless we're in DEBUG or INIT mode.
|
* messages may also be merged with earlier similar messages to keep the output buffer under control.
|
||||||
*/
|
*/
|
||||||
Component.TYPE = {
|
Component.TYPE = {
|
||||||
NOTICE: "notice",
|
|
||||||
WARNING: "warning",
|
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
PROGRESS: "progress"
|
NOTICE: "notice",
|
||||||
|
PROGRESS: "progress",
|
||||||
|
SCRIPT: "script",
|
||||||
|
WARNING: "warning"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -13138,10 +13151,10 @@ class C1PDebugger extends Component {
|
||||||
return;
|
return;
|
||||||
if (!DEBUG && (addrEnd - addr) > 0x100) {
|
if (!DEBUG && (addrEnd - addr) > 0x100) {
|
||||||
/*
|
/*
|
||||||
* Limiting the amount of disassembled code to 1 page in non-DEBUG builds is partly to
|
* Limiting the amount of disassembled code to one "memory page" in non-DEBUG builds is partly
|
||||||
* prevent the user from wedging their browser, but also a recognition that, in non-DEBUG builds,
|
* to prevent the user from wedging their browser, but also a recognition that, in non-DEBUG builds,
|
||||||
* Component.println() also keeps its output buffer truncated to 8K, which is only enough for
|
* the println() output buffer is truncated to 8K, which is only enough for about two pages of
|
||||||
* about 2 pages of disassembled code anyway.
|
* disassembled code anyway.
|
||||||
*/
|
*/
|
||||||
this.println("range too large");
|
this.println("range too large");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -60,7 +60,8 @@ l.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
l.da=function(a,b,c){switch(b){case "clear":return this.P[b]||(this.P[b]=c,c.onclick=function(a){return function(){a.P.print&&(a.P.print.value="")}}(this)),!0;case "print":return this.P[b]||(this.P[b]=c,this.aa=function(a){this.i(a,this.type);return!0},c.value="",this.print=function(a){return function(b){lb(a,b)}}(c),this.i=function(a,b){return function(a,c){a||(a="");if(c!=zb.kd||"..."!=a.slice(-3))c&&(a=c+": "+a),lb(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
l.da=function(a,b,c){switch(b){case "clear":return this.P[b]||(this.P[b]=c,c.onclick=function(a){return function(){a.P.print&&(a.P.print.value="")}}(this)),!0;case "print":return this.P[b]||(this.P[b]=c,this.aa=function(a){this.i(a,this.type);return!0},c.value="",this.print=function(a){return function(b){lb(a,b)}}(c),this.i=function(a,b){return function(a,c){a||(a="");if(c!=zb.kd||"..."!=a.slice(-3))c&&(a=c+": "+a),lb(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
||||||
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};l.log=function(){};l.print=function(){};l.i=function(){};l.status=function(a){this.i(this.type+": "+a)};l.aa=function(a,b,c){if(!b){var d=sb("Computer",this.id);if(d&&d.F.Qb)return console.log("ignoring notice during unload: "+a),!1}Za(a,b,c||this.type);return!0};function Ab(a,b){a.F.error=!0;a.aa(b)}
|
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};l.log=function(){};l.print=function(){};l.i=function(){};l.status=function(a){this.i(this.type+": "+a)};l.aa=function(a,b,c){if(!b){var d=sb("Computer",this.id);if(d&&d.F.Qb)return console.log("ignoring notice during unload: "+a),!1}Za(a,b,c||this.type);return!0};function Ab(a,b){a.F.error=!0;a.aa(b)}
|
||||||
function Bb(a,b){b&&(a.F.ready?b():a.xb=b);return a.F.ready}function Cb(a){if(!a.F.error&&(a.F.ready=!0,a.F.ready)){var b=a.xb;a.xb=null;b&&b()}}function Db(a,b){a.F.kb&&(b?a.F.Hb=!0:void 0===b&&a.i(a.toString()+" busy"));return a.F.kb}function Eb(a,b){if(a.F.Hb)return a.F.kb=!1,a.F.Hb=!1;if(a.F.error)return a.i(a.toString()+" error"),!1;a.F.kb=b;return a.F.kb}l.va=function(){return this.F.ja=!0};l.ua=function(a,b){b&&(this.F.ja=!1);return!0};
|
function Bb(a,b){b&&(a.F.ready?b():a.xb=b);return a.F.ready}function Cb(a){if(!a.F.error&&(a.F.ready=!0,a.F.ready)){var b=a.xb;a.xb=null;b&&b()}}function Db(a,b){a.F.kb&&(b?a.F.Hb=!0:void 0===b&&a.i(a.toString()+" busy"));return a.F.kb}function Eb(a,b){if(a.F.Hb)return a.F.kb=!1,a.F.Hb=!1;if(a.F.error)return a.i(a.toString()+" error"),!1;a.F.kb=b;return a.F.kb}l.va=function(){return this.F.ja=!0};l.ua=function(a,b){b&&(this.F.ja=!1);return!0};
|
||||||
function Fb(a,b){if(a.K){a===a.K?b|=0:b=b||a.ha;var c=a.K.ha&b;return!!b&&c===b||!!(c&a.K.xd)}return!1}function Gb(a,b){a.K&&Fb(a,0)&&a.K.message(b,void 0)}function x(a,b,c,d,e,f,g){a.K&&(!0===g?g=0:null==g&&(g=a.ha),Hb(a.K,a,b,c,d,e,f,g))}var zb={wf:"notice",Pf:"warning",ERROR:"error",kd:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
function Fb(a,b){if(a.K){a===a.K?b|=0:b=b||a.ha;var c=a.K.ha&b;return!!b&&c===b||!!(c&a.K.xd)}return!1}function Gb(a,b){a.K&&Fb(a,0)&&a.K.message(b,void 0)}function x(a,b,c,d,e,f,g){a.K&&(!0===g?g=0:null==g&&(g=a.ha),Hb(a.K,a,b,c,d,e,f,g))}var zb={ERROR:"error",wf:"notice",kd:"progress",SCRIPT:"script",Pf:"warning"};
|
||||||
|
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var ib=window?window.PCjs.Machines:{},gb=window?window.PCjs.Components:[],ub=window?window.PCjs.Commands:{},vb=["hold","sleep","wait"],xb={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},yb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var ib=window?window.PCjs.Machines:{},gb=window?window.PCjs.Components:[],ub=window?window.PCjs.Commands:{},vb=["hold","sleep","wait"],xb={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},yb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -950,7 +950,7 @@ class Str {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace(sFind, sReplace, s)
|
* replace(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
||||||
* the search string is NOT a RegExp; specifically:
|
* the search string is NOT a RegExp; specifically:
|
||||||
|
|
@ -965,36 +965,36 @@ class Str {
|
||||||
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
||||||
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
||||||
*
|
*
|
||||||
* Similar to the JavaScript replace() method, this replaces only one occurrence (ie, the FIRST occurrence);
|
* Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence
|
||||||
* it might be nice to add options to replace the LAST occurrence and/or ALL occurrences, but we'll revisit
|
* (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL
|
||||||
* that later.
|
* occurrences, but we'll revisit that later.
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replace(sFind, sReplace, s)
|
static replace(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var i = s.indexOf(sFind);
|
var i = s.indexOf(sSearch);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
s = s.substr(0, i) + sReplace + s.substr(i + sFind.length);
|
s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaceAll(sFind, sReplace, s)
|
* replaceAll(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replaceAll(sFind, sReplace, s)
|
static replaceAll(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var a = {};
|
var a = {};
|
||||||
a[sFind] = sReplace;
|
a[sSearch] = sReplace;
|
||||||
return Str.replaceArray(a, s);
|
return Str.replaceArray(a, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2692,14 +2692,34 @@ class Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component.print(s)
|
||||||
|
*
|
||||||
|
* Components that inherit from this class should use this.print(), rather than Component.print(), because
|
||||||
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
|
*
|
||||||
|
* @this {Component}
|
||||||
|
* @param {string} s
|
||||||
|
*/
|
||||||
|
static print(s)
|
||||||
|
{
|
||||||
|
if (!COMPILED) {
|
||||||
|
var i = s.lastIndexOf('\n');
|
||||||
|
if (i >= 0) {
|
||||||
|
Component.println(s.substr(0, i));
|
||||||
|
s = s.substr(i + 1);
|
||||||
|
}
|
||||||
|
Component.printBuffer += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component.println(s, type, id)
|
* Component.println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
* Components that inherit from this class should use this.println(), rather than Component.println(), because
|
||||||
*
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
* Components that inherit from this class should use the instance method, this.println(), rather than Component.println(),
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
* because if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the class
|
|
||||||
* method would improperly affect any other machines loaded on the same page).
|
|
||||||
*
|
*
|
||||||
* @param {string} [s] is the message text
|
* @param {string} [s] is the message text
|
||||||
* @param {string} [type] is the message type
|
* @param {string} [type] is the message type
|
||||||
|
|
@ -2708,7 +2728,9 @@ class Component {
|
||||||
static println(s, type, id)
|
static println(s, type, id)
|
||||||
{
|
{
|
||||||
if (!COMPILED) {
|
if (!COMPILED) {
|
||||||
|
s = Component.printBuffer + (s || "");
|
||||||
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
||||||
|
Component.printBuffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2830,9 +2852,6 @@ class Component {
|
||||||
*/
|
*/
|
||||||
static replaceControl(control, sSearch, sReplace)
|
static replaceControl(control, sSearch, sReplace)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
|
||||||
*/
|
|
||||||
var sText = control.value;
|
var sText = control.value;
|
||||||
var i = sText.lastIndexOf(sSearch);
|
var i = sText.lastIndexOf(sSearch);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
@ -2840,6 +2859,9 @@ class Component {
|
||||||
} else {
|
} else {
|
||||||
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
||||||
|
*/
|
||||||
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
||||||
control.value = sText;
|
control.value = sText;
|
||||||
control.scrollTop = control.scrollHeight;
|
control.scrollTop = control.scrollHeight;
|
||||||
|
|
@ -3104,7 +3126,7 @@ class Component {
|
||||||
* ^J ^M ^K ^I ^H ^L
|
* ^J ^M ^K ^I ^H ^L
|
||||||
*
|
*
|
||||||
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
||||||
* is the ASCII code in hex. For ESC, that would \x1B.
|
* is the ASCII code in hex. For ESC, that would be \x1B.
|
||||||
*
|
*
|
||||||
* @param {string} sScript
|
* @param {string} sScript
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -3202,7 +3224,7 @@ class Component {
|
||||||
* instead, but it's a bit too confusing mingling script output in a window that
|
* instead, but it's a bit too confusing mingling script output in a window that
|
||||||
* already mingles Debugger and machine output.
|
* already mingles Debugger and machine output.
|
||||||
*/
|
*/
|
||||||
Component.println('script: ' + aTokens.join(' '));
|
Component.println(aTokens.join(' '), Component.TYPE.SCRIPT);
|
||||||
|
|
||||||
var fnCallReady = null;
|
var fnCallReady = null;
|
||||||
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
||||||
|
|
@ -3484,8 +3506,6 @@ class Component {
|
||||||
/**
|
/**
|
||||||
* print(s)
|
* print(s)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3494,19 +3514,12 @@ class Component {
|
||||||
*/
|
*/
|
||||||
print(s)
|
print(s)
|
||||||
{
|
{
|
||||||
var i = s.lastIndexOf('\n');
|
Component.print(s);
|
||||||
if (i >= 0) {
|
|
||||||
Component.println(s.substr(0, i));
|
|
||||||
s = s.substr(i + 1);
|
|
||||||
}
|
|
||||||
Component.printBuffer += s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* println(s, type, id)
|
* println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3517,8 +3530,7 @@ class Component {
|
||||||
*/
|
*/
|
||||||
println(s, type, id)
|
println(s, type, id)
|
||||||
{
|
{
|
||||||
Component.println(Component.printBuffer + s, type, id || this.id);
|
Component.println(s, type, id || this.id);
|
||||||
Component.printBuffer = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3796,15 +3808,16 @@ class Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the standard TYPE values you can pass as the second argument to println(); in reality,
|
* These are the standard TYPE values you can pass as an optional argument to println(); in reality,
|
||||||
* you can pass anything you want, because they are just tacked onto the message as a prefix, with the
|
* you can pass anything you want, because they are simply prepended to the message, although PROGRESS
|
||||||
* exception of PROGRESS, which will suppress the message unless we're in DEBUG or INIT mode.
|
* messages may also be merged with earlier similar messages to keep the output buffer under control.
|
||||||
*/
|
*/
|
||||||
Component.TYPE = {
|
Component.TYPE = {
|
||||||
NOTICE: "notice",
|
|
||||||
WARNING: "warning",
|
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
PROGRESS: "progress"
|
NOTICE: "notice",
|
||||||
|
PROGRESS: "progress",
|
||||||
|
SCRIPT: "script",
|
||||||
|
WARNING: "warning"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ function Ya(a){for(var b=!0,c=Za[a];c&&c.length;){var d=c.splice(0,1)[0],e=d[0],
|
||||||
k.toString=function(){return this.name?this.name:this.id||this.type};
|
k.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
k.S=function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.w[b]=c,this.G=function(a){this.aa(a,this.type);return!0},c.value="",this.print=function(a){return function(b){Sa(a,b)}}(c),this.aa=function(a,b){return function(a,c){a||(a="");if(c!=cb.Jc||"..."!=a.slice(-3))c&&(a=c+": "+a),Sa(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
k.S=function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.w[b]=c,this.G=function(a){this.aa(a,this.type);return!0},c.value="",this.print=function(a){return function(b){Sa(a,b)}}(c),this.aa=function(a,b){return function(a,c){a||(a="");if(c!=cb.Jc||"..."!=a.slice(-3))c&&(a=c+": "+a),Sa(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
||||||
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};k.log=function(){};k.print=function(){};k.aa=function(){};k.status=function(a){this.aa(this.type+": "+a)};k.G=function(a,b,c){if(!b){var d=Xa("Computer",this.id);if(d&&d.i.pb)return console.log("ignoring notice during unload: "+a),!1}Ja(a,b,c||this.type);return!0};function db(a,b){b&&(a.i.ready?b():a.bb=b);return a.i.ready}
|
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};k.log=function(){};k.print=function(){};k.aa=function(){};k.status=function(a){this.aa(this.type+": "+a)};k.G=function(a,b,c){if(!b){var d=Xa("Computer",this.id);if(d&&d.i.pb)return console.log("ignoring notice during unload: "+a),!1}Ja(a,b,c||this.type);return!0};function db(a,b){b&&(a.i.ready?b():a.bb=b);return a.i.ready}
|
||||||
function B(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.bb;a.bb=null;b&&b()}}function eb(a,b){if(a.i.lb)return a.i.Za=!1,a.i.lb=!1;if(a.i.error)return a.aa(a.toString()+" error"),!1;a.i.Za=b;return a.i.Za}k.ca=function(){return this.i.V=!0};k.ba=function(a,b){b&&(this.i.V=!1);return!0};var cb={Qe:"notice",kf:"warning",ERROR:"error",Jc:"progress"};
|
function B(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.bb;a.bb=null;b&&b()}}function eb(a,b){if(a.i.lb)return a.i.Za=!1,a.i.lb=!1;if(a.i.error)return a.aa(a.toString()+" error"),!1;a.i.Za=b;return a.i.Za}k.ca=function(){return this.i.V=!0};k.ba=function(a,b){b&&(this.i.V=!1);return!0};var cb={ERROR:"error",Qe:"notice",Jc:"progress",SCRIPT:"script",kf:"warning"};
|
||||||
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var Pa=window?window.PCjs.Machines:{},u=window?window.PCjs.Components:[],Za=window?window.PCjs.Commands:{},$a=["hold","sleep","wait"],ab={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},bb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var Pa=window?window.PCjs.Machines:{},u=window?window.PCjs.Components:[],Za=window?window.PCjs.Commands:{},$a=["hold","sleep","wait"],ab={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},bb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -79,7 +79,7 @@ l.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
l.Cb=function(a,b,c){switch(b){case "clear":return this.na[b]||(this.na[b]=c,c.onclick=function(a){return function(){a.na.print&&(a.na.print.value="")}}(this)),!0;case "print":return this.na[b]||(this.na[b]=c,this.Ca=function(a){this.O(a,this.type);return!0},c.value="",this.print=function(a){return function(b){wb(a,b)}}(c),this.O=function(a,b){return function(a,c){a||(a="");c!=Lb.Ce||"..."!=a.slice(-3)?(c&&(a=c+": "+a),wb(b,a+"\n")):xb(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
l.Cb=function(a,b,c){switch(b){case "clear":return this.na[b]||(this.na[b]=c,c.onclick=function(a){return function(){a.na.print&&(a.na.print.value="")}}(this)),!0;case "print":return this.na[b]||(this.na[b]=c,this.Ca=function(a){this.O(a,this.type);return!0},c.value="",this.print=function(a){return function(b){wb(a,b)}}(c),this.O=function(a,b){return function(a,c){a||(a="");c!=Lb.Ce||"..."!=a.slice(-3)?(c&&(a=c+": "+a),wb(b,a+"\n")):xb(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
||||||
l.print=function(){};l.O=function(){};l.status=function(a){this.O(this.type+": "+a)};l.Ca=function(a,b,c){if(!b){var d=zb("Computer",this.id);if(d&&d.ca.Tf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||lb((c?c+": ":"")+a);return!0};function Mb(a,b){a.ca.error=!0;a.Ca(b)}function Nb(a,b){b&&(a.ca.ready?b():a.rg=b);return a.ca.ready}function Ob(a,b){a.ca.error||(a.ca.ready=!1!==b,a.ca.ready&&(b=a.rg,a.rg=null,b&&b()))}
|
l.print=function(){};l.O=function(){};l.status=function(a){this.O(this.type+": "+a)};l.Ca=function(a,b,c){if(!b){var d=zb("Computer",this.id);if(d&&d.ca.Tf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||lb((c?c+": ":"")+a);return!0};function Mb(a,b){a.ca.error=!0;a.Ca(b)}function Nb(a,b){b&&(a.ca.ready?b():a.rg=b);return a.ca.ready}function Ob(a,b){a.ca.error||(a.ca.ready=!1!==b,a.ca.ready&&(b=a.rg,a.rg=null,b&&b()))}
|
||||||
function Pb(a,b){a.ca.qf&&(b?a.ca.eh=!0:void 0===b&&a.O(a.toString()+" busy"));return a.ca.qf}function Qb(a,b){if(a.ca.eh)return a.ca.qf=!1,a.ca.eh=!1;if(a.ca.error)return a.O(a.toString()+" error"),!1;a.ca.qf=b;return a.ca.qf}l.Xb=function(){return this.ca.dc=!0};l.Wb=function(a,b){b&&(this.ca.dc=!1);return!0};function t(a,b){if(a.ba){a===a.ba?b|=0:b=b||a.ic;var c=a.ba.ic&b;return!!b&&c===b||!!(c&a.ba.zl)}return!1}function Rb(a,b,c,d){a.ba&&(!0===c||t(a,c|0))&&a.ba.message(b,d)}
|
function Pb(a,b){a.ca.qf&&(b?a.ca.eh=!0:void 0===b&&a.O(a.toString()+" busy"));return a.ca.qf}function Qb(a,b){if(a.ca.eh)return a.ca.qf=!1,a.ca.eh=!1;if(a.ca.error)return a.O(a.toString()+" error"),!1;a.ca.qf=b;return a.ca.qf}l.Xb=function(){return this.ca.dc=!0};l.Wb=function(a,b){b&&(this.ca.dc=!1);return!0};function t(a,b){if(a.ba){a===a.ba?b|=0:b=b||a.ic;var c=a.ba.ic&b;return!!b&&c===b||!!(c&a.ba.zl)}return!1}function Rb(a,b,c,d){a.ba&&(!0===c||t(a,c|0))&&a.ba.message(b,d)}
|
||||||
function w(a,b,c,d,e,f,g){a.ba&&(!0===g?g=0:null==g&&(g=a.ic),Sb(a.ba,a,b,c,d,e,f,g))}var Lb={Vp:"notice",gq:"warning",ERROR:"error",Ce:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
function w(a,b,c,d,e,f,g){a.ba&&(!0===g?g=0:null==g&&(g=a.ic),Sb(a.ba,a,b,c,d,e,f,g))}var Lb={ERROR:"error",Vp:"notice",Ce:"progress",SCRIPT:"script",gq:"warning"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var ub=window?window.PCjs.Machines:{},rb=window?window.PCjs.Components:[],Gb=window?window.PCjs.Commands:{},Ib=["hold","sleep","wait"],Jb={alert:function(a){lb(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Kb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var ub=window?window.PCjs.Machines:{},rb=window?window.PCjs.Components:[],Gb=window?window.PCjs.Commands:{},Ib=["hold","sleep","wait"],Jb={alert:function(a){lb(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Kb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1178,7 +1178,7 @@ class Str {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace(sFind, sReplace, s)
|
* replace(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
||||||
* the search string is NOT a RegExp; specifically:
|
* the search string is NOT a RegExp; specifically:
|
||||||
|
|
@ -1193,36 +1193,36 @@ class Str {
|
||||||
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
||||||
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
||||||
*
|
*
|
||||||
* Similar to the JavaScript replace() method, this replaces only one occurrence (ie, the FIRST occurrence);
|
* Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence
|
||||||
* it might be nice to add options to replace the LAST occurrence and/or ALL occurrences, but we'll revisit
|
* (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL
|
||||||
* that later.
|
* occurrences, but we'll revisit that later.
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replace(sFind, sReplace, s)
|
static replace(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var i = s.indexOf(sFind);
|
var i = s.indexOf(sSearch);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
s = s.substr(0, i) + sReplace + s.substr(i + sFind.length);
|
s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaceAll(sFind, sReplace, s)
|
* replaceAll(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replaceAll(sFind, sReplace, s)
|
static replaceAll(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var a = {};
|
var a = {};
|
||||||
a[sFind] = sReplace;
|
a[sSearch] = sReplace;
|
||||||
return Str.replaceArray(a, s);
|
return Str.replaceArray(a, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2920,14 +2920,34 @@ class Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component.print(s)
|
||||||
|
*
|
||||||
|
* Components that inherit from this class should use this.print(), rather than Component.print(), because
|
||||||
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
|
*
|
||||||
|
* @this {Component}
|
||||||
|
* @param {string} s
|
||||||
|
*/
|
||||||
|
static print(s)
|
||||||
|
{
|
||||||
|
if (!COMPILED) {
|
||||||
|
var i = s.lastIndexOf('\n');
|
||||||
|
if (i >= 0) {
|
||||||
|
Component.println(s.substr(0, i));
|
||||||
|
s = s.substr(i + 1);
|
||||||
|
}
|
||||||
|
Component.printBuffer += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component.println(s, type, id)
|
* Component.println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
* Components that inherit from this class should use this.println(), rather than Component.println(), because
|
||||||
*
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
* Components that inherit from this class should use the instance method, this.println(), rather than Component.println(),
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
* because if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the class
|
|
||||||
* method would improperly affect any other machines loaded on the same page).
|
|
||||||
*
|
*
|
||||||
* @param {string} [s] is the message text
|
* @param {string} [s] is the message text
|
||||||
* @param {string} [type] is the message type
|
* @param {string} [type] is the message type
|
||||||
|
|
@ -2936,7 +2956,9 @@ class Component {
|
||||||
static println(s, type, id)
|
static println(s, type, id)
|
||||||
{
|
{
|
||||||
if (!COMPILED) {
|
if (!COMPILED) {
|
||||||
|
s = Component.printBuffer + (s || "");
|
||||||
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
||||||
|
Component.printBuffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3058,9 +3080,6 @@ class Component {
|
||||||
*/
|
*/
|
||||||
static replaceControl(control, sSearch, sReplace)
|
static replaceControl(control, sSearch, sReplace)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
|
||||||
*/
|
|
||||||
var sText = control.value;
|
var sText = control.value;
|
||||||
var i = sText.lastIndexOf(sSearch);
|
var i = sText.lastIndexOf(sSearch);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
@ -3068,6 +3087,9 @@ class Component {
|
||||||
} else {
|
} else {
|
||||||
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
||||||
|
*/
|
||||||
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
||||||
control.value = sText;
|
control.value = sText;
|
||||||
control.scrollTop = control.scrollHeight;
|
control.scrollTop = control.scrollHeight;
|
||||||
|
|
@ -3332,7 +3354,7 @@ class Component {
|
||||||
* ^J ^M ^K ^I ^H ^L
|
* ^J ^M ^K ^I ^H ^L
|
||||||
*
|
*
|
||||||
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
||||||
* is the ASCII code in hex. For ESC, that would \x1B.
|
* is the ASCII code in hex. For ESC, that would be \x1B.
|
||||||
*
|
*
|
||||||
* @param {string} sScript
|
* @param {string} sScript
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -3430,7 +3452,7 @@ class Component {
|
||||||
* instead, but it's a bit too confusing mingling script output in a window that
|
* instead, but it's a bit too confusing mingling script output in a window that
|
||||||
* already mingles Debugger and machine output.
|
* already mingles Debugger and machine output.
|
||||||
*/
|
*/
|
||||||
Component.println('script: ' + aTokens.join(' '));
|
Component.println(aTokens.join(' '), Component.TYPE.SCRIPT);
|
||||||
|
|
||||||
var fnCallReady = null;
|
var fnCallReady = null;
|
||||||
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
||||||
|
|
@ -3712,8 +3734,6 @@ class Component {
|
||||||
/**
|
/**
|
||||||
* print(s)
|
* print(s)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3722,19 +3742,12 @@ class Component {
|
||||||
*/
|
*/
|
||||||
print(s)
|
print(s)
|
||||||
{
|
{
|
||||||
var i = s.lastIndexOf('\n');
|
Component.print(s);
|
||||||
if (i >= 0) {
|
|
||||||
Component.println(s.substr(0, i));
|
|
||||||
s = s.substr(i + 1);
|
|
||||||
}
|
|
||||||
Component.printBuffer += s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* println(s, type, id)
|
* println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3745,8 +3758,7 @@ class Component {
|
||||||
*/
|
*/
|
||||||
println(s, type, id)
|
println(s, type, id)
|
||||||
{
|
{
|
||||||
Component.println(Component.printBuffer + s, type, id || this.id);
|
Component.println(s, type, id || this.id);
|
||||||
Component.printBuffer = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -4024,15 +4036,16 @@ class Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the standard TYPE values you can pass as the second argument to println(); in reality,
|
* These are the standard TYPE values you can pass as an optional argument to println(); in reality,
|
||||||
* you can pass anything you want, because they are just tacked onto the message as a prefix, with the
|
* you can pass anything you want, because they are simply prepended to the message, although PROGRESS
|
||||||
* exception of PROGRESS, which will suppress the message unless we're in DEBUG or INIT mode.
|
* messages may also be merged with earlier similar messages to keep the output buffer under control.
|
||||||
*/
|
*/
|
||||||
Component.TYPE = {
|
Component.TYPE = {
|
||||||
NOTICE: "notice",
|
|
||||||
WARNING: "warning",
|
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
PROGRESS: "progress"
|
NOTICE: "notice",
|
||||||
|
PROGRESS: "progress",
|
||||||
|
SCRIPT: "script",
|
||||||
|
WARNING: "warning"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ function lb(a){for(var b=!0,c=mb[a];c&&c.length;){var d=c.splice(0,1)[0],e=d[0],
|
||||||
l.toString=function(){return this.name?this.name:this.id||this.type};
|
l.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
l.yb=function(a,b,c){switch(b){case "clear":return this.ja[b]||(this.ja[b]=c,c.onclick=function(a){return function(){a.ja.print&&(a.ja.print.value="")}}(this)),!0;case "print":return this.ja[b]||(this.ja[b]=c,this.ua=function(a){this.ub(a,this.type);return!0},c.value="",this.print=function(a){return function(b){cb(a,b)}}(c),this.ub=function(a,b){return function(a,c){a||(a="");c!=qb.$d||"..."!=a.slice(-3)?(c&&(a=c+": "+a),cb(b,a+"\n")):db(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
l.yb=function(a,b,c){switch(b){case "clear":return this.ja[b]||(this.ja[b]=c,c.onclick=function(a){return function(){a.ja.print&&(a.ja.print.value="")}}(this)),!0;case "print":return this.ja[b]||(this.ja[b]=c,this.ua=function(a){this.ub(a,this.type);return!0},c.value="",this.print=function(a){return function(b){cb(a,b)}}(c),this.ub=function(a,b){return function(a,c){a||(a="");c!=qb.$d||"..."!=a.slice(-3)?(c&&(a=c+": "+a),cb(b,a+"\n")):db(b,a,a+".")}}(this,c)),!0;default:return!1}};l.log=function(){};
|
||||||
l.print=function(){};l.ub=function(){};l.status=function(a){this.ub(this.type+": "+a)};l.ua=function(a,b,c){if(!b){var d=fb("Computer",this.id);if(d&&d.Z.jf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function rb(a,b){a.Z.error=!0;a.ua(b)}function sb(a,b){b&&(a.Z.ready?b():a.Hf=b);return a.Z.ready}function tb(a,b){a.Z.error||(a.Z.ready=!1!==b,a.Z.ready&&(b=a.Hf,a.Hf=null,b&&b()))}
|
l.print=function(){};l.ub=function(){};l.status=function(a){this.ub(this.type+": "+a)};l.ua=function(a,b,c){if(!b){var d=fb("Computer",this.id);if(d&&d.Z.jf)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function rb(a,b){a.Z.error=!0;a.ua(b)}function sb(a,b){b&&(a.Z.ready?b():a.Hf=b);return a.Z.ready}function tb(a,b){a.Z.error||(a.Z.ready=!1!==b,a.Z.ready&&(b=a.Hf,a.Hf=null,b&&b()))}
|
||||||
function ub(a,b){if(a.Z.pg)return a.Z.zf=!1,a.Z.pg=!1;if(a.Z.error)return a.ub(a.toString()+" error"),!1;a.Z.zf=b;return a.Z.zf}l.Pb=function(){return this.Z.Zb=!0};l.Ob=function(a,b){b&&(this.Z.Zb=!1);return!0};var qb={xo:"notice",Io:"warning",ERROR:"error",$d:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
function ub(a,b){if(a.Z.pg)return a.Z.zf=!1,a.Z.pg=!1;if(a.Z.error)return a.ub(a.toString()+" error"),!1;a.Z.zf=b;return a.Z.zf}l.Pb=function(){return this.Z.Zb=!0};l.Ob=function(a,b){b&&(this.Z.Zb=!1);return!0};var qb={ERROR:"error",xo:"notice",$d:"progress",SCRIPT:"script",Io:"warning"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var ab=window?window.PCjs.Machines:{},Za=window?window.PCjs.Components:[],mb=window?window.PCjs.Commands:{},nb=["hold","sleep","wait"],ob={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},pb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var ab=window?window.PCjs.Machines:{},Za=window?window.PCjs.Components:[],mb=window?window.PCjs.Commands:{},nb=["hold","sleep","wait"],ob={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},pb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -58,7 +58,7 @@ m.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
m.sa=function(a,b,c){switch(b){case "clear":return this.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.J[b]=c,this.ja=function(a){this.u(a,this.type);return!0},c.value="",this.print=function(a){return function(b){rb(a,b)}}(c),this.u=function(a,b){return function(a,c){a||(a="");if(c!=Bb.Rb||"..."!=a.slice(-3))c&&(a=c+": "+a),rb(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
m.sa=function(a,b,c){switch(b){case "clear":return this.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.J[b]=c,this.ja=function(a){this.u(a,this.type);return!0},c.value="",this.print=function(a){return function(b){rb(a,b)}}(c),this.u=function(a,b){return function(a,c){a||(a="");if(c!=Bb.Rb||"..."!=a.slice(-3))c&&(a=c+": "+a),rb(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
||||||
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};m.log=function(){};m.print=function(){};m.u=function(){};m.status=function(a){this.u(this.type+": "+a)};m.ja=function(a,b,c){if(!b){var d=vb("Computer",this.id);if(d&&d.A.ub)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function Cb(a,b){a.A.error=!0;a.ja(b)}
|
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};m.log=function(){};m.print=function(){};m.u=function(){};m.status=function(a){this.u(this.type+": "+a)};m.ja=function(a,b,c){if(!b){var d=vb("Computer",this.id);if(d&&d.A.ub)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function Cb(a,b){a.A.error=!0;a.ja(b)}
|
||||||
function Db(a){return a.A.error?(a.u(a.toString()+" error"),!0):!1}function Eb(a,b){b&&(a.A.ready?b():a.cb=b);return a.A.ready}function Pb(a){if(!a.A.error&&(a.A.ready=!0,a.A.ready)){var b=a.cb;a.cb=null;b&&b()}}function Qb(a,b){a.A.Ua&&(b?a.A.ob=!0:void 0===b&&a.u(a.toString()+" busy"));return a.A.Ua}function Rb(a,b){if(a.A.ob)return a.A.Ua=!1,a.A.ob=!1;if(a.A.error)return a.u(a.toString()+" error"),!1;a.A.Ua=b;return a.A.Ua}m.Aa=function(){return this.A.ba=!0};
|
function Db(a){return a.A.error?(a.u(a.toString()+" error"),!0):!1}function Eb(a,b){b&&(a.A.ready?b():a.cb=b);return a.A.ready}function Pb(a){if(!a.A.error&&(a.A.ready=!0,a.A.ready)){var b=a.cb;a.cb=null;b&&b()}}function Qb(a,b){a.A.Ua&&(b?a.A.ob=!0:void 0===b&&a.u(a.toString()+" busy"));return a.A.Ua}function Rb(a,b){if(a.A.ob)return a.A.Ua=!1,a.A.ob=!1;if(a.A.error)return a.u(a.toString()+" error"),!1;a.A.Ua=b;return a.A.Ua}m.Aa=function(){return this.A.ba=!0};
|
||||||
m.ra=function(a,b){b&&(this.A.ba=!1);return!0};function Sb(a,b){if(a.D){a===a.D?b|=0:b=b||a.da;var c=a.D.da&b;return!!b&&c===b||!!(c&a.D.Eb)}return!1}function Tb(a,b,c,d){a.D&&(!0===c||Sb(a,c|0))&&a.D.message(b,d)}var Bb={cd:"notice",md:"warning",ERROR:"error",Rb:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
m.ra=function(a,b){b&&(this.A.ba=!1);return!0};function Sb(a,b){if(a.D){a===a.D?b|=0:b=b||a.da;var c=a.D.da&b;return!!b&&c===b||!!(c&a.D.Eb)}return!1}function Tb(a,b,c,d){a.D&&(!0===c||Sb(a,c|0))&&a.D.message(b,d)}var Bb={ERROR:"error",cd:"notice",Rb:"progress",SCRIPT:"script",md:"warning"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var jb=window?window.PCjs.Machines:{},hb=window?window.PCjs.Components:[],xb=window?window.PCjs.Commands:{},yb=["hold","sleep","wait"],zb={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Ab={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var jb=window?window.PCjs.Machines:{},hb=window?window.PCjs.Components:[],xb=window?window.PCjs.Commands:{},yb=["hold","sleep","wait"],zb={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Ab={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -950,7 +950,7 @@ class Str {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace(sFind, sReplace, s)
|
* replace(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
||||||
* the search string is NOT a RegExp; specifically:
|
* the search string is NOT a RegExp; specifically:
|
||||||
|
|
@ -965,36 +965,36 @@ class Str {
|
||||||
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
||||||
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
||||||
*
|
*
|
||||||
* Similar to the JavaScript replace() method, this replaces only one occurrence (ie, the FIRST occurrence);
|
* Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence
|
||||||
* it might be nice to add options to replace the LAST occurrence and/or ALL occurrences, but we'll revisit
|
* (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL
|
||||||
* that later.
|
* occurrences, but we'll revisit that later.
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replace(sFind, sReplace, s)
|
static replace(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var i = s.indexOf(sFind);
|
var i = s.indexOf(sSearch);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
s = s.substr(0, i) + sReplace + s.substr(i + sFind.length);
|
s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaceAll(sFind, sReplace, s)
|
* replaceAll(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replaceAll(sFind, sReplace, s)
|
static replaceAll(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var a = {};
|
var a = {};
|
||||||
a[sFind] = sReplace;
|
a[sSearch] = sReplace;
|
||||||
return Str.replaceArray(a, s);
|
return Str.replaceArray(a, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2692,14 +2692,34 @@ class Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component.print(s)
|
||||||
|
*
|
||||||
|
* Components that inherit from this class should use this.print(), rather than Component.print(), because
|
||||||
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
|
*
|
||||||
|
* @this {Component}
|
||||||
|
* @param {string} s
|
||||||
|
*/
|
||||||
|
static print(s)
|
||||||
|
{
|
||||||
|
if (!COMPILED) {
|
||||||
|
var i = s.lastIndexOf('\n');
|
||||||
|
if (i >= 0) {
|
||||||
|
Component.println(s.substr(0, i));
|
||||||
|
s = s.substr(i + 1);
|
||||||
|
}
|
||||||
|
Component.printBuffer += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component.println(s, type, id)
|
* Component.println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
* Components that inherit from this class should use this.println(), rather than Component.println(), because
|
||||||
*
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
* Components that inherit from this class should use the instance method, this.println(), rather than Component.println(),
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
* because if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the class
|
|
||||||
* method would improperly affect any other machines loaded on the same page).
|
|
||||||
*
|
*
|
||||||
* @param {string} [s] is the message text
|
* @param {string} [s] is the message text
|
||||||
* @param {string} [type] is the message type
|
* @param {string} [type] is the message type
|
||||||
|
|
@ -2708,7 +2728,9 @@ class Component {
|
||||||
static println(s, type, id)
|
static println(s, type, id)
|
||||||
{
|
{
|
||||||
if (!COMPILED) {
|
if (!COMPILED) {
|
||||||
|
s = Component.printBuffer + (s || "");
|
||||||
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
||||||
|
Component.printBuffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2830,9 +2852,6 @@ class Component {
|
||||||
*/
|
*/
|
||||||
static replaceControl(control, sSearch, sReplace)
|
static replaceControl(control, sSearch, sReplace)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
|
||||||
*/
|
|
||||||
var sText = control.value;
|
var sText = control.value;
|
||||||
var i = sText.lastIndexOf(sSearch);
|
var i = sText.lastIndexOf(sSearch);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
@ -2840,6 +2859,9 @@ class Component {
|
||||||
} else {
|
} else {
|
||||||
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
||||||
|
*/
|
||||||
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
||||||
control.value = sText;
|
control.value = sText;
|
||||||
control.scrollTop = control.scrollHeight;
|
control.scrollTop = control.scrollHeight;
|
||||||
|
|
@ -3104,7 +3126,7 @@ class Component {
|
||||||
* ^J ^M ^K ^I ^H ^L
|
* ^J ^M ^K ^I ^H ^L
|
||||||
*
|
*
|
||||||
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
||||||
* is the ASCII code in hex. For ESC, that would \x1B.
|
* is the ASCII code in hex. For ESC, that would be \x1B.
|
||||||
*
|
*
|
||||||
* @param {string} sScript
|
* @param {string} sScript
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -3202,7 +3224,7 @@ class Component {
|
||||||
* instead, but it's a bit too confusing mingling script output in a window that
|
* instead, but it's a bit too confusing mingling script output in a window that
|
||||||
* already mingles Debugger and machine output.
|
* already mingles Debugger and machine output.
|
||||||
*/
|
*/
|
||||||
Component.println('script: ' + aTokens.join(' '));
|
Component.println(aTokens.join(' '), Component.TYPE.SCRIPT);
|
||||||
|
|
||||||
var fnCallReady = null;
|
var fnCallReady = null;
|
||||||
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
||||||
|
|
@ -3484,8 +3506,6 @@ class Component {
|
||||||
/**
|
/**
|
||||||
* print(s)
|
* print(s)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3494,19 +3514,12 @@ class Component {
|
||||||
*/
|
*/
|
||||||
print(s)
|
print(s)
|
||||||
{
|
{
|
||||||
var i = s.lastIndexOf('\n');
|
Component.print(s);
|
||||||
if (i >= 0) {
|
|
||||||
Component.println(s.substr(0, i));
|
|
||||||
s = s.substr(i + 1);
|
|
||||||
}
|
|
||||||
Component.printBuffer += s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* println(s, type, id)
|
* println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3517,8 +3530,7 @@ class Component {
|
||||||
*/
|
*/
|
||||||
println(s, type, id)
|
println(s, type, id)
|
||||||
{
|
{
|
||||||
Component.println(Component.printBuffer + s, type, id || this.id);
|
Component.println(s, type, id || this.id);
|
||||||
Component.printBuffer = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3796,15 +3808,16 @@ class Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the standard TYPE values you can pass as the second argument to println(); in reality,
|
* These are the standard TYPE values you can pass as an optional argument to println(); in reality,
|
||||||
* you can pass anything you want, because they are just tacked onto the message as a prefix, with the
|
* you can pass anything you want, because they are simply prepended to the message, although PROGRESS
|
||||||
* exception of PROGRESS, which will suppress the message unless we're in DEBUG or INIT mode.
|
* messages may also be merged with earlier similar messages to keep the output buffer under control.
|
||||||
*/
|
*/
|
||||||
Component.TYPE = {
|
Component.TYPE = {
|
||||||
NOTICE: "notice",
|
|
||||||
WARNING: "warning",
|
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
PROGRESS: "progress"
|
NOTICE: "notice",
|
||||||
|
PROGRESS: "progress",
|
||||||
|
SCRIPT: "script",
|
||||||
|
WARNING: "warning"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ function Sa(a){for(var b=!0,c=Ta[a];c&&c.length;){var d=c.splice(0,1)[0],e=d[0],
|
||||||
k.toString=function(){return this.name?this.name:this.id||this.type};
|
k.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
k.V=function(a,b,c){switch(b){case "clear":return this.m[b]||(this.m[b]=c,c.onclick=function(a){return function(){a.m.print&&(a.m.print.value="")}}(this)),!0;case "print":return this.m[b]||(this.m[b]=c,this.G=function(a){this.N(a,this.type);return!0},c.value="",this.print=function(a){return function(b){Pa(a,b)}}(c),this.N=function(a,b){return function(a,c){a||(a="");if(c!=Xa.fb||"..."!=a.slice(-3))c&&(a=c+": "+a),Pa(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
k.V=function(a,b,c){switch(b){case "clear":return this.m[b]||(this.m[b]=c,c.onclick=function(a){return function(){a.m.print&&(a.m.print.value="")}}(this)),!0;case "print":return this.m[b]||(this.m[b]=c,this.G=function(a){this.N(a,this.type);return!0},c.value="",this.print=function(a){return function(b){Pa(a,b)}}(c),this.N=function(a,b){return function(a,c){a||(a="");if(c!=Xa.fb||"..."!=a.slice(-3))c&&(a=c+": "+a),Pa(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
||||||
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};k.log=function(){};k.print=function(){};k.N=function(){};k.status=function(a){this.N(this.type+": "+a)};k.G=function(a,b,c){if(!b){var d=A("Computer",this.id);if(d&&d.h.Qa)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||q((c?c+": ":"")+a);return!0};function Ya(a,b){b&&(a.h.ready?b():a.Ba=b);return a.h.ready}
|
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};k.log=function(){};k.print=function(){};k.N=function(){};k.status=function(a){this.N(this.type+": "+a)};k.G=function(a,b,c){if(!b){var d=A("Computer",this.id);if(d&&d.h.Qa)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||q((c?c+": ":"")+a);return!0};function Ya(a,b){b&&(a.h.ready?b():a.Ba=b);return a.h.ready}
|
||||||
function B(a){if(!a.h.error&&(a.h.ready=!0,a.h.ready)){var b=a.Ba;a.Ba=null;b&&b()}}function Za(a,b){a.h.Ma?(a.h.za=!1,a.h.Ma=!1):a.h.error?a.N(a.toString()+" error"):a.h.za=b}k.W=function(){return this.h.F=!0};k.R=function(a,b){b&&(this.h.F=!1);return!0};var Xa={pc:"notice",yc:"warning",ERROR:"error",fb:"progress"};
|
function B(a){if(!a.h.error&&(a.h.ready=!0,a.h.ready)){var b=a.Ba;a.Ba=null;b&&b()}}function Za(a,b){a.h.Ma?(a.h.za=!1,a.h.Ma=!1):a.h.error?a.N(a.toString()+" error"):a.h.za=b}k.W=function(){return this.h.F=!0};k.R=function(a,b){b&&(this.h.F=!1);return!0};var Xa={ERROR:"error",pc:"notice",fb:"progress",SCRIPT:"script",yc:"warning"};
|
||||||
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var Ma=window?window.PCjs.Machines:{},v=window?window.PCjs.Components:[],Ta=window?window.PCjs.Commands:{},Ua=["hold","sleep","wait"],Va={alert:function(a){q(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Wa={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var Ma=window?window.PCjs.Machines:{},v=window?window.PCjs.Components:[],Ta=window?window.PCjs.Commands:{},Ua=["hold","sleep","wait"],Va={alert:function(a){q(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},Wa={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -67,7 +67,7 @@ h.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
h.wa=function(a,b,c){switch(b){case "clear":return this.H[b]||(this.H[b]=c,c.onclick=function(a){return function(){a.H.print&&(a.H.print.value="")}}(this)),!0;case "print":return this.H[b]||(this.H[b]=c,this.T=function(a){this.v(a,this.type);return!0},c.value="",this.print=function(a){return function(b){ib(a,b)}}(c),this.v=function(a,b){return function(a,c){a||(a="");if(c!=Cb.Ue||"..."!=a.slice(-3))c&&(a=c+": "+a),ib(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
h.wa=function(a,b,c){switch(b){case "clear":return this.H[b]||(this.H[b]=c,c.onclick=function(a){return function(){a.H.print&&(a.H.print.value="")}}(this)),!0;case "print":return this.H[b]||(this.H[b]=c,this.T=function(a){this.v(a,this.type);return!0},c.value="",this.print=function(a){return function(b){ib(a,b)}}(c),this.v=function(a,b){return function(a,c){a||(a="");if(c!=Cb.Ue||"..."!=a.slice(-3))c&&(a=c+": "+a),ib(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+(a+
|
||||||
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};h.log=function(){};h.print=function(){};h.v=function(){};h.status=function(a){this.v(this.type+": "+a)};h.T=function(a,b,c){if(!b){var d=qb("Computer",this.id);if(d&&d.A.Id)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||w((c?c+": ":"")+a);return!0};function Db(a,b){a.A.error=!0;a.T(b)}
|
".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};h.log=function(){};h.print=function(){};h.v=function(){};h.status=function(a){this.v(this.type+": "+a)};h.T=function(a,b,c){if(!b){var d=qb("Computer",this.id);if(d&&d.A.Id)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||w((c?c+": ":"")+a);return!0};function Db(a,b){a.A.error=!0;a.T(b)}
|
||||||
function Eb(a){return a.A.error?(a.v(a.toString()+" error"),!0):!1}function Fb(a,b){b&&(a.A.ready?b():a.Mc=b);return a.A.ready}function D(a,b){a.A.error||(a.A.ready=!1!==b,a.A.ready&&(b=a.Mc,a.Mc=null,b&&b()))}function Gb(a,b){a.A.cb&&(b?a.A.wd=!0:void 0===b&&a.v(a.toString()+" busy"));return a.A.cb}function Hb(a,b){if(a.A.wd)return a.A.cb=!1,a.A.wd=!1;if(a.A.error)return a.v(a.toString()+" error"),!1;a.A.cb=b;return a.A.cb}h.Da=function(){return this.A.ca=!0};
|
function Eb(a){return a.A.error?(a.v(a.toString()+" error"),!0):!1}function Fb(a,b){b&&(a.A.ready?b():a.Mc=b);return a.A.ready}function D(a,b){a.A.error||(a.A.ready=!1!==b,a.A.ready&&(b=a.Mc,a.Mc=null,b&&b()))}function Gb(a,b){a.A.cb&&(b?a.A.wd=!0:void 0===b&&a.v(a.toString()+" busy"));return a.A.cb}function Hb(a,b){if(a.A.wd)return a.A.cb=!1,a.A.wd=!1;if(a.A.error)return a.v(a.toString()+" error"),!1;a.A.cb=b;return a.A.cb}h.Da=function(){return this.A.ca=!0};
|
||||||
h.Ca=function(a,b){b&&(this.A.ca=!1);return!0};function E(a,b){if(a.D){a===a.D?b|=0:b=b||a.ja;var c=a.D.ja&b;return!!b&&c===b||!!(c&a.D.ke)}return!1}function F(a,b,c,d){a.D&&(!0===c||E(a,c|0))&&a.D.message(b,d)}var Cb={Lj:"notice",mk:"warning",ERROR:"error",Ue:"progress"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
h.Ca=function(a,b){b&&(this.A.ca=!1);return!0};function E(a,b){if(a.D){a===a.D?b|=0:b=b||a.ja;var c=a.D.ja&b;return!!b&&c===b||!!(c&a.D.ke)}return!1}function F(a,b,c,d){a.D&&(!0===c||E(a,c|0))&&a.D.message(b,d)}var Cb={ERROR:"error",Lj:"notice",Ue:"progress",SCRIPT:"script",mk:"warning"};window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var fb=window?window.PCjs.Machines:{},db=window?window.PCjs.Components:[],sb=window?window.PCjs.Commands:{},tb=["hold","sleep","wait"],ub={alert:function(a){w(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},vb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var fb=window?window.PCjs.Machines:{},db=window?window.PCjs.Components:[],sb=window?window.PCjs.Commands:{},tb=["hold","sleep","wait"],ub={alert:function(a){w(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},vb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1178,7 +1178,7 @@ class Str {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace(sFind, sReplace, s)
|
* replace(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
* The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when
|
||||||
* the search string is NOT a RegExp; specifically:
|
* the search string is NOT a RegExp; specifically:
|
||||||
|
|
@ -1193,36 +1193,36 @@ class Str {
|
||||||
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
* So, if a replacement string containing dollar signs passes through a series of replace() calls, untold
|
||||||
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
* problems could result. Hence, this function, which simply uses the replacement string as-is.
|
||||||
*
|
*
|
||||||
* Similar to the JavaScript replace() method, this replaces only one occurrence (ie, the FIRST occurrence);
|
* Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence
|
||||||
* it might be nice to add options to replace the LAST occurrence and/or ALL occurrences, but we'll revisit
|
* (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL
|
||||||
* that later.
|
* occurrences, but we'll revisit that later.
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replace(sFind, sReplace, s)
|
static replace(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var i = s.indexOf(sFind);
|
var i = s.indexOf(sSearch);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
s = s.substr(0, i) + sReplace + s.substr(i + sFind.length);
|
s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaceAll(sFind, sReplace, s)
|
* replaceAll(sSearch, sReplace, s)
|
||||||
*
|
*
|
||||||
* @param {string} sFind
|
* @param {string} sSearch
|
||||||
* @param {string} sReplace
|
* @param {string} sReplace
|
||||||
* @param {string} s
|
* @param {string} s
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
static replaceAll(sFind, sReplace, s)
|
static replaceAll(sSearch, sReplace, s)
|
||||||
{
|
{
|
||||||
var a = {};
|
var a = {};
|
||||||
a[sFind] = sReplace;
|
a[sSearch] = sReplace;
|
||||||
return Str.replaceArray(a, s);
|
return Str.replaceArray(a, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2920,14 +2920,34 @@ class Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component.print(s)
|
||||||
|
*
|
||||||
|
* Components that inherit from this class should use this.print(), rather than Component.print(), because
|
||||||
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
|
*
|
||||||
|
* @this {Component}
|
||||||
|
* @param {string} s
|
||||||
|
*/
|
||||||
|
static print(s)
|
||||||
|
{
|
||||||
|
if (!COMPILED) {
|
||||||
|
var i = s.lastIndexOf('\n');
|
||||||
|
if (i >= 0) {
|
||||||
|
Component.println(s.substr(0, i));
|
||||||
|
s = s.substr(i + 1);
|
||||||
|
}
|
||||||
|
Component.printBuffer += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component.println(s, type, id)
|
* Component.println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
* Components that inherit from this class should use this.println(), rather than Component.println(), because
|
||||||
*
|
* if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the
|
||||||
* Components that inherit from this class should use the instance method, this.println(), rather than Component.println(),
|
* class method would improperly affect any other machines loaded on the same page).
|
||||||
* because if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the class
|
|
||||||
* method would improperly affect any other machines loaded on the same page).
|
|
||||||
*
|
*
|
||||||
* @param {string} [s] is the message text
|
* @param {string} [s] is the message text
|
||||||
* @param {string} [type] is the message type
|
* @param {string} [type] is the message type
|
||||||
|
|
@ -2936,7 +2956,9 @@ class Component {
|
||||||
static println(s, type, id)
|
static println(s, type, id)
|
||||||
{
|
{
|
||||||
if (!COMPILED) {
|
if (!COMPILED) {
|
||||||
|
s = Component.printBuffer + (s || "");
|
||||||
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type);
|
||||||
|
Component.printBuffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3058,9 +3080,6 @@ class Component {
|
||||||
*/
|
*/
|
||||||
static replaceControl(control, sSearch, sReplace)
|
static replaceControl(control, sSearch, sReplace)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
|
||||||
*/
|
|
||||||
var sText = control.value;
|
var sText = control.value;
|
||||||
var i = sText.lastIndexOf(sSearch);
|
var i = sText.lastIndexOf(sSearch);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
@ -3068,6 +3087,9 @@ class Component {
|
||||||
} else {
|
} else {
|
||||||
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
sText = sText.substr(0, i) + sReplace + sText.substr(i + sSearch.length);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Prevent the <textarea> from getting too large; otherwise, printing becomes slower and slower.
|
||||||
|
*/
|
||||||
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
if (COMPILED && sText.length > 8192) sText = sText.substr(sText.length - 4096);
|
||||||
control.value = sText;
|
control.value = sText;
|
||||||
control.scrollTop = control.scrollHeight;
|
control.scrollTop = control.scrollHeight;
|
||||||
|
|
@ -3332,7 +3354,7 @@ class Component {
|
||||||
* ^J ^M ^K ^I ^H ^L
|
* ^J ^M ^K ^I ^H ^L
|
||||||
*
|
*
|
||||||
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
* To support any other non-printable 8-bit character, such as ESC, you should use \xXX, where XX
|
||||||
* is the ASCII code in hex. For ESC, that would \x1B.
|
* is the ASCII code in hex. For ESC, that would be \x1B.
|
||||||
*
|
*
|
||||||
* @param {string} sScript
|
* @param {string} sScript
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
|
|
@ -3430,7 +3452,7 @@ class Component {
|
||||||
* instead, but it's a bit too confusing mingling script output in a window that
|
* instead, but it's a bit too confusing mingling script output in a window that
|
||||||
* already mingles Debugger and machine output.
|
* already mingles Debugger and machine output.
|
||||||
*/
|
*/
|
||||||
Component.println('script: ' + aTokens.join(' '));
|
Component.println(aTokens.join(' '), Component.TYPE.SCRIPT);
|
||||||
|
|
||||||
var fnCallReady = null;
|
var fnCallReady = null;
|
||||||
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
if (Component.asyncCommands.indexOf(sCommand) >= 0) {
|
||||||
|
|
@ -3712,8 +3734,6 @@ class Component {
|
||||||
/**
|
/**
|
||||||
* print(s)
|
* print(s)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
* Components using this.print() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3722,19 +3742,12 @@ class Component {
|
||||||
*/
|
*/
|
||||||
print(s)
|
print(s)
|
||||||
{
|
{
|
||||||
var i = s.lastIndexOf('\n');
|
Component.print(s);
|
||||||
if (i >= 0) {
|
|
||||||
Component.println(s.substr(0, i));
|
|
||||||
s = s.substr(i + 1);
|
|
||||||
}
|
|
||||||
Component.printBuffer += s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* println(s, type, id)
|
* println(s, type, id)
|
||||||
*
|
*
|
||||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
|
||||||
*
|
|
||||||
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
* Components using this.println() should wait until after their constructor has run to display any messages, because
|
||||||
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
* if a Control Panel has been loaded, its override will not take effect until its own constructor has run.
|
||||||
*
|
*
|
||||||
|
|
@ -3745,8 +3758,7 @@ class Component {
|
||||||
*/
|
*/
|
||||||
println(s, type, id)
|
println(s, type, id)
|
||||||
{
|
{
|
||||||
Component.println(Component.printBuffer + s, type, id || this.id);
|
Component.println(s, type, id || this.id);
|
||||||
Component.printBuffer = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -4024,15 +4036,16 @@ class Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the standard TYPE values you can pass as the second argument to println(); in reality,
|
* These are the standard TYPE values you can pass as an optional argument to println(); in reality,
|
||||||
* you can pass anything you want, because they are just tacked onto the message as a prefix, with the
|
* you can pass anything you want, because they are simply prepended to the message, although PROGRESS
|
||||||
* exception of PROGRESS, which will suppress the message unless we're in DEBUG or INIT mode.
|
* messages may also be merged with earlier similar messages to keep the output buffer under control.
|
||||||
*/
|
*/
|
||||||
Component.TYPE = {
|
Component.TYPE = {
|
||||||
NOTICE: "notice",
|
|
||||||
WARNING: "warning",
|
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
PROGRESS: "progress"
|
NOTICE: "notice",
|
||||||
|
PROGRESS: "progress",
|
||||||
|
SCRIPT: "script",
|
||||||
|
WARNING: "warning"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ function ab(a){for(var b=!0,c=bb[a];c&&c.length;){var d=c.splice(0,1)[0],e=d[0],
|
||||||
h.toString=function(){return this.name?this.name:this.id||this.type};
|
h.toString=function(){return this.name?this.name:this.id||this.type};
|
||||||
h.ma=function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.o[b]=c,this.G=function(a){this.aa(a,this.type);return!0},c.value="",this.print=function(a){return function(b){Xa(a,b)}}(c),this.aa=function(a,b){return function(a,c){a||(a="");if(c!=fb.he||"..."!=a.slice(-3))c&&(a=c+": "+a),Xa(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+
|
h.ma=function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.o[b]=c,this.G=function(a){this.aa(a,this.type);return!0},c.value="",this.print=function(a){return function(b){Xa(a,b)}}(c),this.aa=function(a,b){return function(a,c){a||(a="");if(c!=fb.he||"..."!=a.slice(-3))c&&(a=c+": "+a),Xa(b,a+"\n");else{c=b.value;var d=c.lastIndexOf(a);0>d?c+=a+"\n":c=c.substr(0,d)+
|
||||||
(a+".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};h.log=function(){};h.print=function(){};h.aa=function(){};h.status=function(a){this.aa(this.type+": "+a)};h.G=function(a,b,c){if(!b){var d=$a("Computer",this.id);if(d&&d.j.fd)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function gb(a,b){b&&(a.j.ready?b():a.gc=b);return a.j.ready}
|
(a+".")+c.substr(d+a.length);8192<c.length&&(c=c.substr(c.length-4096));b.value=c;b.scrollTop=b.scrollHeight}}}(this,c)),!0;default:return!1}};h.log=function(){};h.print=function(){};h.aa=function(){};h.status=function(a){this.aa(this.type+": "+a)};h.G=function(a,b,c){if(!b){var d=$a("Computer",this.id);if(d&&d.j.fd)return console.log("ignoring notice during unload: "+a),!1}c=c||this.type;b||r((c?c+": ":"")+a);return!0};function gb(a,b){b&&(a.j.ready?b():a.gc=b);return a.j.ready}
|
||||||
function B(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.gc,a.gc=null,b&&b()))}function hb(a,b){a.j.Xc?(a.j.Ra=!1,a.j.Xc=!1):a.j.error?a.aa(a.toString()+" error"):a.j.Ra=b}h.la=function(){return this.j.S=!0};h.ka=function(a,b){b&&(this.j.S=!1);return!0};var fb={$i:"notice",Bj:"warning",ERROR:"error",he:"progress"};
|
function B(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.gc,a.gc=null,b&&b()))}function hb(a,b){a.j.Xc?(a.j.Ra=!1,a.j.Xc=!1):a.j.error?a.aa(a.toString()+" error"):a.j.Ra=b}h.la=function(){return this.j.S=!0};h.ka=function(a,b){b&&(this.j.S=!1);return!0};var fb={ERROR:"error",$i:"notice",he:"progress",SCRIPT:"script",Bj:"warning"};
|
||||||
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||||
var Ua=window?window.PCjs.Machines:{},u=window?window.PCjs.Components:[],bb=window?window.PCjs.Commands:{},cb=["hold","sleep","wait"],db={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},eb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
var Ua=window?window.PCjs.Machines:{},u=window?window.PCjs.Components:[],bb=window?window.PCjs.Commands:{},cb=["hold","sleep","wait"],db={alert:function(a){r(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},eb={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue