aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
authorCharles Krinke2007-12-18 02:41:34 +0000
committerCharles Krinke2007-12-18 02:41:34 +0000
commit6f389ba4cf54d7e964b98430f7a6601d3ec0c73b (patch)
tree2c092e7bea58052485854d3a3c9e548c790abb5b /OpenSim/Region/ScriptEngine/DotNetEngine
parent* Fixed a potential race condition with adding Caps handlers (diff)
downloadopensim-SC-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.zip
opensim-SC-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.tar.gz
opensim-SC-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.tar.bz2
opensim-SC-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.tar.xz
Many Thanks to Alondria for adding:
The list type and a bunch of support functions to LSL Added/ReImplmented: llGetListLength(), llList2Integer(), osList2Double() (note rename), llList2Float(), llList2String(), llList2Key(), llList2Vector(), llList2Rot(), llList2List(), llDeleteSubList(), llGetListEntryType(), llList2CSV(), llCSV2List(), llListInsertList(), llDumpList2String(), Borked Still: llListSort(), llListRandomize(), llList2ListStrided(), llListFindList(), Changed: llHTTPRequest() (Made wrapper of LSL_Types.list->List<string>)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs465
3 files changed, 319 insertions, 214 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 00ddbba..4063647 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
47 dataTypes.Add("key", "string"); 47 dataTypes.Add("key", "string");
48 dataTypes.Add("vector", "LSL_Types.Vector3"); 48 dataTypes.Add("vector", "LSL_Types.Vector3");
49 dataTypes.Add("rotation", "LSL_Types.Quaternion"); 49 dataTypes.Add("rotation", "LSL_Types.Quaternion");
50 dataTypes.Add("list", "List<string>"); 50 dataTypes.Add("list", "LSL_Types.list");
51 dataTypes.Add("null", "null"); 51 dataTypes.Add("null", "null");
52 } 52 }
53 53
@@ -259,7 +259,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
259 259
260 // Replace List []'s 260 // Replace List []'s
261 Script = 261 Script =
262 Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", 262 Regex.Replace(Script, @"\[([^\]]*)\]", @"new LSL_Types.list($1)",
263 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 263 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
264 264
265 265
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index d669c15..1657b74 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -1061,12 +1061,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1061 return m_LSL_Functions.llGetCenterOfMass(); 1061 return m_LSL_Functions.llGetCenterOfMass();
1062 } 1062 }
1063 1063
1064 public List<string> llListSort(List<string> src, int stride, int ascending) 1064 public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending)
1065 { 1065 {
1066 return m_LSL_Functions.llListSort(src, stride, ascending); 1066 return m_LSL_Functions.llListSort(src, stride, ascending);
1067 } 1067 }
1068 1068
1069 public int llGetListLength(List<string> src) 1069 public int llGetListLength(LSL_Types.list src)
1070 { 1070 {
1071 return m_LSL_Functions.llGetListLength(src); 1071 return m_LSL_Functions.llGetListLength(src);
1072 } 1072 }
@@ -1074,67 +1074,67 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1074 // 1074 //
1075 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1075 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1076 // 1076 //
1077 public int llList2Integer(List<string> src, int index) 1077 public int llList2Integer(LSL_Types.list src, int index)
1078 { 1078 {
1079 return m_LSL_Functions.llList2Integer(src, index); 1079 return m_LSL_Functions.llList2Integer(src, index);
1080 } 1080 }
1081 1081
1082 public double llList2double(List<string> src, int index) 1082 public double osList2Double(LSL_Types.list src, int index)
1083 { 1083 {
1084 return m_LSL_Functions.llList2double(src, index); 1084 return m_LSL_Functions.osList2Double(src, index);
1085 } 1085 }
1086 1086
1087 public string llList2String(List<string> src, int index) 1087 public string llList2String(LSL_Types.list src, int index)
1088 { 1088 {
1089 return m_LSL_Functions.llList2String(src, index); 1089 return m_LSL_Functions.llList2String(src, index);
1090 } 1090 }
1091 1091
1092 public string llList2Key(List<string> src, int index) 1092 public string llList2Key(LSL_Types.list src, int index)
1093 { 1093 {
1094 return m_LSL_Functions.llList2Key(src, index); 1094 return m_LSL_Functions.llList2Key(src, index);
1095 } 1095 }
1096 1096
1097 public vector llList2Vector(List<string> src, int index) 1097 public vector llList2Vector(LSL_Types.list src, int index)
1098 { 1098 {
1099 return m_LSL_Functions.llList2Vector(src, index); 1099 return m_LSL_Functions.llList2Vector(src, index);
1100 } 1100 }
1101 1101
1102 public rotation llList2Rot(List<string> src, int index) 1102 public rotation llList2Rot(LSL_Types.list src, int index)
1103 { 1103 {
1104 return m_LSL_Functions.llList2Rot(src, index); 1104 return m_LSL_Functions.llList2Rot(src, index);
1105 } 1105 }
1106 1106
1107 public List<string> llList2List(List<string> src, int start, int end) 1107 public LSL_Types.list llList2List(LSL_Types.list src, int start, int end)
1108 { 1108 {
1109 return m_LSL_Functions.llList2List(src, start, end); 1109 return m_LSL_Functions.llList2List(src, start, end);
1110 } 1110 }
1111 1111
1112 public List<string> llDeleteSubList(List<string> src, int start, int end) 1112 public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end)
1113 { 1113 {
1114 return m_LSL_Functions.llDeleteSubList(src, start, end); 1114 return m_LSL_Functions.llDeleteSubList(src, start, end);
1115 } 1115 }
1116 1116
1117 public int llGetListEntryType(List<string> src, int index) 1117 public int llGetListEntryType(LSL_Types.list src, int index)
1118 { 1118 {
1119 return m_LSL_Functions.llGetListEntryType(src, index); 1119 return m_LSL_Functions.llGetListEntryType(src, index);
1120 } 1120 }
1121 1121
1122 public string llList2CSV(List<string> src) 1122 public string llList2CSV(LSL_Types.list src)
1123 { 1123 {
1124 return m_LSL_Functions.llList2CSV(src); 1124 return m_LSL_Functions.llList2CSV(src);
1125 } 1125 }
1126 1126
1127 public List<string> llCSV2List(string src) 1127 public LSL_Types.list llCSV2List(string src)
1128 { 1128 {
1129 return m_LSL_Functions.llCSV2List(src); 1129 return m_LSL_Functions.llCSV2List(src);
1130 } 1130 }
1131 1131
1132 public List<string> llListRandomize(List<string> src, int stride) 1132 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride)
1133 { 1133 {
1134 return m_LSL_Functions.llListRandomize(src, stride); 1134 return m_LSL_Functions.llListRandomize(src, stride);
1135 } 1135 }
1136 1136
1137 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 1137 public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride)
1138 { 1138 {
1139 return m_LSL_Functions.llList2ListStrided(src, start, end, stride); 1139 return m_LSL_Functions.llList2ListStrided(src, start, end, stride);
1140 } 1140 }
@@ -1144,12 +1144,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1144 return m_LSL_Functions.llGetRegionCorner(); 1144 return m_LSL_Functions.llGetRegionCorner();
1145 } 1145 }
1146 1146
1147 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 1147 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start)
1148 { 1148 {
1149 return m_LSL_Functions.llListInsertList(dest, src, start); 1149 return m_LSL_Functions.llListInsertList(dest, src, start);
1150 } 1150 }
1151 1151
1152 public int llListFindList(List<string> src, List<string> test) 1152 public int llListFindList(LSL_Types.list src, LSL_Types.list test)
1153 { 1153 {
1154 return m_LSL_Functions.llListFindList(src, test); 1154 return m_LSL_Functions.llListFindList(src, test);
1155 } 1155 }
@@ -1375,9 +1375,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1375 m_LSL_Functions.llSetCameraAtOffset(offset); 1375 m_LSL_Functions.llSetCameraAtOffset(offset);
1376 } 1376 }
1377 1377
1378 public void llDumpList2String() 1378 public string llDumpList2String(LSL_Types.list src, string seperator)
1379 { 1379 {
1380 m_LSL_Functions.llDumpList2String(); 1380 return m_LSL_Functions.llDumpList2String(src, seperator);
1381 } 1381 }
1382 1382
1383 public void llScriptDanger(vector pos) 1383 public void llScriptDanger(vector pos)
@@ -1385,7 +1385,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1385 m_LSL_Functions.llScriptDanger(pos); 1385 m_LSL_Functions.llScriptDanger(pos);
1386 } 1386 }
1387 1387
1388 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) 1388 public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
1389 { 1389 {
1390 m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); 1390 m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
1391 } 1391 }
@@ -1448,7 +1448,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1448 return m_LSL_Functions.llMD5String(src, nonce); 1448 return m_LSL_Functions.llMD5String(src, nonce);
1449 } 1449 }
1450 1450
1451 public void llSetPrimitiveParams(List<string> rules) 1451 public void llSetPrimitiveParams(LSL_Types.list rules)
1452 { 1452 {
1453 m_LSL_Functions.llSetPrimitiveParams(rules); 1453 m_LSL_Functions.llSetPrimitiveParams(rules);
1454 } 1454 }
@@ -1483,7 +1483,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1483 return m_LSL_Functions.llLog(val); 1483 return m_LSL_Functions.llLog(val);
1484 } 1484 }
1485 1485
1486 public List<string> llGetAnimationList(string id) 1486 public LSL_Types.list llGetAnimationList(string id)
1487 { 1487 {
1488 return m_LSL_Functions.llGetAnimationList(id); 1488 return m_LSL_Functions.llGetAnimationList(id);
1489 } 1489 }
@@ -1538,7 +1538,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1538 return m_LSL_Functions.llGetNumberOfNotecardLines(name); 1538 return m_LSL_Functions.llGetNumberOfNotecardLines(name);
1539 } 1539 }
1540 1540
1541 public List<string> llGetBoundingBox(string obj) 1541 public LSL_Types.list llGetBoundingBox(string obj)
1542 { 1542 {
1543 return m_LSL_Functions.llGetBoundingBox(obj); 1543 return m_LSL_Functions.llGetBoundingBox(obj);
1544 } 1544 }
@@ -1581,7 +1581,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1581 m_LSL_Functions.llSetLocalRot(rot); 1581 m_LSL_Functions.llSetLocalRot(rot);
1582 } 1582 }
1583 1583
1584 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) 1584 public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers)
1585 { 1585 {
1586 return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); 1586 return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers);
1587 } 1587 }
@@ -1646,7 +1646,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1646 m_LSL_Functions.llLoadURL(avatar_id, message, url); 1646 m_LSL_Functions.llLoadURL(avatar_id, message, url);
1647 } 1647 }
1648 1648
1649 public void llParcelMediaCommandList(List<string> commandList) 1649 public void llParcelMediaCommandList(LSL_Types.list commandList)
1650 { 1650 {
1651 m_LSL_Functions.llParcelMediaCommandList(commandList); 1651 m_LSL_Functions.llParcelMediaCommandList(commandList);
1652 } 1652 }
@@ -1669,7 +1669,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1669 return m_LSL_Functions.llGetInventoryType(name); 1669 return m_LSL_Functions.llGetInventoryType(name);
1670 } 1670 }
1671 1671
1672 public void llSetPayPrice(int price, List<string> quick_pay_buttons) 1672 public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons)
1673 { 1673 {
1674 m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); 1674 m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons);
1675 } 1675 }
@@ -1724,7 +1724,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1724 m_LSL_Functions.llRemoveFromLandBanList(avatar); 1724 m_LSL_Functions.llRemoveFromLandBanList(avatar);
1725 } 1725 }
1726 1726
1727 public void llSetCameraParams(List<string> rules) 1727 public void llSetCameraParams(LSL_Types.list rules)
1728 { 1728 {
1729 m_LSL_Functions.llSetCameraParams(rules); 1729 m_LSL_Functions.llSetCameraParams(rules);
1730 } 1730 }
@@ -1734,7 +1734,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1734 m_LSL_Functions.llClearCameraParams(); 1734 m_LSL_Functions.llClearCameraParams();
1735 } 1735 }
1736 1736
1737 public double llListStatistics(int operation, List<string> src) 1737 public double llListStatistics(int operation, LSL_Types.list src)
1738 { 1738 {
1739 return m_LSL_Functions.llListStatistics(operation, src); 1739 return m_LSL_Functions.llListStatistics(operation, src);
1740 } 1740 }
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1759 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); 1759 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2);
1760 } 1760 }
1761 1761
1762 public string llHTTPRequest(string url, List<string> parameters, string body) 1762 public string llHTTPRequest(string url, LSL_Types.list parameters, string body)
1763 { 1763 {
1764 return m_LSL_Functions.llHTTPRequest(url, parameters, body); 1764 return m_LSL_Functions.llHTTPRequest(url, parameters, body);
1765 } 1765 }
@@ -1779,7 +1779,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1779 return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); 1779 return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide);
1780 } 1780 }
1781 1781
1782 public List<string> llGetParcelPrimOwners(vector pos) 1782 public LSL_Types.list llGetParcelPrimOwners(vector pos)
1783 { 1783 {
1784 return m_LSL_Functions.llGetParcelPrimOwners(pos); 1784 return m_LSL_Functions.llGetParcelPrimOwners(pos);
1785 } 1785 }
@@ -1797,7 +1797,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1797 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); 1797 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
1798 } 1798 }
1799 1799
1800 public List<string> llGetParcelDetails(vector pos, List<string> param) 1800 public LSL_Types.list llGetParcelDetails(vector pos, LSL_Types.list param)
1801 { 1801 {
1802 return m_LSL_Functions.llGetParcelDetails(pos, param); 1802 return m_LSL_Functions.llGetParcelDetails(pos, param);
1803 } 1803 }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 61c4b10..ef31ecc 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -28,6 +28,7 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections;
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using System.Text; 33using System.Text;
33using System.Threading; 34using System.Threading;
@@ -102,6 +103,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
102 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 103 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
103 public double llSin(double f) 104 public double llSin(double f)
104 { 105 {
106
105 return (double) Math.Sin(f); 107 return (double) Math.Sin(f);
106 } 108 }
107 109
@@ -1430,205 +1432,299 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1430 return new LSL_Types.Vector3(); 1432 return new LSL_Types.Vector3();
1431 } 1433 }
1432 1434
1433 public List<string> llListSort(List<string> src, int stride, int ascending) 1435 public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending)
1434 { 1436 {
1435 SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); 1437 // SortedList<string, LSL_Types.list> sorted = new SortedList<string, LSL_Types.list>();
1436 // Add chunks to an array 1438 // Add chunks to an array
1437 int s = stride; 1439 //int s = stride;
1438 if (s < 1) 1440 //if (s < 1)
1439 s = 1; 1441 // s = 1;
1440 int c = 0; 1442 //int c = 0;
1441 List<string> chunk = new List<string>(); 1443 //LSL_Types.list chunk = new LSL_Types.list();
1442 string chunkString = ""; 1444 //string chunkString = "";
1443 foreach (string element in src) 1445 //foreach (string element in src)
1446 //{
1447 // c++;
1448 // if (c > s)
1449 // {
1450 // sorted.Add(chunkString, chunk);
1451 // chunkString = "";
1452 // chunk = new LSL_Types.list();
1453 // c = 0;
1454 // }
1455 // chunk.Add(element);
1456 // chunkString += element.ToString();
1457 //}
1458 //if (chunk.Count > 0)
1459 // sorted.Add(chunkString, chunk);
1460
1461 //LSL_Types.list ret = new LSL_Types.list();
1462 //foreach (LSL_Types.list ls in sorted.Values)
1463 //{
1464 // ret.AddRange(ls);
1465 //}
1466
1467 //if (ascending == LSL_BaseClass.TRUE)
1468 // return ret;
1469 //ret.Reverse();
1470 //return ret;
1471 NotImplemented("llListSort");
1472 return new LSL_Types.list();
1473 }
1474
1475 public int llGetListLength(LSL_Types.list src)
1476 {
1477 return src.Length;
1478 }
1479
1480 public int llList2Integer(LSL_Types.list src, int index)
1481 {
1482 if (index < 0)
1444 { 1483 {
1445 c++; 1484 index = src.Length + index;
1446 if (c > s)
1447 {
1448 sorted.Add(chunkString, chunk);
1449 chunkString = "";
1450 chunk = new List<string>();
1451 c = 0;
1452 }
1453 chunk.Add(element);
1454 chunkString += element.ToString();
1455 } 1485 }
1456 if (chunk.Count > 0) 1486 if (index >= src.Length)
1457 sorted.Add(chunkString, chunk);
1458
1459 List<string> ret = new List<string>();
1460 foreach (List<string> ls in sorted.Values)
1461 { 1487 {
1462 ret.AddRange(ls); 1488 return 0;
1463 } 1489 }
1464 1490 return Convert.ToInt32(src.Data[index]);
1465 if (ascending == LSL_BaseClass.TRUE)
1466 return ret;
1467 ret.Reverse();
1468 return ret;
1469 }
1470
1471 public int llGetListLength(List<string> src)
1472 {
1473 return src.Count;
1474 }
1475
1476 public int llList2Integer(List<string> src, int index)
1477 {
1478 return Convert.ToInt32(src[index]);
1479 } 1491 }
1480 1492
1481 public double llList2double(List<string> src, int index) 1493 public double osList2Double(LSL_Types.list src, int index)
1482 { 1494 {
1483 return Convert.ToDouble(src[index]); 1495 if (index < 0)
1496 {
1497 index = src.Length + index;
1498 }
1499 if (index >= src.Length)
1500 {
1501 return 0.0;
1502 }
1503 return Convert.ToDouble(src.Data[index]);
1484 } 1504 }
1485 1505
1486 public float llList2Float(List<string> src, int index) 1506 public double llList2Float(LSL_Types.list src, int index)
1487 { 1507 {
1488 return Convert.ToSingle(src[index]); 1508 if (index < 0)
1509 {
1510 index = src.Length + index;
1511 }
1512 if (index >= src.Length)
1513 {
1514 return 0.0;
1515 }
1516 return Convert.ToSingle(src.Data[index]);
1489 } 1517 }
1490 1518
1491 public string llList2String(List<string> src, int index) 1519 public string llList2String(LSL_Types.list src, int index)
1492 { 1520 {
1493 return src[index]; 1521 if (index < 0)
1522 {
1523 index = src.Length + index;
1524 }
1525 if (index >= src.Length)
1526 {
1527 return "";
1528 }
1529 return src.Data[index].ToString();
1494 } 1530 }
1495 1531
1496 public string llList2Key(List<string> src, int index) 1532 public string llList2Key(LSL_Types.list src, int index)
1497 { 1533 {
1534 if (index < 0)
1535 {
1536 index = src.Length + index;
1537 }
1538 if (index >= src.Length)
1539 {
1540 return "00000000-0000-0000-0000-000000000000";
1541 }
1498 //return OpenSim.Framework.ToStringHyphenated(src[index]); 1542 //return OpenSim.Framework.ToStringHyphenated(src[index]);
1499 return src[index].ToString(); 1543 LLUUID tmpkey;
1500 } 1544 if (LLUUID.TryParse(src.Data[index].ToString(), out tmpkey))
1501 1545 {
1502 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 1546 return tmpkey.ToStringHyphenated();
1503 { 1547 }
1504 return 1548 else
1505 new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), 1549 {
1506 double.Parse(src[index + 2])); 1550 return "00000000-0000-0000-0000-000000000000";
1551 }
1507 } 1552 }
1508 1553
1509 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 1554 public LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index)
1510 { 1555 {
1511 return 1556 if (index < 0)
1512 new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), 1557 {
1513 double.Parse(src[index + 2]), double.Parse(src[index + 3])); 1558 index = src.Length + index;
1559 }
1560 if (index >= src.Length)
1561 {
1562 return new LSL_Types.Vector3(0, 0, 0);
1563 }
1564 if (src.Data[index].GetType().ToString() == "OpenSim.Region.ScriptEngine.Common.LSL_Types+Vector3")
1565 {
1566 return (LSL_Types.Vector3)src.Data[index];
1567 }
1568 else
1569 {
1570 return new LSL_Types.Vector3(0,0,0);
1571 }
1514 } 1572 }
1515 1573
1516 public List<string> llList2List(List<string> src, int start, int end) 1574 public LSL_Types.Quaternion llList2Rot(LSL_Types.list src, int index)
1517 { 1575 {
1518 if (end > start) 1576 if (index < 0)
1577 {
1578 index = src.Length + index;
1579 }
1580 if (index >= src.Length)
1519 { 1581 {
1520 // Simple straight forward chunk 1582 return new LSL_Types.Quaternion(0, 0, 0, 1);
1521 return src.GetRange(start, end - start); 1583 }
1584 if (src.Data[index].GetType().ToString() == "OpenSim.Region.ScriptEngine.Common.LSL_Types+Quaternion")
1585 {
1586 return (LSL_Types.Quaternion)src.Data[index];
1522 } 1587 }
1523 else 1588 else
1524 { 1589 {
1525 // Some of the end + some of the beginning 1590 return new LSL_Types.Quaternion(0, 0, 0, 1);
1526 // First chunk
1527 List<string> ret = new List<string>();
1528 ret.AddRange(src.GetRange(start, src.Count - start));
1529 ret.AddRange(src.GetRange(0, end));
1530 return ret;
1531 } 1591 }
1532 } 1592 }
1533 1593
1534 public List<string> llDeleteSubList(List<string> src, int start, int end) 1594 public LSL_Types.list llList2List(LSL_Types.list src, int start, int end)
1535 { 1595 {
1536 List<string> ret = new List<string>(src); 1596 return src.GetSublist(start, end);
1537 ret.RemoveRange(start, end - start);
1538 return ret;
1539 } 1597 }
1540 1598
1541 public int llGetListEntryType(List<string> src, int index) 1599 public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end)
1542 { 1600 {
1543 NotImplemented("llGetListEntryType"); 1601 //LSL_Types.list ret = new LSL_Types.list(src);
1544 return 0; 1602 //ret.RemoveRange(start, end - start);
1603 //return ret;
1604
1605 // Just a hunch - needs testing
1606 return src.GetSublist(end, start);
1545 } 1607 }
1546 1608
1547 public string llList2CSV(List<string> src) 1609 public int llGetListEntryType(LSL_Types.list src, int index)
1548 { 1610 {
1549 string ret = ""; 1611 if (index < 0)
1550 foreach (string s in src)
1551 { 1612 {
1552 if (s.Length > 0) 1613 index = src.Length + index;
1553 ret += ","; 1614 }
1554 ret += s; 1615 if (index >= src.Length)
1616 {
1617 return 0;
1618 }
1619 switch (src.Data[index].GetType().ToString())
1620 {
1621 case "System.Int32":
1622 return 1;
1623 case "System.Double":
1624 return 2;
1625 case "System.String":
1626 LLUUID tuuid;
1627 if (LLUUID.TryParse(src.Data[index].ToString(),out tuuid))
1628 {
1629 return 3;
1630 }
1631 else
1632 {
1633 return 4;
1634 }
1635 case "OpenSim.Region.ScriptEngine.Common.LSL_Types+Vector3":
1636 return 5;
1637 case "OpenSim.Region.ScriptEngine.Common.LSL_Types+Quaternion":
1638 return 6;
1639 case "OpenSim.Region.ScriptEngine.Common.LSL_Types+list":
1640 return 7;
1641 default:
1642 return 0;
1555 } 1643 }
1556 return ret;
1557 } 1644 }
1558 1645
1559 public List<string> llCSV2List(string src) 1646 public string llList2CSV(LSL_Types.list src)
1560 { 1647 {
1561 List<string> ret = new List<string>(); 1648 string ret = "";
1562 foreach (string s in src.Split(",".ToCharArray())) 1649 foreach (object o in src.Data)
1563 { 1650 {
1564 ret.Add(s); 1651 ret = ret + o.ToString() + ",";
1565 } 1652 }
1653 ret = ret.Substring(0, ret.Length - 2);
1566 return ret; 1654 return ret;
1567 } 1655 }
1568 1656
1569 public List<string> llListRandomize(List<string> src, int stride) 1657 public LSL_Types.list llCSV2List(string src)
1570 { 1658 {
1571 int s = stride; 1659 return new LSL_Types.list(src.Split(",".ToCharArray()));
1572 if (s < 1) 1660 }
1573 s = 1; 1661
1662 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride)
1663 {
1664 //int s = stride;
1665 //if (s < 1)
1666 // s = 1;
1574 1667
1575 // This is a cowardly way of doing it ;) 1668 // This is a cowardly way of doing it ;)
1576 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange 1669 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange
1577 List<List<string>> tmp = new List<List<string>>(); 1670 //List<LSL_Types.list> tmp = new List<LSL_Types.list>();
1578 1671
1579 // Add chunks to an array 1672 // Add chunks to an array
1580 int c = 0; 1673 //int c = 0;
1581 List<string> chunk = new List<string>(); 1674 //LSL_Types.list chunk = new LSL_Types.list();
1582 foreach (string element in src) 1675 //foreach (string element in src)
1583 { 1676 //{
1584 c++; 1677 // c++;
1585 if (c > s) 1678 // if (c > s)
1586 { 1679 // {
1587 tmp.Add(chunk); 1680 // tmp.Add(chunk);
1588 chunk = new List<string>(); 1681 // chunk = new LSL_Types.list();
1589 c = 0; 1682 // c = 0;
1590 } 1683 // }
1591 chunk.Add(element); 1684 // chunk.Add(element);
1592 } 1685 //}
1593 if (chunk.Count > 0) 1686 //if (chunk.Count > 0)
1594 tmp.Add(chunk); 1687 // tmp.Add(chunk);
1595 1688
1596 // Decreate (<- what kind of word is that? :D ) array back into a list 1689 // Decreate (<- what kind of word is that? :D ) array back into a list
1597 int rnd; 1690 //int rnd;
1598 List<string> ret = new List<string>(); 1691 //LSL_Types.list ret = new LSL_Types.list();
1599 while (tmp.Count > 0) 1692 //while (tmp.Count > 0)
1600 { 1693 //{
1601 rnd = Util.RandomClass.Next(tmp.Count); 1694 // rnd = Util.RandomClass.Next(tmp.Count);
1602 foreach (string str in tmp[rnd]) 1695 // foreach (string str in tmp[rnd])
1603 { 1696 // {
1604 ret.Add(str); 1697 // ret.Add(str);
1605 } 1698 // }
1606 tmp.RemoveAt(rnd); 1699 // tmp.RemoveAt(rnd);
1607 } 1700 //}
1608 1701
1609 return ret; 1702 //return ret;
1610 } 1703 NotImplemented("llListRandomize");
1611 1704 return new LSL_Types.list();
1612 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 1705 }
1613 { 1706
1614 List<string> ret = new List<string>(); 1707 public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride)
1615 int s = stride; 1708 {
1616 if (s < 1) 1709 LSL_Types.list ret = new LSL_Types.list();
1617 s = 1; 1710 //int s = stride;
1618 1711 //if (s < 1)
1619 int sc = s; 1712 // s = 1;
1620 for (int i = start; i < src.Count; i++) 1713
1621 { 1714 //int sc = s;
1622 sc--; 1715 //for (int i = start; i < src.Count; i++)
1623 if (sc == 0) 1716 //{
1624 { 1717 // sc--;
1625 sc = s; 1718 // if (sc == 0)
1626 // Addthis 1719 // {
1627 ret.Add(src[i]); 1720 // sc = s;
1628 } 1721 // // Addthis
1629 if (i == end) 1722 // ret.Add(src[i]);
1630 break; 1723 // }
1631 } 1724 // if (i == end)
1725 // break;
1726 //}
1727 NotImplemented("llList2ListStrided");
1632 return ret; 1728 return ret;
1633 } 1729 }
1634 1730
@@ -1637,27 +1733,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1637 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0); 1733 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0);
1638 } 1734 }
1639 1735
1640 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 1736 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start)
1641 { 1737 {
1642 List<string> ret = new List<string>(dest); 1738 return dest.GetSublist(0, start - 1) + src + dest.GetSublist(start, -1);
1643 //foreach (string s in src.Reverse())
1644 for (int ci = src.Count - 1; ci > -1; ci--)
1645 {
1646 ret.Insert(start, src[ci]);
1647 }
1648 return ret;
1649 } 1739 }
1650 1740
1651 public int llListFindList(List<string> src, List<string> test) 1741 public int llListFindList(LSL_Types.list src, LSL_Types.list test)
1652 { 1742 {
1653 foreach (string s in test) 1743 //foreach (string s in test)
1654 { 1744 //{
1655 for (int ci = 0; ci < src.Count; ci++) 1745 // for (int ci = 0; ci < src.Count; ci++)
1656 { 1746 // {
1657 if (s == src[ci]) 1747 // if (s == src[ci])
1658 return ci; 1748 // return ci;
1659 } 1749 // }
1660 } 1750 //}
1751 NotImplemented("llListFindList");
1661 return -1; 1752 return -1;
1662 } 1753 }
1663 1754
@@ -2018,9 +2109,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2018 NotImplemented("llSetCameraAtOffset"); 2109 NotImplemented("llSetCameraAtOffset");
2019 } 2110 }
2020 2111
2021 public void llDumpList2String() 2112 public string llDumpList2String(LSL_Types.list src, string seperator)
2022 { 2113 {
2023 NotImplemented("llDumpList2String"); 2114 if (src.Length == 0)
2115 {
2116 return "";
2117 }
2118 string ret = "";
2119 foreach (object o in src.Data)
2120 {
2121 ret = ret + o.ToString() + seperator;
2122 }
2123 ret = ret.Substring(0, ret.Length - seperator.Length);
2124 return ret;
2024 } 2125 }
2025 2126
2026 public void llScriptDanger(LSL_Types.Vector3 pos) 2127 public void llScriptDanger(LSL_Types.Vector3 pos)
@@ -2028,7 +2129,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2028 NotImplemented("llScriptDanger"); 2129 NotImplemented("llScriptDanger");
2029 } 2130 }
2030 2131
2031 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) 2132 public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
2032 { 2133 {
2033 NotImplemented("llDialog"); 2134 NotImplemented("llDialog");
2034 } 2135 }
@@ -2103,7 +2204,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2103 return Util.Md5Hash(src + ":" + nonce.ToString()); 2204 return Util.Md5Hash(src + ":" + nonce.ToString());
2104 } 2205 }
2105 2206
2106 public void llSetPrimitiveParams(List<string> rules) 2207 public void llSetPrimitiveParams(LSL_Types.list rules)
2107 { 2208 {
2108 NotImplemented("llSetPrimitiveParams"); 2209 NotImplemented("llSetPrimitiveParams");
2109 } 2210 }
@@ -2162,10 +2263,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2162 return (double) Math.Log(val); 2263 return (double) Math.Log(val);
2163 } 2264 }
2164 2265
2165 public List<string> llGetAnimationList(string id) 2266 public LSL_Types.list llGetAnimationList(string id)
2166 { 2267 {
2167 NotImplemented("llGetAnimationList"); 2268 NotImplemented("llGetAnimationList");
2168 return new List<string>(); 2269 return new LSL_Types.list();
2169 } 2270 }
2170 2271
2171 public void llSetParcelMusicURL(string url) 2272 public void llSetParcelMusicURL(string url)
@@ -2221,10 +2322,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2221 return ""; 2322 return "";
2222 } 2323 }
2223 2324
2224 public List<string> llGetBoundingBox(string obj) 2325 public LSL_Types.list llGetBoundingBox(string obj)
2225 { 2326 {
2226 NotImplemented("llGetBoundingBox"); 2327 NotImplemented("llGetBoundingBox");
2227 return new List<string>(); 2328 return new LSL_Types.list();
2228 } 2329 }
2229 2330
2230 public LSL_Types.Vector3 llGetGeometricCenter() 2331 public LSL_Types.Vector3 llGetGeometricCenter()
@@ -2265,10 +2366,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2265 NotImplemented("llSetLocalRot"); 2366 NotImplemented("llSetLocalRot");
2266 } 2367 }
2267 2368
2268 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) 2369 public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers)
2269 { 2370 {
2270 NotImplemented("llParseStringKeepNulls"); 2371 NotImplemented("llParseStringKeepNulls");
2271 return new List<string>(); 2372 return new LSL_Types.list();
2272 } 2373 }
2273 2374
2274 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, 2375 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
@@ -2337,7 +2438,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2337 url); 2438 url);
2338 } 2439 }
2339 2440
2340 public void llParcelMediaCommandList(List<string> commandList) 2441 public void llParcelMediaCommandList(LSL_Types.list commandList)
2341 { 2442 {
2342 NotImplemented("llParcelMediaCommandList"); 2443 NotImplemented("llParcelMediaCommandList");
2343 } 2444 }
@@ -2360,7 +2461,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2360 return 0; 2461 return 0;
2361 } 2462 }
2362 2463
2363 public void llSetPayPrice(int price, List<string> quick_pay_buttons) 2464 public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons)
2364 { 2465 {
2365 NotImplemented("llSetPayPrice"); 2466 NotImplemented("llSetPayPrice");
2366 } 2467 }
@@ -2431,7 +2532,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2431 NotImplemented("llRemoveFromLandBanList"); 2532 NotImplemented("llRemoveFromLandBanList");
2432 } 2533 }
2433 2534
2434 public void llSetCameraParams(List<string> rules) 2535 public void llSetCameraParams(LSL_Types.list rules)
2435 { 2536 {
2436 NotImplemented("llSetCameraParams"); 2537 NotImplemented("llSetCameraParams");
2437 } 2538 }
@@ -2441,7 +2542,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2441 NotImplemented("llClearCameraParams"); 2542 NotImplemented("llClearCameraParams");
2442 } 2543 }
2443 2544
2444 public double llListStatistics(int operation, List<string> src) 2545 public double llListStatistics(int operation, LSL_Types.list src)
2445 { 2546 {
2446 NotImplemented("llListStatistics"); 2547 NotImplemented("llListStatistics");
2447 return 0; 2548 return 0;
@@ -2481,13 +2582,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2481 return llStringToBase64(ret); 2582 return llStringToBase64(ret);
2482 } 2583 }
2483 2584
2484 public string llHTTPRequest(string url, List<string> parameters, string body) 2585 public string llHTTPRequest(string url, LSL_Types.list parameters, string body)
2485 { 2586 {
2486 IHttpRequests httpScriptMod = 2587 IHttpRequests httpScriptMod =
2487 m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>(); 2588 m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>();
2488 2589 List<string> param = new List<string>();
2590 foreach (object o in parameters.Data)
2591 {
2592 param.Add(o.ToString());
2593 }
2489 LLUUID reqID = httpScriptMod. 2594 LLUUID reqID = httpScriptMod.
2490 StartHttpRequest(m_localID, m_itemID, url, parameters, body); 2595 StartHttpRequest(m_localID, m_itemID, url, param, body);
2491 2596
2492 if( reqID != null ) 2597 if( reqID != null )
2493 return reqID.ToString(); 2598 return reqID.ToString();
@@ -2511,10 +2616,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2511 return 0; 2616 return 0;
2512 } 2617 }
2513 2618
2514 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) 2619 public LSL_Types.list llGetParcelPrimOwners(LSL_Types.Vector3 pos)
2515 { 2620 {
2516 NotImplemented("llGetParcelPrimOwners"); 2621 NotImplemented("llGetParcelPrimOwners");
2517 return new List<string>(); 2622 return new LSL_Types.list();
2518 } 2623 }
2519 2624
2520 public int llGetObjectPrimCount(string object_id) 2625 public int llGetObjectPrimCount(string object_id)
@@ -2529,10 +2634,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
2529 return 0; 2634 return 0;
2530 } 2635 }
2531 2636
2532 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) 2637 public LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param)
2533 { 2638 {
2534 NotImplemented("llGetParcelDetails"); 2639 NotImplemented("llGetParcelDetails");
2535 return new List<string>(); 2640 return new LSL_Types.list();
2536 } 2641 }
2537 2642
2538 // 2643 //