summaryrefslogtreecommitdiff
path: root/threads.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-07-15 15:45:11 +0200
committerjmoenig <jens@moenig.org>2013-07-15 15:45:11 +0200
commit4c9150d7e76a83bff903c079b3595cb44a255b30 (patch)
treed2a4918229f0512f4392c4ea353c9f7aae766b6a /threads.js
parent6dbfe66420571a945688278cba70451083b43ccd (diff)
downloadsnap-4c9150d7e76a83bff903c079b3595cb44a255b30.tar.gz
snap-4c9150d7e76a83bff903c079b3595cb44a255b30.zip
experimental text-function primitive
(hidden, shown only in dev mode in the operators category)
Diffstat (limited to 'threads.js')
-rw-r--r--threads.js35
1 files changed, 33 insertions, 2 deletions
diff --git a/threads.js b/threads.js
index c67360a..5368b18 100644
--- a/threads.js
+++ b/threads.js
@@ -61,7 +61,7 @@ ReporterBlockMorph, ScriptsMorph, ShadowMorph, StringMorph,
SyntaxElementMorph, TextMorph, WorldMorph, blocksVersion, contains,
degrees, detect, getDocumentPositionOf, newCanvas, nop, radians,
useBlurredShadows, ReporterSlotMorph, CSlotMorph, RingMorph, IDE_Morph,
-ArgLabelMorph, localize*/
+ArgLabelMorph, localize, XML_Element, hex_sha512*/
// globals from objects.js:
@@ -83,7 +83,7 @@ ArgLabelMorph, localize*/
// Global stuff ////////////////////////////////////////////////////////
-modules.threads = '2013-July-11';
+modules.threads = '2013-July-15';
var ThreadManager;
var Process;
@@ -1917,6 +1917,37 @@ Process.prototype.reportMonadic = function (fname, n) {
return result;
};
+Process.prototype.reportTextFunction = function (fname, string) {
+ var x = (isNil(string) ? '' : string).toString(),
+ result = '';
+
+ switch (this.inputOption(fname)) {
+ case 'encode URI':
+ result = encodeURI(x);
+ break;
+ case 'decode URI':
+ result = decodeURI(x);
+ break;
+ case 'encode URI component':
+ result = encodeURIComponent(x);
+ break;
+ case 'decode URI component':
+ result = decodeURIComponent(x);
+ break;
+ case 'XML escape':
+ result = new XML_Element().escape(x);
+ break;
+ case 'XML unescape':
+ result = new XML_Element().unescape(x);
+ break;
+ case 'hex sha512 hash':
+ result = hex_sha512(x);
+ break;
+ default:
+ }
+ return result;
+};
+
Process.prototype.reportJoin = function (a, b) {
var x = (isNil(a) ? '' : a).toString(),
y = (isNil(b) ? '' : b).toString();