corrade-lsl-templates – Diff between revs 5 and 29

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 5 Rev 29
Line 1... Line 1...
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2015 - License: CC BY 2.0 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: https://creativecommons.org/licenses/by/2.0 for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
Line 6... Line 6...
6   6  
7 /////////////////////////////////////////////////////////////////////////// 7 ///////////////////////////////////////////////////////////////////////////
8 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 8 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
9 /////////////////////////////////////////////////////////////////////////// 9 ///////////////////////////////////////////////////////////////////////////
10 // escapes a string in conformance with RFC1738 10 // escapes a string in conformance with RFC1738
11 string wasURLEscape(string i) { 11 string wasURLEscape(string i) {
12 string o = ""; 12 string o = "";
Line 27... Line 27...
27 } while(i != ""); 27 } while(i != "");
28 return o; 28 return o;
29 } 29 }
Line 30... Line 30...
30   30  
31 /////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////
32 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 32 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
33 /////////////////////////////////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////////
34 // unescapes a string in conformance with RFC1738 34 // unescapes a string in conformance with RFC1738
35 string wasURLUnescape(string i) { 35 string wasURLUnescape(string i) {
36 return llUnescapeURL( 36 return llUnescapeURL(
Line 51... Line 51...
51 ) 51 )
52 ); 52 );
53 } 53 }
Line 54... Line 54...
54   54  
55 /////////////////////////////////////////////////////////////////////////// 55 ///////////////////////////////////////////////////////////////////////////
56 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 56 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
57 /////////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////
58 string wasKeyValueEncode(list data) { 58 string wasKeyValueEncode(list data) {
59 list k = llList2ListStrided(data, 0, -1, 2); 59 list k = llList2ListStrided(data, 0, -1, 2);
60 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 60 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
Line 66... Line 66...
66 } while(llGetListLength(k) != 0); 66 } while(llGetListLength(k) != 0);
67 return llDumpList2String(data, "&"); 67 return llDumpList2String(data, "&");
68 } 68 }
Line 69... Line 69...
69   69  
70 /////////////////////////////////////////////////////////////////////////// 70 ///////////////////////////////////////////////////////////////////////////
71 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 71 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
72 /////////////////////////////////////////////////////////////////////////// 72 ///////////////////////////////////////////////////////////////////////////
73 string wasKeyValueGet(string k, string data) { 73 string wasKeyValueGet(string k, string data) {
74 if(llStringLength(data) == 0) return ""; 74 if(llStringLength(data) == 0) return "";
75 if(llStringLength(k) == 0) return ""; 75 if(llStringLength(k) == 0) return "";
Line 78... Line 78...
78 if(i != -1) return llList2String(a, 2*i+1); 78 if(i != -1) return llList2String(a, 2*i+1);
79 return ""; 79 return "";
80 } 80 }
Line 81... Line 81...
81   81  
82 /////////////////////////////////////////////////////////////////////////// 82 ///////////////////////////////////////////////////////////////////////////
83 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 83 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
84 /////////////////////////////////////////////////////////////////////////// 84 ///////////////////////////////////////////////////////////////////////////
85 list wasCSVToList(string csv) { 85 list wasCSVToList(string csv) {
86 list l = []; 86 list l = [];
87 list s = []; 87 list s = [];
Line 117... Line 117...
117 // postcondition: length(s) = 0 117 // postcondition: length(s) = 0
118 return l + m; 118 return l + m;
119 } 119 }
Line 120... Line 120...
120   120  
121 /////////////////////////////////////////////////////////////////////////// 121 ///////////////////////////////////////////////////////////////////////////
122 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 122 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
123 /////////////////////////////////////////////////////////////////////////// 123 ///////////////////////////////////////////////////////////////////////////
124 integer wasDateTimeToStamp( 124 integer wasDateTimeToStamp(
125 integer year, 125 integer year,
126 integer month, 126 integer month,
Line 142... Line 142...
142 ) * 60 + minute 142 ) * 60 + minute
143 ) * 60 + second; 143 ) * 60 + second;
144 } 144 }
Line 145... Line 145...
145   145  
146 /////////////////////////////////////////////////////////////////////////// 146 ///////////////////////////////////////////////////////////////////////////
147 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 147 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
148 /////////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////////
149 float wasFmod(float a, float p) { 149 float wasFmod(float a, float p) {
150 if(p == 0) return (float)"nan"; 150 if(p == 0) return (float)"nan";
151 return a - ((integer)(a/p) * p); 151 return a - ((integer)(a/p) * p);
Line 152... Line 152...
152 } 152 }
153   153  
154 /////////////////////////////////////////////////////////////////////////// 154 ///////////////////////////////////////////////////////////////////////////
155 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 155 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
156 // Original: Clive Page, Leicester University, UK. 1995-MAY-2 // 156 // Original: Clive Page, Leicester University, UK. 1995-MAY-2 //
157 /////////////////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////////////////
158 list wasUnixTimeToDateTime(integer seconds) { 158 list wasUnixTimeToDateTime(integer seconds) {