From 4c9150d7e76a83bff903c079b3595cb44a255b30 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 15 Jul 2013 15:45:11 +0200 Subject: experimental text-function primitive (hidden, shown only in dev mode in the operators category) --- threads.js | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'threads.js') 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(); -- cgit v1.3.1