Collapsed /configs into /devices (or in some cases, /apps or /disks), simplifying the structure a bit

This commit is contained in:
Jeff Parsons 2014-11-03 00:11:40 -08:00 committed by jeffpar
commit 0e8e11d2d8
159 changed files with 1498 additions and 1472 deletions

View file

@ -18,8 +18,8 @@
<cpu id="cpu6502"/>
<ram id="ram8K" size="0x2000"/>
<rom id="romNull" size="0x8000"/>
<rom id="romBasic" size="0x2000" image="/devices/c1p/roms/basic-gcpatch.hex"/>
<rom id="romSystem" size="0x0800" image="/devices/c1p/roms/system.hex"/>
<rom id="romBasic" size="0x2000" image="/devices/c1p/rom/basic-gcpatch.hex"/>
<rom id="romSystem" size="0x0800" image="/devices/c1p/rom/system.hex"/>
<video id="video" screenwidth="256" screenheight="192" cols="32" rows="32" charset="/devices/c1p/video/chargen1x.png" padding="8px"/>
<keyboard id="keyboard">
<control type="button" class="input" binding="ctrl-c">CTRL-C</control>
@ -53,8 +53,8 @@
the "bindings" that connect the components to the visual elements.</p>
<p>Here are some working examples:
<ul>
<li><a href="/configs/c1p/machines/8kb/large/debugger/">Challenger 1P w/Debugger</a></li>
<li><a href="/configs/c1p/machines/8kb/array/">Challenger 1P "Server Array" Demo</a></li>
<li><a href="/devices/c1p/machine/8kb/large/debugger/">Challenger 1P w/Debugger</a></li>
<li><a href="/devices/c1p/machine/8kb/array/">Challenger 1P "Server Array" Demo</a></li>
</ul>
</p>
<p>Here's what a machine definition XML file typically looks like:
@ -75,8 +75,8 @@
<lt/>cpu id="cpu6502"/<gt/>
<lt/>ram id="ram8K" size="0x2000"/<gt/>
<lt/>rom id="romNull" size="0x8000"/<gt/>
<lt/>rom id="romBasic" size="0x2000" image="/devices/c1p/roms/basic-gcpatch.hex"/<gt/>
<lt/>rom id="romSystem" size="0x0800" image="/devices/c1p/roms/system.hex"/<gt/>
<lt/>rom id="romBasic" size="0x2000" image="/devices/c1p/rom/basic-gcpatch.hex"/<gt/>
<lt/>rom id="romSystem" size="0x0800" image="/devices/c1p/rom/system.hex"/<gt/>
<lt/>video id="video" screenwidth="256" screenheight="192" cols="32" rows="32"
charset="/devices/c1p/video/chargen1x.png" width="256px" padding="8px"/<gt/>
<lt/>keyboard id="keyboard"<gt/>

View file

@ -520,7 +520,7 @@ HTMLOut.filter = function(req, res, next)
* crack at the URL and redirect with a trailing slash as appropriate.
*
* This isn't just a cosmetic issue, because without "strict routing" and the "express-slash" module,
* URLs like "http://localhost:9126/configs/pc/machines/5150/mda/64kb/debugger" will cause problems for
* URLs like "http://localhost:8088/devices/pc/machine/5150/mda/64kb/debugger" will cause problems for
* client-side JavaScript when it tries to do an XMLHttpRequest with a relative filename (eg, "machine.xml");
* that request will fetch the "machine.xml" in the parent directory instead of the "debugger" directory.
*
@ -1392,7 +1392,7 @@ HTMLOut.prototype.getMachineXML = function(sToken, sIndent, aParms, sXMLFile, sS
*
* But, instead of displaying a cryptic error message inside our beautiful HTML template, eg:
*
* htmlout error: ENOENT, open '/Users/Jeff/Sites/pcjs/configs/pc/machines/5160/cga/256kb/win101/debugger/machine.xml'
* htmlout error: ENOENT, open '/Users/Jeff/Sites/pcjs/devices/pc/machine/5160/cga/256kb/win101/debugger/machine.xml'
*
* we have one more fallback: a random string! Less useful, but more entertaining. Well, maybe not even that.
*
@ -1623,7 +1623,7 @@ HTMLOut.prototype.getReadMe = function(sToken, sIndent, aParms, sPrevious)
/*
* Instead of displaying a cryptic error message inside our beautiful HTML template, eg:
*
* htmlout error: ENOENT, open '/Users/Jeff/Sites/pcjs/configs/pc/machines/5160/cga/256kb/win101/debugger/README.md'
* htmlout error: ENOENT, open '/Users/Jeff/Sites/pcjs/devices/pc/machine/5160/cga/256kb/win101/debugger/README.md'
*
* which is all this will give us:
*

View file

@ -90,7 +90,7 @@ var logFile = null;
* Redirect permanent /videos/pcjs/ /disks/pc/dos/microsoft/4.0M/
* RedirectMatch permanent /demos/pc/.* /configs/pc/machines/
*/
var externalRedirects = {
var aExternalRedirects = {
"/c1p": "/docs/c1pjs/",
"/c1pjs": "/docs/c1pjs/",
"/pc": "/docs/about/pcjs/",
@ -118,20 +118,21 @@ var externalRedirects = {
"/videos/pcjs": "/configs/pc/machines/5160/cga/640kb/dos400m/"
};
var aExternalRedirectPatterns = {
"^/configs/pc/machines/(.*)": "/devices/pc/machine/$1"
};
/*
* Entries in this table are matched next, using a RegExp comparison; comparisons start with the first entry
* and continue until a match is found, at which point the replacement is performed and comparisons stop;
* we could make the replacement process "additive", by continuing comparisons/replacements until the
* end is reached, but let's not, unless there's an actual need.
*
* In fact, until I find a compelling need for any of these redirects, I'm going to disable them, so that we
* don't waste time running RegExp tests on every server request.
*
* Feel free to use subgroups on the left-hand side, and references to them (eg, $1, $2, etc) on the right.
*/
var internalRedirects = {
// "^/apps/pc/visicalc/": "/apps/pc/1981/visicalc/",
// "^/demos/pc/.*": "/configs/pc/machines/"
var aInternalRedirectPatterns = {
// "^/apps/pc/visicalc/": "/apps/pc/1981/visicalc/",
// "^/demos/pc/.*": "/configs/pc/machines/"
};
/**
@ -181,6 +182,7 @@ var userVolumes = {};
*/
HTTPAPI.redirect = function(req, res, next)
{
var re;
var sPath = req.path;
if (sPath.slice(-1) == '/') sPath = sPath.slice(0, -1);
@ -190,15 +192,23 @@ HTTPAPI.redirect = function(req, res, next)
return true;
}
if (externalRedirects[sPath] !== undefined) {
res.redirect(301, externalRedirects[sPath]);
if (aExternalRedirects[sPath] !== undefined) {
res.redirect(301, aExternalRedirects[sPath]);
return true;
}
for (sPath in internalRedirects) {
for (sPath in aExternalRedirectPatterns) {
re = new RegExp(sPath);
if (re.exec(req.url)) {
res.redirect(301, req.url.replace(re, aExternalRedirectPatterns[sPath]));
return true;
}
}
for (sPath in aInternalRedirectPatterns) {
var re = new RegExp(sPath);
if (re.exec(req.url)) {
req.url = req.url.replace(re, internalRedirects[sPath]);
req.url = req.url.replace(re, aInternalRedirectPatterns[sPath]);
break;
}
}

View file

@ -880,7 +880,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
* Before we call convertMDLinks() to process any normal Markdown-style links, we first
* look for our own special flavor of "machine" Markdown links; ie:
*
* [IBM PC](/configs/pc/foo/ "PCjs:demoPC:stylesheet:version:options:state")
* [IBM PC](/devices/pc/machine/5150/mda/64kb/ "PCjs:demoPC:stylesheet:version:options:state")
*
* where a special title attribute triggers generation of an embedded machine rather than
* a link. Use "PCjs" or "C1Pjs" to automatically include the latest version of either
@ -888,7 +888,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)
* If you need to use the script with the built-in Debugger (ie, either "pc-dbg.js" or
* "c1p-dbg.js"), then include "debugger" in the list of comma-delimited options, as in:
*
* [IBM PC](/configs/pc/foo/ "PCjs:demoPC:::debugger")
* [IBM PC](/devices/pc/machine/5150/mda/64kb/ "PCjs:demoPC:::debugger")
*
* If the link ends with a slash, then it's an implied reference to a "machine.xml".
*

View file

@ -87,5 +87,5 @@
"name": "",
"messages": ""
},
"xml": "/configs/pc/machines/5150/mda/64kb/machine.xml"
"xml": "/devices/pc/machine/5150/mda/64kb/machine.xml"
}

View file

@ -91,11 +91,11 @@
* 1) Creating new (empty) disk images
* 2) Pre-loading pre-built JSON-encoded disk images (converting them to JSON on the fly as needed)
*
* An example of #1 is in /configs/pc/machines/5160/cga/256kb/demo/machine.xml:
* An example of #1 is in /devices/pc/machine/5160/cga/256kb/demo/machine.xml:
*
* <hdc id="hdcXT" drives='[{name:"10Mb Hard Disk",type:3}]'/>
*
* and an example of #2 is in /configs/pc/disks/fixed/win101.xml:
* and an example of #2 is in /disks/pc/fixed/win101.xml:
*
* <hdc id="hdcXT" drives='[{name:"10Mb Hard Disk",path:"/disks/pc/fixed/win101/10mb.json",type:3}]'/>
*

View file

@ -27,7 +27,7 @@
</xsl:template>
<xsl:template name="machine">
<xsl:param name="href">/configs/pc/machines/5150/mda/64kb/index.xml</xsl:param>
<xsl:param name="href">/devices/pc/machine/5150/mda/64kb/machine.xml</xsl:param>
<xsl:param name="state" select="''"/>
<xsl:variable name="componentFile"><xsl:value-of select="$rootDir"/><xsl:value-of select="$href"/></xsl:variable>
<xsl:apply-templates select="document($componentFile)/machine">

View file

@ -129,7 +129,7 @@ function parseXML(sXML, sXMLFile, idMachine, sStateFile, fResolve, display, done
}
/*
* If the resource we requested is not really an XML file (or the file didn't exist and the server simply returned
* a message like "Cannot GET /configs/pc/machines/5150/cga/64kb/donkey/index.xml"), we'd like to display a more
* a message like "Cannot GET /devices/pc/machine/5150/cga/64kb/donkey/machine.xml"), we'd like to display a more
* meaningful message, because the XML DOM parsers will blithely return a document that contains nothing useful; eg:
*
* This page contains the following errors:error on line 1 at column 1:

View file

@ -284,7 +284,7 @@ web.loadResource = function(sURL, fAsync, data, componentNotify, fnNotify, pNoti
*
* @param {string} sApp (eg, "PCjs")
* @param {string} sVer (eg, "1.02")
* @param {string} sURL (eg, "/configs/pc/machines/5150/mda/64kb/index.xml")
* @param {string} sURL (eg, "/devices/pc/machine/5150/mda/64kb/machine.xml")
* @param {string} sUser (ie, the user key, if any)
* @param {string} sType (eg, "bug"); one of ReportAPI.TYPE.*
* @param {string} sReport (eg, unparsed state data)

View file

@ -22,7 +22,7 @@
<li><a href="/">Home</a></li>
<li><a href="/apps/pc/">Apps</a></li>
<li><a href="/disks/pc/">Disks</a></li>
<li><a href="/configs/">Machines</a></li>
<li><a href="/devices/">Machines</a></li>
<li><a href="/docs/">Docs</a></li>
<li><a href="/pubs/">Pubs</a></li>
<li><a href="/blog/">Blog</a></li>

View file

@ -22,7 +22,7 @@
<li><a href="/">Home</a></li>
<li><a href="/apps/pc/">Apps</a></li>
<li><a href="/disks/pc/">Disks</a></li>
<li><a href="/configs/">Machines</a></li>
<li><a href="/devices/">Machines</a></li>
<li><a href="/docs/">Docs</a></li>
<li><a href="/pubs/">Pubs</a></li>
<li><a href="/blog/">Blog</a></li>