This commit is contained in:
Andrew Sliwinski 2016-04-18 17:20:30 -04:00
parent 655556273a
commit f9f47ed103
20 changed files with 2113 additions and 13 deletions
src/engine

19
src/engine/thread.js Normal file
View file

@ -0,0 +1,19 @@
/**
* Thread is an internal data structure used by the interpreter. It holds the
* state of a thread so it can continue from where it left off, and it has
* a stack to support nested control structures and procedure calls.
*
* @param {String} Unique block identifier
*/
function Thread (id) {
this.topBlockId = id;
this.blockPointer = id;
this.blockFirstTime = -1;
this.nextBlock = null;
this.waiting = null;
this.runningDeviceBlock = false;
this.stack = [];
this.repeatCounter = -1;
}
module.exports = Thread;