Cleaned up how components print messages and how the Computer component overrides their notice/print/println methods (in preparation for new Computer overrides)
This commit is contained in:
parent
6f9bfa1950
commit
d4d3448fd5
20 changed files with 954 additions and 910 deletions
|
|
@ -98,6 +98,7 @@ class ComputerPDP10 extends Component {
|
|||
* function (if it has one--it's optional). We call the CPU's powerUp() function last,
|
||||
* so that the CPU is assured that all other components are ready and "powered".
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @param {Object} parmsComputer
|
||||
* @param {Object} [parmsMachine]
|
||||
* @param {boolean} [fSuspended]
|
||||
|
|
@ -164,9 +165,11 @@ class ComputerPDP10 extends Component {
|
|||
*/
|
||||
var iComponent, component;
|
||||
var aComponents = Component.getComponents(this.id);
|
||||
this.panel = /** @type {PanelPDP10} */ (Component.getComponentByType("Panel", this.id));
|
||||
|
||||
if (this.panel && this.panel.controlPrint) {
|
||||
this.panel = /** @type {PanelPDP10} */ (Component.getComponentByType("Panel", this.id));
|
||||
this.controlPrint = this.panel && this.panel.bindings['print'];
|
||||
|
||||
if (this.controlPrint) {
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
/*
|
||||
|
|
@ -175,8 +178,8 @@ class ComputerPDP10 extends Component {
|
|||
* too darn convenient to slam those overrides into the components directly.
|
||||
*/
|
||||
component.notice = this.panel.notice;
|
||||
component.print = this.panel.print;
|
||||
component.println = this.panel.println;
|
||||
component.controlPrint = this.panel.controlPrint;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,9 +265,22 @@ class ComputerPDP10 extends Component {
|
|||
if (!fSuspended && this.fAutoPower) this.wait(this.powerOn);
|
||||
}
|
||||
|
||||
/**
|
||||
* clearPanel()
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
*/
|
||||
clearPanel()
|
||||
{
|
||||
if (this.controlPrint) {
|
||||
this.controlPrint.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getMachineID()
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @return {string}
|
||||
*/
|
||||
getMachineID()
|
||||
|
|
@ -277,6 +293,7 @@ class ComputerPDP10 extends Component {
|
|||
*
|
||||
* If no explicit machine parms were provided, then we check for 'parms' in the bundled resources (if any).
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @param {Object} [parmsMachine]
|
||||
*/
|
||||
setMachineParms(parmsMachine)
|
||||
|
|
@ -308,6 +325,7 @@ class ComputerPDP10 extends Component {
|
|||
* (eg, Str.TYPES.NUMBER) is used, the return value will be that type; unfortunately, every caller
|
||||
* must coerce their own return value.
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @param {string} sParm
|
||||
* @param {Object|null} [parmsComponent]
|
||||
* @param {number} [type] (from Str.TYPES)
|
||||
|
|
@ -345,6 +363,7 @@ class ComputerPDP10 extends Component {
|
|||
/**
|
||||
* saveMachineParms()
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @return {string|null}
|
||||
*/
|
||||
saveMachineParms()
|
||||
|
|
@ -355,6 +374,7 @@ class ComputerPDP10 extends Component {
|
|||
/**
|
||||
* getUserID()
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @return {string}
|
||||
*/
|
||||
getUserID()
|
||||
|
|
@ -1161,6 +1181,8 @@ class ComputerPDP10 extends Component {
|
|||
|
||||
/**
|
||||
* resetUserID()
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
*/
|
||||
resetUserID()
|
||||
{
|
||||
|
|
@ -1171,6 +1193,7 @@ class ComputerPDP10 extends Component {
|
|||
/**
|
||||
* queryUserID(fPrompt)
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @param {boolean} [fPrompt]
|
||||
* @returns {string|null|undefined}
|
||||
*/
|
||||
|
|
@ -1259,6 +1282,7 @@ class ComputerPDP10 extends Component {
|
|||
/**
|
||||
* saveServerState(sUserID, sState)
|
||||
*
|
||||
* @this {ComputerPDP10}
|
||||
* @param {string} sUserID
|
||||
* @param {string|null} sState
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -232,15 +232,6 @@ class CPUPDP10 extends Component {
|
|||
if (DEBUGGER && this.dbg) {
|
||||
this.dbg.init(this.flags.autoStart);
|
||||
} else {
|
||||
/*
|
||||
* The Computer (this.cmp) knows if there's a Control Panel (this.panel), and the Control Panel
|
||||
* knows if there's a "print" control (this.panel.controlPrint), and if there IS a "print" control
|
||||
* but no debugger, the machine is probably misconfigured (most likely, the page simply neglected to
|
||||
* load the Debugger component).
|
||||
*
|
||||
* However, we don't actually need to check all that; it's always safe use println(), regardless whether
|
||||
* a Control Panel with a "print" control is present or not.
|
||||
*/
|
||||
this.status("No debugger detected");
|
||||
}
|
||||
if (!this.flags.autoStart) {
|
||||
|
|
|
|||
|
|
@ -2848,10 +2848,7 @@ class DebuggerPDP10 extends Debugger {
|
|||
*/
|
||||
doClear(sCmd)
|
||||
{
|
||||
/*
|
||||
* TODO: There should be a clear() component method that the Control Panel overrides to perform this function.
|
||||
*/
|
||||
if (this.controlPrint) this.controlPrint.value = "";
|
||||
this.cmp.clearPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue