comparison 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
comparison
equal deleted inserted replaced
83:e813e427fbe6 84:0f6cf96a6aee
19 }, 19 },
20 onRestore: function() { 20 onRestore: function() {
21 }, 21 },
22 onQuit: function() { 22 onQuit: function() {
23 }, 23 },
24 onRestart: function(callback) { 24 onRestart: function() {
25 }, 25 },
26 onWimpOut: function(callback) { 26 onWimpOut: function(callback) {
27 }, 27 },
28 onBreakpoint: function(callback) { 28 onBreakpoint: function(callback) {
29 }, 29 },
122 }, 122 },
123 123
124 _receiveCharacterInput: function(input) { 124 _receiveCharacterInput: function(input) {
125 self._isWaitingForCallback = false; 125 self._isWaitingForCallback = false;
126 self._engine.answer(0, input); 126 self._engine.answer(0, input);
127 if (!self._isInLoop) {
128 self._continueRunning();
129 } else {
130 /* We're still inside _loop(), so just return. */
131 }
132 },
133
134 _unWimpOut: function() {
135 self._isWaitingForCallback = false;
127 if (!self._isInLoop) { 136 if (!self._isInLoop) {
128 self._continueRunning(); 137 self._continueRunning();
129 } else { 138 } else {
130 /* We're still inside _loop(), so just return. */ 139 /* We're still inside _loop(), so just return. */
131 } 140 }
189 case GNUSTO_EFFECT_RESTART: 198 case GNUSTO_EFFECT_RESTART:
190 self.stop(); 199 self.stop();
191 self._zui.onRestart(); 200 self._zui.onRestart();
192 break; 201 break;
193 case GNUSTO_EFFECT_WIMP_OUT: 202 case GNUSTO_EFFECT_WIMP_OUT:
203 self._isWaitingForCallback = true;
204 self._zui.onWimpOut(self._unWimpOut);
205 break;
194 case GNUSTO_EFFECT_BREAKPOINT: 206 case GNUSTO_EFFECT_BREAKPOINT:
195 case GNUSTO_EFFECT_FLAGS_CHANGED: 207 case GNUSTO_EFFECT_FLAGS_CHANGED:
196 case GNUSTO_EFFECT_PIRACY: 208 case GNUSTO_EFFECT_PIRACY:
197 throw new Error("Unimplemented effect: " + effect); 209 throw new Error("Unimplemented effect: " + effect);
198 case GNUSTO_EFFECT_STYLE: 210 case GNUSTO_EFFECT_STYLE: