diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler')
3 files changed, 49 insertions, 28 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index ec6b962..61e6ff9 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -18,8 +18,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
18 | dataTypes.Add("integer", "int"); | 18 | dataTypes.Add("integer", "int"); |
19 | dataTypes.Add("float", "double"); | 19 | dataTypes.Add("float", "double"); |
20 | dataTypes.Add("string", "string"); | 20 | dataTypes.Add("string", "string"); |
21 | dataTypes.Add("key", "string"); | 21 | dataTypes.Add("key", "string"); |
22 | dataTypes.Add("vector", "LSL_Types.Vector3"); | 22 | dataTypes.Add("vector", "LSL_Types.Vector3"); |
23 | dataTypes.Add("rotation", "LSL_Types.Quaternion"); | 23 | dataTypes.Add("rotation", "LSL_Types.Quaternion"); |
24 | dataTypes.Add("list", "list"); | 24 | dataTypes.Add("list", "list"); |
25 | dataTypes.Add("null", "null"); | 25 | dataTypes.Add("null", "null"); |
@@ -225,9 +225,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | // Add namespace, class name and inheritance | 228 | // Add namespace, class name and inheritance |
229 | 229 | ||
230 | Return = "" + | 230 | Return = "" + |
231 | "using OpenSim.Region.ScriptEngine.Common;"; | 231 | "using OpenSim.Region.ScriptEngine.Common;"; |
232 | //"using System; " + | 232 | //"using System; " + |
233 | //"using System.Collections.Generic; " + | 233 | //"using System.Collections.Generic; " + |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 5f92e96..1294213 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -45,7 +45,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | public LSL_BuiltIn_Commands_Interface m_LSL_Functions; | 48 | public LSL_BuiltIn_Commands_Interface m_LSL_Functions; |
49 | public string SourceCode = ""; | ||
49 | 50 | ||
50 | public LSL_BaseClass() | 51 | public LSL_BaseClass() |
51 | { | 52 | { |
@@ -452,8 +453,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
452 | public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } | 453 | public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } |
453 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } | 454 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } |
454 | public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } | 455 | public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } |
455 | public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } | 456 | public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } |
456 | public void llHTTPRequest() { m_LSL_Functions.llHTTPRequest(); } | 457 | public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } |
457 | public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } | 458 | public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } |
458 | public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } | 459 | public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } |
459 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } | 460 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } |
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 064ed4f..20f5d51 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 | |||
@@ -327,7 +327,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
327 | return src.Substring(start, end); | 327 | return src.Substring(start, end); |
328 | } | 328 | } |
329 | 329 | ||
330 | public string llDeleteSubString(string src, int start, int end) | 330 | public string llDeleteSubString(string src, int start, int end) |
331 | { | 331 | { |
332 | return src.Remove(start, end - start); | 332 | return src.Remove(start, end - start); |
333 | } | 333 | } |
@@ -431,7 +431,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
431 | public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } | 431 | public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } |
432 | public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } | 432 | public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } |
433 | 433 | ||
434 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { NotImplemented("llSetText"); } | 434 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) |
435 | { | ||
436 | Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); | ||
437 | m_host.SetText(text, av3, alpha); | ||
438 | } | ||
439 | |||
435 | 440 | ||
436 | public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } | 441 | public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } |
437 | public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } | 442 | public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } |
@@ -443,7 +448,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
443 | public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } | 448 | public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } |
444 | public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } | 449 | public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } |
445 | public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } | 450 | public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } |
446 | public void llResetScript() { } | 451 | public void llResetScript() |
452 | { | ||
453 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); | ||
454 | } | ||
447 | public void llMessageLinked(int linknum, int num, string str, string id) { } | 455 | public void llMessageLinked(int linknum, int num, string str, string id) { } |
448 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } | 456 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } |
449 | public void llPassCollisions(int pass) { } | 457 | public void llPassCollisions(int pass) { } |
@@ -482,7 +490,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
482 | 490 | ||
483 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } | 491 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } |
484 | 492 | ||
485 | public List<string> llListSort(List<string> src, int stride, int ascending) { | 493 | public List<string> llListSort(List<string> src, int stride, int ascending) |
494 | { | ||
486 | SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); | 495 | SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); |
487 | // Add chunks to an array | 496 | // Add chunks to an array |
488 | int s = stride; | 497 | int s = stride; |
@@ -497,7 +506,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
497 | if (c > s) | 506 | if (c > s) |
498 | { | 507 | { |
499 | sorted.Add(chunkString, chunk); | 508 | sorted.Add(chunkString, chunk); |
500 | chunkString = ""; | 509 | chunkString = ""; |
501 | chunk = new List<string>(); | 510 | chunk = new List<string>(); |
502 | c = 0; | 511 | c = 0; |
503 | } | 512 | } |
@@ -554,7 +563,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
554 | { | 563 | { |
555 | return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); | 564 | return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); |
556 | } | 565 | } |
557 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { | 566 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) |
567 | { | ||
558 | return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); | 568 | return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); |
559 | } | 569 | } |
560 | public List<string> llList2List(List<string> src, int start, int end) | 570 | public List<string> llList2List(List<string> src, int start, int end) |
@@ -632,7 +642,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
632 | if (chunk.Count > 0) | 642 | if (chunk.Count > 0) |
633 | tmp.Add(chunk); | 643 | tmp.Add(chunk); |
634 | 644 | ||
635 | // Decreate array back into a list | 645 | // Decreate (<- what kind of word is that? :D ) array back into a list |
636 | int rnd; | 646 | int rnd; |
637 | List<string> ret = new List<string>(); | 647 | List<string> ret = new List<string>(); |
638 | while (tmp.Count > 0) | 648 | while (tmp.Count > 0) |
@@ -649,7 +659,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
649 | 659 | ||
650 | 660 | ||
651 | } | 661 | } |
652 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | 662 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) |
653 | { | 663 | { |
654 | List<string> ret = new List<string>(); | 664 | List<string> ret = new List<string>(); |
655 | int s = stride; | 665 | int s = stride; |
@@ -657,9 +667,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
657 | s = 1; | 667 | s = 1; |
658 | 668 | ||
659 | int sc = s; | 669 | int sc = s; |
660 | for (int i = start; i < src.Count; i++) { | 670 | for (int i = start; i < src.Count; i++) |
671 | { | ||
661 | sc--; | 672 | sc--; |
662 | if (sc ==0) { | 673 | if (sc == 0) |
674 | { | ||
663 | sc = s; | 675 | sc = s; |
664 | // Addthis | 676 | // Addthis |
665 | ret.Add(src[i]); | 677 | ret.Add(src[i]); |
@@ -795,7 +807,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
795 | } | 807 | } |
796 | 808 | ||
797 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } | 809 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } |
798 | public string llStringToBase64(string str) { | 810 | public string llStringToBase64(string str) |
811 | { | ||
799 | 812 | ||
800 | try | 813 | try |
801 | { | 814 | { |
@@ -808,14 +821,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
808 | { | 821 | { |
809 | throw new Exception("Error in base64Encode" + e.Message); | 822 | throw new Exception("Error in base64Encode" + e.Message); |
810 | } | 823 | } |
811 | } | 824 | } |
812 | 825 | ||
813 | public string llBase64ToString(string str) { | 826 | public string llBase64ToString(string str) |
827 | { | ||
814 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); | 828 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); |
815 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); | 829 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); |
816 | try | 830 | try |
817 | { | 831 | { |
818 | 832 | ||
819 | byte[] todecode_byte = Convert.FromBase64String(str); | 833 | byte[] todecode_byte = Convert.FromBase64String(str); |
820 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | 834 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); |
821 | char[] decoded_char = new char[charCount]; | 835 | char[] decoded_char = new char[charCount]; |
@@ -861,11 +875,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
861 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } | 875 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } |
862 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } | 876 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } |
863 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } | 877 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } |
864 | public string llIntegerToBase64(int number) { | 878 | public string llIntegerToBase64(int number) |
865 | NotImplemented("llIntegerToBase64"); return ""; | 879 | { |
880 | NotImplemented("llIntegerToBase64"); return ""; | ||
866 | } | 881 | } |
867 | public int llBase64ToInteger(string str) { | 882 | public int llBase64ToInteger(string str) |
868 | NotImplemented("llBase64ToInteger"); return 0; | 883 | { |
884 | NotImplemented("llBase64ToInteger"); return 0; | ||
869 | } | 885 | } |
870 | 886 | ||
871 | public double llGetGMTclock() | 887 | public double llGetGMTclock() |
@@ -957,7 +973,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
957 | 973 | ||
958 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } | 974 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } |
959 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } | 975 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } |
960 | public string llXorBase64StringsCorrect(string str1, string str2) { | 976 | public string llXorBase64StringsCorrect(string str1, string str2) |
977 | { | ||
961 | string ret = ""; | 978 | string ret = ""; |
962 | string src1 = llBase64ToString(str1); | 979 | string src1 = llBase64ToString(str1); |
963 | string src2 = llBase64ToString(str2); | 980 | string src2 = llBase64ToString(str2); |
@@ -972,7 +989,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
972 | } | 989 | } |
973 | return llStringToBase64(ret); | 990 | return llStringToBase64(ret); |
974 | } | 991 | } |
975 | public void llHTTPRequest() { NotImplemented("llHTTPRequest"); } | 992 | public void llHTTPRequest(string url, List<string> parameters, string body) |
993 | { | ||
994 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); | ||
995 | } | ||
976 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } | 996 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } |
977 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } | 997 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } |
978 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } | 998 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } |