Fixed lingering code inspection issues

This commit is contained in:
Jeff Parsons 2015-11-09 08:22:08 -08:00
commit 55c3236380
18 changed files with 45 additions and 43 deletions

View file

@ -949,7 +949,7 @@ Bus.prototype.setLongDirect = function(addr, l)
*
* @this {Bus}
* @param {Object} obj
* @param {BackTrack} bto
* @param {BackTrack|null} bto
* @param {number} off (the offset within obj that this wrapper object is relative to)
* @return {BackTrack|null}
*/

View file

@ -1036,7 +1036,7 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
this.cpu = cpu;
this.dbg = dbg;
this.cmp = cmp;
this.kbd = cmp.getComponentByType("Keyboard");
this.kbd = cmp.getMachineComponent("Keyboard");
/*
* This divisor is invariant, so we calculate it as soon as we're able to query the CPU's base speed.
*/

View file

@ -1235,14 +1235,14 @@ Computer.prototype.onReset = function()
};
/**
* getComponentByType(sType, componentPrev)
* getMachineComponent(sType, componentPrev)
*
* @this {Computer}
* @param {string} sType
* @param {Component|null} [componentPrev] of previously returned component, if any
* @return {Component|null}
*/
Computer.prototype.getComponentByType = function(sType, componentPrev)
Computer.prototype.getMachineComponent = function(sType, componentPrev)
{
var aComponents = Component.getComponents(this.id);
for (var iComponent = 0; iComponent < aComponents.length; iComponent++) {

View file

@ -186,7 +186,7 @@ CPU.prototype.initBus = function(cmp, bus, cpu, dbg)
* Attach the Video component to the CPU, so that the CPU can periodically update
* the video display via updateVideo(), as cycles permit.
*/
for (var video = null; (video = cmp.getComponentByType("Video", video));) {
for (var video = null; (video = cmp.getMachineComponent("Video", video));) {
this.aVideo.push(video);
}
/*
@ -195,7 +195,7 @@ CPU.prototype.initBus = function(cmp, bus, cpu, dbg)
*
* We must also call chipset.updateAllTimers() periodically; stepCPU() takes care of that.
*/
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
this.setReady();
};

View file

@ -1202,10 +1202,10 @@ if (DEBUGGER) {
this.bus = bus;
this.cpu = cpu;
this.cmp = cmp;
this.fdc = cmp.getComponentByType("FDC");
this.hdc = cmp.getComponentByType("HDC");
this.mouse = cmp.getComponentByType("Mouse");
if (MAXDEBUG) this.chipset = cmp.getComponentByType("ChipSet");
this.fdc = cmp.getMachineComponent("FDC");
this.hdc = cmp.getMachineComponent("HDC");
this.mouse = cmp.getMachineComponent("Mouse");
if (MAXDEBUG) this.chipset = cmp.getMachineComponent("ChipSet");
this.cchAddr = bus.getWidth() >> 2;
this.maskAddr = bus.nBusLimit;
@ -2630,7 +2630,7 @@ if (DEBUGGER) {
sInfo = '%' + str.toHex(addr) + ": " + (this.bus.getSymbol(addr, true) || sInfo);
} else {
var component, componentPrev = null;
while (component = this.cmp.getComponentByType("Disk", componentPrev)) {
while (component = this.cmp.getMachineComponent("Disk", componentPrev)) {
var aInfo = component.getSymbolInfo(sAddr);
if (aInfo.length) {
sInfo = "";
@ -3040,7 +3040,7 @@ if (DEBUGGER) {
var aSymbols = [];
if (SYMBOLS) {
var component, componentPrev = null;
while (component = this.cmp.getComponentByType("Disk", componentPrev)) {
while (component = this.cmp.getMachineComponent("Disk", componentPrev)) {
aSymbols = component.getModuleInfo(sModule, nSegment);
if (aSymbols.length) break;
componentPrev = component;

View file

@ -505,7 +505,7 @@ FDC.prototype.setBinding = function(sHTMLType, sBinding, control)
}
else {
if (DEBUG) this.log("Local file support not available");
control.parentNode.removeChild(control);
control.parentNode.removeChild(/** @type {Node} */ (control));
}
return true;
@ -531,7 +531,7 @@ FDC.prototype.initBus = function(cmp, bus, cpu, dbg)
this.dbg = dbg;
this.cmp = cmp;
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
/*
* If we didn't need auto-mount support, we could defer controller initialization until we received a powerUp() notification,

View file

@ -508,7 +508,7 @@ HDC.prototype.initBus = function(cmp, bus, cpu, dbg)
* We need access to the ChipSet component, because we need to communicate with
* the PIC and DMA controller.
*/
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
bus.addPortInputTable(this, this.fATC? HDC.aATCPortInput : HDC.aXTCPortInput);
bus.addPortOutputTable(this, this.fATC? HDC.aATCPortOutput : HDC.aXTCPortOutput);

View file

@ -1151,7 +1151,7 @@ if (DEBUGGER) {
* 01 Commit all local files (*) (3.0+)
* Entry: None
* Exit: None
* 02 Close all occurences of file (*) (3.0+)
* 02 Close all occurrences of file (*) (3.0+)
* Entry: DS:DX-&gt;parameter block (DS:DX-&gt;qualified filespec)
* Exit: CF=0 None
* CF=1 AX=error code

View file

@ -1131,7 +1131,7 @@ Keyboard.prototype.initBus = function(cmp, bus, cpu, dbg)
this.bus = bus;
this.cpu = cpu;
this.dbg = dbg;
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
};
/**

View file

@ -1465,9 +1465,9 @@ if (PAGEBLOCKS) {
}
if (TYPEDARRAYS) {
Memory.afnArrayBE = [Memory.prototype.readByteBE, Memory.prototype.readShortBE, Memory.prototype.readLongBE, Memory.prototype.writeByteBE, Memory.prototype.writeShortBE, Memory.prototype.writeLongBE];
Memory.afnArrayLE = [Memory.prototype.readByteLE, Memory.prototype.readShortLE, Memory.prototype.readLongLE, Memory.prototype.writeByteLE, Memory.prototype.writeShortLE, Memory.prototype.writeLongLE];
Memory.afnPagedLE = [Memory.prototype.readBytePLE, Memory.prototype.readShortPLE, Memory.prototype.readLongPLE, Memory.prototype.writeBytePLE, Memory.prototype.writeShortPLE, Memory.prototype.writeLongPLE];
Memory.afnArrayBE = [Memory.prototype.readByteBE, Memory.prototype.readShortBE, Memory.prototype.readLongBE, Memory.prototype.writeByteBE, Memory.prototype.writeShortBE, Memory.prototype.writeLongBE];
Memory.afnArrayLE = [Memory.prototype.readByteLE, Memory.prototype.readShortLE, Memory.prototype.readLongLE, Memory.prototype.writeByteLE, Memory.prototype.writeShortLE, Memory.prototype.writeLongLE];
Memory.afnPagedLE = [Memory.prototype.readBytePLE, Memory.prototype.readShortPLE, Memory.prototype.readLongPLE, Memory.prototype.writeBytePLE, Memory.prototype.writeShortPLE, Memory.prototype.writeLongPLE];
}
if (NODE) module.exports = Memory;

View file

@ -193,7 +193,7 @@ Mouse.prototype.initBus = function(cmp, bus, cpu, dbg)
* Attach the Video component to the CPU, so that the CPU can periodically update
* the video display via updateVideo(), as cycles permit.
*/
for (var video = null; (video = cmp.getComponentByType("Video", video));) {
for (var video = null; (video = cmp.getMachineComponent("Video", video));) {
this.aVideo.push(video);
}
};
@ -246,7 +246,7 @@ Mouse.prototype.powerUp = function(data, fRepower)
}
if (this.sAdapterType && !this.componentAdapter) {
var componentAdapter = null;
while ((componentAdapter = this.cmp.getComponentByType(this.sAdapterType, componentAdapter))) {
while ((componentAdapter = this.cmp.getMachineComponent(this.sAdapterType, componentAdapter))) {
if (componentAdapter.attachMouse) {
this.componentAdapter = componentAdapter.attachMouse(this.idAdapter, this);
if (this.componentAdapter) {

View file

@ -348,7 +348,7 @@ Panel.prototype.initBus = function(cmp, bus, cpu, dbg)
this.bus = bus;
this.cpu = cpu;
this.dbg = dbg;
this.kbd = cmp.getComponentByType("Keyboard");
this.kbd = cmp.getMachineComponent("Keyboard");
};
/**
@ -486,7 +486,7 @@ Panel.prototype.findAddress = function(x, y)
x -= rect.x;
y -= rect.y;
var region = this.busInfo.aRegions[i];
var iBlock = usr.getBitField(Bus.BlockInfo.num, this.busInfo.aBlocks[region.iBlock]);
var iBlock = usr.getBitField(/** @type {BitField} */ (Bus.BlockInfo.num), this.busInfo.aBlocks[region.iBlock]);
var addr = iBlock * this.bus.nBlockSize;
var addrLimit = (iBlock + region.cBlocks) * this.bus.nBlockSize - 1;
@ -619,8 +619,8 @@ Panel.prototype.findRegions = function()
for (var iBlock = 0; iBlock < this.busInfo.cBlocks; iBlock++) {
var blockInfo = this.busInfo.aBlocks[iBlock];
var typeBlock = usr.getBitField(Bus.BlockInfo.type, blockInfo);
var nBlockCurr = usr.getBitField(Bus.BlockInfo.num, blockInfo);
var typeBlock = usr.getBitField(/** @type {BitField} */ (Bus.BlockInfo.type), blockInfo);
var nBlockCurr = usr.getBitField(/** @type {BitField} */ (Bus.BlockInfo.num), blockInfo);
if (typeBlock != typeRegion || nBlockCurr != nBlockPrev + 1) {
var cBlocks = iBlock - iBlockRegion;
if (cBlocks) {

View file

@ -84,7 +84,7 @@ RAM.prototype.initBus = function(cmp, bus, cpu, dbg)
this.bus = bus;
this.cpu = cpu;
this.dbg = dbg;
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
this.setReady();
};

View file

@ -408,7 +408,7 @@ SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg)
this.bus = bus;
this.cpu = cpu;
this.dbg = dbg;
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
bus.addPortInputTable(this, SerialPort.aPortInput, this.portBase);
bus.addPortOutputTable(this, SerialPort.aPortOutput, this.portBase);
this.setReady();

View file

@ -2880,7 +2880,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
* If we have an associated keyboard, then ensure that the keyboard will be notified whenever the canvas
* gets focus and receives input.
*/
this.kbd = cmp.getComponentByType("Keyboard");
this.kbd = cmp.getMachineComponent("Keyboard");
if (this.kbd && this.canvasScreen) {
for (var s in this.bindings) {
if (s.indexOf("lock") > 0) this.kbd.setBinding("led", s, this.bindings[s]);
@ -2889,7 +2889,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
}
this.bEGASwitches = 0x09; // our default "switches" setting (see aEGAMonitorSwitches)
this.chipset = cmp.getComponentByType("ChipSet");
this.chipset = cmp.getMachineComponent("ChipSet");
if (this.chipset && this.sSwitches) {
if (this.nCard == Video.CARD.EGA) this.bEGASwitches = this.chipset.parseSwitches(this.sSwitches, this.bEGASwitches);
}
@ -2900,7 +2900,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
* touch-screen support.
*/
if (this.sTouchScreen == "mouse") {
this.mouse = cmp.getComponentByType("Mouse");
this.mouse = cmp.getMachineComponent("Mouse");
if (this.mouse) this.captureTouch(Video.TOUCH.MOUSE);
}
else if (this.sTouchScreen == "keygrid") {
@ -2939,7 +2939,7 @@ Video.prototype.setBinding = function(sHTMLType, sBinding, control)
};
} else {
if (DEBUG) this.log("FullScreen API not available");
control.parentNode.removeChild(control);
control.parentNode.removeChild(/** @type {Node} */ (control));
}
return true;
@ -2952,7 +2952,7 @@ Video.prototype.setBinding = function(sHTMLType, sBinding, control)
};
} else {
if (DEBUG) this.log("Pointer Lock API not available");
control.parentNode.removeChild(control);
control.parentNode.removeChild(/** @type {Node} */ (control));
}
return true;
@ -4326,7 +4326,7 @@ Video.prototype.checkBlink = function()
this.cBlinks = 0;
/*
* At this point, we can either fire up our own timer (doBlink), or rely on updateScreen()
* being called by the CPU at a regular rate (eg, CPU.VIDEO_UPDATES_PER_SECOND = 60) and advance
* being called by the CPU at regular bursts (eg, CPU.VIDEO_UPDATES_PER_SECOND = 60) and advance
* cBlinks at the start of updateScreen() accordingly.
*
* doBlink() wants to increment cBlinks every 266ms. On the other hand, if updateScreen() is being
@ -5142,8 +5142,8 @@ Video.prototype.invalidateScreen = function(fModified)
* doBlink()
*
* This function is obsolete, now that the checkBlink() function is called on every updateScreen()
* and checkCursor() call. updateScreen() is driven by the CPU timer, so piggy-backing on that to
* drive blink updates seems preferable to having another active timer in the system.
* and checkCursor() call. updateScreen() is driven by CPU bursts, so piggy-backing on that to drive
* blink updates seems preferable to having another active timer in the system.
*
* @this {Video}
* @param {boolean} [fStart]
@ -7151,8 +7151,9 @@ Video.init = function()
var eTextArea = window.document.createElement("textarea");
/*
* As noted in keyboard.js, the keyboard on an iOS device pops up with the SHIFT key depressed,
* which is not the initial keyboard state that the Keyboard component expects.
* As noted in keyboard.js, the keyboard on an iOS device tends to pop up with the SHIFT key depressed,
* which is not the initial keyboard state that the Keyboard component expects, so hopefully turning off
* these "auto" attributes will help.
*/
if (web.isUserAgent("iOS")) {
eTextArea.setAttribute("autocapitalize", "off");

View file

@ -400,6 +400,7 @@ X86CPU.prototype.enablePageBlocks = function()
this.setError("PAGEBLOCKS support required");
return;
}
var iBlock;
if (this.aMemBlocks === this.aBusBlocks) {
this.aMemBlocks = new Array(this.nBlockTotal);
/*
@ -424,7 +425,7 @@ X86CPU.prototype.enablePageBlocks = function()
*/
this.blockUnpaged = new Memory(null, 0, 0, Memory.TYPE.UNPAGED, null, this);
this.blockUnpaged.copyBreakpoints(this.dbg);
for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
for (iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
this.aMemBlocks[iBlock] = this.blockUnpaged;
}
/*
@ -448,7 +449,7 @@ X86CPU.prototype.enablePageBlocks = function()
* a constrained TLB -- at least not from the 80386 era, which is all we're emulating.
*/
for (var i = 0; i < this.aBlocksPaged.length; i++) {
var iBlock = this.aBlocksPaged[i];
iBlock = this.aBlocksPaged[i];
this.releasePageBlock(this.aMemBlocks[iBlock]);
this.aMemBlocks[iBlock] = this.blockUnpaged;
}

View file

@ -1694,7 +1694,7 @@ X86.fnLGDT = function(dst, src)
} else {
/*
* Hopefully it won't hurt to always fetch a 32-bit base address (even on an 80286), which we then
* mask apppropriately.
* mask appropriately.
*/
this.addrGDT = this.getLong(this.regEA + 2) & (this.maskData | (this.maskData << 8));
/*
@ -1756,7 +1756,7 @@ X86.fnLIDT = function(dst, src)
} else {
/*
* Hopefully it won't hurt to always fetch a 32-bit base address (even on an 80286), which we then
* mask apppropriately.
* mask appropriately.
*/
this.addrIDT = this.getLong(this.regEA + 2) & (this.maskData | (this.maskData << 8));
/*

View file

@ -234,7 +234,7 @@ var BitFields;
* The above set bit field "bfs.num" in numeric variable "n" to the value 1.
*
* @param {Object} bfs
* @return {*} (technically, we transform the bfs object into a BitFields object, but the Closure Compiler won't let us specify that)
* @return {BitFields}
*/
usr.defineBitFields = function(bfs)
{