Experimental “processes” count watcher

(hidden in dev mode)
pull/3/merge
jmoenig 2014-12-17 08:12:35 +01:00
rodzic 33b859739c
commit 777498a9f4
3 zmienionych plików z 32 dodań i 4 usunięć

Wyświetl plik

@ -2398,3 +2398,7 @@ ______
141215 141215
------ ------
* New Swedish translation! Yay!! Thanks, Erik A Olsson! * New Swedish translation! Yay!! Thanks, Erik A Olsson!
141217
------
* Objects, Store: Experimental “processes” count watcher (hidden in dev mode)

Wyświetl plik

@ -125,7 +125,7 @@ PrototypeHatBlockMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.objects = '2014-December-04'; modules.objects = '2014-December-17';
var SpriteMorph; var SpriteMorph;
var StageMorph; var StageMorph;
@ -793,6 +793,12 @@ SpriteMorph.prototype.initBlocks = function () {
category: 'sensing', category: 'sensing',
spec: 'frames' spec: 'frames'
}, },
reportThreadCount: {
dev: true,
type: 'reporter',
category: 'sensing',
spec: 'processes'
},
doAsk: { doAsk: {
type: 'command', type: 'command',
category: 'sensing', category: 'sensing',
@ -1918,6 +1924,8 @@ SpriteMorph.prototype.blockTemplates = function (category) {
txt.setColor(this.paletteTextColor); txt.setColor(this.paletteTextColor);
blocks.push(txt); blocks.push(txt);
blocks.push('-'); blocks.push('-');
blocks.push(watcherToggle('reportThreadCount'));
blocks.push(block('reportThreadCount'));
blocks.push(block('colorFiltered')); blocks.push(block('colorFiltered'));
blocks.push(block('reportStackSize')); blocks.push(block('reportStackSize'));
blocks.push(block('reportFrameCount')); blocks.push(block('reportFrameCount'));
@ -3579,6 +3587,16 @@ SpriteMorph.prototype.reportMouseY = function () {
return 0; return 0;
}; };
// SpriteMorph thread count (for debugging)
SpriteMorph.prototype.reportThreadCount = function () {
var stage = this.parentThatIsA(StageMorph);
if (stage) {
return stage.threads.processes.length;
}
return 0;
};
// SpriteMorph variable watchers (for palette checkbox toggling) // SpriteMorph variable watchers (for palette checkbox toggling)
SpriteMorph.prototype.findVariableWatcher = function (varName) { SpriteMorph.prototype.findVariableWatcher = function (varName) {
@ -5059,6 +5077,8 @@ StageMorph.prototype.blockTemplates = function (category) {
txt.setColor(this.paletteTextColor); txt.setColor(this.paletteTextColor);
blocks.push(txt); blocks.push(txt);
blocks.push('-'); blocks.push('-');
blocks.push(watcherToggle('reportThreadCount'));
blocks.push(block('reportThreadCount'));
blocks.push(block('colorFiltered')); blocks.push(block('colorFiltered'));
blocks.push(block('reportStackSize')); blocks.push(block('reportStackSize'));
blocks.push(block('reportFrameCount')); blocks.push(block('reportFrameCount'));
@ -5509,6 +5529,9 @@ StageMorph.prototype.watcherFor =
StageMorph.prototype.getLastAnswer StageMorph.prototype.getLastAnswer
= SpriteMorph.prototype.getLastAnswer; = SpriteMorph.prototype.getLastAnswer;
StageMorph.prototype.reportThreadCount
= SpriteMorph.prototype.reportThreadCount;
// StageMorph message broadcasting // StageMorph message broadcasting
StageMorph.prototype.allMessageNames StageMorph.prototype.allMessageNames
@ -6757,7 +6780,7 @@ WatcherMorph.prototype.object = function () {
WatcherMorph.prototype.isGlobal = function (selector) { WatcherMorph.prototype.isGlobal = function (selector) {
return contains( return contains(
['getLastAnswer', 'getLastMessage', 'getTempo', 'getTimer', ['getLastAnswer', 'getLastMessage', 'getTempo', 'getTimer',
'reportMouseX', 'reportMouseY'], 'reportMouseX', 'reportMouseY', 'reportThreadCount'],
selector selector
); );
}; };

Wyświetl plik

@ -61,7 +61,7 @@ SyntaxElementMorph, Variable*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.store = '2014-December-06'; modules.store = '2014-December-17';
// XML_Serializer /////////////////////////////////////////////////////// // XML_Serializer ///////////////////////////////////////////////////////
@ -267,7 +267,8 @@ SnapSerializer.prototype.watcherLabels = {
getTimer: 'timer', getTimer: 'timer',
getCostumeIdx: 'costume #', getCostumeIdx: 'costume #',
reportMouseX: 'mouse x', reportMouseX: 'mouse x',
reportMouseY: 'mouse y' reportMouseY: 'mouse y',
reportThreadCount: 'processes'
}; };
// SnapSerializer instance creation: // SnapSerializer instance creation: