Added "Adventures in Math (1983)" along with some notes about the failure to properly archive files

This commit is contained in:
Jeff Parsons 2017-06-14 09:48:51 -07:00 committed by Jeff Parsons
commit 36bf15561f
19 changed files with 619 additions and 379 deletions

View file

@ -1702,18 +1702,24 @@ HTMLOut.prototype.getManifestXML = function(sToken, sIndent, aParms)
sStateFile = match[2];
}
}
if (sXMLFile) {
obj.getMachineXML(sToken, sIndent, null, sXMLFile, sStateFile);
return;
}
/*
* Because it's common (and preferred, actually) to have a README.md file accompany a manifest,
* and because README.md files offer the preferred way to embed machines, we no longer immediately
* process any machine file specified by the manifest. Instead, we pass along sXMLFile and
* sStateFile to getMarkdownFile(), which it will use if no README.md exists.
*
* if (sXMLFile) {
* obj.getMachineXML(sToken, sIndent, null, sXMLFile, sStateFile);
* return;
* }
*/
}
/*
* If we're still here, then there was either a problem reading the manifest XSL file,
* or the manifest XML file didn't contain a machine reference. For now, we fall back to
* getMarkdownFile().
* or the manifest XML file didn't contain a machine reference (or, as explained above, we
* simply prefer to process README.md files first), so we fall back to getMarkdownFile().
*/
obj.getMarkdownFile(obj.sFile, sToken, sIndent, aParms);
obj.getMarkdownFile(obj.sFile, sToken, sIndent, aParms, null, sXMLFile, sStateFile);
});
return;
}
@ -1727,7 +1733,7 @@ HTMLOut.prototype.getManifestXML = function(sToken, sIndent, aParms)
};
/**
* getMarkdownFile(sFile, sToken, sIndent, aParms, sPrevious, sMachineFile)
* getMarkdownFile(sFile, sToken, sIndent, aParms, sPrevious, sXMLFile, sStateFile)
*
* If sFile exists in the current directory, open it, convert it, and prepare for replacement.
*
@ -1737,9 +1743,10 @@ HTMLOut.prototype.getManifestXML = function(sToken, sIndent, aParms)
* @param {string} [sIndent]
* @param {Array.<string>} [aParms]
* @param {string|null} [sPrevious] is text, if any, that should precede the file
* @param {string} [sMachineFile] name (if any) of machine.xml file already processed by the caller
* @param {string} [sXMLFile] name (if any) of a default machine.xml
* @param {string} [sStateFile] name (if any) of a default state file
*/
HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPrevious, sMachineFile)
HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPrevious, sXMLFile, sStateFile)
{
var obj = this;
@ -1754,7 +1761,7 @@ HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPr
*/
if (sFile.indexOf(sReadMeFile) >= 0) {
sFile = sFile.replace(sReadMeFile, sMachineMDFile);
obj.getMarkdownFile(sFile, sToken, sIndent, aParms, sPrevious, sMachineFile);
obj.getMarkdownFile(sFile, sToken, sIndent, aParms, sPrevious, sXMLFile, sStateFile);
return;
}
/*
@ -1769,18 +1776,18 @@ HTMLOut.prototype.getMarkdownFile = function(sFile, sToken, sIndent, aParms, sPr
* we now try some fallbacks, like checking for a "machine.xml" -- but only if sPrevious is not defined.
*/
if (sToken) {
if (sPrevious !== undefined) { // this means getMachineXML() called us, so it's the end of road
if (sPrevious != null) { // this means getMachineXML() called us, so it's the end of road
obj.aTokens[sToken] = sPrevious;
obj.replaceTokens();
} else {
obj.getMachineXML(sToken, sIndent); // we don't pass along aParms, because those are for Markdown files only
} else { // we don't pass along aParms, because those are for Markdown files only
obj.getMachineXML(sToken, sIndent, null, sXMLFile, sStateFile);
}
}
} else {
var m = new MarkOut(s, sIndent, obj.req, aParms, obj.fDebug, sMachineFile, obj.sExt == "md");
var m = new MarkOut(s, sIndent, obj.req, aParms, obj.fDebug, sXMLFile, obj.sExt == "md");
s = m.convertMD(" ").trim();
if (sMachineFile && m.hasMachines()) sPrevious = null;
if (sXMLFile && m.hasMachines()) sPrevious = null;
/*
* If the Markdown document begins with a heading, stuff that into the <title> tag;

View file

@ -153,7 +153,7 @@ class FDC extends Component {
* We record any 'autoMount' object now, but we no longer parse it until initBus(), because the Computer's
* getMachineParm() service may have an override for us.
*/
this.configMount = parmsFDC['autoMount'] || null;
this.configMount = this.parseConfig(parmsFDC['autoMount']);
/*
* This establishes "name" as the default; if we decide we'd prefer "none" to be the default (ie, the order
@ -421,23 +421,7 @@ class FDC extends Component {
this.cmp = cmp;
this.chipset = cmp.getMachineComponent("ChipSet");
this.configMount = this.cmp.getMachineParm('autoMount') || this.configMount;
if (this.configMount) {
if (typeof this.configMount == "string") {
try {
/*
* The most likely source of any exception will be right here, where we're parsing
* the JSON-encoded diskette data.
*/
this.configMount = eval("(" + this.configMount + ")");
} catch (e) {
Component.error("FDC auto-mount error: " + e.message + " (" + this.configMount + ")");
this.configMount = null;
}
}
}
this.parseConfig(this.cmp.getMachineParm('autoMount'), this.configMount);
/*
* If we didn't need auto-mount support, we could defer controller initialization until we received a powerUp() notification,
@ -456,6 +440,39 @@ class FDC extends Component {
if (!this.autoMount()) this.setReady();
}
/**
* parseConfig(config, configMerge)
*
* @this {FDC}
* @param {Object|string|undefined} config
* @param {Object} [configMerge]
* @return {Object}
*/
parseConfig(config, configMerge)
{
if (config) {
if (typeof config == "string") {
try {
/*
* We must take care when parsing user-supplied JSON-encoded diskette data.
*/
config = /** @type {Object} */ (eval("(" + config + ")"));
} catch (e) {
Component.error("FDC auto-mount error: " + e.message + " (" + config + ")");
config = {};
}
}
} else {
config = {};
}
if (configMerge) {
for (var drive in config) {
configMerge[drive] = config[drive];
}
}
return config;
}
/**
* powerUp(data, fRepower)
*
@ -1067,26 +1084,24 @@ class FDC extends Component {
autoMount(fRemount)
{
if (!fRemount) this.cAutoMount = 0;
if (this.configMount) {
for (var sDrive in this.configMount) {
var configDrive = this.configMount[sDrive];
var sDiskettePath = configDrive['path'] || "";
var sDisketteName = configDrive['name'] || this.findDiskette(sDiskettePath);
if (sDiskettePath && sDisketteName) {
/*
* WARNING: This conversion of drive letter to drive number, starting with A:, is very simplistic
* and is not guaranteed to match the drive mapping that DOS ultimately uses.
*/
var iDrive = sDrive.charCodeAt(0) - 0x41;
if (iDrive >= 0 && iDrive < this.aDrives.length) {
if (!this.loadDrive(iDrive, sDisketteName, sDiskettePath, true) && fRemount) {
this.setReady(false);
}
continue;
for (var sDrive in this.configMount) {
var configDrive = this.configMount[sDrive];
var sDiskettePath = configDrive['path'] || "";
var sDisketteName = configDrive['name'] || this.findDiskette(sDiskettePath);
if (sDiskettePath && sDisketteName) {
/*
* WARNING: This conversion of drive letter to drive number, starting with A:, is very simplistic
* and is not guaranteed to match the drive mapping that DOS ultimately uses.
*/
var iDrive = sDrive.charCodeAt(0) - 0x41;
if (iDrive >= 0 && iDrive < this.aDrives.length) {
if (!this.loadDrive(iDrive, sDisketteName, sDiskettePath, true) && fRemount) {
this.setReady(false);
}
continue;
}
this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")");
}
this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")");
}
return !!this.cAutoMount;
}

View file

@ -184,8 +184,7 @@ class HDC extends Component {
else if (this.sDriveConfigs) {
try {
/*
* The most likely source of any exception will be right here, where we're parsing
* the JSON-encoded drive data.
* We must take care when parsing user-supplied JSON-encoded drive data.
*/
this.aDriveConfigs = eval("(" + this.sDriveConfigs + ")");
/*