annotate engine-runner.js @ 84:0f6cf96a6aee

Implemented wimp-out instruction, which is invoked often in Galatea.
author Atul Varma <varmaa@toolness.com>
date Wed, 21 May 2008 15:20:01 -0700
parents 5c35e18a9d1a
children e48403e2a3b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
1 function Zui() {
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
2 }
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
3
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
4 Zui.prototype = {
62
3355248e2638 Fixed a top-window display bug in curses.
Atul Varma <varmaa@toolness.com>
parents: 54
diff changeset
5 setVersion: function(version) {
3355248e2638 Fixed a top-window display bug in curses.
Atul Varma <varmaa@toolness.com>
parents: 54
diff changeset
6 },
36
afa332a44721 The zui now has a getSize() method which returns the size of the screen in characters. This is communicated to the z-machine.
Atul Varma <varmaa@toolness.com>
parents: 35
diff changeset
7
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
8 // Returns a 2-element list containing the width and height of the
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
9 // screen, in characters. The width may be 255, which means
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
10 // "infinite".
36
afa332a44721 The zui now has a getSize() method which returns the size of the screen in characters. This is communicated to the z-machine.
Atul Varma <varmaa@toolness.com>
parents: 35
diff changeset
11
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
12 getSize: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
13 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
14 onLineInput: function(callback) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
15 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
16 onCharacterInput: function(callback) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
17 },
73
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
18 onSave: function(data) {
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
19 },
73
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
20 onRestore: function() {
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
21 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
22 onQuit: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
23 },
84
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
24 onRestart: function() {
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
25 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
26 onWimpOut: function(callback) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
27 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
28 onBreakpoint: function(callback) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
29 },
49
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
30
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
31 // From the Z-Machine spec for set_text_style: Sets the text style
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
32 // to: Roman (if 0), Reverse Video (if 1), Bold (if 2), Italic (4),
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
33 // Fixed Pitch (8). In some interpreters (though this is not
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
34 // required) a combination of styles is possible (such as reverse
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
35 // video and bold). In these, changing to Roman should turn off all
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
36 // the other styles currently set.
2c4d6b171f60 Text styles now display properly in the lower window (but not the upper one, yet).
Atul Varma <varmaa@toolness.com>
parents: 47
diff changeset
37
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
38 onSetStyle: function(textStyle, foreground, background) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
39 },
35
be2a410b8518 Added docs for onEraseWindow(), changed implementation to match.
Atul Varma <varmaa@toolness.com>
parents: 34
diff changeset
40
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
41 // From the Z-Machine spec for split_window: Splits the screen so
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
42 // that the upper window has the given number of lines: or, if
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
43 // this is zero, unsplits the screen again.
37
9e7a743ccac5 Added very, very buggy support for the top window.
Atul Varma <varmaa@toolness.com>
parents: 36
diff changeset
44
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
45 onSplitWindow: function(numLines) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
46 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
47 onSetWindow: function(window) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
48 },
37
9e7a743ccac5 Added very, very buggy support for the top window.
Atul Varma <varmaa@toolness.com>
parents: 36
diff changeset
49
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
50 // From the Z-Machine spec for erase_window: Erases window with
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
51 // given number (to background colour); or if -1 it unsplits the
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
52 // screen and clears the lot; or if -2 it clears the screen
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
53 // without unsplitting it.
35
be2a410b8518 Added docs for onEraseWindow(), changed implementation to match.
Atul Varma <varmaa@toolness.com>
parents: 34
diff changeset
54
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
55 onEraseWindow: function(window) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
56 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
57 onEraseLine: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
58 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
59 onSetCursor: function(x, y) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
60 },
47
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
61
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
62 // From the Z-Machine spec for buffer_mode: If set to 1, text output
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
63 // on the lower window in stream 1 is buffered up so that it can be
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
64 // word-wrapped properly. If set to 0, it isn't.
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
65
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
66 onSetBufferMode: function(flag) {
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
67 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
68 onSetInputStream: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
69 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
70 onGetCursor: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
71 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
72 onPrint: function(output) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
73 },
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
74 onPrintTable: function(lines) {
50
a9d7445d07d4 Just a few JS warning fixes.
Atul Varma <varmaa@toolness.com>
parents: 49
diff changeset
75 }
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
76 };
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
77
34
cf2303c41d8c Added logging functionality to engine-runner.
Atul Varma <varmaa@toolness.com>
parents: 32
diff changeset
78 function EngineRunner(engine, zui, logfunc) {
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
79 this._engine = engine;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
80 this._zui = zui;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
81 this._isRunning = false;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
82 this._isInLoop = false;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
83 this._isWaitingForCallback = false;
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
84
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
85 if (logfunc) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
86 this._log = logfunc;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
87 } else {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
88 this._log = function() {};
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
89 }
34
cf2303c41d8c Added logging functionality to engine-runner.
Atul Varma <varmaa@toolness.com>
parents: 32
diff changeset
90
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
91 var self = this;
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
92
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
93 this.__proto__ = {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
94 stop: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
95 self._isRunning = false;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
96 },
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
97
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
98 run: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
99 var size = self._zui.getSize();
62
3355248e2638 Fixed a top-window display bug in curses.
Atul Varma <varmaa@toolness.com>
parents: 54
diff changeset
100 self._zui.setVersion(self._engine.m_version);
36
afa332a44721 The zui now has a getSize() method which returns the size of the screen in characters. This is communicated to the z-machine.
Atul Varma <varmaa@toolness.com>
parents: 35
diff changeset
101
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
102 self._isRunning = true;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
103 self._engine.m_memory[0x20] = size[1];
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
104 self._engine.m_memory[0x21] = size[0];
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
105 self._continueRunning();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
106 },
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
107
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
108 _continueRunning: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
109 while (self._isRunning && !self._isWaitingForCallback) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
110 self._loop();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
111 }
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
112 },
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
113
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
114 _receiveLineInput: function(input) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
115 self._isWaitingForCallback = false;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
116 self._engine.answer(1, input);
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
117 if (!self._isInLoop) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
118 self._continueRunning();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
119 } else {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
120 /* We're still inside _loop(), so just return. */
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
121 }
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
122 },
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
123
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
124 _receiveCharacterInput: function(input) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
125 self._isWaitingForCallback = false;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
126 self._engine.answer(0, input);
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
127 if (!self._isInLoop) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
128 self._continueRunning();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
129 } else {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
130 /* We're still inside _loop(), so just return. */
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
131 }
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
132 },
32
3a85b5915ea6 Added bad implementation of character input. The 'info' command in Troll no longer crashes the Z-Machine, but because we don't currently support multiple windows and the the 'info' command uses the top window as an interface, it still looks like it's hanging.
Atul Varma <varmaa@toolness.com>
parents: 31
diff changeset
133
84
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
134 _unWimpOut: function() {
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
135 self._isWaitingForCallback = false;
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
136 if (!self._isInLoop) {
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
137 self._continueRunning();
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
138 } else {
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
139 /* We're still inside _loop(), so just return. */
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
140 }
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
141 },
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
142
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
143 _loop: function() {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
144 if (self._isInLoop)
50
a9d7445d07d4 Just a few JS warning fixes.
Atul Varma <varmaa@toolness.com>
parents: 49
diff changeset
145 throw new Error("Already in loop!");
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
146
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
147 self._isInLoop = true;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
148 var engine = self._engine;
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
149
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
150 engine.run();
38
696fef276111 Top window output is less buggy now.
Atul Varma <varmaa@toolness.com>
parents: 37
diff changeset
151
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
152 var text = engine.consoleText();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
153 if (text)
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
154 self._zui.onPrint(text);
38
696fef276111 Top window output is less buggy now.
Atul Varma <varmaa@toolness.com>
parents: 37
diff changeset
155
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
156 var effect = '"' + engine.effect(0) + '"';
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
157
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
158 var logString = "[ " + engine.effect(0);
34
cf2303c41d8c Added logging functionality to engine-runner.
Atul Varma <varmaa@toolness.com>
parents: 32
diff changeset
159
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
160 for (var i = 1; engine.effect(i) != undefined; i++) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
161 var value = engine.effect(i);
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
162 if (typeof value == "string")
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
163 value = value.quote();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
164 logString += ", " + value;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
165 }
34
cf2303c41d8c Added logging functionality to engine-runner.
Atul Varma <varmaa@toolness.com>
parents: 32
diff changeset
166
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
167 self._log(logString + " ]");
34
cf2303c41d8c Added logging functionality to engine-runner.
Atul Varma <varmaa@toolness.com>
parents: 32
diff changeset
168
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
169 switch (effect) {
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
170 case GNUSTO_EFFECT_INPUT:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
171 self._isWaitingForCallback = true;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
172 self._zui.onLineInput(self._receiveLineInput);
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
173 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
174 case GNUSTO_EFFECT_INPUT_CHAR:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
175 self._isWaitingForCallback = true;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
176 self._zui.onCharacterInput(self._receiveCharacterInput);
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
177 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
178 case GNUSTO_EFFECT_SAVE:
73
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
179 engine.saveGame();
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
180 if (self._zui.onSave(engine.saveGameData()))
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
181 engine.answer(0, 1);
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
182 else
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
183 engine.answer(0, 0);
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
184 break;
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
185 case GNUSTO_EFFECT_RESTORE:
73
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
186 var saveGameData = self._zui.onRestore();
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
187 if (saveGameData) {
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
188 var beret = new Beret(engine);
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
189 beret.load(saveGameData);
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
190 } else {
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
191 engine.answer(0, 0);
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
192 }
5c35e18a9d1a Added a modified version of beret.js from gnusto (originally at src/xpcom/beret/beret.js in the gnusto source tree), because this file contains code to load quetzal save files (gnusto-engine.js contains code to save quetzal files).
Atul Varma <varmaa@toolness.com>
parents: 62
diff changeset
193 break;
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
194 case GNUSTO_EFFECT_QUIT:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
195 self.stop();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
196 self._zui.onQuit();
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
197 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
198 case GNUSTO_EFFECT_RESTART:
54
7dc2c7bded08 Added implementation of the restart opcode.
Atul Varma <varmaa@toolness.com>
parents: 50
diff changeset
199 self.stop();
7dc2c7bded08 Added implementation of the restart opcode.
Atul Varma <varmaa@toolness.com>
parents: 50
diff changeset
200 self._zui.onRestart();
7dc2c7bded08 Added implementation of the restart opcode.
Atul Varma <varmaa@toolness.com>
parents: 50
diff changeset
201 break;
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
202 case GNUSTO_EFFECT_WIMP_OUT:
84
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
203 self._isWaitingForCallback = true;
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
204 self._zui.onWimpOut(self._unWimpOut);
0f6cf96a6aee Implemented wimp-out instruction, which is invoked often in Galatea.
Atul Varma <varmaa@toolness.com>
parents: 73
diff changeset
205 break;
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
206 case GNUSTO_EFFECT_BREAKPOINT:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
207 case GNUSTO_EFFECT_FLAGS_CHANGED:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
208 case GNUSTO_EFFECT_PIRACY:
50
a9d7445d07d4 Just a few JS warning fixes.
Atul Varma <varmaa@toolness.com>
parents: 49
diff changeset
209 throw new Error("Unimplemented effect: " + effect);
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
210 case GNUSTO_EFFECT_STYLE:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
211 self._zui.onSetStyle(engine.effect(1),
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
212 engine.effect(2),
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
213 engine.effect(3));
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
214 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
215 case GNUSTO_EFFECT_SOUND:
50
a9d7445d07d4 Just a few JS warning fixes.
Atul Varma <varmaa@toolness.com>
parents: 49
diff changeset
216 throw new Error("Unimplemented effect: " + effect);
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
217 case GNUSTO_EFFECT_SPLITWINDOW:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
218 self._zui.onSplitWindow(engine.effect(1));
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
219 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
220 case GNUSTO_EFFECT_SETWINDOW:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
221 self._zui.onSetWindow(engine.effect(1));
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
222 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
223 case GNUSTO_EFFECT_ERASEWINDOW:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
224 self._zui.onEraseWindow(engine.effect(1));
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
225 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
226 case GNUSTO_EFFECT_ERASELINE:
50
a9d7445d07d4 Just a few JS warning fixes.
Atul Varma <varmaa@toolness.com>
parents: 49
diff changeset
227 throw new Error("Unimplemented effect: " + effect);
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
228 case GNUSTO_EFFECT_SETCURSOR:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
229 self._zui.onSetCursor(engine.effect(2),
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
230 engine.effect(1));
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
231 break;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
232 case GNUSTO_EFFECT_SETBUFFERMODE:
47
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
233 self._zui.onSetBufferMode(engine.effect(1));
1effb310d6ee Added stub implementation for setBufferMode().
Atul Varma <varmaa@toolness.com>
parents: 43
diff changeset
234 break;
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
235 case GNUSTO_EFFECT_SETINPUTSTREAM:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
236 case GNUSTO_EFFECT_GETCURSOR:
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
237 case GNUSTO_EFFECT_PRINTTABLE:
50
a9d7445d07d4 Just a few JS warning fixes.
Atul Varma <varmaa@toolness.com>
parents: 49
diff changeset
238 throw new Error("Unimplemented effect: " + effect);
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
239 }
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
240
43
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
241 self._isInLoop = false;
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
242 }
e45b81cdb4d0 Modified indentation to be 2 spaces instead of 4, as per Mozilla's JS style guidelines.
Atul Varma <varmaa@toolness.com>
parents: 38
diff changeset
243 };
6
aeb4289c141f Added a test runner class w/ simple test suite.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
244 }