summaryrefslogtreecommitdiff
path: root/threads.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2015-07-23 14:26:06 +0200
committerGubolin <gubolin@fantasymail.de>2015-07-23 14:26:06 +0200
commit5aec52889d79a8257971095719195fabcbc33559 (patch)
treee225dc622d1b16ee78bc495ead9a0df63c6f6b99 /threads.js
parenta3cae8db6e442da230a880a26546595afee7a3bd (diff)
parent40b1d4910ca55004c8f927abcdb02755b986923b (diff)
downloadsnap-5aec52889d79a8257971095719195fabcbc33559.tar.gz
snap-5aec52889d79a8257971095719195fabcbc33559.zip
merge upstreamdevelopment
Diffstat (limited to 'threads.js')
-rw-r--r--threads.js43
1 files changed, 21 insertions, 22 deletions
diff --git a/threads.js b/threads.js
index 1b8fdc6..8e4f0c4 100644
--- a/threads.js
+++ b/threads.js
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff ////////////////////////////////////////////////////////
-modules.threads = '2015-May-01';
+modules.threads = '2015-June-25';
var ThreadManager;
var Process;
@@ -348,7 +348,7 @@ ThreadManager.prototype.findProcess = function (block) {
*/
Process.prototype = {};
-Process.prototype.contructor = Process;
+Process.prototype.constructor = Process;
Process.prototype.timeout = 500; // msecs after which to force yield
Process.prototype.isCatchingErrors = true;
@@ -2235,14 +2235,14 @@ Process.prototype.reportMonadic = function (fname, n) {
case 'ln':
result = Math.log(x);
break;
- case 'log':
- result = 0;
+ case 'log': // base 10
+ result = Math.log(x) / Math.LN10;
break;
case 'e^':
result = Math.exp(x);
break;
case '10^':
- result = 0;
+ result = Math.pow(10, x);
break;
default:
nop();
@@ -2796,31 +2796,30 @@ Process.prototype.reportTimer = function () {
};
// Process Dates and times in Snap
-// Map block options to built-in functions
-var dateMap = {
- 'year' : 'getFullYear',
- 'month' : 'getMonth',
- 'date': 'getDate',
- 'day of week' : 'getDay',
- 'hour' : 'getHours',
- 'minute' : 'getMinutes',
- 'second' : 'getSeconds',
- 'time in milliseconds' : 'getTime'
-};
-
Process.prototype.reportDate = function (datefn) {
- var inputFn = this.inputOption(datefn),
- currDate = new Date(),
- func = dateMap[inputFn],
- result = currDate[func]();
+ var currDate, func, result,
+ inputFn = this.inputOption(datefn),
+ // Map block options to built-in functions
+ dateMap = {
+ 'year' : 'getFullYear',
+ 'month' : 'getMonth',
+ 'date': 'getDate',
+ 'day of week' : 'getDay',
+ 'hour' : 'getHours',
+ 'minute' : 'getMinutes',
+ 'second' : 'getSeconds',
+ 'time in milliseconds' : 'getTime'
+ };
if (!dateMap[inputFn]) { return ''; }
+ currDate = new Date();
+ func = dateMap[inputFn];
+ result = currDate[func]();
// Show months as 1-12 and days as 1-7
if (inputFn === 'month' || inputFn === 'day of week') {
result += 1;
}
-
return result;
};