Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Commit

Permalink
Allow DEBUG to be turned off from URL
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpar committed May 23, 2018
1 parent f7416b1 commit b0020cd
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ OS X users may also need to preface this command with `sudo`:
npm install gulp-cli -g

Now you can run `gulp` anywhere within the PCjs project to build an updated version. If no command-line arguments
are specified, `gulp` runs the "default" task defined by the project's [gulpfile](gulpfile.js); that task runs
are specified, `gulp` runs the "default" task defined by the project's [gulpfile.js](gulpfile.js); that task runs
Google's [Closure Compiler](https://developers.google.com/closure/compiler/) if any of the target files (eg, pcx86.js
in the [versions](/versions/) directory) are out-of date.

### Using the JavaScript-based Closure Compiler

The latest [gulpfile](gulpfile.js) now compiles all PCjs machine modules using
The latest [gulpfile.js](gulpfile.js) now compiles all PCjs machine modules using
Google's [JavaScript-based Closure Compiler](https://github.com/google/closure-compiler-js).

Running `gulp` should build a complete set of "compiled" machine scripts in the [versions](/versions/) directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ machines:
- id: ibm5170
type: pcx86
debugger: true
uncompiled: true # for now, debugger and uncompiled must be true to enable BACKTRACK support
uncompiled: true # this is required for DEBUG, and DEBUG and DEBUGGER must both be true to enable BACKTRACK
---

{% include machine.html id="ibm5170" %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ machines:
- id: ibm5170
type: pcx86
debugger: true
uncompiled: true # for now, debugger and uncompiled must be true to enable BACKTRACK support
uncompiled: true # this is required for DEBUG, and DEBUG and DEBUGGER must both be true to enable BACKTRACK
---

{% include machine.html id="ibm5170" %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ machines:
- id: deskpro386
type: pcx86
debugger: true
uncompiled: true # for now, debugger and uncompiled must be true to enable BACKTRACK support
uncompiled: true # this is required for DEBUG, and DEBUG and DEBUGGER must both be true to enable BACKTRACK
---

{% include machine.html id="deskpro386" %}
2 changes: 1 addition & 1 deletion modules/markout/lib/markout.js
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock)

sMachineID = aMachineParms[0];
sMachineXSLFile = aMachineParms[1] || "";
sMachineVersion = aMachineParms[2] || this.sMachineVersion;
sMachineVersion = aMachineParms[2] || sMachineVersion || this.sMachineVersion;
sMachineOptions = aMachineParms[3] || "";
sMachineParms = aMachineParms[4] || "";
var aMachineOptions = sMachineOptions.split(',');
Expand Down
3 changes: 1 addition & 2 deletions modules/pcx86/lib/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,7 @@ class Bus extends Component {
* at CPUX86.stepCPU (http://pcjs:8088/modules/pcx86/lib/cpux86.js:4637:37)
* at CPUX86.CPU.runCPU (http://pcjs:8088/modules/pcx86/lib/cpu.js:1014:22)
*
* TODO: Investigate. For now, BACKTRACK is completely disabled (in part because it also needs
* to be revamped for machines with paging enabled).
* TODO: Investigate. For now, disable BACKTRACK if you run into this or other problems.
*/
this.assert(slot < Bus.BTINFO.SLOT_MAX);
this.ibtLastAlloc = slot;
Expand Down
10 changes: 4 additions & 6 deletions modules/pcx86/lib/defines.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ var TYPEDARRAYS = (typeof ArrayBuffer !== 'undefined');
* BACKTRACK enables backtracking: a mechanism that allows us to tag every byte of incoming data and follow the
* flow of that data.
*
* This is set to !COMPILED, disabling backtracking in all compiled versions, but we may eventually set it to
* match the DEBUGGER setting -- unless it slows down machines using the built-in Debugger too much, in which case
* we'll have to rethink that choice OR provide a Debugger command that dynamically enables/disables as much of
* the backtracking support as possible.
* It is enabled only if DEBUG is set (implying an un-COMPILED build) and the DEBUGGER is enabled (since it's
* really only of use to someone using the built-in debugger).
*
* TODO: BACKTRACK support is currently completely disabled until we have a chance to investigate the problem
* discussed in Bus.addBackTrackObject().
* TODO: BACKTRACK support may need to be disabled until we have a chance to investigate the problem discussed in
* Bus.addBackTrackObject(); BACKTRACK support also needs to be updated for the 80386 at some point.
*/
var BACKTRACK = DEBUG && DEBUGGER;

Expand Down
16 changes: 16 additions & 0 deletions modules/shared/lib/weblib.js
Original file line number Diff line number Diff line change
Expand Up @@ -1130,4 +1130,20 @@ Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")
Web.doPageEvent(Web.aPageEventHandlers['exit']);
});

/*
* If this is DEBUG (eg, un-COMPILED) code, then allow the user to override DEBUG with a "?debug=false" embedded in
* the URL; note that the Closure Compiler won't let us alter the DEBUG variable, because it's defined as a @define, which
* implies @const as well, so we must resort to modifying it indirectly, using the global window object.
*
* TODO: Consider yet another embedXXX() parameter that would also allow DEBUG to be turned off on a page-by-page basis;
* it's low priority, because it would only affect machines that explicitly request un-COMPILED code, and there are very
* few such machines (eg, https://www.pcjs.org/blog/2015/04/16/).
*/
if (DEBUG && window) {
let sDebug = Web.getURLParm("debug");
if (sDebug == "false") {
window['DEBUG'] = false;
}
}

if (NODE) module.exports = Web;
16 changes: 16 additions & 0 deletions versions/c1pjs/1.71.2/c1p-uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,22 @@ Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")
Web.doPageEvent(Web.aPageEventHandlers['exit']);
});

/*
* If this is DEBUG (eg, un-COMPILED) code, then allow the user to override DEBUG with a "?debug=false" embedded in
* the URL; note that the Closure Compiler won't let us alter the DEBUG variable, because it's defined as a @define, which
* implies @const as well, so we must resort to modifying it indirectly, using the global window object.
*
* TODO: Consider yet another embedXXX() parameter that would also allow DEBUG to be turned off on a page-by-page basis;
* it's low priority, because it would only affect machines that explicitly request un-COMPILED code, and there are very
* few such machines (eg, https://www.pcjs.org/blog/2015/04/16/).
*/
if (DEBUG && window) {
let sDebug = Web.getURLParm("debug");
if (sDebug == "false") {
window['DEBUG'] = false;
}
}



/**
Expand Down
2 changes: 1 addition & 1 deletion versions/c1pjs/1.71.2/c1p.js.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions versions/pc8080/1.71.2/pc8080-uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2741,6 +2741,22 @@ Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")
Web.doPageEvent(Web.aPageEventHandlers['exit']);
});

/*
* If this is DEBUG (eg, un-COMPILED) code, then allow the user to override DEBUG with a "?debug=false" embedded in
* the URL; note that the Closure Compiler won't let us alter the DEBUG variable, because it's defined as a @define, which
* implies @const as well, so we must resort to modifying it indirectly, using the global window object.
*
* TODO: Consider yet another embedXXX() parameter that would also allow DEBUG to be turned off on a page-by-page basis;
* it's low priority, because it would only affect machines that explicitly request un-COMPILED code, and there are very
* few such machines (eg, https://www.pcjs.org/blog/2015/04/16/).
*/
if (DEBUG && window) {
let sDebug = Web.getURLParm("debug");
if (sDebug == "false") {
window['DEBUG'] = false;
}
}



/**
Expand Down
2 changes: 1 addition & 1 deletion versions/pc8080/1.71.2/pc8080.js.map

Large diffs are not rendered by default.

29 changes: 21 additions & 8 deletions versions/pcx86/1.71.2/pcx86-uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2969,6 +2969,22 @@ Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")
Web.doPageEvent(Web.aPageEventHandlers['exit']);
});

/*
* If this is DEBUG (eg, un-COMPILED) code, then allow the user to override DEBUG with a "?debug=false" embedded in
* the URL; note that the Closure Compiler won't let us alter the DEBUG variable, because it's defined as a @define, which
* implies @const as well, so we must resort to modifying it indirectly, using the global window object.
*
* TODO: Consider yet another embedXXX() parameter that would also allow DEBUG to be turned off on a page-by-page basis;
* it's low priority, because it would only affect machines that explicitly request un-COMPILED code, and there are very
* few such machines (eg, https://www.pcjs.org/blog/2015/04/16/).
*/
if (DEBUG && window) {
let sDebug = Web.getURLParm("debug");
if (sDebug == "false") {
window['DEBUG'] = false;
}
}



/**
Expand Down Expand Up @@ -4557,13 +4573,11 @@ var TYPEDARRAYS = (typeof ArrayBuffer !== 'undefined');
* BACKTRACK enables backtracking: a mechanism that allows us to tag every byte of incoming data and follow the
* flow of that data.
*
* This is set to !COMPILED, disabling backtracking in all compiled versions, but we may eventually set it to
* match the DEBUGGER setting -- unless it slows down machines using the built-in Debugger too much, in which case
* we'll have to rethink that choice OR provide a Debugger command that dynamically enables/disables as much of
* the backtracking support as possible.
* It is enabled only if DEBUG is set (implying an un-COMPILED build) and the DEBUGGER is enabled (since it's
* really only of use to someone using the built-in debugger).
*
* TODO: BACKTRACK support is currently completely disabled until we have a chance to investigate the problem
* discussed in Bus.addBackTrackObject().
* TODO: BACKTRACK support may need to be disabled until we have a chance to investigate the problem discussed in
* Bus.addBackTrackObject(); BACKTRACK support also needs to be updated for the 80386 at some point.
*/
var BACKTRACK = DEBUG && DEBUGGER;

Expand Down Expand Up @@ -9688,8 +9702,7 @@ class Bus extends Component {
* at CPUX86.stepCPU (http://pcjs:8088/modules/pcx86/lib/cpux86.js:4637:37)
* at CPUX86.CPU.runCPU (http://pcjs:8088/modules/pcx86/lib/cpu.js:1014:22)
*
* TODO: Investigate. For now, BACKTRACK is completely disabled (in part because it also needs
* to be revamped for machines with paging enabled).
* TODO: Investigate. For now, disable BACKTRACK if you run into this or other problems.
*/

this.ibtLastAlloc = slot;
Expand Down
2 changes: 1 addition & 1 deletion versions/pcx86/1.71.2/pcx86.js.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions versions/pdpjs/1.71.2/pdp10-uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2741,6 +2741,22 @@ Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")
Web.doPageEvent(Web.aPageEventHandlers['exit']);
});

/*
* If this is DEBUG (eg, un-COMPILED) code, then allow the user to override DEBUG with a "?debug=false" embedded in
* the URL; note that the Closure Compiler won't let us alter the DEBUG variable, because it's defined as a @define, which
* implies @const as well, so we must resort to modifying it indirectly, using the global window object.
*
* TODO: Consider yet another embedXXX() parameter that would also allow DEBUG to be turned off on a page-by-page basis;
* it's low priority, because it would only affect machines that explicitly request un-COMPILED code, and there are very
* few such machines (eg, https://www.pcjs.org/blog/2015/04/16/).
*/
if (DEBUG && window) {
let sDebug = Web.getURLParm("debug");
if (sDebug == "false") {
window['DEBUG'] = false;
}
}



/**
Expand Down
2 changes: 1 addition & 1 deletion versions/pdpjs/1.71.2/pdp10.js.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions versions/pdpjs/1.71.2/pdp11-uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2969,6 +2969,22 @@ Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")
Web.doPageEvent(Web.aPageEventHandlers['exit']);
});

/*
* If this is DEBUG (eg, un-COMPILED) code, then allow the user to override DEBUG with a "?debug=false" embedded in
* the URL; note that the Closure Compiler won't let us alter the DEBUG variable, because it's defined as a @define, which
* implies @const as well, so we must resort to modifying it indirectly, using the global window object.
*
* TODO: Consider yet another embedXXX() parameter that would also allow DEBUG to be turned off on a page-by-page basis;
* it's low priority, because it would only affect machines that explicitly request un-COMPILED code, and there are very
* few such machines (eg, https://www.pcjs.org/blog/2015/04/16/).
*/
if (DEBUG && window) {
let sDebug = Web.getURLParm("debug");
if (sDebug == "false") {
window['DEBUG'] = false;
}
}



/**
Expand Down
2 changes: 1 addition & 1 deletion versions/pdpjs/1.71.2/pdp11.js.map

Large diffs are not rendered by default.

0 comments on commit b0020cd

Please sign in to comment.