Skip to content

Commit 249db52

Browse files
committed
Code formatting
1 parent c92c70c commit 249db52

7 files changed

+49
-49
lines changed

plugins/SocketPlugin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ function SocketPlugin() {
639639
if (this.status == plugin.Socket_Connected ||
640640
this.status == plugin.Socket_OtherEndClosed ||
641641
this.status == plugin.Socket_WaitingForConnection) {
642-
if(this.webSocket) {
642+
if (this.webSocket) {
643643
this.webSocket.close();
644644
this.webSocket = null;
645645
}

squeak_headless.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function runImage(imageData, imageName, options) {
6060
vm.interpret(50, function runAgain(ms) {
6161
// Ignore display.quitFlag when requested.
6262
// Some Smalltalk images quit when no display is found.
63-
if(options.ignoreQuit || !display.quitFlag) {
63+
if (options.ignoreQuit || !display.quitFlag) {
6464
setTimeout(run, ms === "sleep" ? 10 : ms);
6565
}
6666
});
@@ -80,7 +80,7 @@ function fetchImageAndRun(imageName, options) {
8080
mode: "cors",
8181
cache: "no-store"
8282
}).then(function(response) {
83-
if(!response.ok) {
83+
if (!response.ok) {
8484
throw new Error("Response not OK: " + response.status);
8585
}
8686
return response.arrayBuffer();
@@ -104,7 +104,7 @@ Object.extend(Squeak, {
104104
// Retrieve image name from URL
105105
var searchParams = (new URL(self.location)).searchParams;
106106
var imageName = searchParams.get("imageName");
107-
if(imageName) {
107+
if (imageName) {
108108
var options = {
109109
ignoreQuit: searchParams.get("ignoreQuit") !== null
110110
};

squeak_node.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ var path = require("path");
3737
// Retrieve image name and parameters from command line
3838
var processArgs = process.argv.slice(2);
3939
var ignoreQuit = processArgs[0] === "-ignoreQuit";
40-
if(ignoreQuit) {
40+
if (ignoreQuit) {
4141
processArgs = processArgs.slice(1);
4242
}
4343
var fullName = processArgs[0];
44-
if(!fullName) {
44+
if (!fullName) {
4545
console.error("No image name specified.");
4646
console.log("Usage (simplified): " + path.basename(process.argv0) + path.basename(process.argv[1]) + " [-ignoreQuit] <image filename>");
4747
process.exit(1);
@@ -122,7 +122,7 @@ Object.extend(Squeak.Primitives.prototype, {
122122

123123
// Read raw image
124124
fs.readFile(root + imageName + ".image", function(error, data) {
125-
if(error) {
125+
if (error) {
126126
console.error("Failed to read image", error);
127127
return;
128128
}
@@ -140,7 +140,7 @@ fs.readFile(root + imageName + ".image", function(error, data) {
140140

141141
// Ignore display.quitFlag when requested.
142142
// Some Smalltalk images quit when no display is found.
143-
if(ignoreQuit || !display.quitFlag) {
143+
if (ignoreQuit || !display.quitFlag) {
144144
setTimeout(run, ms === "sleep" ? 10 : ms);
145145
}
146146
});

vm.interpreter.js

+33-33
Original file line numberDiff line numberDiff line change
@@ -323,37 +323,37 @@ Object.subclass('Squeak.Interpreter',
323323

324324
// Arithmetic Ops... + - < > <= >= = ~= * / @ lshift: lxor: land: lor:
325325
case 0xB0: this.success = true; this.resultIsFloat = false;
326-
if(!this.pop2AndPushNumResult(this.stackIntOrFloat(1) + this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // PLUS +
326+
if (!this.pop2AndPushNumResult(this.stackIntOrFloat(1) + this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // PLUS +
327327
case 0xB1: this.success = true; this.resultIsFloat = false;
328-
if(!this.pop2AndPushNumResult(this.stackIntOrFloat(1) - this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // MINUS -
328+
if (!this.pop2AndPushNumResult(this.stackIntOrFloat(1) - this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // MINUS -
329329
case 0xB2: this.success = true;
330-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) < this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LESS <
330+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) < this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LESS <
331331
case 0xB3: this.success = true;
332-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) > this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GRTR >
332+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) > this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GRTR >
333333
case 0xB4: this.success = true;
334-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) <= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LEQ <=
334+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) <= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LEQ <=
335335
case 0xB5: this.success = true;
336-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) >= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GEQ >=
336+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) >= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GEQ >=
337337
case 0xB6: this.success = true;
338-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) === this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // EQU =
338+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) === this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // EQU =
339339
case 0xB7: this.success = true;
340-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) !== this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // NEQ ~=
340+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) !== this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // NEQ ~=
341341
case 0xB8: this.success = true; this.resultIsFloat = false;
342-
if(!this.pop2AndPushNumResult(this.stackIntOrFloat(1) * this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // TIMES *
342+
if (!this.pop2AndPushNumResult(this.stackIntOrFloat(1) * this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // TIMES *
343343
case 0xB9: this.success = true;
344-
if(!this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide /
344+
if (!this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide /
345345
case 0xBA: this.success = true;
346-
if(!this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // MOD \
346+
if (!this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // MOD \
347347
case 0xBB: this.success = true;
348-
if(!this.primHandler.primitiveMakePoint(1, true)) this.sendSpecial(b&0xF); return; // MakePt int@int
348+
if (!this.primHandler.primitiveMakePoint(1, true)) this.sendSpecial(b&0xF); return; // MakePt int@int
349349
case 0xBC: this.success = true;
350-
if(!this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // bitShift:
350+
if (!this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // bitShift:
351351
case 0xBD: this.success = true;
352-
if(!this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide //
352+
if (!this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide //
353353
case 0xBE: this.success = true;
354-
if(!this.pop2AndPushIntResult(this.stackInteger(1) & this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitAnd:
354+
if (!this.pop2AndPushIntResult(this.stackInteger(1) & this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitAnd:
355355
case 0xBF: this.success = true;
356-
if(!this.pop2AndPushIntResult(this.stackInteger(1) | this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitOr:
356+
if (!this.pop2AndPushIntResult(this.stackInteger(1) | this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitOr:
357357

358358
// at:, at:put:, size, next, nextPut:, ...
359359
case 0xC0: case 0xC1: case 0xC2: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7:
@@ -437,37 +437,37 @@ Object.subclass('Squeak.Interpreter',
437437

438438
// Arithmetic Ops... + - < > <= >= = ~= * / @ lshift: lxor: land: lor:
439439
case 0x60: this.success = true; this.resultIsFloat = false;
440-
if(!this.pop2AndPushNumResult(this.stackIntOrFloat(1) + this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // PLUS +
440+
if (!this.pop2AndPushNumResult(this.stackIntOrFloat(1) + this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // PLUS +
441441
case 0x61: this.success = true; this.resultIsFloat = false;
442-
if(!this.pop2AndPushNumResult(this.stackIntOrFloat(1) - this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // MINUS -
442+
if (!this.pop2AndPushNumResult(this.stackIntOrFloat(1) - this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // MINUS -
443443
case 0x62: this.success = true;
444-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) < this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LESS <
444+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) < this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LESS <
445445
case 0x63: this.success = true;
446-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) > this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GRTR >
446+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) > this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GRTR >
447447
case 0x64: this.success = true;
448-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) <= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LEQ <=
448+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) <= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // LEQ <=
449449
case 0x65: this.success = true;
450-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) >= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GEQ >=
450+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) >= this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // GEQ >=
451451
case 0x66: this.success = true;
452-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) === this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // EQU =
452+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) === this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // EQU =
453453
case 0x67: this.success = true;
454-
if(!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) !== this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // NEQ ~=
454+
if (!this.pop2AndPushBoolResult(this.stackIntOrFloat(1) !== this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // NEQ ~=
455455
case 0x68: this.success = true; this.resultIsFloat = false;
456-
if(!this.pop2AndPushNumResult(this.stackIntOrFloat(1) * this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // TIMES *
456+
if (!this.pop2AndPushNumResult(this.stackIntOrFloat(1) * this.stackIntOrFloat(0))) this.sendSpecial(b&0xF); return; // TIMES *
457457
case 0x69: this.success = true;
458-
if(!this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide /
458+
if (!this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide /
459459
case 0x6A: this.success = true;
460-
if(!this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // MOD \
460+
if (!this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // MOD \
461461
case 0x6B: this.success = true;
462-
if(!this.primHandler.primitiveMakePoint(1, true)) this.sendSpecial(b&0xF); return; // MakePt int@int
462+
if (!this.primHandler.primitiveMakePoint(1, true)) this.sendSpecial(b&0xF); return; // MakePt int@int
463463
case 0x6C: this.success = true;
464-
if(!this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // bitShift:
464+
if (!this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // bitShift:
465465
case 0x6D: this.success = true;
466-
if(!this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide //
466+
if (!this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))) this.sendSpecial(b&0xF); return; // Divide //
467467
case 0x6E: this.success = true;
468-
if(!this.pop2AndPushIntResult(this.stackInteger(1) & this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitAnd:
468+
if (!this.pop2AndPushIntResult(this.stackInteger(1) & this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitAnd:
469469
case 0x6F: this.success = true;
470-
if(!this.pop2AndPushIntResult(this.stackInteger(1) | this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitOr:
470+
if (!this.pop2AndPushIntResult(this.stackInteger(1) | this.stackInteger(0))) this.sendSpecial(b&0xF); return; // bitOr:
471471

472472
// at:, at:put:, size, next, nextPut:, ...
473473
case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77:
@@ -690,7 +690,7 @@ Object.subclass('Squeak.Interpreter',
690690
var sema = this.specialObjects[Squeak.splOb_TheLowSpaceSemaphore];
691691
if (!sema.isNil) this.primHandler.synchronousSignal(sema);
692692
}
693-
// if(now >= nextPollTick) {
693+
// if (now >= nextPollTick) {
694694
// ioProcessEvents(); //sets interruptPending if interrupt key pressed
695695
// nextPollTick= now + 500; } //msecs to wait before next call to ioProcessEvents"
696696
if (this.interruptPending) {

vm.plugins.file.node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Object.extend(Squeak.Primitives.prototype,
7070
var entry = null;
7171
try {
7272
var dirEntries = fs.readdirSync(dirName);
73-
if(index < 1 || index > dirEntries.length) return false;
73+
if (index < 1 || index > dirEntries.length) return false;
7474
var dirEntry = dirEntries[index - 1];
7575
var stats = fs.statSync(dirName + path.sep + dirEntry);
7676
entry = [

vm.primitives.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,8 @@ Object.subclass('Squeak.Primitives',
15511551
var rcvr = this.vm.stackValue(1);
15521552
var sqArgCount = this.stackInteger(0);
15531553
var homeCtxt = rcvr;
1554-
if(!this.vm.isContext(homeCtxt)) this.success = false;
1555-
if(!this.success) return rcvr;
1554+
if (!this.vm.isContext(homeCtxt)) this.success = false;
1555+
if (!this.success) return rcvr;
15561556
if (typeof homeCtxt.pointers[Squeak.Context_method] === "number")
15571557
// ctxt is itself a block; get the context for its enclosing method
15581558
homeCtxt = homeCtxt.pointers[Squeak.BlockContext_home];
@@ -2144,7 +2144,7 @@ Object.subclass('Squeak.Primitives',
21442144
this.vm.image.fullGC("snapshot"); // before cleanup so traversal works
21452145
var buffer = this.vm.image.writeToBuffer();
21462146
// Write snapshot if files are supported
2147-
if(Squeak.flushAllFiles) {
2147+
if (Squeak.flushAllFiles) {
21482148
Squeak.flushAllFiles(); // so there are no more writes pending
21492149
Squeak.filePut(this.vm.image.name, buffer);
21502150
}
@@ -2153,7 +2153,7 @@ Object.subclass('Squeak.Primitives',
21532153
},
21542154
primitiveQuit: function(argCount) {
21552155
// Flush any files if files are supported
2156-
if(Squeak.flushAllFiles)
2156+
if (Squeak.flushAllFiles)
21572157
Squeak.flushAllFiles();
21582158
this.display.quitFlag = true;
21592159
this.vm.breakNow("quit");

ws/server/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ function startServer(port) {
2020
});
2121
var handleIO = function() {
2222
io.question("Next command: ", function(command) {
23-
if(command) {
23+
if (command) {
2424
isClosed = isClosed || [ "quit", "exit", "bye" ].indexOf(command) >= 0;
25-
if(!isClosed) {
25+
if (!isClosed) {
2626
ws.send(command);
2727
} else {
2828
ws.close();
@@ -35,7 +35,7 @@ function startServer(port) {
3535
};
3636

3737
// Handle events
38-
var isClosed = false;
38+
var isClosed = false;
3939
ws
4040
.on("message", function(message) {
4141
console.log("Message received: " + message);

0 commit comments

Comments
 (0)