Cleaned up the SerialPort header a bit

This commit is contained in:
Jeff Parsons 2017-08-08 17:12:20 -07:00 committed by Jeff Parsons
commit f6fe72f43f
4 changed files with 31 additions and 26 deletions

View file

@ -38,28 +38,28 @@ if (NODE) {
var ChipSet = require("./chipset"); var ChipSet = require("./chipset");
} }
/* /**
* class SerialPort * SerialPort class
* property {number} iAdapter
* property {number} portBase
* property {number} nIRQ
* property {Object} controlIOBuffer is a DOM element bound to the port (for rudimentary output; see transmitByte())
* *
* NOTE: This class declaration started as a way of informing the code inspector of the controlIOBuffer property, * The class property declarations below started as a way of informing the code inspector of the controlIOBuffer
* which remained undefined until a setBinding() call set it later, but I've since decided that explicitly * property, which remained undefined until a setBinding() call set it later, but I've since decided that explicitly
* initializing such properties in the constructor is a better way to go -- even though it's more code -- because * initializing such properties in the constructor is a better way to go -- even though it's more code -- because
* JavaScript compilers are supposed to be happier when the underlying object structures aren't constantly changing. * JavaScript compilers are supposed to be happier when the underlying object structures aren't constantly changing.
* *
* Besides, I'm not sure I want to get into documenting every property this way, for this or any/every other class, * Besides, I'm not sure I want to get into documenting every property this way, for this or any/every other class,
* let alone getting into which ones should be considered private or protected, because PCjs isn't really a library * let alone getting into which ones should be considered private or protected, because PCjs isn't really a library
* for third-party apps. * for third-party apps.
*/
/**
* TODO: The Closure Compiler treats ES6 classes as 'struct' rather than 'dict' by default,
* which would force us to declare all class properties in the constructor, as well as prevent
* us from defining any named properties. So, for now, we mark all our classes as 'unrestricted'.
* *
* TODO: The Closure Compiler treats ES6 classes as 'struct' rather than 'dict' by default, which would force us
* to declare all class properties in the constructor, as well as prevent us from defining any named properties.
* So, for now, we mark all our classes as 'unrestricted'.
*
* @class SerialPort
* @property {number} iAdapter
* @property {number} portBase
* @property {number} nIRQ
* @property {string|null} consoleOutput
* @property {Object} controlIOBuffer (DOM element bound to the port for rudimentary output; see transmitByte())
* @unrestricted * @unrestricted
*/ */
class SerialPort extends Component { class SerialPort extends Component {
@ -75,19 +75,18 @@ class SerialPort extends Component {
* tabSize: set to a non-zero number to convert tabs to spaces (applies only to output to * tabSize: set to a non-zero number to convert tabs to spaces (applies only to output to
* the above binding); default is 0 (no conversion) * the above binding); default is 0 (no conversion)
* *
* In the future, we may support 'port' and 'irq' properties that allow the machine to define a * In the future, we may support 'port' and 'irq' properties that allow the machine to define a non-standard
* non-standard serial port configuration, instead of only our pre-defined 'adapter' configurations. * serial port configuration, instead of only our pre-defined 'adapter' configurations.
* *
* NOTE: Since the XSL file defines 'adapter' as a number, not a string, there's no need to use * NOTE: Since the XSL file defines 'adapter' as a number, not a string, there's no need to use parseInt(),
* parseInt(), and as an added benefit, we don't need to worry about whether a hex or decimal format * and as an added benefit, we don't need to worry about whether a hex or decimal format was used.
* was used.
* *
* This hard-coded approach mimics the original IBM PC Asynchronous Adapter configuration, which * This hard-coded approach mimics the original IBM PC Asynchronous Adapter configuration, which contained a
* contained a pair of "shunt modules" that allowed the user to select a port address of either * pair of "shunt modules" that allowed the user to select a port address of either 0x3F8 ("Primary") or 0x2F8
* 0x3F8 ("Primary") or 0x2F8 ("Secondary"). * ("Secondary").
* *
* DOS typically names the Primary adapter "COM1" and the Secondary adapter "COM2", but I prefer * DOS typically names the Primary adapter "COM1" and the Secondary adapter "COM2", but I prefer to stick to
* to stick to adapter numbers, since not all operating systems follow those naming conventions. * adapter numbers, since not all operating systems follow those naming conventions.
* *
* @this {SerialPort} * @this {SerialPort}
* @param {Object} parmsSerial * @param {Object} parmsSerial

File diff suppressed because one or more lines are too long

View file

@ -55010,6 +55010,12 @@ Web.onInit(ParallelPort.init);
* which would force us to declare all class properties in the constructor, as well as prevent * which would force us to declare all class properties in the constructor, as well as prevent
* us from defining any named properties. So, for now, we mark all our classes as 'unrestricted'. * us from defining any named properties. So, for now, we mark all our classes as 'unrestricted'.
* *
* @class SerialPort
* @property {number} iAdapter
* @property {number} portBase
* @property {number} nIRQ
* @property {string|null} consoleOutput
* @property {Object} controlIOBuffer (DOM element bound to the port for rudimentary output; see transmitByte())
* @unrestricted * @unrestricted
*/ */
class SerialPort extends Component { class SerialPort extends Component {

File diff suppressed because one or more lines are too long