standardlib.ysl2
changeset 52 b4a9a3122abb
parent 22 3a2bd70c01df
child 53 b94d4c5b9496
--- a/standardlib.ysl2	Wed Aug 29 23:57:58 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// YML2 standardlib version 2.5.8
-
-function "yml:hex2dec" {
-    param "hex";
-    param "_result", 0;
-    
-    const "hd", "substring($hex, 1, 1)";
-    const "a", """translate($hd, 'ABCDEFabcdef123456789',
-        '123456123456000000000')""";
-
-    const "d" choose {
-        when "$a>0" value "$a + 9";
-        otherwise value "$hd";
-    }
-
-    choose {
-        when "string-length($hex) = 1"
-            value "$_result * 16 + $d";
-        otherwise call "yml:hex2dec"
-            with "hex", "substring($hex, 2, 8)", 
-            with "_result", "$_result * 16 + $d";
-    }
-}
-
-function "yml:dec2hex" {
-    param "dec";
-    param "bits", !16**7!;
-
-    const "v", "floor($dec div $bits)";
-    value "substring('0123456789abcdef', $v + 1, 1)";
-
-    if "$bits > 1" call "yml:dec2hex"
-        with "dec", "$dec - $bits * $v",
-        with "bits", "$bits div 16";
-}
-
-def "yml:dec2hex" {
-    param "dec";
-    param "digits", 8;
-        
-    result call "yml:dec2hex" with "dec", "$dec", with "bits", "math:power(16, $digits - 1)";
-}
-
-def "yml:hex2dec" {
-    param "hex";
-    result call "yml:hex2dec" with "hex", "$hex";
-}
-
-def "yml:lcase" {
-    param "text", "''";
-    result "translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')";
-}
-
-def "yml:ucase" {
-    param "text", "''";
-    result "translate($text, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')";
-}
-
-def "yml:mixedCase" {
-    param "text", "''";
-    result "concat(yml:lcase(substring($text,1,1)),substring($text,2))";
-}
-
-def "yml:capit" {
-    param "text", "''";
-    result "concat(yml:ucase(substring($text,1,1)),substring($text,2))";
-}
-