kopia lustrzana https://github.com/backface/turtlestitch
Merge tag '4.2.1.4' of https://github.com/jmoenig/Snap--Build-Your-Own-Blocks into upd4.2
commit
71ec1e56dc
11
blocks.js
11
blocks.js
|
@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.blocks = '2018-June-08';
|
||||
modules.blocks = '2018-September-09';
|
||||
|
||||
var SyntaxElementMorph;
|
||||
var BlockMorph;
|
||||
|
@ -2312,7 +2312,7 @@ BlockMorph.prototype.setSpec = function (spec, silently, definition) {
|
|||
this.add(this.placeHolder());
|
||||
}
|
||||
this.parseSpec(spec).forEach(function (word) {
|
||||
if (word[0] === '%') {
|
||||
if (word[0] === '%' && (word !== '%br')) {
|
||||
inputIdx += 1;
|
||||
}
|
||||
part = myself.labelPart(word);
|
||||
|
@ -8664,9 +8664,10 @@ InputSlotMorph.prototype.shadowedVariablesMenu = function () {
|
|||
|
||||
if (!block) {return dict; }
|
||||
rcvr = block.scriptTarget();
|
||||
if (this.parentThatIsA(RingMorph)) {
|
||||
if (this.parentThatIsA(RingMorph) ||
|
||||
this.topBlock().selector === 'receiveOnClone') {
|
||||
// show own local vars and attributes, because this is likely to be
|
||||
// inside TELL, ASK or OF
|
||||
// inside TELL, ASK or OF or when initializing a new clone
|
||||
vars = rcvr.variables.names();
|
||||
vars.forEach(function (name) {
|
||||
dict[name] = name;
|
||||
|
@ -9419,7 +9420,7 @@ BooleanSlotMorph.uber = ArgMorph.prototype;
|
|||
|
||||
// BooleanSlotMorph preferences settings
|
||||
|
||||
BooleanSlotMorph.prototype.isTernary = true;
|
||||
BooleanSlotMorph.prototype.isTernary = false;
|
||||
|
||||
// BooleanSlotMorph instance creation:
|
||||
|
||||
|
|
37
gui.js
37
gui.js
|
@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.gui = '2018-July-09';
|
||||
modules.gui = '2018-September-09';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -361,6 +361,9 @@ IDE_Morph.prototype.openIn = function (world) {
|
|||
if (dict.noExitWarning) {
|
||||
window.onbeforeunload = nop;
|
||||
}
|
||||
if (dict.lang) {
|
||||
myself.setLanguage(dict.lang, null, true); // don't persist
|
||||
}
|
||||
}
|
||||
|
||||
// dynamic notifications from non-source text files
|
||||
|
@ -392,6 +395,13 @@ IDE_Morph.prototype.openIn = function (world) {
|
|||
)) {
|
||||
this.droppedText(hash);
|
||||
} else {
|
||||
idx = hash.indexOf("&");
|
||||
if (idx > 0) {
|
||||
dict = myself.cloud.parseDict(hash.substr(idx));
|
||||
dict.editMode = true;
|
||||
hash = hash.slice(0, idx);
|
||||
applyFlags(dict);
|
||||
}
|
||||
this.droppedText(getURL(hash));
|
||||
}
|
||||
} else if (location.hash.substr(0, 5) === '#run:') {
|
||||
|
@ -512,13 +522,12 @@ IDE_Morph.prototype.openIn = function (world) {
|
|||
);
|
||||
} else if (location.hash.substr(0, 6) === '#lang:') {
|
||||
urlLanguage = location.hash.substr(6);
|
||||
this.setLanguage(urlLanguage);
|
||||
this.setLanguage(urlLanguage, null, true); // don't persist
|
||||
this.loadNewProject = true;
|
||||
} else if (location.hash.substr(0, 7) === '#signup') {
|
||||
this.createCloudAccount();
|
||||
}
|
||||
this.loadNewProject = false;
|
||||
|
||||
}
|
||||
|
||||
if (this.userLanguage) {
|
||||
|
@ -3504,7 +3513,7 @@ IDE_Morph.prototype.aboutSnap = function () {
|
|||
module, btn1, btn2, btn3, btn4, licenseBtn, translatorsBtn,
|
||||
world = this.world();
|
||||
|
||||
aboutTxt = 'Snap! 4.2.1\nBuild Your Own Blocks\n\n'
|
||||
aboutTxt = 'Snap! 4.2.1.4\nBuild Your Own Blocks\n\n'
|
||||
+ 'Copyright \u24B8 2018 Jens M\u00F6nig and '
|
||||
+ 'Brian Harvey\n'
|
||||
+ 'jens@moenig.org, bh@cs.berkeley.edu\n\n'
|
||||
|
@ -4956,7 +4965,7 @@ IDE_Morph.prototype.languageMenu = function () {
|
|||
menu.popup(world, pos);
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.setLanguage = function (lang, callback) {
|
||||
IDE_Morph.prototype.setLanguage = function (lang, callback, noSave) {
|
||||
var translation = document.getElementById('language'),
|
||||
src = this.resourceURL('lang-' + lang + '.js'),
|
||||
myself = this;
|
||||
|
@ -4965,18 +4974,18 @@ IDE_Morph.prototype.setLanguage = function (lang, callback) {
|
|||
document.head.removeChild(translation);
|
||||
}
|
||||
if (lang === 'en') {
|
||||
return this.reflectLanguage('en', callback);
|
||||
return this.reflectLanguage('en', callback, noSave);
|
||||
}
|
||||
translation = document.createElement('script');
|
||||
translation.id = 'language';
|
||||
translation.onload = function () {
|
||||
myself.reflectLanguage(lang, callback);
|
||||
myself.reflectLanguage(lang, callback, noSave);
|
||||
};
|
||||
document.head.appendChild(translation);
|
||||
translation.src = src;
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.reflectLanguage = function (lang, callback) {
|
||||
IDE_Morph.prototype.reflectLanguage = function (lang, callback, noSave) {
|
||||
var projectData,
|
||||
urlBar = location.hash;
|
||||
SnapTranslator.language = lang;
|
||||
|
@ -5002,7 +5011,9 @@ IDE_Morph.prototype.reflectLanguage = function (lang, callback) {
|
|||
} else {
|
||||
this.openProjectString(projectData);
|
||||
}
|
||||
this.saveSetting('language', lang);
|
||||
if (!noSave) {
|
||||
this.saveSetting('language', lang);
|
||||
}
|
||||
if (callback) {callback.call(this); }
|
||||
};
|
||||
|
||||
|
@ -5641,7 +5652,9 @@ IDE_Morph.prototype.getURL = function (url, callback, responseType) {
|
|||
}
|
||||
};
|
||||
}
|
||||
request.setRequestHeader('Cache-Control', 'max-age=0');
|
||||
// cache-control, commented out for now
|
||||
// added for Snap4Arduino but has issues with local robot servers
|
||||
// request.setRequestHeader('Cache-Control', 'max-age=0');
|
||||
request.send();
|
||||
if (!async) {
|
||||
if (request.status === 200) {
|
||||
|
@ -5892,9 +5905,9 @@ ProjectDialogMorph.prototype.buildContents = function () {
|
|||
this.addButton('cancel', 'Cancel');
|
||||
|
||||
if (notification) {
|
||||
this.setExtent(new Point(455, 335).add(notification.extent()));
|
||||
this.setExtent(new Point(555, 335).add(notification.extent()));
|
||||
} else {
|
||||
this.setExtent(new Point(455, 335));
|
||||
this.setExtent(new Point(555, 335));
|
||||
}
|
||||
this.fixLayout();
|
||||
|
||||
|
|
58
history.txt
58
history.txt
|
@ -4211,7 +4211,6 @@ Translation Updates:
|
|||
* Portuguese, thanks, Manuel!
|
||||
* Catalan, thanks, Joan!
|
||||
|
||||
=== in development ===
|
||||
|
||||
180703
|
||||
------
|
||||
|
@ -4253,3 +4252,60 @@ Translation Updates:
|
|||
* Portuguese, thanks, Manuel!
|
||||
* French, thanks, Nathalie and Joan!
|
||||
* Spanish, Catalan and French translations of the tools library, thanks, Nathalie and Joan!
|
||||
|
||||
180710
|
||||
------
|
||||
* Threads, GUI: reverted Cache-Control header for HTTP requests b/c of CORS issues
|
||||
|
||||
=== v4.2.1.1 maintenance release ===
|
||||
|
||||
180710
|
||||
------
|
||||
* Threads, GUI: fixed #712 - false "reporter didn't report" error messages
|
||||
|
||||
180711
|
||||
------
|
||||
* GUI: added support for "&lang=nn" url parameter, made it non-permanent
|
||||
* Threads: fixed outer script variable scope for TELL/ASK and OF
|
||||
* Tools: fixed JOIN WORDS and LIST -> SENTENCE
|
||||
|
||||
180712
|
||||
------
|
||||
* Threads: tweaked outer script variable scope for TELL/ASK and OF
|
||||
* Blocks: fixed #2145 - newlines in block labels conflict with input declarations
|
||||
* GUI: increased project dialog width to accommodate translations for the "recover" button
|
||||
|
||||
180713
|
||||
------
|
||||
* Blocks: enabled smart ternary Boolean slots by default
|
||||
|
||||
=== v4.2.1.2 maintenance release ===
|
||||
|
||||
New Feature:
|
||||
* new "&lang=nn" url parameter for specifying a session translation in a web-link
|
||||
|
||||
Changed:
|
||||
* smart ternary Boolean slots - only 2 states except inside rings and in the palette
|
||||
* made project dialog wider to accommodate translations for the "recover" button
|
||||
|
||||
Fixes:
|
||||
* corrected scope for outer script variables in inter-sprite messages (TELL, ASK, OF)
|
||||
* eliminated false "reporter didn't report" error messages
|
||||
|
||||
|
||||
180719
|
||||
------
|
||||
* Threads: fixed a regression conflict between "when I am stopped" and broadcasts
|
||||
|
||||
=== v4.2.1.3 maintenance release ===
|
||||
|
||||
180909
|
||||
------
|
||||
* new dev version
|
||||
* Threads: fixed #2176 ('arguments' not found for calling empty multi-slots)
|
||||
* Blocks: enabled drop-down for "inherit" command for clone-initialization scripts
|
||||
|
||||
=== v4.2.1.4 maintenance release ===
|
||||
|
||||
|
||||
=== in development ===
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,14 +2,14 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Snap! Build Your Own Blocks 4.2.1</title>
|
||||
<title>Snap! Build Your Own Blocks 4.2.1.4</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<script type="text/javascript" src="morphic.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="widgets.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="blocks.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="threads.js?version=2018-07-09"></script>
|
||||
<script type="text/javascript" src="blocks.js?version=2018-09-09"></script>
|
||||
<script type="text/javascript" src="threads.js?version=2018-09-09"></script>
|
||||
<script type="text/javascript" src="objects.js?version=2018-07-06"></script>
|
||||
<script type="text/javascript" src="gui.js?version=2018-07-09"></script>
|
||||
<script type="text/javascript" src="gui.js?version=2018-09-09"></script>
|
||||
<script type="text/javascript" src="paint.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="lists.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="byob.js?version=2018-06-21"></script>
|
||||
|
|
66
threads.js
66
threads.js
|
@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
|
|||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
|
||||
TableFrameMorph, ColorSlotMorph, isSnapObject*/
|
||||
|
||||
modules.threads = '2018-July-09';
|
||||
modules.threads = '2018-September-09';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -217,6 +217,7 @@ ThreadManager.prototype.startProcess = function (
|
|||
return active;
|
||||
}
|
||||
active.stop();
|
||||
active.canBroadcast = true; // broadcasts to fire despite reentrancy
|
||||
this.removeTerminatedProcesses();
|
||||
}
|
||||
newProc = new Process(top, receiver, callback, isClicked);
|
||||
|
@ -528,6 +529,7 @@ ThreadManager.prototype.toggleSingleStepping = function () {
|
|||
invocations can catch them
|
||||
flashingContext for single stepping
|
||||
isInterrupted boolean, indicates intra-step flashing of blocks
|
||||
canBroadcast boolean, used to control reentrancy & "when stopped"
|
||||
*/
|
||||
|
||||
Process.prototype = {};
|
||||
|
@ -565,6 +567,7 @@ function Process(topBlock, receiver, onComplete, yieldFirst) {
|
|||
this.procedureCount = 0;
|
||||
this.flashingContext = null; // experimental, for single-stepping
|
||||
this.isInterrupted = false; // experimental, for single-stepping
|
||||
this.canBroadcast = true; // used to control "when I am stopped"
|
||||
|
||||
if (topBlock) {
|
||||
this.homeContext.variables.parentFrame =
|
||||
|
@ -648,6 +651,7 @@ Process.prototype.stop = function () {
|
|||
if (this.context) {
|
||||
this.context.stopMusic();
|
||||
}
|
||||
this.canBroadcast = false;
|
||||
};
|
||||
|
||||
Process.prototype.pause = function () {
|
||||
|
@ -1113,7 +1117,13 @@ Process.prototype.evaluate = function (
|
|||
this.readyToYield = (Date.now() - this.lastYield > this.timeout);
|
||||
}
|
||||
|
||||
// assign parameters if any were passed
|
||||
// assign arguments to parameters
|
||||
|
||||
// assign the actual arguments list to the special
|
||||
// parameter ID ['arguments'], to be used for variadic inputs
|
||||
outer.variables.addVar(['arguments'], args);
|
||||
|
||||
// assign arguments that are actually passed
|
||||
if (parms.length > 0) {
|
||||
|
||||
// assign formal parameters
|
||||
|
@ -1127,10 +1137,6 @@ Process.prototype.evaluate = function (
|
|||
|
||||
// assign implicit parameters if there are no formal ones
|
||||
if (context.inputs.length === 0) {
|
||||
// assign the actual arguments list to the special
|
||||
// parameter ID ['arguments'], to be used for variadic inputs
|
||||
outer.variables.addVar(['arguments'], args);
|
||||
|
||||
// in case there is only one input
|
||||
// assign it to all empty slots
|
||||
if (parms.length === 1) {
|
||||
|
@ -1183,12 +1189,12 @@ Process.prototype.fork = function (context, args) {
|
|||
stage = this.homeContext.receiver.parentThatIsA(StageMorph);
|
||||
proc.instrument = this.instrument;
|
||||
proc.receiver = this.receiver;
|
||||
proc.initializeFor(context, args, this.enableSingleStepping);
|
||||
proc.initializeFor(context, args);
|
||||
// proc.pushContext('doYield');
|
||||
stage.threads.processes.push(proc);
|
||||
};
|
||||
|
||||
Process.prototype.initializeFor = function (context, args, ignoreExit) {
|
||||
Process.prototype.initializeFor = function (context, args) {
|
||||
// used by Process.fork() and global invoke()
|
||||
if (context.isContinuation) {
|
||||
throw new Error(
|
||||
|
@ -1206,13 +1212,18 @@ Process.prototype.initializeFor = function (context, args, ignoreExit) {
|
|||
),
|
||||
parms = args.asArray(),
|
||||
i,
|
||||
value,
|
||||
exit;
|
||||
value;
|
||||
|
||||
// remember the receiver
|
||||
this.context = context.receiver;
|
||||
|
||||
// assign parameters if any were passed
|
||||
// assign arguments to parameters
|
||||
|
||||
// assign the actual arguments list to the special
|
||||
// parameter ID ['arguments'], to be used for variadic inputs
|
||||
outer.variables.addVar(['arguments'], args);
|
||||
|
||||
// assign arguments that are actually passed
|
||||
if (parms.length > 0) {
|
||||
|
||||
// assign formal parameters
|
||||
|
@ -1226,10 +1237,6 @@ Process.prototype.initializeFor = function (context, args, ignoreExit) {
|
|||
|
||||
// assign implicit parameters if there are no formal ones
|
||||
if (context.inputs.length === 0) {
|
||||
// assign the actual arguments list to the special
|
||||
// parameter ID ['arguments'], to be used for variadic inputs
|
||||
outer.variables.addVar(['arguments'], args);
|
||||
|
||||
// in case there is only one input
|
||||
// assign it to all empty slots
|
||||
if (parms.length === 1) {
|
||||
|
@ -1256,20 +1263,6 @@ Process.prototype.initializeFor = function (context, args, ignoreExit) {
|
|||
|
||||
if (runnable.expression instanceof CommandBlockMorph) {
|
||||
runnable.expression = runnable.expression.blockSequence();
|
||||
|
||||
// insert a tagged exit context
|
||||
// which "report" can catch later
|
||||
// needed for invoke() situations
|
||||
if (!ignoreExit) { // when single stepping LAUNCH
|
||||
exit = new Context(
|
||||
runnable.parentContext,
|
||||
'expectReport',
|
||||
outer,
|
||||
outer.receiver
|
||||
);
|
||||
exit.tag = 'exit';
|
||||
runnable.parentContext = exit;
|
||||
}
|
||||
}
|
||||
|
||||
this.homeContext = new Context(); // context.outerContext;
|
||||
|
@ -2302,7 +2295,9 @@ Process.prototype.reportURL = function (url) {
|
|||
}
|
||||
this.httpRequest = new XMLHttpRequest();
|
||||
this.httpRequest.open("GET", url, true);
|
||||
this.httpRequest.setRequestHeader('Cache-Control', 'max-age=0');
|
||||
// cache-control, commented out for now
|
||||
// added for Snap4Arduino but has issues with local robot servers
|
||||
// this.httpRequest.setRequestHeader('Cache-Control', 'max-age=0');
|
||||
this.httpRequest.send(null);
|
||||
if (this.context.isCustomCommand) {
|
||||
// special case when ignoring the result, e.g. when
|
||||
|
@ -2337,7 +2332,7 @@ Process.prototype.doBroadcast = function (message) {
|
|||
myself = this,
|
||||
procs = [];
|
||||
|
||||
if (this.readyToTerminate) {
|
||||
if (!this.canBroadcast) {
|
||||
return [];
|
||||
}
|
||||
if (message instanceof List && (message.length() === 2)) {
|
||||
|
@ -3434,7 +3429,14 @@ Process.prototype.reportContextFor = function (context, otherObj) {
|
|||
result.outerContext = copy(result.outerContext);
|
||||
result.outerContext.variables = copy(result.outerContext.variables);
|
||||
result.outerContext.receiver = otherObj;
|
||||
result.outerContext.variables.parentFrame = otherObj.variables;
|
||||
if (result.outerContext.variables.parentFrame) {
|
||||
result.outerContext.variables.parentFrame =
|
||||
copy(result.outerContext.variables.parentFrame);
|
||||
result.outerContext.variables.parentFrame.parentFrame =
|
||||
otherObj.variables;
|
||||
} else {
|
||||
result.outerContext.variables.parentFrame = otherObj.variables;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
Ładowanie…
Reference in New Issue