aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/Executor.cs88
-rw-r--r--OpenSim/Region/ScriptEngine/Common/IScript.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs48
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs2007
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs149
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs186
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs135
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs208
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs1810
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs173
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs74
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs101
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs20
28 files changed, 3974 insertions, 1476 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs
index a2148ea..c656e01 100644
--- a/OpenSim/Region/ScriptEngine/Common/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 31using System.Reflection;
33using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
34 33
@@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common
53 { 52 {
54 //Console.WriteLine("Executor: InitializeLifetimeService()"); 53 //Console.WriteLine("Executor: InitializeLifetimeService()");
55 // return null; 54 // return null;
56 ILease lease = (ILease)base.InitializeLifetimeService(); 55 ILease lease = (ILease) base.InitializeLifetimeService();
57 56
58 if (lease.CurrentState == LeaseState.Initial) 57 if (lease.CurrentState == LeaseState.Initial)
59 { 58 {
@@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common
75 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! 74 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
76 //try 75 //try
77 //{ 76 //{
78 if (m_Running == false) 77 if (m_Running == false)
79 { 78 {
80 // Script is inactive, do not execute! 79 // Script is inactive, do not execute!
81 return; 80 return;
82 } 81 }
83 82
84 string EventName = m_Script.State() + "_event_" + FunctionName; 83 string EventName = m_Script.State() + "_event_" + FunctionName;
85 84
86 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); 85 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
87 86
88 //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); 87 //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
89 88
90 if (Events.ContainsKey(EventName) == false) 89 if (Events.ContainsKey(EventName) == false)
90 {
91 // Not found, create
92 Type type = m_Script.GetType();
93 try
91 { 94 {
92 // Not found, create 95 MethodInfo mi = type.GetMethod(EventName);
93 Type type = m_Script.GetType(); 96 Events.Add(EventName, mi);
94 try
95 {
96 MethodInfo mi = type.GetMethod(EventName);
97 Events.Add(EventName, mi);
98 }
99 catch
100 {
101 // Event name not found, cache it as not found
102 Events.Add(EventName, null);
103 }
104 } 97 }
105 98 catch
106 // Get event
107 MethodInfo ev = null;
108 Events.TryGetValue(EventName, out ev);
109
110 if (ev == null) // No event by that name!
111 { 99 {
112 //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); 100 // Event name not found, cache it as not found
113 return; 101 Events.Add(EventName, null);
114 } 102 }
103 }
104
105 // Get event
106 MethodInfo ev = null;
107 Events.TryGetValue(EventName, out ev);
108
109 if (ev == null) // No event by that name!
110 {
111 //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\"");
112 return;
113 }
115 114
116 // Found 115 // Found
117 //try 116 //try
118 //{ 117 //{
119 // Invoke it 118 // Invoke it
120 ev.Invoke(m_Script, args); 119 ev.Invoke(m_Script, args);
121 120
122 //} 121 //}
123 //catch (Exception e) 122 //catch (Exception e)
124 //{ 123 //{
125 // // TODO: Send to correct place 124 // // TODO: Send to correct place
126 // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); 125 // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString());
127 //} 126 //}
128 127
129 128
130 //} 129 //}
@@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common
136 { 135 {
137 m_Running = false; 136 m_Running = false;
138 } 137 }
139
140
141 } 138 }
142 139} \ No newline at end of file
143}
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs
index df0e824..08c0e9c 100644
--- a/OpenSim/Region/ScriptEngine/Common/IScript.cs
+++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ScriptEngine.Common 29namespace OpenSim.Region.ScriptEngine.Common
34{ 30{
35 public interface IScript 31 public interface IScript
@@ -37,4 +33,4 @@ namespace OpenSim.Region.ScriptEngine.Common
37 string State(); 33 string State();
38 Executor Exec { get; } 34 Executor Exec { get; }
39 } 35 }
40} 36} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index ff5c6bf..9cba882 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
@@ -26,15 +26,12 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.Common 31namespace OpenSim.Region.ScriptEngine.Common
34{ 32{
35 public interface LSL_BuiltIn_Commands_Interface 33 public interface LSL_BuiltIn_Commands_Interface
36 { 34 {
37
38 string State(); 35 string State();
39 36
40 double llSin(double f); 37 double llSin(double f);
@@ -404,7 +401,9 @@ namespace OpenSim.Region.ScriptEngine.Common
404 //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) 401 //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate)
405 void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); 402 void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate);
406 //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) 403 //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west)
407 void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west); 404 void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
405 LSL_Types.Vector3 bottom_south_west);
406
408 //wiki: llEjectFromLand(key pest) 407 //wiki: llEjectFromLand(key pest)
409 void llEjectFromLand(string pest); 408 void llEjectFromLand(string pest);
410 void llParseString2List(); 409 void llParseString2List();
@@ -437,7 +436,7 @@ namespace OpenSim.Region.ScriptEngine.Common
437 //wiki: double llGetRegionFPS() 436 //wiki: double llGetRegionFPS()
438 double llGetRegionFPS(); 437 double llGetRegionFPS();
439 //wiki: llParticleSystem(List<Object> rules 438 //wiki: llParticleSystem(List<Object> rules
440 void llParticleSystem(List<Object> rules); 439 void llParticleSystem(List<object> rules);
441 //wiki: llGroundRepel(double height, integer water, double tau) 440 //wiki: llGroundRepel(double height, integer water, double tau)
442 void llGroundRepel(double height, int water, double tau); 441 void llGroundRepel(double height, int water, double tau);
443 void llGiveInventoryList(); 442 void llGiveInventoryList();
@@ -548,7 +547,9 @@ namespace OpenSim.Region.ScriptEngine.Common
548 //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) 547 //wiki: list llParseStringKeepNulls( string src, list separators, list spacers )
549 List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); 548 List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers);
550 //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) 549 //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param)
551 void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param); 550 void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
551 LSL_Types.Quaternion rot, int param);
552
552 //wiki: integer llGetObjectPermMask(integer mask) 553 //wiki: integer llGetObjectPermMask(integer mask)
553 int llGetObjectPermMask(int mask); 554 int llGetObjectPermMask(int mask);
554 //wiki: llSetObjectPermMask(integer mask, integer value) 555 //wiki: llSetObjectPermMask(integer mask, integer value)
@@ -632,4 +633,4 @@ namespace OpenSim.Region.ScriptEngine.Common
632 //OpenSim functions 633 //OpenSim functions
633 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); 634 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
634 } 635 }
635} 636} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 7d69379..df3d752 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -41,11 +41,12 @@ namespace OpenSim.Region.ScriptEngine.Common
41 public double Z; 41 public double Z;
42 42
43 public Vector3(Vector3 vector) 43 public Vector3(Vector3 vector)
44 { 44 {
45 X = (float)vector.X; 45 X = (float) vector.X;
46 Y = (float)vector.Y; 46 Y = (float) vector.Y;
47 Z = (float)vector.Z; 47 Z = (float) vector.Z;
48 } 48 }
49
49 public Vector3(double x, double y, double z) 50 public Vector3(double x, double y, double z)
50 { 51 {
51 X = x; 52 X = x;
@@ -53,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Common
53 Z = z; 54 Z = z;
54 } 55 }
55 } 56 }
57
56 [Serializable] 58 [Serializable]
57 public struct Quaternion 59 public struct Quaternion
58 { 60 {
@@ -62,12 +64,13 @@ namespace OpenSim.Region.ScriptEngine.Common
62 public double R; 64 public double R;
63 65
64 public Quaternion(Quaternion Quat) 66 public Quaternion(Quaternion Quat)
65 { 67 {
66 X = (float)Quat.X; 68 X = (float) Quat.X;
67 Y = (float)Quat.Y; 69 Y = (float) Quat.Y;
68 Z = (float)Quat.Z; 70 Z = (float) Quat.Z;
69 R = (float)Quat.R; 71 R = (float) Quat.R;
70 } 72 }
73
71 public Quaternion(double x, double y, double z, double r) 74 public Quaternion(double x, double y, double z, double r)
72 { 75 {
73 X = x; 76 X = x;
@@ -75,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.Common
75 Z = z; 78 Z = z;
76 R = r; 79 R = r;
77 } 80 }
78
79 } 81 }
80 } 82 }
81} 83} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs
index 98704d5..48cf45a 100644
--- a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs
@@ -1,26 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
4 3
5// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 6// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.Common")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.Common")]
14[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
15[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] 24
25[assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")]
24 26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices;
29// Build Number 31// Build Number
30// Revision 32// Revision
31// 33//
32[assembly: AssemblyVersion("1.0.0.0")] 34
33[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly : AssemblyVersion("1.0.0.0")]
36[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index 391e3aa..bc241ce 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -27,27 +27,22 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 32using System.Reflection;
33using System.Threading;
34using System.Runtime.Remoting;
35using System.IO;
36using OpenSim.Region.Environment.Scenes;
37using OpenSim.Region.Environment.Scenes.Scripting;
38using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 33using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
39using OpenSim.Region.ScriptEngine.Common;
40using libsecondlife;
41 34
42namespace OpenSim.Region.ScriptEngine.DotNetEngine 35namespace OpenSim.Region.ScriptEngine.DotNetEngine
43{ 36{
44 public class AppDomainManager 37 public class AppDomainManager
45 { 38 {
46 private int maxScriptsPerAppDomain = 1; 39 private int maxScriptsPerAppDomain = 1;
40
47 /// <summary> 41 /// <summary>
48 /// Internal list of all AppDomains 42 /// Internal list of all AppDomains
49 /// </summary> 43 /// </summary>
50 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>(); 44 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>();
45
51 /// <summary> 46 /// <summary>
52 /// Structure to keep track of data around AppDomain 47 /// Structure to keep track of data around AppDomain
53 /// </summary> 48 /// </summary>
@@ -57,19 +52,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
57 /// The AppDomain itself 52 /// The AppDomain itself
58 /// </summary> 53 /// </summary>
59 public AppDomain CurrentAppDomain; 54 public AppDomain CurrentAppDomain;
55
60 /// <summary> 56 /// <summary>
61 /// Number of scripts loaded into AppDomain 57 /// Number of scripts loaded into AppDomain
62 /// </summary> 58 /// </summary>
63 public int ScriptsLoaded; 59 public int ScriptsLoaded;
60
64 /// <summary> 61 /// <summary>
65 /// Number of dead scripts 62 /// Number of dead scripts
66 /// </summary> 63 /// </summary>
67 public int ScriptsWaitingUnload; 64 public int ScriptsWaitingUnload;
68 } 65 }
66
69 /// <summary> 67 /// <summary>
70 /// Current AppDomain 68 /// Current AppDomain
71 /// </summary> 69 /// </summary>
72 private AppDomainStructure currentAD; 70 private AppDomainStructure currentAD;
71
73 private object getLock = new object(); // Mutex 72 private object getLock = new object(); // Mutex
74 private object freeLock = new object(); // Mutex 73 private object freeLock = new object(); // Mutex
75 74
@@ -94,22 +93,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
94 { 93 {
95 // Add it to AppDomains list and empty current 94 // Add it to AppDomains list and empty current
96 appDomains.Add(currentAD); 95 appDomains.Add(currentAD);
97 currentAD = null; 96 currentAD = null;
98 } 97 }
99 // No current 98 // No current
100 if (currentAD == null) 99 if (currentAD == null)
101 { 100 {
102 // Create a new current AppDomain 101 // Create a new current AppDomain
103 currentAD = new AppDomainStructure(); 102 currentAD = new AppDomainStructure();
104 currentAD.CurrentAppDomain = PrepareNewAppDomain(); 103 currentAD.CurrentAppDomain = PrepareNewAppDomain();
105 } 104 }
106 105
107 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); 106 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded);
108 return currentAD; 107 return currentAD;
109 } // lock 108 } // lock
110 } 109 }
111 110
112 private int AppDomainNameCount; 111 private int AppDomainNameCount;
112
113 /// <summary> 113 /// <summary>
114 /// Create and prepare a new AppDomain for scripts 114 /// Create and prepare a new AppDomain for scripts
115 /// </summary> 115 /// </summary>
@@ -130,12 +130,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
130 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; 130 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
131 131
132 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); 132 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads);
133 Console.WriteLine("Loading: " + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); 133 Console.WriteLine("Loading: " +
134 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
134 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); 135 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll"));
135 136
136 // Return the new AppDomain 137 // Return the new AppDomain
137 return AD; 138 return AD;
138
139 } 139 }
140 140
141 /// <summary> 141 /// <summary>
@@ -146,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
146 lock (freeLock) 146 lock (freeLock)
147 { 147 {
148 // Go through all 148 // Go through all
149 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) 149 foreach (AppDomainStructure ads in new ArrayList(appDomains))
150 { 150 {
151 // Don't process current AppDomain 151 // Don't process current AppDomain
152 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) 152 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
@@ -164,23 +164,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
164 // Unload 164 // Unload
165 AppDomain.Unload(ads.CurrentAppDomain); 165 AppDomain.Unload(ads.CurrentAppDomain);
166#if DEBUG 166#if DEBUG
167 Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); 167 Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) +
168 " bytes of memory");
168#endif 169#endif
169 } 170 }
170 } 171 }
171 } // foreach 172 } // foreach
172 } // lock 173 } // lock
173 } 174 }
174
175 175
176 176
177 public OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadScript(string FileName) 177 public LSL_BaseClass LoadScript(string FileName)
178 { 178 {
179 // Find next available AppDomain to put it in 179 // Find next available AppDomain to put it in
180 AppDomainStructure FreeAppDomain = GetFreeAppDomain(); 180 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
181 181
182 Console.WriteLine("Loading into AppDomain: " + FileName); 182 Console.WriteLine("Loading into AppDomain: " + FileName);
183 LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); 183 LSL_BaseClass mbrt =
184 (LSL_BaseClass)
185 FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
184 //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); 186 //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt));
185 FreeAppDomain.ScriptsLoaded++; 187 FreeAppDomain.ScriptsLoaded++;
186 188
@@ -207,7 +209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
207 } 209 }
208 210
209 // Lopp through all AppDomains 211 // Lopp through all AppDomains
210 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) 212 foreach (AppDomainStructure ads in new ArrayList(appDomains))
211 { 213 {
212 if (ads.CurrentAppDomain == ad) 214 if (ads.CurrentAppDomain == ad)
213 { 215 {
@@ -219,10 +221,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
219 } // lock 221 } // lock
220 222
221 UnloadAppDomains(); // Outsite lock, has its own GetLock 223 UnloadAppDomains(); // Outsite lock, has its own GetLock
222
223
224 } 224 }
225
226
227 } 225 }
228} 226} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
index 49ce8b8..e04a9ed 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
@@ -26,34 +26,30 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ScriptEngine.DotNetEngine 29namespace OpenSim.Region.ScriptEngine.DotNetEngine
34{ 30{
35 public static class Common 31 public static class Common
36 { 32 {
37 static public bool debug = true; 33 public static bool debug = true;
38 static public ScriptEngine mySE; 34 public static ScriptEngine mySE;
39 35
40 //public delegate void SendToDebugEventDelegate(string Message); 36 //public delegate void SendToDebugEventDelegate(string Message);
41 //public delegate void SendToLogEventDelegate(string Message); 37 //public delegate void SendToLogEventDelegate(string Message);
42 //static public event SendToDebugEventDelegate SendToDebugEvent; 38 //static public event SendToDebugEventDelegate SendToDebugEvent;
43 //static public event SendToLogEventDelegate SendToLogEvent; 39 //static public event SendToLogEventDelegate SendToLogEvent;
44 40
45 static public void SendToDebug(string Message) 41 public static void SendToDebug(string Message)
46 { 42 {
47 //if (Debug == true) 43 //if (Debug == true)
48 mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); 44 mySE.Log.Verbose("ScriptEngine", "Debug: " + Message);
49 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 45 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
50 } 46 }
51 static public void SendToLog(string Message) 47
48 public static void SendToLog(string Message)
52 { 49 {
53 //if (Debug == true) 50 //if (Debug == true)
54 mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); 51 mySE.Log.Verbose("ScriptEngine", "LOG: " + Message);
55 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 52 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
56 } 53 }
57 } 54 }
58 55} \ No newline at end of file
59}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index a2eee66..7f452e0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -27,16 +27,13 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using Microsoft.CSharp;
34using System.CodeDom.Compiler; 30using System.CodeDom.Compiler;
31using System.IO;
35using System.Reflection; 32using System.Reflection;
33using Microsoft.CSharp;
36 34
37namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
38{ 36{
39
40 public class Compiler 37 public class Compiler
41 { 38 {
42 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 39 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
@@ -45,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
45 //private ICodeCompiler icc = codeProvider.CreateCompiler(); 42 //private ICodeCompiler icc = codeProvider.CreateCompiler();
46 public string CompileFromFile(string LSOFileName) 43 public string CompileFromFile(string LSOFileName)
47 { 44 {
48 switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) 45 switch (Path.GetExtension(LSOFileName).ToLower())
49 { 46 {
50 case ".txt": 47 case ".txt":
51 case ".lsl": 48 case ".lsl":
@@ -58,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
58 throw new Exception("Unknown script type."); 55 throw new Exception("Unknown script type.");
59 } 56 }
60 } 57 }
58
61 /// <summary> 59 /// <summary>
62 /// Converts script from LSL to CS and calls CompileFromCSText 60 /// Converts script from LSL to CS and calls CompileFromCSText
63 /// </summary> 61 /// </summary>
@@ -67,13 +65,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
67 { 65 {
68 if (Script.Substring(0, 4).ToLower() == "//c#") 66 if (Script.Substring(0, 4).ToLower() == "//c#")
69 { 67 {
70 return CompileFromCSText( Script ); 68 return CompileFromCSText(Script);
71 } 69 }
72 else 70 else
73 { 71 {
74 return CompileFromCSText(LSL_Converter.Convert(Script)); 72 return CompileFromCSText(LSL_Converter.Convert(Script));
75 } 73 }
76 } 74 }
75
77 /// <summary> 76 /// <summary>
78 /// Compile CS script to .Net assembly (.dll) 77 /// Compile CS script to .Net assembly (.dll)
79 /// </summary> 78 /// </summary>
@@ -81,14 +80,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
81 /// <returns>Filename to .dll assembly</returns> 80 /// <returns>Filename to .dll assembly</returns>
82 public string CompileFromCSText(string Script) 81 public string CompileFromCSText(string Script)
83 { 82 {
84
85
86 // Output assembly name 83 // Output assembly name
87 scriptCompileCounter++; 84 scriptCompileCounter++;
88 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); 85 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
89 try 86 try
90 { 87 {
91 System.IO.File.Delete(OutFile); 88 File.Delete(OutFile);
92 } 89 }
93 catch (Exception e) 90 catch (Exception e)
94 { 91 {
@@ -99,12 +96,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
99 // DEBUG - write source to disk 96 // DEBUG - write source to disk
100 try 97 try
101 { 98 {
102 File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); 99 File.WriteAllText(
100 Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script);
101 }
102 catch
103 {
103 } 104 }
104 catch { }
105 105
106 // Do actual compile 106 // Do actual compile
107 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); 107 CompilerParameters parameters = new CompilerParameters();
108 parameters.IncludeDebugInformation = true; 108 parameters.IncludeDebugInformation = true;
109 // Add all available assemblies 109 // Add all available assemblies
110 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) 110 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
@@ -114,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
114 } 114 }
115 115
116 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 116 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
117 string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); 117 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
118 //Console.WriteLine("Assembly location: " + rootPath); 118 //Console.WriteLine("Assembly location: " + rootPath);
119 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); 119 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
120 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); 120 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll"));
121 121
122 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); 122 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
123 parameters.GenerateExecutable = false; 123 parameters.GenerateExecutable = false;
124 parameters.OutputAssembly = OutFile; 124 parameters.OutputAssembly = OutFile;
@@ -129,13 +129,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
129 // TODO: Return errors to user somehow 129 // TODO: Return errors to user somehow
130 if (results.Errors.Count > 0) 130 if (results.Errors.Count > 0)
131 { 131 {
132
133 string errtext = ""; 132 string errtext = "";
134 foreach (CompilerError CompErr in results.Errors) 133 foreach (CompilerError CompErr in results.Errors)
135 { 134 {
136 errtext += "Line number " + (CompErr.Line - 1) + 135 errtext += "Line number " + (CompErr.Line - 1) +
137 ", Error Number: " + CompErr.ErrorNumber + 136 ", Error Number: " + CompErr.ErrorNumber +
138 ", '" + CompErr.ErrorText + "'\r\n"; 137 ", '" + CompErr.ErrorText + "'\r\n";
139 } 138 }
140 throw new Exception(errtext); 139 throw new Exception(errtext);
141 } 140 }
@@ -143,6 +142,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
143 142
144 return OutFile; 143 return OutFile;
145 } 144 }
146
147 } 145 }
148} 146} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 18eeaa3..0c28617 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -26,9 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using System.Text.RegularExpressions; 30using System.Text.RegularExpressions;
33 31
34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 32namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
@@ -51,9 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
51 dataTypes.Add("rotation", "LSL_Types.Quaternion"); 49 dataTypes.Add("rotation", "LSL_Types.Quaternion");
52 dataTypes.Add("list", "list"); 50 dataTypes.Add("list", "list");
53 dataTypes.Add("null", "null"); 51 dataTypes.Add("null", "null");
54
55 } 52 }
56 53
57 public string Convert(string Script) 54 public string Convert(string Script)
58 { 55 {
59 string Return = ""; 56 string Return = "";
@@ -81,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
81 int quote_replaced_count = 0; 78 int quote_replaced_count = 0;
82 for (int p = 0; p < Script.Length; p++) 79 for (int p = 0; p < Script.Length; p++)
83 { 80 {
84
85 C = Script.Substring(p, 1); 81 C = Script.Substring(p, 1);
86 while (true) 82 while (true)
87 { 83 {
@@ -99,10 +95,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
99 if (quote == "") 95 if (quote == "")
100 { 96 {
101 // We didn't replace quote, probably because of empty string? 97 // We didn't replace quote, probably because of empty string?
102 _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); 98 _Script += quote_replacement_string +
99 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
103 } 100 }
104 // We just left a quote 101 // We just left a quote
105 quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); 102 quotes.Add(
103 quote_replacement_string +
104 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
106 quote = ""; 105 quote = "";
107 } 106 }
108 break; 107 break;
@@ -112,7 +111,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
112 { 111 {
113 // We are not inside a quote 112 // We are not inside a quote
114 quote_replaced = false; 113 quote_replaced = false;
115
116 } 114 }
117 else 115 else
118 { 116 {
@@ -120,7 +118,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
120 if (!quote_replaced) 118 if (!quote_replaced)
121 { 119 {
122 // Replace quote 120 // Replace quote
123 _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); 121 _Script += quote_replacement_string +
122 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
124 quote_replaced = true; 123 quote_replaced = true;
125 } 124 }
126 quote += C; 125 quote += C;
@@ -141,7 +140,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
141 // 140 //
142 141
143 142
144
145 // 143 //
146 // PROCESS STATES 144 // PROCESS STATES
147 // Remove state definitions and add state names to start of each event within state 145 // Remove state definitions and add state names to start of each event within state
@@ -170,7 +168,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
170 if (ilevel == 1 && lastlevel == 0) 168 if (ilevel == 1 && lastlevel == 0)
171 { 169 {
172 // 0 => 1: Get last 170 // 0 => 1: Get last
173 Match m = Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 171 Match m =
172 Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{",
173 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
174 174
175 in_state = false; 175 in_state = false;
176 if (m.Success) 176 if (m.Success)
@@ -179,7 +179,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
179 in_state = true; 179 in_state = true;
180 current_statename = m.Groups[1].Captures[0].Value; 180 current_statename = m.Groups[1].Captures[0].Value;
181 //Console.WriteLine("Current statename: " + current_statename); 181 //Console.WriteLine("Current statename: " + current_statename);
182 cache = Regex.Replace(cache, @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", "${s1}${s2}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 182 cache =
183 Regex.Replace(cache,
184 @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){",
185 "${s1}${s2}",
186 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
183 } 187 }
184 ret += cache; 188 ret += cache;
185 cache = ""; 189 cache = "";
@@ -196,7 +200,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
196 // void dataserver(key query_id, string data) { 200 // void dataserver(key query_id, string data) {
197 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 201 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
198 //Console.WriteLine("Replacing using statename: " + current_statename); 202 //Console.WriteLine("Replacing using statename: " + current_statename);
199 cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 203 cache =
204 Regex.Replace(cache,
205 @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)",
206 @"$1public " + current_statename + "_event_$2",
207 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
200 } 208 }
201 209
202 ret += cache; 210 ret += cache;
@@ -216,32 +224,48 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
216 ret = ""; 224 ret = "";
217 225
218 226
219
220 foreach (string key in dataTypes.Keys) 227 foreach (string key in dataTypes.Keys)
221 { 228 {
222 string val; 229 string val;
223 dataTypes.TryGetValue(key, out val); 230 dataTypes.TryGetValue(key, out val);
224 231
225 // Replace CAST - (integer) with (int) 232 // Replace CAST - (integer) with (int)
226 Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); 233 Script =
234 Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")",
235 RegexOptions.Compiled | RegexOptions.Multiline);
227 // Replace return types and function variables - integer a() and f(integer a, integer a) 236 // Replace return types and function variables - integer a() and f(integer a, integer a)
228 Script = Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", RegexOptions.Compiled | RegexOptions.Multiline); 237 Script =
238 Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3",
239 RegexOptions.Compiled | RegexOptions.Multiline);
229 } 240 }
230 241
231 // Add "void" in front of functions that needs it 242 // Add "void" in front of functions that needs it
232 Script = Regex.Replace(Script, @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 243 Script =
244 Regex.Replace(Script,
245 @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)",
246 @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
233 247
234 // Replace <x,y,z> and <x,y,z,r> 248 // Replace <x,y,z> and <x,y,z,r>
235 Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 249 Script =
236 Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 250 Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)",
251 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
252 Script =
253 Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)",
254 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
237 255
238 // Replace List []'s 256 // Replace List []'s
239 Script = Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 257 Script =
258 Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)",
259 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
240 260
241 261
242 // Replace (string) to .ToString() // 262 // Replace (string) to .ToString() //
243 Script = Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 263 Script =
244 Script = Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 264 Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()",
265 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
266 Script =
267 Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)",
268 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
245 269
246 270
247 // REPLACE BACK QUOTES 271 // REPLACE BACK QUOTES
@@ -256,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
256 // Add namespace, class name and inheritance 280 // Add namespace, class name and inheritance
257 281
258 Return = "" + 282 Return = "" +
259 "using OpenSim.Region.ScriptEngine.Common;"; 283 "using OpenSim.Region.ScriptEngine.Common;";
260 //"using System; " + 284 //"using System; " +
261 //"using System.Collections.Generic; " + 285 //"using System.Collections.Generic; " +
262 //"using System.Text; " + 286 //"using System.Text; " +
@@ -278,17 +302,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
278 302
279 303
280 Return += "" + 304 Return += "" +
281 "namespace SecondLife { "; 305 "namespace SecondLife { ";
282 Return += "" + 306 Return += "" +
283 //"[Serializable] " + 307 //"[Serializable] " +
284 "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; 308 "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { ";
285 Return += @"public Script() { } "; 309 Return += @"public Script() { } ";
286 Return += Script; 310 Return += Script;
287 Return += "} }\r\n"; 311 Return += "} }\r\n";
288 312
289 return Return; 313 return Return;
290 } 314 }
291
292
293 } 315 }
294} 316} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index ea05efc..f2774d6 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -28,12 +28,9 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
33using OpenSim.Region.ScriptEngine.Common;
34using System.Threading;
35using System.Reflection;
36using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
32using System.Threading;
33using OpenSim.Region.ScriptEngine.Common;
37using integer = System.Int32; 34using integer = System.Int32;
38using key = System.String; 35using key = System.String;
39using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; 36using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3;
@@ -44,13 +41,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
44 //[Serializable] 41 //[Serializable]
45 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript 42 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
46 { 43 {
47
48 // Object never expires 44 // Object never expires
49 public override Object InitializeLifetimeService() 45 public override Object InitializeLifetimeService()
50 { 46 {
51 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); 47 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()");
52 // return null; 48 // return null;
53 ILease lease = (ILease)base.InitializeLifetimeService(); 49 ILease lease = (ILease) base.InitializeLifetimeService();
54 50
55 if (lease.CurrentState == LeaseState.Initial) 51 if (lease.CurrentState == LeaseState.Initial)
56 { 52 {
@@ -63,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
63 59
64 60
65 private Executor m_Exec; 61 private Executor m_Exec;
62
66 public Executor Exec 63 public Executor Exec
67 { 64 {
68 get 65 get
@@ -79,6 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
79 public LSL_BaseClass() 76 public LSL_BaseClass()
80 { 77 {
81 } 78 }
79
82 public string State() 80 public string State()
83 { 81 {
84 return m_LSL_Functions.State(); 82 return m_LSL_Functions.State();
@@ -94,410 +92,1724 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
94 // Get this AppDomain's settings and display some of them. 92 // Get this AppDomain's settings and display some of them.
95 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; 93 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation;
96 Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", 94 Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}",
97 ads.ApplicationName, 95 ads.ApplicationName,
98 ads.ApplicationBase, 96 ads.ApplicationBase,
99 ads.ConfigurationFile 97 ads.ConfigurationFile
100 ); 98 );
101 99
102 // Display the name of the calling AppDomain and the name 100 // Display the name of the calling AppDomain and the name
103 // of the second domain. 101 // of the second domain.
104 // NOTE: The application's thread has transitioned between 102 // NOTE: The application's thread has transitioned between
105 // AppDomains. 103 // AppDomains.
106 Console.WriteLine("Calling to '{0}'.", 104 Console.WriteLine("Calling to '{0}'.",
107 Thread.GetDomain().FriendlyName 105 Thread.GetDomain().FriendlyName
108 ); 106 );
109 107
110 return; 108 return;
111 } 109 }
112 110
113 111
114
115 // 112 //
116 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 113 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
117 // 114 //
118 // They are only forwarders to LSL_BuiltIn_Commands.cs 115 // They are only forwarders to LSL_BuiltIn_Commands.cs
119 // 116 //
120 public double llSin(double f) { return m_LSL_Functions.llSin(f); } 117 public double llSin(double f)
121 public double llCos(double f) { return m_LSL_Functions.llCos(f); } 118 {
122 public double llTan(double f) { return m_LSL_Functions.llTan(f); } 119 return m_LSL_Functions.llSin(f);
123 public double llAtan2(double x, double y) { return m_LSL_Functions.llAtan2(x, y); } 120 }
124 public double llSqrt(double f) { return m_LSL_Functions.llSqrt(f); } 121
125 public double llPow(double fbase, double fexponent) { return m_LSL_Functions.llPow(fbase, fexponent); } 122 public double llCos(double f)
126 public int llAbs(int i) { return m_LSL_Functions.llAbs(i); } 123 {
127 public double llFabs(double f) { return m_LSL_Functions.llFabs(f); } 124 return m_LSL_Functions.llCos(f);
128 public double llFrand(double mag) { return m_LSL_Functions.llFrand(mag); } 125 }
129 public int llFloor(double f) { return m_LSL_Functions.llFloor(f); } 126
130 public int llCeil(double f) { return m_LSL_Functions.llCeil(f); } 127 public double llTan(double f)
131 public int llRound(double f) { return m_LSL_Functions.llRound(f); } 128 {
132 public double llVecMag(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecMag(v); } 129 return m_LSL_Functions.llTan(f);
133 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecNorm(v); } 130 }
134 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) { return m_LSL_Functions.llVecDist(a, b); } 131
135 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Euler(r); } 132 public double llAtan2(double x, double y)
136 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) { return m_LSL_Functions.llEuler2Rot(v); } 133 {
137 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return m_LSL_Functions.llAxes2Rot(fwd, left, up); } 134 return m_LSL_Functions.llAtan2(x, y);
138 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Fwd(r); } 135 }
139 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Left(r); } 136
140 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Up(r); } 137 public double llSqrt(double f)
141 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return m_LSL_Functions.llRotBetween(start, end); } 138 {
142 public void llWhisper(int channelID, string text) { m_LSL_Functions.llWhisper(channelID, text); } 139 return m_LSL_Functions.llSqrt(f);
143 public void llSay(int channelID, string text) { m_LSL_Functions.llSay(channelID, text); } 140 }
141
142 public double llPow(double fbase, double fexponent)
143 {
144 return m_LSL_Functions.llPow(fbase, fexponent);
145 }
146
147 public int llAbs(int i)
148 {
149 return m_LSL_Functions.llAbs(i);
150 }
151
152 public double llFabs(double f)
153 {
154 return m_LSL_Functions.llFabs(f);
155 }
156
157 public double llFrand(double mag)
158 {
159 return m_LSL_Functions.llFrand(mag);
160 }
161
162 public int llFloor(double f)
163 {
164 return m_LSL_Functions.llFloor(f);
165 }
166
167 public int llCeil(double f)
168 {
169 return m_LSL_Functions.llCeil(f);
170 }
171
172 public int llRound(double f)
173 {
174 return m_LSL_Functions.llRound(f);
175 }
176
177 public double llVecMag(vector v)
178 {
179 return m_LSL_Functions.llVecMag(v);
180 }
181
182 public vector llVecNorm(vector v)
183 {
184 return m_LSL_Functions.llVecNorm(v);
185 }
186
187 public double llVecDist(vector a, vector b)
188 {
189 return m_LSL_Functions.llVecDist(a, b);
190 }
191
192 public vector llRot2Euler(rotation r)
193 {
194 return m_LSL_Functions.llRot2Euler(r);
195 }
196
197 public rotation llEuler2Rot(vector v)
198 {
199 return m_LSL_Functions.llEuler2Rot(v);
200 }
201
202 public rotation llAxes2Rot(vector fwd, vector left, vector up)
203 {
204 return m_LSL_Functions.llAxes2Rot(fwd, left, up);
205 }
206
207 public vector llRot2Fwd(rotation r)
208 {
209 return m_LSL_Functions.llRot2Fwd(r);
210 }
211
212 public vector llRot2Left(rotation r)
213 {
214 return m_LSL_Functions.llRot2Left(r);
215 }
216
217 public vector llRot2Up(rotation r)
218 {
219 return m_LSL_Functions.llRot2Up(r);
220 }
221
222 public rotation llRotBetween(vector start, vector end)
223 {
224 return m_LSL_Functions.llRotBetween(start, end);
225 }
226
227 public void llWhisper(int channelID, string text)
228 {
229 m_LSL_Functions.llWhisper(channelID, text);
230 }
231
232 public void llSay(int channelID, string text)
233 {
234 m_LSL_Functions.llSay(channelID, text);
235 }
236
144 // 237 //
145 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 238 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
146 // 239 //
147 public void llShout(int channelID, string text) { m_LSL_Functions.llShout(channelID, text); } 240 public void llShout(int channelID, string text)
148 public int llListen(int channelID, string name, string ID, string msg) { return m_LSL_Functions.llListen(channelID, name, ID, msg); } 241 {
149 public void llListenControl(int number, int active) { m_LSL_Functions.llListenControl(number, active); } 242 m_LSL_Functions.llShout(channelID, text);
150 public void llListenRemove(int number) { m_LSL_Functions.llListenRemove(number); } 243 }
151 public void llSensor(string name, string id, int type, double range, double arc) { m_LSL_Functions.llSensor(name, id, type, range, arc); } 244
152 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); } 245 public int llListen(int channelID, string name, string ID, string msg)
153 public void llSensorRemove() { m_LSL_Functions.llSensorRemove(); } 246 {
154 public string llDetectedName(int number) { return m_LSL_Functions.llDetectedName(number); } 247 return m_LSL_Functions.llListen(channelID, name, ID, msg);
155 public string llDetectedKey(int number) { return m_LSL_Functions.llDetectedKey(number); } 248 }
156 public string llDetectedOwner(int number) { return m_LSL_Functions.llDetectedOwner(number); } 249
157 public int llDetectedType(int number) { return m_LSL_Functions.llDetectedType(number); } 250 public void llListenControl(int number, int active)
158 public LSL_Types.Vector3 llDetectedPos(int number) { return m_LSL_Functions.llDetectedPos(number); } 251 {
159 public LSL_Types.Vector3 llDetectedVel(int number) { return m_LSL_Functions.llDetectedVel(number); } 252 m_LSL_Functions.llListenControl(number, active);
160 public LSL_Types.Vector3 llDetectedGrab(int number) { return m_LSL_Functions.llDetectedGrab(number); } 253 }
161 public LSL_Types.Quaternion llDetectedRot(int number) { return m_LSL_Functions.llDetectedRot(number); } 254
162 public int llDetectedGroup(int number) { return m_LSL_Functions.llDetectedGroup(number); } 255 public void llListenRemove(int number)
163 public int llDetectedLinkNumber(int number) { return m_LSL_Functions.llDetectedLinkNumber(number); } 256 {
257 m_LSL_Functions.llListenRemove(number);
258 }
259
260 public void llSensor(string name, string id, int type, double range, double arc)
261 {
262 m_LSL_Functions.llSensor(name, id, type, range, arc);
263 }
264
265 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
266 {
267 m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate);
268 }
269
270 public void llSensorRemove()
271 {
272 m_LSL_Functions.llSensorRemove();
273 }
274
275 public string llDetectedName(int number)
276 {
277 return m_LSL_Functions.llDetectedName(number);
278 }
279
280 public string llDetectedKey(int number)
281 {
282 return m_LSL_Functions.llDetectedKey(number);
283 }
284
285 public string llDetectedOwner(int number)
286 {
287 return m_LSL_Functions.llDetectedOwner(number);
288 }
289
290 public int llDetectedType(int number)
291 {
292 return m_LSL_Functions.llDetectedType(number);
293 }
294
295 public vector llDetectedPos(int number)
296 {
297 return m_LSL_Functions.llDetectedPos(number);
298 }
299
300 public vector llDetectedVel(int number)
301 {
302 return m_LSL_Functions.llDetectedVel(number);
303 }
304
305 public vector llDetectedGrab(int number)
306 {
307 return m_LSL_Functions.llDetectedGrab(number);
308 }
309
310 public rotation llDetectedRot(int number)
311 {
312 return m_LSL_Functions.llDetectedRot(number);
313 }
314
315 public int llDetectedGroup(int number)
316 {
317 return m_LSL_Functions.llDetectedGroup(number);
318 }
319
320 public int llDetectedLinkNumber(int number)
321 {
322 return m_LSL_Functions.llDetectedLinkNumber(number);
323 }
324
164 // 325 //
165 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 326 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
166 // 327 //
167 public void llDie() { m_LSL_Functions.llDie(); } 328 public void llDie()
168 public double llGround(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGround(offset); } 329 {
169 public double llCloud(LSL_Types.Vector3 offset) { return m_LSL_Functions.llCloud(offset); } 330 m_LSL_Functions.llDie();
170 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWind(offset); } 331 }
171 public void llSetStatus(int status, int value) { m_LSL_Functions.llSetStatus(status, value); } 332
172 public int llGetStatus(int status) { return m_LSL_Functions.llGetStatus(status); } 333 public double llGround(vector offset)
173 public void llSetScale(LSL_Types.Vector3 scale) { m_LSL_Functions.llSetScale(scale); } 334 {
174 public LSL_Types.Vector3 llGetScale() { return m_LSL_Functions.llGetScale(); } 335 return m_LSL_Functions.llGround(offset);
175 public void llSetColor(LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetColor(color, face); } 336 }
176 public double llGetAlpha(int face) { return m_LSL_Functions.llGetAlpha(face); } 337
177 public void llSetAlpha(double alpha, int face) { m_LSL_Functions.llSetAlpha(alpha, face); } 338 public double llCloud(vector offset)
178 public LSL_Types.Vector3 llGetColor(int face) { return m_LSL_Functions.llGetColor(face); } 339 {
179 public void llSetTexture(string texture, int face) { m_LSL_Functions.llSetTexture(texture, face); } 340 return m_LSL_Functions.llCloud(offset);
180 public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); } 341 }
181 public void llOffsetTexture(double u, double v, int face) { m_LSL_Functions.llOffsetTexture(u, v, face); } 342
182 public void llRotateTexture(double rotation, int face) { m_LSL_Functions.llRotateTexture(rotation, face); } 343 public vector llWind(vector offset)
183 public string llGetTexture(int face) { return m_LSL_Functions.llGetTexture(face); } 344 {
345 return m_LSL_Functions.llWind(offset);
346 }
347
348 public void llSetStatus(int status, int value)
349 {
350 m_LSL_Functions.llSetStatus(status, value);
351 }
352
353 public int llGetStatus(int status)
354 {
355 return m_LSL_Functions.llGetStatus(status);
356 }
357
358 public void llSetScale(vector scale)
359 {
360 m_LSL_Functions.llSetScale(scale);
361 }
362
363 public vector llGetScale()
364 {
365 return m_LSL_Functions.llGetScale();
366 }
367
368 public void llSetColor(vector color, int face)
369 {
370 m_LSL_Functions.llSetColor(color, face);
371 }
372
373 public double llGetAlpha(int face)
374 {
375 return m_LSL_Functions.llGetAlpha(face);
376 }
377
378 public void llSetAlpha(double alpha, int face)
379 {
380 m_LSL_Functions.llSetAlpha(alpha, face);
381 }
382
383 public vector llGetColor(int face)
384 {
385 return m_LSL_Functions.llGetColor(face);
386 }
387
388 public void llSetTexture(string texture, int face)
389 {
390 m_LSL_Functions.llSetTexture(texture, face);
391 }
392
393 public void llScaleTexture(double u, double v, int face)
394 {
395 m_LSL_Functions.llScaleTexture(u, v, face);
396 }
397
398 public void llOffsetTexture(double u, double v, int face)
399 {
400 m_LSL_Functions.llOffsetTexture(u, v, face);
401 }
402
403 public void llRotateTexture(double rotation, int face)
404 {
405 m_LSL_Functions.llRotateTexture(rotation, face);
406 }
407
408 public string llGetTexture(int face)
409 {
410 return m_LSL_Functions.llGetTexture(face);
411 }
412
184 // 413 //
185 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 414 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
186 // 415 //
187 public void llSetPos(LSL_Types.Vector3 pos) { m_LSL_Functions.llSetPos(pos); } 416 public void llSetPos(vector pos)
188 public LSL_Types.Vector3 llGetPos() { return m_LSL_Functions.llGetPos(); } 417 {
189 public LSL_Types.Vector3 llGetLocalPos() { return m_LSL_Functions.llGetLocalPos(); } 418 m_LSL_Functions.llSetPos(pos);
190 public void llSetRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetRot(rot); } 419 }
191 public LSL_Types.Quaternion llGetRot() { return m_LSL_Functions.llGetRot(); } 420
192 public LSL_Types.Quaternion llGetLocalRot() { return m_LSL_Functions.llGetLocalRot(); } 421 public vector llGetPos()
193 public void llSetForce(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llSetForce(force, local); } 422 {
194 public LSL_Types.Vector3 llGetForce() { return m_LSL_Functions.llGetForce(); } 423 return m_LSL_Functions.llGetPos();
195 public int llTarget(LSL_Types.Vector3 position, double range) { return m_LSL_Functions.llTarget(position, range); } 424 }
196 public void llTargetRemove(int number) { m_LSL_Functions.llTargetRemove(number); } 425
197 public int llRotTarget(LSL_Types.Quaternion rot, double error) { return m_LSL_Functions.llRotTarget(rot, error); } 426 public vector llGetLocalPos()
198 public void llRotTargetRemove(int number) { m_LSL_Functions.llRotTargetRemove(number); } 427 {
199 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { m_LSL_Functions.llMoveToTarget(target, tau); } 428 return m_LSL_Functions.llGetLocalPos();
200 public void llStopMoveToTarget() { m_LSL_Functions.llStopMoveToTarget(); } 429 }
201 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyImpulse(force, local); } 430
431 public void llSetRot(rotation rot)
432 {
433 m_LSL_Functions.llSetRot(rot);
434 }
435
436 public rotation llGetRot()
437 {
438 return m_LSL_Functions.llGetRot();
439 }
440
441 public rotation llGetLocalRot()
442 {
443 return m_LSL_Functions.llGetLocalRot();
444 }
445
446 public void llSetForce(vector force, int local)
447 {
448 m_LSL_Functions.llSetForce(force, local);
449 }
450
451 public vector llGetForce()
452 {
453 return m_LSL_Functions.llGetForce();
454 }
455
456 public int llTarget(vector position, double range)
457 {
458 return m_LSL_Functions.llTarget(position, range);
459 }
460
461 public void llTargetRemove(int number)
462 {
463 m_LSL_Functions.llTargetRemove(number);
464 }
465
466 public int llRotTarget(rotation rot, double error)
467 {
468 return m_LSL_Functions.llRotTarget(rot, error);
469 }
470
471 public void llRotTargetRemove(int number)
472 {
473 m_LSL_Functions.llRotTargetRemove(number);
474 }
475
476 public void llMoveToTarget(vector target, double tau)
477 {
478 m_LSL_Functions.llMoveToTarget(target, tau);
479 }
480
481 public void llStopMoveToTarget()
482 {
483 m_LSL_Functions.llStopMoveToTarget();
484 }
485
486 public void llApplyImpulse(vector force, int local)
487 {
488 m_LSL_Functions.llApplyImpulse(force, local);
489 }
490
202 // 491 //
203 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 492 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
204 // 493 //
205 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyRotationalImpulse(force, local); } 494 public void llApplyRotationalImpulse(vector force, int local)
206 public void llSetTorque(LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetTorque(torque, local); } 495 {
207 public LSL_Types.Vector3 llGetTorque() { return m_LSL_Functions.llGetTorque(); } 496 m_LSL_Functions.llApplyRotationalImpulse(force, local);
208 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetForceAndTorque(force, torque, local); } 497 }
209 public LSL_Types.Vector3 llGetVel() { return m_LSL_Functions.llGetVel(); } 498
210 public LSL_Types.Vector3 llGetAccel() { return m_LSL_Functions.llGetAccel(); } 499 public void llSetTorque(vector torque, int local)
211 public LSL_Types.Vector3 llGetOmega() { return m_LSL_Functions.llGetOmega(); } 500 {
212 public double llGetTimeOfDay() { return m_LSL_Functions.llGetTimeOfDay(); } 501 m_LSL_Functions.llSetTorque(torque, local);
213 public double llGetWallclock() { return m_LSL_Functions.llGetWallclock(); } 502 }
214 public double llGetTime() { return m_LSL_Functions.llGetTime(); } 503
215 public void llResetTime() { m_LSL_Functions.llResetTime(); } 504 public vector llGetTorque()
216 public double llGetAndResetTime() { return m_LSL_Functions.llGetAndResetTime(); } 505 {
217 public void llSound() { m_LSL_Functions.llSound(); } 506 return m_LSL_Functions.llGetTorque();
218 public void llPlaySound(string sound, double volume) { m_LSL_Functions.llPlaySound(sound, volume); } 507 }
219 public void llLoopSound(string sound, double volume) { m_LSL_Functions.llLoopSound(sound, volume); } 508
220 public void llLoopSoundMaster(string sound, double volume) { m_LSL_Functions.llLoopSoundMaster(sound, volume); } 509 public void llSetForceAndTorque(vector force, vector torque, int local)
221 public void llLoopSoundSlave(string sound, double volume) { m_LSL_Functions.llLoopSoundSlave(sound, volume); } 510 {
222 public void llPlaySoundSlave(string sound, double volume) { m_LSL_Functions.llPlaySoundSlave(sound, volume); } 511 m_LSL_Functions.llSetForceAndTorque(force, torque, local);
512 }
513
514 public vector llGetVel()
515 {
516 return m_LSL_Functions.llGetVel();
517 }
518
519 public vector llGetAccel()
520 {
521 return m_LSL_Functions.llGetAccel();
522 }
523
524 public vector llGetOmega()
525 {
526 return m_LSL_Functions.llGetOmega();
527 }
528
529 public double llGetTimeOfDay()
530 {
531 return m_LSL_Functions.llGetTimeOfDay();
532 }
533
534 public double llGetWallclock()
535 {
536 return m_LSL_Functions.llGetWallclock();
537 }
538
539 public double llGetTime()
540 {
541 return m_LSL_Functions.llGetTime();
542 }
543
544 public void llResetTime()
545 {
546 m_LSL_Functions.llResetTime();
547 }
548
549 public double llGetAndResetTime()
550 {
551 return m_LSL_Functions.llGetAndResetTime();
552 }
553
554 public void llSound()
555 {
556 m_LSL_Functions.llSound();
557 }
558
559 public void llPlaySound(string sound, double volume)
560 {
561 m_LSL_Functions.llPlaySound(sound, volume);
562 }
563
564 public void llLoopSound(string sound, double volume)
565 {
566 m_LSL_Functions.llLoopSound(sound, volume);
567 }
568
569 public void llLoopSoundMaster(string sound, double volume)
570 {
571 m_LSL_Functions.llLoopSoundMaster(sound, volume);
572 }
573
574 public void llLoopSoundSlave(string sound, double volume)
575 {
576 m_LSL_Functions.llLoopSoundSlave(sound, volume);
577 }
578
579 public void llPlaySoundSlave(string sound, double volume)
580 {
581 m_LSL_Functions.llPlaySoundSlave(sound, volume);
582 }
583
223 // 584 //
224 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 585 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
225 // 586 //
226 public void llTriggerSound(string sound, double volume) { m_LSL_Functions.llTriggerSound(sound, volume); } 587 public void llTriggerSound(string sound, double volume)
227 public void llStopSound() { m_LSL_Functions.llStopSound(); } 588 {
228 public void llPreloadSound(string sound) { m_LSL_Functions.llPreloadSound(sound); } 589 m_LSL_Functions.llTriggerSound(sound, volume);
229 public string llGetSubString(string src, int start, int end) { return m_LSL_Functions.llGetSubString(src, start, end); } 590 }
230 public string llDeleteSubString(string src, int start, int end) { return m_LSL_Functions.llDeleteSubString(src, start, end); } 591
231 public string llInsertString(string dst, int position, string src) { return m_LSL_Functions.llInsertString(dst, position, src); } 592 public void llStopSound()
232 public string llToUpper(string source) { return m_LSL_Functions.llToUpper(source); } 593 {
233 public string llToLower(string source) { return m_LSL_Functions.llToLower(source); } 594 m_LSL_Functions.llStopSound();
234 public int llGiveMoney(string destination, int amount) { return m_LSL_Functions.llGiveMoney(destination, amount); } 595 }
235 public void llMakeExplosion() { m_LSL_Functions.llMakeExplosion(); } 596
236 public void llMakeFountain() { m_LSL_Functions.llMakeFountain(); } 597 public void llPreloadSound(string sound)
237 public void llMakeSmoke() { m_LSL_Functions.llMakeSmoke(); } 598 {
238 public void llMakeFire() { m_LSL_Functions.llMakeFire(); } 599 m_LSL_Functions.llPreloadSound(sound);
239 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezObject(inventory, pos, rot, param); } 600 }
240 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { m_LSL_Functions.llLookAt(target, strength, damping); } 601
241 public void llStopLookAt() { m_LSL_Functions.llStopLookAt(); } 602 public string llGetSubString(string src, int start, int end)
242 public void llSetTimerEvent(double sec) { m_LSL_Functions.llSetTimerEvent(sec); } 603 {
243 public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); } 604 return m_LSL_Functions.llGetSubString(src, start, end);
605 }
606
607 public string llDeleteSubString(string src, int start, int end)
608 {
609 return m_LSL_Functions.llDeleteSubString(src, start, end);
610 }
611
612 public string llInsertString(string dst, int position, string src)
613 {
614 return m_LSL_Functions.llInsertString(dst, position, src);
615 }
616
617 public string llToUpper(string source)
618 {
619 return m_LSL_Functions.llToUpper(source);
620 }
621
622 public string llToLower(string source)
623 {
624 return m_LSL_Functions.llToLower(source);
625 }
626
627 public int llGiveMoney(string destination, int amount)
628 {
629 return m_LSL_Functions.llGiveMoney(destination, amount);
630 }
631
632 public void llMakeExplosion()
633 {
634 m_LSL_Functions.llMakeExplosion();
635 }
636
637 public void llMakeFountain()
638 {
639 m_LSL_Functions.llMakeFountain();
640 }
641
642 public void llMakeSmoke()
643 {
644 m_LSL_Functions.llMakeSmoke();
645 }
646
647 public void llMakeFire()
648 {
649 m_LSL_Functions.llMakeFire();
650 }
651
652 public void llRezObject(string inventory, vector pos, rotation rot, int param)
653 {
654 m_LSL_Functions.llRezObject(inventory, pos, rot, param);
655 }
656
657 public void llLookAt(vector target, double strength, double damping)
658 {
659 m_LSL_Functions.llLookAt(target, strength, damping);
660 }
661
662 public void llStopLookAt()
663 {
664 m_LSL_Functions.llStopLookAt();
665 }
666
667 public void llSetTimerEvent(double sec)
668 {
669 m_LSL_Functions.llSetTimerEvent(sec);
670 }
671
672 public void llSleep(double sec)
673 {
674 m_LSL_Functions.llSleep(sec);
675 }
676
244 // 677 //
245 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 678 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
246 // 679 //
247 public double llGetMass() { return m_LSL_Functions.llGetMass(); } 680 public double llGetMass()
248 public void llCollisionFilter(string name, string id, int accept) { m_LSL_Functions.llCollisionFilter(name, id, accept); } 681 {
249 public void llTakeControls(int controls, int accept, int pass_on) { m_LSL_Functions.llTakeControls(controls, accept, pass_on); } 682 return m_LSL_Functions.llGetMass();
250 public void llReleaseControls() { m_LSL_Functions.llReleaseControls(); } 683 }
251 public void llAttachToAvatar(int attachment) { m_LSL_Functions.llAttachToAvatar(attachment); } 684
252 public void llDetachFromAvatar() { m_LSL_Functions.llDetachFromAvatar(); } 685 public void llCollisionFilter(string name, string id, int accept)
253 public void llTakeCamera() { m_LSL_Functions.llTakeCamera(); } 686 {
254 public void llReleaseCamera() { m_LSL_Functions.llReleaseCamera(); } 687 m_LSL_Functions.llCollisionFilter(name, id, accept);
255 public string llGetOwner() { return m_LSL_Functions.llGetOwner(); } 688 }
256 public void llInstantMessage(string user, string message) { m_LSL_Functions.llInstantMessage(user, message); } 689
257 public void llEmail(string address, string subject, string message) { m_LSL_Functions.llEmail(address, subject, message); } 690 public void llTakeControls(int controls, int accept, int pass_on)
258 public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); } 691 {
259 public string llGetKey() { return m_LSL_Functions.llGetKey(); } 692 m_LSL_Functions.llTakeControls(controls, accept, pass_on);
260 public void llSetBuoyancy(double buoyancy) { m_LSL_Functions.llSetBuoyancy(buoyancy); } 693 }
261 public void llSetHoverHeight(double height, int water, double tau) { m_LSL_Functions.llSetHoverHeight(height, water, tau); } 694
262 public void llStopHover() { m_LSL_Functions.llStopHover(); } 695 public void llReleaseControls()
263 public void llMinEventDelay(double delay) { m_LSL_Functions.llMinEventDelay(delay); } 696 {
264 public void llSoundPreload() { m_LSL_Functions.llSoundPreload(); } 697 m_LSL_Functions.llReleaseControls();
265 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { m_LSL_Functions.llRotLookAt(target, strength, damping); } 698 }
699
700 public void llAttachToAvatar(int attachment)
701 {
702 m_LSL_Functions.llAttachToAvatar(attachment);
703 }
704
705 public void llDetachFromAvatar()
706 {
707 m_LSL_Functions.llDetachFromAvatar();
708 }
709
710 public void llTakeCamera()
711 {
712 m_LSL_Functions.llTakeCamera();
713 }
714
715 public void llReleaseCamera()
716 {
717 m_LSL_Functions.llReleaseCamera();
718 }
719
720 public string llGetOwner()
721 {
722 return m_LSL_Functions.llGetOwner();
723 }
724
725 public void llInstantMessage(string user, string message)
726 {
727 m_LSL_Functions.llInstantMessage(user, message);
728 }
729
730 public void llEmail(string address, string subject, string message)
731 {
732 m_LSL_Functions.llEmail(address, subject, message);
733 }
734
735 public void llGetNextEmail(string address, string subject)
736 {
737 m_LSL_Functions.llGetNextEmail(address, subject);
738 }
739
740 public string llGetKey()
741 {
742 return m_LSL_Functions.llGetKey();
743 }
744
745 public void llSetBuoyancy(double buoyancy)
746 {
747 m_LSL_Functions.llSetBuoyancy(buoyancy);
748 }
749
750 public void llSetHoverHeight(double height, int water, double tau)
751 {
752 m_LSL_Functions.llSetHoverHeight(height, water, tau);
753 }
754
755 public void llStopHover()
756 {
757 m_LSL_Functions.llStopHover();
758 }
759
760 public void llMinEventDelay(double delay)
761 {
762 m_LSL_Functions.llMinEventDelay(delay);
763 }
764
765 public void llSoundPreload()
766 {
767 m_LSL_Functions.llSoundPreload();
768 }
769
770 public void llRotLookAt(rotation target, double strength, double damping)
771 {
772 m_LSL_Functions.llRotLookAt(target, strength, damping);
773 }
774
266 // 775 //
267 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 776 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
268 // 777 //
269 public int llStringLength(string str) { return m_LSL_Functions.llStringLength(str); } 778 public int llStringLength(string str)
270 public void llStartAnimation(string anim) { m_LSL_Functions.llStartAnimation(anim); } 779 {
271 public void llStopAnimation(string anim) { m_LSL_Functions.llStopAnimation(anim); } 780 return m_LSL_Functions.llStringLength(str);
272 public void llPointAt() { m_LSL_Functions.llPointAt(); } 781 }
273 public void llStopPointAt() { m_LSL_Functions.llStopPointAt(); } 782
274 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { m_LSL_Functions.llTargetOmega(axis, spinrate, gain); } 783 public void llStartAnimation(string anim)
275 public int llGetStartParameter() { return m_LSL_Functions.llGetStartParameter(); } 784 {
276 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { m_LSL_Functions.llGodLikeRezObject(inventory, pos); } 785 m_LSL_Functions.llStartAnimation(anim);
277 public void llRequestPermissions(string agent, int perm) { m_LSL_Functions.llRequestPermissions(agent, perm); } 786 }
278 public string llGetPermissionsKey() { return m_LSL_Functions.llGetPermissionsKey(); } 787
279 public int llGetPermissions() { return m_LSL_Functions.llGetPermissions(); } 788 public void llStopAnimation(string anim)
280 public int llGetLinkNumber() { return m_LSL_Functions.llGetLinkNumber(); } 789 {
281 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetLinkColor(linknumber, color, face); } 790 m_LSL_Functions.llStopAnimation(anim);
282 public void llCreateLink(string target, int parent) { m_LSL_Functions.llCreateLink(target, parent); } 791 }
283 public void llBreakLink(int linknum) { m_LSL_Functions.llBreakLink(linknum); } 792
284 public void llBreakAllLinks() { m_LSL_Functions.llBreakAllLinks(); } 793 public void llPointAt()
285 public string llGetLinkKey(int linknum) { return m_LSL_Functions.llGetLinkKey(linknum); } 794 {
286 public void llGetLinkName(int linknum) { m_LSL_Functions.llGetLinkName(linknum); } 795 m_LSL_Functions.llPointAt();
287 public int llGetInventoryNumber(int type) { return m_LSL_Functions.llGetInventoryNumber(type); } 796 }
288 public string llGetInventoryName(int type, int number) { return m_LSL_Functions.llGetInventoryName(type, number); } 797
798 public void llStopPointAt()
799 {
800 m_LSL_Functions.llStopPointAt();
801 }
802
803 public void llTargetOmega(vector axis, double spinrate, double gain)
804 {
805 m_LSL_Functions.llTargetOmega(axis, spinrate, gain);
806 }
807
808 public int llGetStartParameter()
809 {
810 return m_LSL_Functions.llGetStartParameter();
811 }
812
813 public void llGodLikeRezObject(string inventory, vector pos)
814 {
815 m_LSL_Functions.llGodLikeRezObject(inventory, pos);
816 }
817
818 public void llRequestPermissions(string agent, int perm)
819 {
820 m_LSL_Functions.llRequestPermissions(agent, perm);
821 }
822
823 public string llGetPermissionsKey()
824 {
825 return m_LSL_Functions.llGetPermissionsKey();
826 }
827
828 public int llGetPermissions()
829 {
830 return m_LSL_Functions.llGetPermissions();
831 }
832
833 public int llGetLinkNumber()
834 {
835 return m_LSL_Functions.llGetLinkNumber();
836 }
837
838 public void llSetLinkColor(int linknumber, vector color, int face)
839 {
840 m_LSL_Functions.llSetLinkColor(linknumber, color, face);
841 }
842
843 public void llCreateLink(string target, int parent)
844 {
845 m_LSL_Functions.llCreateLink(target, parent);
846 }
847
848 public void llBreakLink(int linknum)
849 {
850 m_LSL_Functions.llBreakLink(linknum);
851 }
852
853 public void llBreakAllLinks()
854 {
855 m_LSL_Functions.llBreakAllLinks();
856 }
857
858 public string llGetLinkKey(int linknum)
859 {
860 return m_LSL_Functions.llGetLinkKey(linknum);
861 }
862
863 public void llGetLinkName(int linknum)
864 {
865 m_LSL_Functions.llGetLinkName(linknum);
866 }
867
868 public int llGetInventoryNumber(int type)
869 {
870 return m_LSL_Functions.llGetInventoryNumber(type);
871 }
872
873 public string llGetInventoryName(int type, int number)
874 {
875 return m_LSL_Functions.llGetInventoryName(type, number);
876 }
877
289 // 878 //
290 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 879 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
291 // 880 //
292 public void llSetScriptState(string name, int run) { m_LSL_Functions.llSetScriptState(name, run); } 881 public void llSetScriptState(string name, int run)
293 public double llGetEnergy() { return m_LSL_Functions.llGetEnergy(); } 882 {
294 public void llGiveInventory(string destination, string inventory) { m_LSL_Functions.llGiveInventory(destination, inventory); } 883 m_LSL_Functions.llSetScriptState(name, run);
295 public void llRemoveInventory(string item) { m_LSL_Functions.llRemoveInventory(item); } 884 }
296 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { m_LSL_Functions.llSetText(text, color, alpha); } 885
297 public double llWater(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWater(offset); } 886 public double llGetEnergy()
298 public void llPassTouches(int pass) { m_LSL_Functions.llPassTouches(pass); } 887 {
299 public string llRequestAgentData(string id, int data) { return m_LSL_Functions.llRequestAgentData(id, data); } 888 return m_LSL_Functions.llGetEnergy();
300 public string llRequestInventoryData(string name) { return m_LSL_Functions.llRequestInventoryData(name); } 889 }
301 public void llSetDamage(double damage) { m_LSL_Functions.llSetDamage(damage); } 890
302 public void llTeleportAgentHome(string agent) { m_LSL_Functions.llTeleportAgentHome(agent); } 891 public void llGiveInventory(string destination, string inventory)
303 public void llModifyLand(int action, int brush) { m_LSL_Functions.llModifyLand(action, brush); } 892 {
304 public void llCollisionSound(string impact_sound, double impact_volume) { m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); } 893 m_LSL_Functions.llGiveInventory(destination, inventory);
305 public void llCollisionSprite(string impact_sprite) { m_LSL_Functions.llCollisionSprite(impact_sprite); } 894 }
306 public string llGetAnimation(string id) { return m_LSL_Functions.llGetAnimation(id); } 895
307 public void llResetScript() { m_LSL_Functions.llResetScript(); } 896 public void llRemoveInventory(string item)
308 public void llMessageLinked(int linknum, int num, string str, string id) { m_LSL_Functions.llMessageLinked(linknum, num, str, id); } 897 {
309 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); } 898 m_LSL_Functions.llRemoveInventory(item);
310 public void llPassCollisions(int pass) { m_LSL_Functions.llPassCollisions(pass); } 899 }
311 public string llGetScriptName() { return m_LSL_Functions.llGetScriptName(); } 900
312 public int llGetNumberOfSides() { return m_LSL_Functions.llGetNumberOfSides(); } 901 public void llSetText(string text, vector color, double alpha)
902 {
903 m_LSL_Functions.llSetText(text, color, alpha);
904 }
905
906 public double llWater(vector offset)
907 {
908 return m_LSL_Functions.llWater(offset);
909 }
910
911 public void llPassTouches(int pass)
912 {
913 m_LSL_Functions.llPassTouches(pass);
914 }
915
916 public string llRequestAgentData(string id, int data)
917 {
918 return m_LSL_Functions.llRequestAgentData(id, data);
919 }
920
921 public string llRequestInventoryData(string name)
922 {
923 return m_LSL_Functions.llRequestInventoryData(name);
924 }
925
926 public void llSetDamage(double damage)
927 {
928 m_LSL_Functions.llSetDamage(damage);
929 }
930
931 public void llTeleportAgentHome(string agent)
932 {
933 m_LSL_Functions.llTeleportAgentHome(agent);
934 }
935
936 public void llModifyLand(int action, int brush)
937 {
938 m_LSL_Functions.llModifyLand(action, brush);
939 }
940
941 public void llCollisionSound(string impact_sound, double impact_volume)
942 {
943 m_LSL_Functions.llCollisionSound(impact_sound, impact_volume);
944 }
945
946 public void llCollisionSprite(string impact_sprite)
947 {
948 m_LSL_Functions.llCollisionSprite(impact_sprite);
949 }
950
951 public string llGetAnimation(string id)
952 {
953 return m_LSL_Functions.llGetAnimation(id);
954 }
955
956 public void llResetScript()
957 {
958 m_LSL_Functions.llResetScript();
959 }
960
961 public void llMessageLinked(int linknum, int num, string str, string id)
962 {
963 m_LSL_Functions.llMessageLinked(linknum, num, str, id);
964 }
965
966 public void llPushObject(string target, vector impulse, vector ang_impulse, int local)
967 {
968 m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local);
969 }
970
971 public void llPassCollisions(int pass)
972 {
973 m_LSL_Functions.llPassCollisions(pass);
974 }
975
976 public string llGetScriptName()
977 {
978 return m_LSL_Functions.llGetScriptName();
979 }
980
981 public int llGetNumberOfSides()
982 {
983 return m_LSL_Functions.llGetNumberOfSides();
984 }
985
313 // 986 //
314 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 987 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
315 // 988 //
316 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return m_LSL_Functions.llAxisAngle2Rot(axis, angle); } 989 public rotation llAxisAngle2Rot(vector axis, double angle)
317 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return m_LSL_Functions.llRot2Axis(rot); } 990 {
318 public void llRot2Angle() { m_LSL_Functions.llRot2Angle(); } 991 return m_LSL_Functions.llAxisAngle2Rot(axis, angle);
319 public double llAcos(double val) { return m_LSL_Functions.llAcos(val); } 992 }
320 public double llAsin(double val) { return m_LSL_Functions.llAsin(val); } 993
321 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return m_LSL_Functions.llAngleBetween(a, b); } 994 public vector llRot2Axis(rotation rot)
322 public string llGetInventoryKey(string name) { return m_LSL_Functions.llGetInventoryKey(name); } 995 {
323 public void llAllowInventoryDrop(int add) { m_LSL_Functions.llAllowInventoryDrop(add); } 996 return m_LSL_Functions.llRot2Axis(rot);
324 public LSL_Types.Vector3 llGetSunDirection() { return m_LSL_Functions.llGetSunDirection(); } 997 }
325 public LSL_Types.Vector3 llGetTextureOffset(int face) { return m_LSL_Functions.llGetTextureOffset(face); } 998
326 public LSL_Types.Vector3 llGetTextureScale(int side) { return m_LSL_Functions.llGetTextureScale(side); } 999 public void llRot2Angle()
327 public double llGetTextureRot(int side) { return m_LSL_Functions.llGetTextureRot(side); } 1000 {
328 public int llSubStringIndex(string source, string pattern) { return m_LSL_Functions.llSubStringIndex(source, pattern); } 1001 m_LSL_Functions.llRot2Angle();
329 public string llGetOwnerKey(string id) { return m_LSL_Functions.llGetOwnerKey(id); } 1002 }
330 public LSL_Types.Vector3 llGetCenterOfMass() { return m_LSL_Functions.llGetCenterOfMass(); } 1003
331 public List<string> llListSort(List<string> src, int stride, int ascending) { return m_LSL_Functions.llListSort(src, stride, ascending); } 1004 public double llAcos(double val)
332 public int llGetListLength(List<string> src) { return m_LSL_Functions.llGetListLength(src); } 1005 {
1006 return m_LSL_Functions.llAcos(val);
1007 }
1008
1009 public double llAsin(double val)
1010 {
1011 return m_LSL_Functions.llAsin(val);
1012 }
1013
1014 public double llAngleBetween(rotation a, rotation b)
1015 {
1016 return m_LSL_Functions.llAngleBetween(a, b);
1017 }
1018
1019 public string llGetInventoryKey(string name)
1020 {
1021 return m_LSL_Functions.llGetInventoryKey(name);
1022 }
1023
1024 public void llAllowInventoryDrop(int add)
1025 {
1026 m_LSL_Functions.llAllowInventoryDrop(add);
1027 }
1028
1029 public vector llGetSunDirection()
1030 {
1031 return m_LSL_Functions.llGetSunDirection();
1032 }
1033
1034 public vector llGetTextureOffset(int face)
1035 {
1036 return m_LSL_Functions.llGetTextureOffset(face);
1037 }
1038
1039 public vector llGetTextureScale(int side)
1040 {
1041 return m_LSL_Functions.llGetTextureScale(side);
1042 }
1043
1044 public double llGetTextureRot(int side)
1045 {
1046 return m_LSL_Functions.llGetTextureRot(side);
1047 }
1048
1049 public int llSubStringIndex(string source, string pattern)
1050 {
1051 return m_LSL_Functions.llSubStringIndex(source, pattern);
1052 }
1053
1054 public string llGetOwnerKey(string id)
1055 {
1056 return m_LSL_Functions.llGetOwnerKey(id);
1057 }
1058
1059 public vector llGetCenterOfMass()
1060 {
1061 return m_LSL_Functions.llGetCenterOfMass();
1062 }
1063
1064 public List<string> llListSort(List<string> src, int stride, int ascending)
1065 {
1066 return m_LSL_Functions.llListSort(src, stride, ascending);
1067 }
1068
1069 public int llGetListLength(List<string> src)
1070 {
1071 return m_LSL_Functions.llGetListLength(src);
1072 }
1073
333 // 1074 //
334 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1075 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
335 // 1076 //
336 public int llList2Integer(List<string> src, int index) { return m_LSL_Functions.llList2Integer(src, index); } 1077 public int llList2Integer(List<string> src, int index)
337 public double llList2double(List<string> src, int index) { return m_LSL_Functions.llList2double(src, index); } 1078 {
338 public string llList2String(List<string> src, int index) { return m_LSL_Functions.llList2String(src, index); } 1079 return m_LSL_Functions.llList2Integer(src, index);
339 public string llList2Key(List<string> src, int index) { return m_LSL_Functions.llList2Key(src, index); } 1080 }
340 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) { return m_LSL_Functions.llList2Vector(src, index); } 1081
341 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { return m_LSL_Functions.llList2Rot(src, index); } 1082 public double llList2double(List<string> src, int index)
342 public List<string> llList2List(List<string> src, int start, int end) { return m_LSL_Functions.llList2List(src, start, end); } 1083 {
343 public List<string> llDeleteSubList(List<string> src, int start, int end) { return m_LSL_Functions.llDeleteSubList(src, start, end); } 1084 return m_LSL_Functions.llList2double(src, index);
344 public int llGetListEntryType(List<string> src, int index) { return m_LSL_Functions.llGetListEntryType(src, index); } 1085 }
345 public string llList2CSV(List<string> src) { return m_LSL_Functions.llList2CSV(src); } 1086
346 public List<string> llCSV2List(string src) { return m_LSL_Functions.llCSV2List(src); } 1087 public string llList2String(List<string> src, int index)
347 public List<string> llListRandomize(List<string> src, int stride) { return m_LSL_Functions.llListRandomize(src, stride); } 1088 {
348 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { return m_LSL_Functions.llList2ListStrided(src, start, end, stride); } 1089 return m_LSL_Functions.llList2String(src, index);
349 public LSL_Types.Vector3 llGetRegionCorner() { return m_LSL_Functions.llGetRegionCorner(); } 1090 }
350 public List<string> llListInsertList(List<string> dest, List<string> src, int start) { return m_LSL_Functions.llListInsertList(dest, src, start); } 1091
351 public int llListFindList(List<string> src, List<string> test) { return m_LSL_Functions.llListFindList(src, test); } 1092 public string llList2Key(List<string> src, int index)
352 public string llGetObjectName() { return m_LSL_Functions.llGetObjectName(); } 1093 {
353 public void llSetObjectName(string name) { m_LSL_Functions.llSetObjectName(name); } 1094 return m_LSL_Functions.llList2Key(src, index);
354 public string llGetDate() { return m_LSL_Functions.llGetDate(); } 1095 }
355 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return m_LSL_Functions.llEdgeOfWorld(pos, dir); } 1096
356 public int llGetAgentInfo(string id) { return m_LSL_Functions.llGetAgentInfo(id); } 1097 public vector llList2Vector(List<string> src, int index)
1098 {
1099 return m_LSL_Functions.llList2Vector(src, index);
1100 }
1101
1102 public rotation llList2Rot(List<string> src, int index)
1103 {
1104 return m_LSL_Functions.llList2Rot(src, index);
1105 }
1106
1107 public List<string> llList2List(List<string> src, int start, int end)
1108 {
1109 return m_LSL_Functions.llList2List(src, start, end);
1110 }
1111
1112 public List<string> llDeleteSubList(List<string> src, int start, int end)
1113 {
1114 return m_LSL_Functions.llDeleteSubList(src, start, end);
1115 }
1116
1117 public int llGetListEntryType(List<string> src, int index)
1118 {
1119 return m_LSL_Functions.llGetListEntryType(src, index);
1120 }
1121
1122 public string llList2CSV(List<string> src)
1123 {
1124 return m_LSL_Functions.llList2CSV(src);
1125 }
1126
1127 public List<string> llCSV2List(string src)
1128 {
1129 return m_LSL_Functions.llCSV2List(src);
1130 }
1131
1132 public List<string> llListRandomize(List<string> src, int stride)
1133 {
1134 return m_LSL_Functions.llListRandomize(src, stride);
1135 }
1136
1137 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
1138 {
1139 return m_LSL_Functions.llList2ListStrided(src, start, end, stride);
1140 }
1141
1142 public vector llGetRegionCorner()
1143 {
1144 return m_LSL_Functions.llGetRegionCorner();
1145 }
1146
1147 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
1148 {
1149 return m_LSL_Functions.llListInsertList(dest, src, start);
1150 }
1151
1152 public int llListFindList(List<string> src, List<string> test)
1153 {
1154 return m_LSL_Functions.llListFindList(src, test);
1155 }
1156
1157 public string llGetObjectName()
1158 {
1159 return m_LSL_Functions.llGetObjectName();
1160 }
1161
1162 public void llSetObjectName(string name)
1163 {
1164 m_LSL_Functions.llSetObjectName(name);
1165 }
1166
1167 public string llGetDate()
1168 {
1169 return m_LSL_Functions.llGetDate();
1170 }
1171
1172 public int llEdgeOfWorld(vector pos, vector dir)
1173 {
1174 return m_LSL_Functions.llEdgeOfWorld(pos, dir);
1175 }
1176
1177 public int llGetAgentInfo(string id)
1178 {
1179 return m_LSL_Functions.llGetAgentInfo(id);
1180 }
1181
357 // 1182 //
358 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1183 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
359 // 1184 //
360 public void llAdjustSoundVolume(double volume) { m_LSL_Functions.llAdjustSoundVolume(volume); } 1185 public void llAdjustSoundVolume(double volume)
361 public void llSetSoundQueueing(int queue) { m_LSL_Functions.llSetSoundQueueing(queue); } 1186 {
362 public void llSetSoundRadius(double radius) { m_LSL_Functions.llSetSoundRadius(radius); } 1187 m_LSL_Functions.llAdjustSoundVolume(volume);
363 public string llKey2Name(string id) { return m_LSL_Functions.llKey2Name(id); } 1188 }
364 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); } 1189
365 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); } 1190 public void llSetSoundQueueing(int queue)
366 public void llEjectFromLand(string pest) { m_LSL_Functions.llEjectFromLand(pest); } 1191 {
367 public void llParseString2List() { m_LSL_Functions.llParseString2List(); } 1192 m_LSL_Functions.llSetSoundQueueing(queue);
368 public int llOverMyLand(string id) { return m_LSL_Functions.llOverMyLand(id); } 1193 }
369 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetLandOwnerAt(pos); } 1194
370 public string llGetNotecardLine(string name, int line) { return m_LSL_Functions.llGetNotecardLine(name, line); } 1195 public void llSetSoundRadius(double radius)
371 public LSL_Types.Vector3 llGetAgentSize(string id) { return m_LSL_Functions.llGetAgentSize(id); } 1196 {
372 public int llSameGroup(string agent) { return m_LSL_Functions.llSameGroup(agent); } 1197 m_LSL_Functions.llSetSoundRadius(radius);
373 public void llUnSit(string id) { m_LSL_Functions.llUnSit(id); } 1198 }
374 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundSlope(offset); } 1199
375 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundNormal(offset); } 1200 public string llKey2Name(string id)
376 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundContour(offset); } 1201 {
377 public int llGetAttached() { return m_LSL_Functions.llGetAttached(); } 1202 return m_LSL_Functions.llKey2Name(id);
378 public int llGetFreeMemory() { return m_LSL_Functions.llGetFreeMemory(); } 1203 }
379 public string llGetRegionName() { return m_LSL_Functions.llGetRegionName(); } 1204
380 public double llGetRegionTimeDilation() { return m_LSL_Functions.llGetRegionTimeDilation(); } 1205 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
381 public double llGetRegionFPS() { return m_LSL_Functions.llGetRegionFPS(); } 1206 {
1207 m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate);
1208 }
1209
1210 public void llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west)
1211 {
1212 m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west);
1213 }
1214
1215 public void llEjectFromLand(string pest)
1216 {
1217 m_LSL_Functions.llEjectFromLand(pest);
1218 }
1219
1220 public void llParseString2List()
1221 {
1222 m_LSL_Functions.llParseString2List();
1223 }
1224
1225 public int llOverMyLand(string id)
1226 {
1227 return m_LSL_Functions.llOverMyLand(id);
1228 }
1229
1230 public string llGetLandOwnerAt(vector pos)
1231 {
1232 return m_LSL_Functions.llGetLandOwnerAt(pos);
1233 }
1234
1235 public string llGetNotecardLine(string name, int line)
1236 {
1237 return m_LSL_Functions.llGetNotecardLine(name, line);
1238 }
1239
1240 public vector llGetAgentSize(string id)
1241 {
1242 return m_LSL_Functions.llGetAgentSize(id);
1243 }
1244
1245 public int llSameGroup(string agent)
1246 {
1247 return m_LSL_Functions.llSameGroup(agent);
1248 }
1249
1250 public void llUnSit(string id)
1251 {
1252 m_LSL_Functions.llUnSit(id);
1253 }
1254
1255 public vector llGroundSlope(vector offset)
1256 {
1257 return m_LSL_Functions.llGroundSlope(offset);
1258 }
1259
1260 public vector llGroundNormal(vector offset)
1261 {
1262 return m_LSL_Functions.llGroundNormal(offset);
1263 }
1264
1265 public vector llGroundContour(vector offset)
1266 {
1267 return m_LSL_Functions.llGroundContour(offset);
1268 }
1269
1270 public int llGetAttached()
1271 {
1272 return m_LSL_Functions.llGetAttached();
1273 }
1274
1275 public int llGetFreeMemory()
1276 {
1277 return m_LSL_Functions.llGetFreeMemory();
1278 }
1279
1280 public string llGetRegionName()
1281 {
1282 return m_LSL_Functions.llGetRegionName();
1283 }
1284
1285 public double llGetRegionTimeDilation()
1286 {
1287 return m_LSL_Functions.llGetRegionTimeDilation();
1288 }
1289
1290 public double llGetRegionFPS()
1291 {
1292 return m_LSL_Functions.llGetRegionFPS();
1293 }
1294
382 // 1295 //
383 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1296 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
384 // 1297 //
385 public void llParticleSystem(List<Object> rules) { m_LSL_Functions.llParticleSystem(rules); } 1298 public void llParticleSystem(List<Object> rules)
386 public void llGroundRepel(double height, int water, double tau) { m_LSL_Functions.llGroundRepel(height, water, tau); } 1299 {
387 public void llGiveInventoryList() { m_LSL_Functions.llGiveInventoryList(); } 1300 m_LSL_Functions.llParticleSystem(rules);
388 public void llSetVehicleType(int type) { m_LSL_Functions.llSetVehicleType(type); } 1301 }
389 public void llSetVehicledoubleParam(int param, double value) { m_LSL_Functions.llSetVehicledoubleParam(param, value); } 1302
390 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { m_LSL_Functions.llSetVehicleVectorParam(param, vec); } 1303 public void llGroundRepel(double height, int water, double tau)
391 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { m_LSL_Functions.llSetVehicleRotationParam(param, rot); } 1304 {
392 public void llSetVehicleFlags(int flags) { m_LSL_Functions.llSetVehicleFlags(flags); } 1305 m_LSL_Functions.llGroundRepel(height, water, tau);
393 public void llRemoveVehicleFlags(int flags) { m_LSL_Functions.llRemoveVehicleFlags(flags); } 1306 }
394 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { m_LSL_Functions.llSitTarget(offset, rot); } 1307
395 public string llAvatarOnSitTarget() { return m_LSL_Functions.llAvatarOnSitTarget(); } 1308 public void llGiveInventoryList()
396 public void llAddToLandPassList(string avatar, double hours) { m_LSL_Functions.llAddToLandPassList(avatar, hours); } 1309 {
397 public void llSetTouchText(string text) { m_LSL_Functions.llSetTouchText(text); } 1310 m_LSL_Functions.llGiveInventoryList();
398 public void llSetSitText(string text) { m_LSL_Functions.llSetSitText(text); } 1311 }
399 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraEyeOffset(offset); } 1312
400 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraAtOffset(offset); } 1313 public void llSetVehicleType(int type)
401 public void llDumpList2String() { m_LSL_Functions.llDumpList2String(); } 1314 {
402 public void llScriptDanger(LSL_Types.Vector3 pos) { m_LSL_Functions.llScriptDanger(pos); } 1315 m_LSL_Functions.llSetVehicleType(type);
403 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); } 1316 }
404 public void llVolumeDetect(int detect) { m_LSL_Functions.llVolumeDetect(detect); } 1317
405 public void llResetOtherScript(string name) { m_LSL_Functions.llResetOtherScript(name); } 1318 public void llSetVehicledoubleParam(int param, double value)
406 public int llGetScriptState(string name) { return m_LSL_Functions.llGetScriptState(name); } 1319 {
407 public void llRemoteLoadScript() { m_LSL_Functions.llRemoteLoadScript(); } 1320 m_LSL_Functions.llSetVehicledoubleParam(param, value);
408 public void llSetRemoteScriptAccessPin(int pin) { m_LSL_Functions.llSetRemoteScriptAccessPin(pin); } 1321 }
409 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); } 1322
1323 public void llSetVehicleVectorParam(int param, vector vec)
1324 {
1325 m_LSL_Functions.llSetVehicleVectorParam(param, vec);
1326 }
1327
1328 public void llSetVehicleRotationParam(int param, rotation rot)
1329 {
1330 m_LSL_Functions.llSetVehicleRotationParam(param, rot);
1331 }
1332
1333 public void llSetVehicleFlags(int flags)
1334 {
1335 m_LSL_Functions.llSetVehicleFlags(flags);
1336 }
1337
1338 public void llRemoveVehicleFlags(int flags)
1339 {
1340 m_LSL_Functions.llRemoveVehicleFlags(flags);
1341 }
1342
1343 public void llSitTarget(vector offset, rotation rot)
1344 {
1345 m_LSL_Functions.llSitTarget(offset, rot);
1346 }
1347
1348 public string llAvatarOnSitTarget()
1349 {
1350 return m_LSL_Functions.llAvatarOnSitTarget();
1351 }
1352
1353 public void llAddToLandPassList(string avatar, double hours)
1354 {
1355 m_LSL_Functions.llAddToLandPassList(avatar, hours);
1356 }
1357
1358 public void llSetTouchText(string text)
1359 {
1360 m_LSL_Functions.llSetTouchText(text);
1361 }
1362
1363 public void llSetSitText(string text)
1364 {
1365 m_LSL_Functions.llSetSitText(text);
1366 }
1367
1368 public void llSetCameraEyeOffset(vector offset)
1369 {
1370 m_LSL_Functions.llSetCameraEyeOffset(offset);
1371 }
1372
1373 public void llSetCameraAtOffset(vector offset)
1374 {
1375 m_LSL_Functions.llSetCameraAtOffset(offset);
1376 }
1377
1378 public void llDumpList2String()
1379 {
1380 m_LSL_Functions.llDumpList2String();
1381 }
1382
1383 public void llScriptDanger(vector pos)
1384 {
1385 m_LSL_Functions.llScriptDanger(pos);
1386 }
1387
1388 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1389 {
1390 m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
1391 }
1392
1393 public void llVolumeDetect(int detect)
1394 {
1395 m_LSL_Functions.llVolumeDetect(detect);
1396 }
1397
1398 public void llResetOtherScript(string name)
1399 {
1400 m_LSL_Functions.llResetOtherScript(name);
1401 }
1402
1403 public int llGetScriptState(string name)
1404 {
1405 return m_LSL_Functions.llGetScriptState(name);
1406 }
1407
1408 public void llRemoteLoadScript()
1409 {
1410 m_LSL_Functions.llRemoteLoadScript();
1411 }
1412
1413 public void llSetRemoteScriptAccessPin(int pin)
1414 {
1415 m_LSL_Functions.llSetRemoteScriptAccessPin(pin);
1416 }
1417
1418 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
1419 {
1420 m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param);
1421 }
1422
410 // 1423 //
411 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1424 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
412 // 1425 //
413 public void llOpenRemoteDataChannel() { m_LSL_Functions.llOpenRemoteDataChannel(); } 1426 public void llOpenRemoteDataChannel()
414 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); } 1427 {
415 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); } 1428 m_LSL_Functions.llOpenRemoteDataChannel();
416 public void llCloseRemoteDataChannel(string channel) { m_LSL_Functions.llCloseRemoteDataChannel(channel); } 1429 }
417 public string llMD5String(string src, int nonce) { return m_LSL_Functions.llMD5String(src, nonce); } 1430
418 public void llSetPrimitiveParams(List<string> rules) { m_LSL_Functions.llSetPrimitiveParams(rules); } 1431 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
419 public string llStringToBase64(string str) { return m_LSL_Functions.llStringToBase64(str); } 1432 {
420 public string llBase64ToString(string str) { return m_LSL_Functions.llBase64ToString(str); } 1433 return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata);
421 public void llXorBase64Strings() { m_LSL_Functions.llXorBase64Strings(); } 1434 }
422 public void llRemoteDataSetRegion() { m_LSL_Functions.llRemoteDataSetRegion(); } 1435
423 public double llLog10(double val) { return m_LSL_Functions.llLog10(val); } 1436 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
424 public double llLog(double val) { return m_LSL_Functions.llLog(val); } 1437 {
425 public List<string> llGetAnimationList(string id) { return m_LSL_Functions.llGetAnimationList(id); } 1438 m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata);
426 public void llSetParcelMusicURL(string url) { m_LSL_Functions.llSetParcelMusicURL(url); } 1439 }
427 public LSL_Types.Vector3 llGetRootPosition() { return m_LSL_Functions.llGetRootPosition(); } 1440
428 public LSL_Types.Quaternion llGetRootRotation() { return m_LSL_Functions.llGetRootRotation(); } 1441 public void llCloseRemoteDataChannel(string channel)
429 public string llGetObjectDesc() { return m_LSL_Functions.llGetObjectDesc(); } 1442 {
430 public void llSetObjectDesc(string desc) { m_LSL_Functions.llSetObjectDesc(desc); } 1443 m_LSL_Functions.llCloseRemoteDataChannel(channel);
431 public string llGetCreator() { return m_LSL_Functions.llGetCreator(); } 1444 }
432 public string llGetTimestamp() { return m_LSL_Functions.llGetTimestamp(); } 1445
433 public void llSetLinkAlpha(int linknumber, double alpha, int face) { m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); } 1446 public string llMD5String(string src, int nonce)
434 public int llGetNumberOfPrims() { return m_LSL_Functions.llGetNumberOfPrims(); } 1447 {
435 public string llGetNumberOfNotecardLines(string name) { return m_LSL_Functions.llGetNumberOfNotecardLines(name); } 1448 return m_LSL_Functions.llMD5String(src, nonce);
436 public List<string> llGetBoundingBox(string obj) { return m_LSL_Functions.llGetBoundingBox(obj); } 1449 }
437 public LSL_Types.Vector3 llGetGeometricCenter() { return m_LSL_Functions.llGetGeometricCenter(); } 1450
438 public void llGetPrimitiveParams() { m_LSL_Functions.llGetPrimitiveParams(); } 1451 public void llSetPrimitiveParams(List<string> rules)
1452 {
1453 m_LSL_Functions.llSetPrimitiveParams(rules);
1454 }
1455
1456 public string llStringToBase64(string str)
1457 {
1458 return m_LSL_Functions.llStringToBase64(str);
1459 }
1460
1461 public string llBase64ToString(string str)
1462 {
1463 return m_LSL_Functions.llBase64ToString(str);
1464 }
1465
1466 public void llXorBase64Strings()
1467 {
1468 m_LSL_Functions.llXorBase64Strings();
1469 }
1470
1471 public void llRemoteDataSetRegion()
1472 {
1473 m_LSL_Functions.llRemoteDataSetRegion();
1474 }
1475
1476 public double llLog10(double val)
1477 {
1478 return m_LSL_Functions.llLog10(val);
1479 }
1480
1481 public double llLog(double val)
1482 {
1483 return m_LSL_Functions.llLog(val);
1484 }
1485
1486 public List<string> llGetAnimationList(string id)
1487 {
1488 return m_LSL_Functions.llGetAnimationList(id);
1489 }
1490
1491 public void llSetParcelMusicURL(string url)
1492 {
1493 m_LSL_Functions.llSetParcelMusicURL(url);
1494 }
1495
1496 public vector llGetRootPosition()
1497 {
1498 return m_LSL_Functions.llGetRootPosition();
1499 }
1500
1501 public rotation llGetRootRotation()
1502 {
1503 return m_LSL_Functions.llGetRootRotation();
1504 }
1505
1506 public string llGetObjectDesc()
1507 {
1508 return m_LSL_Functions.llGetObjectDesc();
1509 }
1510
1511 public void llSetObjectDesc(string desc)
1512 {
1513 m_LSL_Functions.llSetObjectDesc(desc);
1514 }
1515
1516 public string llGetCreator()
1517 {
1518 return m_LSL_Functions.llGetCreator();
1519 }
1520
1521 public string llGetTimestamp()
1522 {
1523 return m_LSL_Functions.llGetTimestamp();
1524 }
1525
1526 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1527 {
1528 m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face);
1529 }
1530
1531 public int llGetNumberOfPrims()
1532 {
1533 return m_LSL_Functions.llGetNumberOfPrims();
1534 }
1535
1536 public string llGetNumberOfNotecardLines(string name)
1537 {
1538 return m_LSL_Functions.llGetNumberOfNotecardLines(name);
1539 }
1540
1541 public List<string> llGetBoundingBox(string obj)
1542 {
1543 return m_LSL_Functions.llGetBoundingBox(obj);
1544 }
1545
1546 public vector llGetGeometricCenter()
1547 {
1548 return m_LSL_Functions.llGetGeometricCenter();
1549 }
1550
1551 public void llGetPrimitiveParams()
1552 {
1553 m_LSL_Functions.llGetPrimitiveParams();
1554 }
1555
439 // 1556 //
440 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1557 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
441 // 1558 //
442 public string llIntegerToBase64(int number) { return m_LSL_Functions.llIntegerToBase64(number); } 1559 public string llIntegerToBase64(int number)
443 public int llBase64ToInteger(string str) { return m_LSL_Functions.llBase64ToInteger(str); } 1560 {
444 public double llGetGMTclock() { return m_LSL_Functions.llGetGMTclock(); } 1561 return m_LSL_Functions.llIntegerToBase64(number);
445 public string llGetSimulatorHostname() { return m_LSL_Functions.llGetSimulatorHostname(); } 1562 }
446 public void llSetLocalRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetLocalRot(rot); } 1563
447 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); } 1564 public int llBase64ToInteger(string str)
448 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); } 1565 {
449 public int llGetObjectPermMask(int mask) { return m_LSL_Functions.llGetObjectPermMask(mask); } 1566 return m_LSL_Functions.llBase64ToInteger(str);
450 public void llSetObjectPermMask(int mask, int value) { m_LSL_Functions.llSetObjectPermMask(mask, value); } 1567 }
451 public void llGetInventoryPermMask(string item, int mask) { m_LSL_Functions.llGetInventoryPermMask(item, mask); } 1568
452 public void llSetInventoryPermMask(string item, int mask, int value) { m_LSL_Functions.llSetInventoryPermMask(item, mask, value); } 1569 public double llGetGMTclock()
453 public string llGetInventoryCreator(string item) { return m_LSL_Functions.llGetInventoryCreator(item); } 1570 {
454 public void llOwnerSay(string msg) { m_LSL_Functions.llOwnerSay(msg); } 1571 return m_LSL_Functions.llGetGMTclock();
455 public void llRequestSimulatorData(string simulator, int data) { m_LSL_Functions.llRequestSimulatorData(simulator, data); } 1572 }
456 public void llForceMouselook(int mouselook) { m_LSL_Functions.llForceMouselook(mouselook); } 1573
457 public double llGetObjectMass(string id) { return m_LSL_Functions.llGetObjectMass(id); } 1574 public string llGetSimulatorHostname()
458 public void llListReplaceList() { m_LSL_Functions.llListReplaceList(); } 1575 {
459 public void llLoadURL(string avatar_id, string message, string url) { m_LSL_Functions.llLoadURL(avatar_id, message, url); } 1576 return m_LSL_Functions.llGetSimulatorHostname();
460 public void llParcelMediaCommandList(List<string> commandList) { m_LSL_Functions.llParcelMediaCommandList(commandList); } 1577 }
461 public void llParcelMediaQuery() { m_LSL_Functions.llParcelMediaQuery(); } 1578
462 public int llModPow(int a, int b, int c) { return m_LSL_Functions.llModPow(a, b, c); } 1579 public void llSetLocalRot(rotation rot)
1580 {
1581 m_LSL_Functions.llSetLocalRot(rot);
1582 }
1583
1584 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
1585 {
1586 return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers);
1587 }
1588
1589 public void llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, int param)
1590 {
1591 m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param);
1592 }
1593
1594 public int llGetObjectPermMask(int mask)
1595 {
1596 return m_LSL_Functions.llGetObjectPermMask(mask);
1597 }
1598
1599 public void llSetObjectPermMask(int mask, int value)
1600 {
1601 m_LSL_Functions.llSetObjectPermMask(mask, value);
1602 }
1603
1604 public void llGetInventoryPermMask(string item, int mask)
1605 {
1606 m_LSL_Functions.llGetInventoryPermMask(item, mask);
1607 }
1608
1609 public void llSetInventoryPermMask(string item, int mask, int value)
1610 {
1611 m_LSL_Functions.llSetInventoryPermMask(item, mask, value);
1612 }
1613
1614 public string llGetInventoryCreator(string item)
1615 {
1616 return m_LSL_Functions.llGetInventoryCreator(item);
1617 }
1618
1619 public void llOwnerSay(string msg)
1620 {
1621 m_LSL_Functions.llOwnerSay(msg);
1622 }
1623
1624 public void llRequestSimulatorData(string simulator, int data)
1625 {
1626 m_LSL_Functions.llRequestSimulatorData(simulator, data);
1627 }
1628
1629 public void llForceMouselook(int mouselook)
1630 {
1631 m_LSL_Functions.llForceMouselook(mouselook);
1632 }
1633
1634 public double llGetObjectMass(string id)
1635 {
1636 return m_LSL_Functions.llGetObjectMass(id);
1637 }
1638
1639 public void llListReplaceList()
1640 {
1641 m_LSL_Functions.llListReplaceList();
1642 }
1643
1644 public void llLoadURL(string avatar_id, string message, string url)
1645 {
1646 m_LSL_Functions.llLoadURL(avatar_id, message, url);
1647 }
1648
1649 public void llParcelMediaCommandList(List<string> commandList)
1650 {
1651 m_LSL_Functions.llParcelMediaCommandList(commandList);
1652 }
1653
1654 public void llParcelMediaQuery()
1655 {
1656 m_LSL_Functions.llParcelMediaQuery();
1657 }
1658
1659 public int llModPow(int a, int b, int c)
1660 {
1661 return m_LSL_Functions.llModPow(a, b, c);
1662 }
1663
463 // 1664 //
464 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1665 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
465 // 1666 //
466 public int llGetInventoryType(string name) { return m_LSL_Functions.llGetInventoryType(name); } 1667 public int llGetInventoryType(string name)
467 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); } 1668 {
468 public LSL_Types.Vector3 llGetCameraPos() { return m_LSL_Functions.llGetCameraPos(); } 1669 return m_LSL_Functions.llGetInventoryType(name);
469 public LSL_Types.Quaternion llGetCameraRot() { return m_LSL_Functions.llGetCameraRot(); } 1670 }
470 public void llSetPrimURL() { m_LSL_Functions.llSetPrimURL(); } 1671
471 public void llRefreshPrimURL() { m_LSL_Functions.llRefreshPrimURL(); } 1672 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
472 public string llEscapeURL(string url) { return m_LSL_Functions.llEscapeURL(url); } 1673 {
473 public string llUnescapeURL(string url) { return m_LSL_Functions.llUnescapeURL(url); } 1674 m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons);
474 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { m_LSL_Functions.llMapDestination(simname, pos, look_at); } 1675 }
475 public void llAddToLandBanList(string avatar, double hours) { m_LSL_Functions.llAddToLandBanList(avatar, hours); } 1676
476 public void llRemoveFromLandPassList(string avatar) { m_LSL_Functions.llRemoveFromLandPassList(avatar); } 1677 public vector llGetCameraPos()
477 public void llRemoveFromLandBanList(string avatar) { m_LSL_Functions.llRemoveFromLandBanList(avatar); } 1678 {
478 public void llSetCameraParams(List<string> rules) { m_LSL_Functions.llSetCameraParams(rules); } 1679 return m_LSL_Functions.llGetCameraPos();
479 public void llClearCameraParams() { m_LSL_Functions.llClearCameraParams(); } 1680 }
480 public double llListStatistics(int operation, List<string> src) { return m_LSL_Functions.llListStatistics(operation, src); } 1681
481 public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } 1682 public rotation llGetCameraRot()
482 public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } 1683 {
483 public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } 1684 return m_LSL_Functions.llGetCameraRot();
484 public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } 1685 }
485 public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } 1686
486 public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } 1687 public void llSetPrimURL()
487 public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } 1688 {
488 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } 1689 m_LSL_Functions.llSetPrimURL();
489 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelPrimOwners(pos); } 1690 }
490 public int llGetObjectPrimCount(string object_id) { return m_LSL_Functions.llGetObjectPrimCount(object_id); } 1691
1692 public void llRefreshPrimURL()
1693 {
1694 m_LSL_Functions.llRefreshPrimURL();
1695 }
1696
1697 public string llEscapeURL(string url)
1698 {
1699 return m_LSL_Functions.llEscapeURL(url);
1700 }
1701
1702 public string llUnescapeURL(string url)
1703 {
1704 return m_LSL_Functions.llUnescapeURL(url);
1705 }
1706
1707 public void llMapDestination(string simname, vector pos, vector look_at)
1708 {
1709 m_LSL_Functions.llMapDestination(simname, pos, look_at);
1710 }
1711
1712 public void llAddToLandBanList(string avatar, double hours)
1713 {
1714 m_LSL_Functions.llAddToLandBanList(avatar, hours);
1715 }
1716
1717 public void llRemoveFromLandPassList(string avatar)
1718 {
1719 m_LSL_Functions.llRemoveFromLandPassList(avatar);
1720 }
1721
1722 public void llRemoveFromLandBanList(string avatar)
1723 {
1724 m_LSL_Functions.llRemoveFromLandBanList(avatar);
1725 }
1726
1727 public void llSetCameraParams(List<string> rules)
1728 {
1729 m_LSL_Functions.llSetCameraParams(rules);
1730 }
1731
1732 public void llClearCameraParams()
1733 {
1734 m_LSL_Functions.llClearCameraParams();
1735 }
1736
1737 public double llListStatistics(int operation, List<string> src)
1738 {
1739 return m_LSL_Functions.llListStatistics(operation, src);
1740 }
1741
1742 public int llGetUnixTime()
1743 {
1744 return m_LSL_Functions.llGetUnixTime();
1745 }
1746
1747 public int llGetParcelFlags(vector pos)
1748 {
1749 return m_LSL_Functions.llGetParcelFlags(pos);
1750 }
1751
1752 public int llGetRegionFlags()
1753 {
1754 return m_LSL_Functions.llGetRegionFlags();
1755 }
1756
1757 public string llXorBase64StringsCorrect(string str1, string str2)
1758 {
1759 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2);
1760 }
1761
1762 public void llHTTPRequest(string url, List<string> parameters, string body)
1763 {
1764 m_LSL_Functions.llHTTPRequest(url, parameters, body);
1765 }
1766
1767 public void llResetLandBanList()
1768 {
1769 m_LSL_Functions.llResetLandBanList();
1770 }
1771
1772 public void llResetLandPassList()
1773 {
1774 m_LSL_Functions.llResetLandPassList();
1775 }
1776
1777 public int llGetParcelPrimCount(vector pos, int category, int sim_wide)
1778 {
1779 return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide);
1780 }
1781
1782 public List<string> llGetParcelPrimOwners(vector pos)
1783 {
1784 return m_LSL_Functions.llGetParcelPrimOwners(pos);
1785 }
1786
1787 public int llGetObjectPrimCount(string object_id)
1788 {
1789 return m_LSL_Functions.llGetObjectPrimCount(object_id);
1790 }
1791
491 // 1792 //
492 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1793 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
493 // 1794 //
494 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } 1795 public int llGetParcelMaxPrims(vector pos, int sim_wide)
495 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } 1796 {
1797 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
1798 }
1799
1800 public List<string> llGetParcelDetails(vector pos, List<string> param)
1801 {
1802 return m_LSL_Functions.llGetParcelDetails(pos, param);
1803 }
496 1804
497 // 1805 //
498 // OpenSim Functions 1806 // OpenSim Functions
499 // 1807 //
500 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } 1808 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
1809 int timer)
1810 {
1811 return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer);
1812 }
501 1813
502 // LSL CONSTANTS 1814 // LSL CONSTANTS
503 public const int TRUE = 1; 1815 public const int TRUE = 1;
@@ -803,10 +2115,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
803 public const double SQRT2 = 1.414213538f; 2115 public const double SQRT2 = 1.414213538f;
804 2116
805 // Can not be public const? 2117 // Can not be public const?
806 public LSL_Types.Vector3 ZERO_VECTOR = new LSL_Types.Vector3(0, 0, 0); 2118 public vector ZERO_VECTOR = new vector(0, 0, 0);
807 public LSL_Types.Quaternion ZERO_ROTATION = new LSL_Types.Quaternion(0, 0, 0, 0); 2119 public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0);
808
809
810
811 } 2120 }
812} 2121} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
index 00eb899..190e6d7 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
@@ -27,31 +27,32 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
35 public static class Common 33 public static class Common
36 { 34 {
37 static public bool Debug = true; 35 public static bool Debug = true;
38 static public bool IL_UseTryCatch = true; 36 public static bool IL_UseTryCatch = true;
39 static public bool IL_CreateConstructor = true; 37 public static bool IL_CreateConstructor = true;
40 static public bool IL_CreateFunctionList = true; 38 public static bool IL_CreateFunctionList = true;
41 static public bool IL_ProcessCodeChunks = true; 39 public static bool IL_ProcessCodeChunks = true;
42 40
43 public delegate void SendToDebugEventDelegate(string Message); 41 public delegate void SendToDebugEventDelegate(string Message);
42
44 public delegate void SendToLogEventDelegate(string Message); 43 public delegate void SendToLogEventDelegate(string Message);
45 static public event SendToDebugEventDelegate SendToDebugEvent;
46 static public event SendToLogEventDelegate SendToLogEvent;
47 44
48 static public void SendToDebug(string Message) 45 public static event SendToDebugEventDelegate SendToDebugEvent;
46 public static event SendToLogEventDelegate SendToLogEvent;
47
48 public static void SendToDebug(string Message)
49 { 49 {
50 //if (Debug == true) 50 //if (Debug == true)
51 Console.WriteLine("COMPILER:Debug: " + Message); 51 Console.WriteLine("COMPILER:Debug: " + Message);
52 SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 52 SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
53 } 53 }
54 static public void SendToLog(string Message) 54
55 public static void SendToLog(string Message)
55 { 56 {
56 //if (Debug == true) 57 //if (Debug == true)
57 Console.WriteLine("COMPILER:LOG: " + Message); 58 Console.WriteLine("COMPILER:LOG: " + Message);
@@ -68,6 +69,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
68 Common.SendToDebug("ReverseFormatString format: " + format); 69 Common.SendToDebug("ReverseFormatString format: " + format);
69 return string.Format(format, text1); 70 return string.Format(format, text1);
70 } 71 }
72
71 public static string ReverseFormatString(string text1, UInt32 text2, string format) 73 public static string ReverseFormatString(string text1, UInt32 text2, string format)
72 { 74 {
73 Common.SendToDebug("ReverseFormatString text1: " + text1); 75 Common.SendToDebug("ReverseFormatString text1: " + text1);
@@ -75,10 +77,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
75 Common.SendToDebug("ReverseFormatString format: " + format); 77 Common.SendToDebug("ReverseFormatString format: " + format);
76 return string.Format(format, text1, text2.ToString()); 78 return string.Format(format, text1, text2.ToString());
77 } 79 }
80
78 public static string Cast_ToString(object obj) 81 public static string Cast_ToString(object obj)
79 { 82 {
80 Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); 83 Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString());
81 return "ABCDEFGIHJKLMNOPQ123"; 84 return "ABCDEFGIHJKLMNOPQ123";
82 } 85 }
83 } 86 }
84} 87} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
index f060f06..97981cc 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
@@ -27,20 +27,19 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.IO;
30using System.Reflection; 31using System.Reflection;
31using System.Reflection.Emit; 32using System.Reflection.Emit;
33using System.Text;
32using System.Threading; 34using System.Threading;
33 35
34
35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
36{ 37{
37
38
39 public class Engine 38 public class Engine
40 { 39 {
41 //private string LSO_FileName = @"LSO\AdditionTest.lso"; 40 //private string LSO_FileName = @"LSO\AdditionTest.lso";
42 private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; 41 private string LSO_FileName; // = @"LSO\CloseToDefault.lso";
43 AppDomain appDomain; 42 private AppDomain appDomain;
44 43
45 public string Compile(string LSOFileName) 44 public string Compile(string LSOFileName)
46 { 45 {
@@ -52,20 +51,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
52 51
53 // Create Assembly Name 52 // Create Assembly Name
54 AssemblyName asmName = new AssemblyName(); 53 AssemblyName asmName = new AssemblyName();
55 asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); 54 asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName);
56 //asmName.Name = "TestAssembly"; 55 //asmName.Name = "TestAssembly";
57 56
58 string DLL_FileName = asmName.Name + ".dll"; 57 string DLL_FileName = asmName.Name + ".dll";
59 string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; 58 string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName;
60 59
61 Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName)); 60 Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName));
62 Common.SendToLog("Assembly name: " + asmName.Name); 61 Common.SendToLog("Assembly name: " + asmName.Name);
63 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); 62 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll");
64 Common.SendToLog("Starting processing of LSL ByteCode..."); 63 Common.SendToLog("Starting processing of LSL ByteCode...");
65 Common.SendToLog(""); 64 Common.SendToLog("");
66 65
67 66
68
69 // Create Assembly 67 // Create Assembly
70 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( 68 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly(
71 asmName, 69 asmName,
@@ -78,15 +76,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
78 76
79 // Create a module (and save to disk) 77 // Create a module (and save to disk)
80 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule 78 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
81 (asmName.Name, 79 (asmName.Name,
82 DLL_FileName); 80 DLL_FileName);
83 81
84 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); 82 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\"");
85 // Create a Class (/Type) 83 // Create a Class (/Type)
86 TypeBuilder typeBuilder = modBuilder.DefineType( 84 TypeBuilder typeBuilder = modBuilder.DefineType(
87 "LSL_ScriptObject", 85 "LSL_ScriptObject",
88 TypeAttributes.Public | TypeAttributes.BeforeFieldInit, 86 TypeAttributes.Public | TypeAttributes.BeforeFieldInit,
89 typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass)); 87 typeof (LSL_BaseClass));
90 //, 88 //,
91 // typeof()); 89 // typeof());
92 //, typeof(LSL_BuiltIn_Commands_Interface)); 90 //, typeof(LSL_BuiltIn_Commands_Interface));
@@ -95,7 +93,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
95 // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); 93 // new Type[] { typeof(LSL_CLRInterface.LSLScript) });
96 94
97 95
98
99 /* 96 /*
100 * Generate the IL itself 97 * Generate the IL itself
101 */ 98 */
@@ -123,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
123 asmBuilder.Save(DLL_FileName); 120 asmBuilder.Save(DLL_FileName);
124 121
125 Common.SendToLog("Returning assembly filename: " + DLL_FileName); 122 Common.SendToLog("Returning assembly filename: " + DLL_FileName);
126 123
127 124
128 return DLL_FileName; 125 return DLL_FileName;
129 126
@@ -135,9 +132,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
135 //object MyScript = (object)Activator.CreateInstance(type); 132 //object MyScript = (object)Activator.CreateInstance(type);
136 133
137 134
138
139
140
141 //System.Reflection.MemberInfo[] Members = type.GetMembers(); 135 //System.Reflection.MemberInfo[] Members = type.GetMembers();
142 136
143 //Common.SendToLog("Members of assembly " + type.ToString() + ":"); 137 //Common.SendToLog("Members of assembly " + type.ToString() + ":");
@@ -165,29 +159,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
165 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); 159 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" });
166 160
167 //} 161 //}
168
169
170 } 162 }
171 163
172 164
173 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) 165 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP)
174 { 166 {
175
176
177 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); 167 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()");
178 //ConstructorBuilder constructor = typeBuilder.DefineConstructor( 168 //ConstructorBuilder constructor = typeBuilder.DefineConstructor(
179 // MethodAttributes.Public, 169 // MethodAttributes.Public,
180 // CallingConventions.Standard, 170 // CallingConventions.Standard,
181 // new Type[0]); 171 // new Type[0]);
182 ConstructorBuilder constructor = typeBuilder.DefineConstructor( 172 ConstructorBuilder constructor = typeBuilder.DefineConstructor(
183 MethodAttributes.Public | 173 MethodAttributes.Public |
184 MethodAttributes.SpecialName | 174 MethodAttributes.SpecialName |
185 MethodAttributes.RTSpecialName, 175 MethodAttributes.RTSpecialName,
186 CallingConventions.Standard, 176 CallingConventions.Standard,
187 new Type[0]); 177 new Type[0]);
188 178
189 //Define the reflection ConstructorInfor for System.Object 179 //Define the reflection ConstructorInfor for System.Object
190 ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]); 180 ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]);
191 181
192 //call constructor of base object 182 //call constructor of base object
193 ILGenerator il = constructor.GetILGenerator(); 183 ILGenerator il = constructor.GetILGenerator();
@@ -230,58 +220,61 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
230 LSO_Struct.StaticBlock sb; 220 LSO_Struct.StaticBlock sb;
231 LSOP.StaticBlocks.TryGetValue(pos, out sb); 221 LSOP.StaticBlocks.TryGetValue(pos, out sb);
232 222
233 if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's 223 if (sb.ObjectType > 0 && sb.ObjectType < 8)
234
235 il.Emit(OpCodes.Ldarg_0);
236 // Push position to stack
237 il.Emit(OpCodes.Ldc_I4, pos);
238 //il.Emit(OpCodes.Box, typeof(UInt32));
239
240
241 Type datatype = null;
242
243 // Push data to stack
244 Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")");
245 switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType)
246 { 224 {
247 case LSO_Enums.Variable_Type_Codes.Float: 225 // We don't want void or null's
248 case LSO_Enums.Variable_Type_Codes.Integer: 226
249 //UInt32 227 il.Emit(OpCodes.Ldarg_0);
250 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); 228 // Push position to stack
251 datatype = typeof(UInt32); 229 il.Emit(OpCodes.Ldc_I4, pos);
252 il.Emit(OpCodes.Box, datatype); 230 //il.Emit(OpCodes.Box, typeof(UInt32));
253 break; 231
254 case LSO_Enums.Variable_Type_Codes.String: 232
255 case LSO_Enums.Variable_Type_Codes.Key: 233 Type datatype = null;
256 //String 234
257 LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); 235 // Push data to stack
258 il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data)); 236 Common.SendToDebug("Adding to static (" + pos + ") type: " +
259 datatype = typeof(string); 237 ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType +
260 break; 238 ")");
261 case LSO_Enums.Variable_Type_Codes.Vector: 239 switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType)
262 datatype = typeof(LSO_Enums.Vector); 240 {
263 //TODO: Not implemented 241 case LSO_Enums.Variable_Type_Codes.Float:
264 break; 242 case LSO_Enums.Variable_Type_Codes.Integer:
265 case LSO_Enums.Variable_Type_Codes.Rotation: 243 //UInt32
266 //Object 244 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0));
267 //TODO: Not implemented 245 datatype = typeof (UInt32);
268 datatype = typeof(LSO_Enums.Rotation); 246 il.Emit(OpCodes.Box, datatype);
269 break; 247 break;
270 default: 248 case LSO_Enums.Variable_Type_Codes.String:
271 datatype = typeof(object); 249 case LSO_Enums.Variable_Type_Codes.Key:
272 break; 250 //String
273 } 251 LSO_Struct.HeapBlock hb =
274 252 LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1);
275 253 il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data));
276 // Make call 254 datatype = typeof (string);
277 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype })); 255 break;
256 case LSO_Enums.Variable_Type_Codes.Vector:
257 datatype = typeof (LSO_Enums.Vector);
258 //TODO: Not implemented
259 break;
260 case LSO_Enums.Variable_Type_Codes.Rotation:
261 //Object
262 //TODO: Not implemented
263 datatype = typeof (LSO_Enums.Rotation);
264 break;
265 default:
266 datatype = typeof (object);
267 break;
268 }
269
270
271 // Make call
272 il.Emit(OpCodes.Call,
273 typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype}));
278 } 274 }
279
280 } 275 }
281 276
282 277
283
284
285 ////il.Emit(OpCodes.Newobj, typeof(UInt32)); 278 ////il.Emit(OpCodes.Newobj, typeof(UInt32));
286 //il.Emit(OpCodes.Starg_0); 279 //il.Emit(OpCodes.Starg_0);
287 //// Create LSL function library 280 //// Create LSL function library
@@ -293,8 +286,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
293 } 286 }
294 287
295 288
296
297
298 // End of class 289 // End of class
299 } 290 }
300} 291} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
index 65be5e3..2dc8055 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
@@ -27,30 +27,25 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 30using System.Reflection;
33using System.Reflection.Emit; 31using System.Reflection.Emit;
34 32
35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
36{ 34{
37 partial class LSO_Parser 35 internal partial class LSO_Parser
38 { 36 {
39 private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) 37 private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName)
40 { 38 {
41 TypeBuilder typeBuilder = modBuilder.DefineType(typeName, 39 TypeBuilder typeBuilder = modBuilder.DefineType(typeName,
42 TypeAttributes.Public | 40 TypeAttributes.Public |
43 TypeAttributes.Class | 41 TypeAttributes.Class |
44 TypeAttributes.AutoClass | 42 TypeAttributes.AutoClass |
45 TypeAttributes.AnsiClass | 43 TypeAttributes.AnsiClass |
46 TypeAttributes.BeforeFieldInit | 44 TypeAttributes.BeforeFieldInit |
47 TypeAttributes.AutoLayout, 45 TypeAttributes.AutoLayout,
48 typeof(object), 46 typeof (object),
49 new Type[] { typeof(object) }); 47 new Type[] {typeof (object)});
50 return typeBuilder; 48 return typeBuilder;
51
52 } 49 }
53
54
55 } 50 }
56} 51} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
index 2fb8e45..b84400c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
@@ -28,9 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
34using OpenSim.Region.ScriptEngine.Common; 31using OpenSim.Region.ScriptEngine.Common;
35 32
36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
@@ -39,9 +36,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
39 { 36 {
40 //public MemoryStream LSLStack = new MemoryStream(); 37 //public MemoryStream LSLStack = new MemoryStream();
41 public Stack<object> LSLStack = new Stack<object>(); 38 public Stack<object> LSLStack = new Stack<object>();
42 public Dictionary<UInt32, object> StaticVariables = new Dictionary<UInt32, object>(); 39 public Dictionary<uint, object> StaticVariables = new Dictionary<uint, object>();
43 public Dictionary<UInt32, object> GlobalVariables = new Dictionary<UInt32, object>(); 40 public Dictionary<uint, object> GlobalVariables = new Dictionary<uint, object>();
44 public Dictionary<UInt32, object> LocalVariables = new Dictionary<UInt32, object>(); 41 public Dictionary<uint, object> LocalVariables = new Dictionary<uint, object>();
45 //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>(); 42 //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>();
46 //public void AddFunction(String x) { 43 //public void AddFunction(String x) {
47 // FunctionList.Add(x); 44 // FunctionList.Add(x);
@@ -54,19 +51,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
54 //} 51 //}
55 public UInt32 State = 0; 52 public UInt32 State = 0;
56 public LSL_BuiltIn_Commands_Interface LSL_Builtins; 53 public LSL_BuiltIn_Commands_Interface LSL_Builtins;
54
57 public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn() 55 public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn()
58 { 56 {
59 return LSL_Builtins; 57 return LSL_Builtins;
60 } 58 }
61 59
62 60
63 public LSL_BaseClass() { } 61 public LSL_BaseClass()
62 {
63 }
64 64
65 65
66 public virtual int OverrideMe() 66 public virtual int OverrideMe()
67 { 67 {
68 return 0; 68 return 0;
69 } 69 }
70
70 public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins) 71 public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins)
71 { 72 {
72 LSL_Builtins = LSLBuiltins; 73 LSL_Builtins = LSLBuiltins;
@@ -81,8 +82,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
81 Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType()); 82 Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType());
82 StaticVariables.Add(index, obj); 83 StaticVariables.Add(index, obj);
83 } 84 }
84
85
86
87 } 85 }
88} 86} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
index a75b4c8..c805a01 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
@@ -53,6 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
53 LocalVariables.Remove(index); 51 LocalVariables.Remove(index);
54 LocalVariables.Add(index, LSLStack.Peek()); 52 LocalVariables.Add(index, LSLStack.Peek());
55 } 53 }
54
56 public void StoreToGlobal(UInt32 index) 55 public void StoreToGlobal(UInt32 index)
57 { 56 {
58 Common.SendToDebug("::StoreToGlobal " + index); 57 Common.SendToDebug("::StoreToGlobal " + index);
@@ -60,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
60 GlobalVariables.Remove(index); 59 GlobalVariables.Remove(index);
61 GlobalVariables.Add(index, LSLStack.Peek()); 60 GlobalVariables.Add(index, LSLStack.Peek());
62 } 61 }
62
63 public void StoreToStatic(UInt32 index) 63 public void StoreToStatic(UInt32 index)
64 { 64 {
65 Common.SendToDebug("::StoreToStatic " + index); 65 Common.SendToDebug("::StoreToStatic " + index);
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
67 // StaticVariables.Remove(index); 67 // StaticVariables.Remove(index);
68 StaticVariables.Add(index, LSLStack.Peek()); 68 StaticVariables.Add(index, LSLStack.Peek());
69 } 69 }
70
70 public void GetFromLocal(UInt32 index) 71 public void GetFromLocal(UInt32 index)
71 { 72 {
72 // TODO: How to determine local? 73 // TODO: How to determine local?
@@ -76,6 +77,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
76 LSLStack.Push(ret); 77 LSLStack.Push(ret);
77 //return ret; 78 //return ret;
78 } 79 }
80
79 public void GetFromGlobal(UInt32 index) 81 public void GetFromGlobal(UInt32 index)
80 { 82 {
81 Common.SendToDebug("::GetFromGlobal " + index); 83 Common.SendToDebug("::GetFromGlobal " + index);
@@ -84,6 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
84 LSLStack.Push(ret); 86 LSLStack.Push(ret);
85 //return ret; 87 //return ret;
86 } 88 }
89
87 public void GetFromStatic(UInt32 index) 90 public void GetFromStatic(UInt32 index)
88 { 91 {
89 Common.SendToDebug("::GetFromStatic " + index); 92 Common.SendToDebug("::GetFromStatic " + index);
@@ -99,22 +102,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
99 Common.SendToDebug("::POPToStack"); 102 Common.SendToDebug("::POPToStack");
100 //return LSLStack.Pop(); 103 //return LSLStack.Pop();
101 object p = LSLStack.Pop(); 104 object p = LSLStack.Pop();
102 if (p.GetType() == typeof(UInt32)) 105 if (p.GetType() == typeof (UInt32))
103 return (UInt32)p; 106 return (UInt32) p;
104 if (p.GetType() == typeof(string)) 107 if (p.GetType() == typeof (string))
105 return (string)p; 108 return (string) p;
106 if (p.GetType() == typeof(Int32)) 109 if (p.GetType() == typeof (Int32))
107 return (Int32)p; 110 return (Int32) p;
108 if (p.GetType() == typeof(UInt16)) 111 if (p.GetType() == typeof (UInt16))
109 return (UInt16)p; 112 return (UInt16) p;
110 if (p.GetType() == typeof(float)) 113 if (p.GetType() == typeof (float))
111 return (float)p; 114 return (float) p;
112 if (p.GetType() == typeof(LSO_Enums.Vector)) 115 if (p.GetType() == typeof (LSO_Enums.Vector))
113 return (LSO_Enums.Vector)p; 116 return (LSO_Enums.Vector) p;
114 if (p.GetType() == typeof(LSO_Enums.Rotation)) 117 if (p.GetType() == typeof (LSO_Enums.Rotation))
115 return (LSO_Enums.Rotation)p; 118 return (LSO_Enums.Rotation) p;
116 if (p.GetType() == typeof(LSO_Enums.Key)) 119 if (p.GetType() == typeof (LSO_Enums.Key))
117 return (LSO_Enums.Key)p; 120 return (LSO_Enums.Key) p;
118 121
119 return p; 122 return p;
120 } 123 }
@@ -151,6 +154,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
151 LSLStack.Pop(); 154 LSLStack.Pop();
152 } 155 }
153 } 156 }
157
154 public void PUSH(object Param) 158 public void PUSH(object Param)
155 { 159 {
156 if (Param == null) 160 if (Param == null)
@@ -159,205 +163,218 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
159 } 163 }
160 else 164 else
161 { 165 {
162
163 //Common.SendToDebug("::PUSH: " + Param.GetType()); 166 //Common.SendToDebug("::PUSH: " + Param.GetType());
164 } 167 }
165 168
166 LSLStack.Push(Param); 169 LSLStack.Push(Param);
167 } 170 }
171
168 public void ADD(UInt32 Param) 172 public void ADD(UInt32 Param)
169 { 173 {
170 Common.SendToDebug("::ADD: " + Param); 174 Common.SendToDebug("::ADD: " + Param);
171 object o2 = LSLStack.Pop(); 175 object o2 = LSLStack.Pop();
172 object o1 = LSLStack.Pop(); 176 object o1 = LSLStack.Pop();
173 Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + " (" + o2.ToString() + ")"); 177 Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() +
174 if (o2.GetType() == typeof(string)) 178 " (" + o2.ToString() + ")");
179 if (o2.GetType() == typeof (string))
175 { 180 {
176 LSLStack.Push((string)o1 + (string)o2); 181 LSLStack.Push((string) o1 + (string) o2);
177 return; 182 return;
178 } 183 }
179 if (o2.GetType() == typeof(UInt32)) 184 if (o2.GetType() == typeof (UInt32))
180 { 185 {
181 LSLStack.Push((UInt32)o1 + (UInt32)o2); 186 LSLStack.Push((UInt32) o1 + (UInt32) o2);
182 return; 187 return;
183 } 188 }
184
185 } 189 }
190
186 public void SUB(UInt32 Param) 191 public void SUB(UInt32 Param)
187 { 192 {
188 Common.SendToDebug("::SUB: " + Param); 193 Common.SendToDebug("::SUB: " + Param);
189 UInt32 i2 = (UInt32)LSLStack.Pop(); 194 UInt32 i2 = (UInt32) LSLStack.Pop();
190 UInt32 i1 = (UInt32)LSLStack.Pop(); 195 UInt32 i1 = (UInt32) LSLStack.Pop();
191 LSLStack.Push((UInt32)(i1 - i2)); 196 LSLStack.Push((UInt32) (i1 - i2));
192 } 197 }
198
193 public void MUL(UInt32 Param) 199 public void MUL(UInt32 Param)
194 { 200 {
195 Common.SendToDebug("::SUB: " + Param); 201 Common.SendToDebug("::SUB: " + Param);
196 UInt32 i2 = (UInt32)LSLStack.Pop(); 202 UInt32 i2 = (UInt32) LSLStack.Pop();
197 UInt32 i1 = (UInt32)LSLStack.Pop(); 203 UInt32 i1 = (UInt32) LSLStack.Pop();
198 LSLStack.Push((UInt32)(i1 * i2)); 204 LSLStack.Push((UInt32) (i1*i2));
199 } 205 }
206
200 public void DIV(UInt32 Param) 207 public void DIV(UInt32 Param)
201 { 208 {
202 Common.SendToDebug("::DIV: " + Param); 209 Common.SendToDebug("::DIV: " + Param);
203 UInt32 i2 = (UInt32)LSLStack.Pop(); 210 UInt32 i2 = (UInt32) LSLStack.Pop();
204 UInt32 i1 = (UInt32)LSLStack.Pop(); 211 UInt32 i1 = (UInt32) LSLStack.Pop();
205 LSLStack.Push((UInt32)(i1 / i2)); 212 LSLStack.Push((UInt32) (i1/i2));
206 } 213 }
207 214
208 215
209 public void MOD(UInt32 Param) 216 public void MOD(UInt32 Param)
210 { 217 {
211 Common.SendToDebug("::MOD: " + Param); 218 Common.SendToDebug("::MOD: " + Param);
212 UInt32 i2 = (UInt32)LSLStack.Pop(); 219 UInt32 i2 = (UInt32) LSLStack.Pop();
213 UInt32 i1 = (UInt32)LSLStack.Pop(); 220 UInt32 i1 = (UInt32) LSLStack.Pop();
214 LSLStack.Push((UInt32)(i1 % i2)); 221 LSLStack.Push((UInt32) (i1%i2));
215 } 222 }
223
216 public void EQ(UInt32 Param) 224 public void EQ(UInt32 Param)
217 { 225 {
218 Common.SendToDebug("::EQ: " + Param); 226 Common.SendToDebug("::EQ: " + Param);
219 UInt32 i2 = (UInt32)LSLStack.Pop(); 227 UInt32 i2 = (UInt32) LSLStack.Pop();
220 UInt32 i1 = (UInt32)LSLStack.Pop(); 228 UInt32 i1 = (UInt32) LSLStack.Pop();
221 if (i1 == i2) 229 if (i1 == i2)
222 { 230 {
223 LSLStack.Push((UInt32)1); 231 LSLStack.Push((UInt32) 1);
224 } 232 }
225 else 233 else
226 { 234 {
227 LSLStack.Push((UInt32)0); 235 LSLStack.Push((UInt32) 0);
228 } 236 }
229 } 237 }
238
230 public void NEQ(UInt32 Param) 239 public void NEQ(UInt32 Param)
231 { 240 {
232 Common.SendToDebug("::NEQ: " + Param); 241 Common.SendToDebug("::NEQ: " + Param);
233 UInt32 i2 = (UInt32)LSLStack.Pop(); 242 UInt32 i2 = (UInt32) LSLStack.Pop();
234 UInt32 i1 = (UInt32)LSLStack.Pop(); 243 UInt32 i1 = (UInt32) LSLStack.Pop();
235 if (i1 != i2) 244 if (i1 != i2)
236 { 245 {
237 LSLStack.Push((UInt32)1); 246 LSLStack.Push((UInt32) 1);
238 } 247 }
239 else 248 else
240 { 249 {
241 LSLStack.Push((UInt32)0); 250 LSLStack.Push((UInt32) 0);
242 } 251 }
243 } 252 }
253
244 public void LEQ(UInt32 Param) 254 public void LEQ(UInt32 Param)
245 { 255 {
246 Common.SendToDebug("::LEQ: " + Param); 256 Common.SendToDebug("::LEQ: " + Param);
247 UInt32 i2 = (UInt32)LSLStack.Pop(); 257 UInt32 i2 = (UInt32) LSLStack.Pop();
248 UInt32 i1 = (UInt32)LSLStack.Pop(); 258 UInt32 i1 = (UInt32) LSLStack.Pop();
249 if (i1 <= i2) 259 if (i1 <= i2)
250 { 260 {
251 LSLStack.Push((UInt32)1); 261 LSLStack.Push((UInt32) 1);
252 } 262 }
253 else 263 else
254 { 264 {
255 LSLStack.Push((UInt32)0); 265 LSLStack.Push((UInt32) 0);
256 } 266 }
257 } 267 }
268
258 public void GEQ(UInt32 Param) 269 public void GEQ(UInt32 Param)
259 { 270 {
260 Common.SendToDebug("::GEQ: " + Param); 271 Common.SendToDebug("::GEQ: " + Param);
261 UInt32 i2 = (UInt32)LSLStack.Pop(); 272 UInt32 i2 = (UInt32) LSLStack.Pop();
262 UInt32 i1 = (UInt32)LSLStack.Pop(); 273 UInt32 i1 = (UInt32) LSLStack.Pop();
263 if (i1 >= i2) 274 if (i1 >= i2)
264 { 275 {
265 LSLStack.Push((UInt32)1); 276 LSLStack.Push((UInt32) 1);
266 } 277 }
267 else 278 else
268 { 279 {
269 LSLStack.Push((UInt32)0); 280 LSLStack.Push((UInt32) 0);
270 } 281 }
271 } 282 }
283
272 public void LESS(UInt32 Param) 284 public void LESS(UInt32 Param)
273 { 285 {
274 Common.SendToDebug("::LESS: " + Param); 286 Common.SendToDebug("::LESS: " + Param);
275 UInt32 i2 = (UInt32)LSLStack.Pop(); 287 UInt32 i2 = (UInt32) LSLStack.Pop();
276 UInt32 i1 = (UInt32)LSLStack.Pop(); 288 UInt32 i1 = (UInt32) LSLStack.Pop();
277 if (i1 < i2) 289 if (i1 < i2)
278 { 290 {
279 LSLStack.Push((UInt32)1); 291 LSLStack.Push((UInt32) 1);
280 } 292 }
281 else 293 else
282 { 294 {
283 LSLStack.Push((UInt32)0); 295 LSLStack.Push((UInt32) 0);
284 } 296 }
285 } 297 }
298
286 public void GREATER(UInt32 Param) 299 public void GREATER(UInt32 Param)
287 { 300 {
288 Common.SendToDebug("::GREATER: " + Param); 301 Common.SendToDebug("::GREATER: " + Param);
289 UInt32 i2 = (UInt32)LSLStack.Pop(); 302 UInt32 i2 = (UInt32) LSLStack.Pop();
290 UInt32 i1 = (UInt32)LSLStack.Pop(); 303 UInt32 i1 = (UInt32) LSLStack.Pop();
291 if (i1 > i2) 304 if (i1 > i2)
292 { 305 {
293 LSLStack.Push((UInt32)1); 306 LSLStack.Push((UInt32) 1);
294 } 307 }
295 else 308 else
296 { 309 {
297 LSLStack.Push((UInt32)0); 310 LSLStack.Push((UInt32) 0);
298 } 311 }
299 } 312 }
300 313
301 314
302
303 public void BITAND() 315 public void BITAND()
304 { 316 {
305 Common.SendToDebug("::BITAND"); 317 Common.SendToDebug("::BITAND");
306 UInt32 i2 = (UInt32)LSLStack.Pop(); 318 UInt32 i2 = (UInt32) LSLStack.Pop();
307 UInt32 i1 = (UInt32)LSLStack.Pop(); 319 UInt32 i1 = (UInt32) LSLStack.Pop();
308 LSLStack.Push((UInt32)(i1 & i2)); 320 LSLStack.Push((UInt32) (i1 & i2));
309 } 321 }
322
310 public void BITOR() 323 public void BITOR()
311 { 324 {
312 Common.SendToDebug("::BITOR"); 325 Common.SendToDebug("::BITOR");
313 UInt32 i2 = (UInt32)LSLStack.Pop(); 326 UInt32 i2 = (UInt32) LSLStack.Pop();
314 UInt32 i1 = (UInt32)LSLStack.Pop(); 327 UInt32 i1 = (UInt32) LSLStack.Pop();
315 LSLStack.Push((UInt32)(i1 | i2)); 328 LSLStack.Push((UInt32) (i1 | i2));
316 } 329 }
330
317 public void BITXOR() 331 public void BITXOR()
318 { 332 {
319 Common.SendToDebug("::BITXOR"); 333 Common.SendToDebug("::BITXOR");
320 UInt32 i2 = (UInt32)LSLStack.Pop(); 334 UInt32 i2 = (UInt32) LSLStack.Pop();
321 UInt32 i1 = (UInt32)LSLStack.Pop(); 335 UInt32 i1 = (UInt32) LSLStack.Pop();
322 LSLStack.Push((UInt32)(i1 ^ i2)); 336 LSLStack.Push((UInt32) (i1 ^ i2));
323 } 337 }
338
324 public void BOOLAND() 339 public void BOOLAND()
325 { 340 {
326 Common.SendToDebug("::BOOLAND"); 341 Common.SendToDebug("::BOOLAND");
327 bool b2 = bool.Parse((string)LSLStack.Pop()); 342 bool b2 = bool.Parse((string) LSLStack.Pop());
328 bool b1 = bool.Parse((string)LSLStack.Pop()); 343 bool b1 = bool.Parse((string) LSLStack.Pop());
329 if (b1 && b2) 344 if (b1 && b2)
330 { 345 {
331 LSLStack.Push((UInt32)1); 346 LSLStack.Push((UInt32) 1);
332 } 347 }
333 else 348 else
334 { 349 {
335 LSLStack.Push((UInt32)0); 350 LSLStack.Push((UInt32) 0);
336 } 351 }
337 } 352 }
353
338 public void BOOLOR() 354 public void BOOLOR()
339 { 355 {
340 Common.SendToDebug("::BOOLOR"); 356 Common.SendToDebug("::BOOLOR");
341 bool b2 = bool.Parse((string)LSLStack.Pop()); 357 bool b2 = bool.Parse((string) LSLStack.Pop());
342 bool b1 = bool.Parse((string)LSLStack.Pop()); 358 bool b1 = bool.Parse((string) LSLStack.Pop());
343 359
344 if (b1 || b2) 360 if (b1 || b2)
345 { 361 {
346 LSLStack.Push((UInt32)1); 362 LSLStack.Push((UInt32) 1);
347 } 363 }
348 else 364 else
349 { 365 {
350 LSLStack.Push((UInt32)0); 366 LSLStack.Push((UInt32) 0);
351 } 367 }
352
353 } 368 }
369
354 public void NEG(UInt32 Param) 370 public void NEG(UInt32 Param)
355 { 371 {
356 Common.SendToDebug("::NEG: " + Param); 372 Common.SendToDebug("::NEG: " + Param);
357 //UInt32 i2 = (UInt32)LSLStack.Pop(); 373 //UInt32 i2 = (UInt32)LSLStack.Pop();
358 UInt32 i1 = (UInt32)LSLStack.Pop(); 374 UInt32 i1 = (UInt32) LSLStack.Pop();
359 LSLStack.Push((UInt32)(i1 * -1)); 375 LSLStack.Push((UInt32) (i1*-1));
360 } 376 }
377
361 public void BITNOT() 378 public void BITNOT()
362 { 379 {
363 //Common.SendToDebug("::BITNOT"); 380 //Common.SendToDebug("::BITNOT");
@@ -365,6 +382,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
365 //UInt32 i1 = (UInt32)LSLStack.Pop(); 382 //UInt32 i1 = (UInt32)LSLStack.Pop();
366 //LSLStack.Push((UInt32)(i1 / i2)); 383 //LSLStack.Push((UInt32)(i1 / i2));
367 } 384 }
385
368 public void BOOLNOT() 386 public void BOOLNOT()
369 { 387 {
370 //Common.SendToDebug("::BOOLNOT"); 388 //Common.SendToDebug("::BOOLNOT");
@@ -372,7 +390,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
372 //UInt32 i1 = (UInt32)LSLStack.Pop(); 390 //UInt32 i1 = (UInt32)LSLStack.Pop();
373 //LSLStack.Push((UInt32)(i1)); 391 //LSLStack.Push((UInt32)(i1));
374 } 392 }
375
376
377 } 393 }
378} 394} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
index 5f01bf5..8b233ba 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 29namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 30{
35 public class LSL_CLRInterface 31 public class LSL_CLRInterface
@@ -76,4 +72,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
76 //void event_http_response(); 72 //void event_http_response();
77 } 73 }
78 } 74 }
79} 75} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
index ee166a6..e1d7768 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
@@ -27,32 +27,28 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 30using System.Reflection;
33using System.Reflection.Emit; 31using System.Reflection.Emit;
34using OpenSim.Region.ScriptEngine.Common; 32using OpenSim.Region.ScriptEngine.Common;
35 33
36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
37{ 35{
38 partial class LSO_Parser 36 internal partial class LSO_Parser
39 { 37 {
40 //internal Stack<Type> ILStack = new Stack<Type>(); 38 //internal Stack<Type> ILStack = new Stack<Type>();
41 //LSO_Enums MyLSO_Enums = new LSO_Enums(); 39 //LSO_Enums MyLSO_Enums = new LSO_Enums();
42 40
43 internal bool LSL_PROCESS_OPCODE(ILGenerator il) 41 internal bool LSL_PROCESS_OPCODE(ILGenerator il)
44 { 42 {
45
46 byte bp1; 43 byte bp1;
47 UInt32 u32p1; 44 UInt32 u32p1;
48 float fp1; 45 float fp1;
49 UInt16 opcode = br_read(1)[0]; 46 UInt16 opcode = br_read(1)[0];
50 Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); 47 Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString());
51 string idesc = ((LSO_Enums.Operation_Table)opcode).ToString(); 48 string idesc = ((LSO_Enums.Operation_Table) opcode).ToString();
52 switch ((LSO_Enums.Operation_Table)opcode) 49 switch ((LSO_Enums.Operation_Table) opcode)
53 { 50 {
54 51 /***************
55 /***************
56 * IMPLEMENTED * 52 * IMPLEMENTED *
57 ***************/ 53 ***************/
58 case LSO_Enums.Operation_Table.NOOP: 54 case LSO_Enums.Operation_Table.NOOP:
@@ -60,33 +56,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
60 case LSO_Enums.Operation_Table.PUSHSP: 56 case LSO_Enums.Operation_Table.PUSHSP:
61 // Push Stack Top (Memory Address) to stack 57 // Push Stack Top (Memory Address) to stack
62 Common.SendToDebug("Instruction " + idesc); 58 Common.SendToDebug("Instruction " + idesc);
63 Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack"); 59 Common.SendToDebug("Instruction " + idesc +
64 IL_Push(il, (UInt32)myHeader.SP); 60 ": Description: Pushing Stack Top (Memory Address from header) to stack");
61 IL_Push(il, (UInt32) myHeader.SP);
65 break; 62 break;
66 // BYTE 63 // BYTE
67 case LSO_Enums.Operation_Table.PUSHARGB: 64 case LSO_Enums.Operation_Table.PUSHARGB:
68 Common.SendToDebug("Param1: " + br_read(1)[0]); 65 Common.SendToDebug("Param1: " + br_read(1)[0]);
69 break; 66 break;
70 // INTEGER 67 // INTEGER
71 case LSO_Enums.Operation_Table.PUSHARGI: 68 case LSO_Enums.Operation_Table.PUSHARGI:
72 u32p1 = BitConverter.ToUInt32(br_read(4), 0); 69 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
73 Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); 70 Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1);
74 IL_Push(il, u32p1); 71 IL_Push(il, u32p1);
75 break; 72 break;
76 // FLOAT 73 // FLOAT
77 case LSO_Enums.Operation_Table.PUSHARGF: 74 case LSO_Enums.Operation_Table.PUSHARGF:
78 fp1 = BitConverter.ToUInt32(br_read(4), 0); 75 fp1 = BitConverter.ToUInt32(br_read(4), 0);
79 Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); 76 Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1);
80 IL_Push(il, fp1); 77 IL_Push(il, fp1);
81 break; 78 break;
82 // STRING 79 // STRING
83 case LSO_Enums.Operation_Table.PUSHARGS: 80 case LSO_Enums.Operation_Table.PUSHARGS:
84 string s = Read_String(); 81 string s = Read_String();
85 Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); 82 Common.SendToDebug("Instruction " + idesc + ", Param1: " + s);
86 IL_Debug(il, "OPCODE: " + idesc + ":" + s); 83 IL_Debug(il, "OPCODE: " + idesc + ":" + s);
87 IL_Push(il, s); 84 IL_Push(il, s);
88 break; 85 break;
89 // VECTOR z,y,x 86 // VECTOR z,y,x
90 case LSO_Enums.Operation_Table.PUSHARGV: 87 case LSO_Enums.Operation_Table.PUSHARGV:
91 LSO_Enums.Vector v = new LSO_Enums.Vector(); 88 LSO_Enums.Vector v = new LSO_Enums.Vector();
92 v.Z = BitConverter.ToUInt32(br_read(4), 0); 89 v.Z = BitConverter.ToUInt32(br_read(4), 0);
@@ -97,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
97 Common.SendToDebug("Param1 X: " + v.X); 94 Common.SendToDebug("Param1 X: " + v.X);
98 IL_Push(il, v); 95 IL_Push(il, v);
99 break; 96 break;
100 // ROTATION s,z,y,x 97 // ROTATION s,z,y,x
101 case LSO_Enums.Operation_Table.PUSHARGQ: 98 case LSO_Enums.Operation_Table.PUSHARGQ:
102 LSO_Enums.Rotation r = new LSO_Enums.Rotation(); 99 LSO_Enums.Rotation r = new LSO_Enums.Rotation();
103 r.S = BitConverter.ToUInt32(br_read(4), 0); 100 r.S = BitConverter.ToUInt32(br_read(4), 0);
@@ -112,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
112 break; 109 break;
113 110
114 case LSO_Enums.Operation_Table.PUSHE: 111 case LSO_Enums.Operation_Table.PUSHE:
115 IL_Push(il, (UInt32)0); 112 IL_Push(il, (UInt32) 0);
116 break; 113 break;
117 114
118 case LSO_Enums.Operation_Table.PUSHARGE: 115 case LSO_Enums.Operation_Table.PUSHARGE:
@@ -121,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
121 //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); 118 //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1)));
122 IL_Push(il, u32p1); 119 IL_Push(il, u32p1);
123 break; 120 break;
124 // BYTE 121 // BYTE
125 case LSO_Enums.Operation_Table.ADD: 122 case LSO_Enums.Operation_Table.ADD:
126 case LSO_Enums.Operation_Table.SUB: 123 case LSO_Enums.Operation_Table.SUB:
127 case LSO_Enums.Operation_Table.MUL: 124 case LSO_Enums.Operation_Table.MUL:
@@ -136,10 +133,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
136 case LSO_Enums.Operation_Table.MOD: 133 case LSO_Enums.Operation_Table.MOD:
137 bp1 = br_read(1)[0]; 134 bp1 = br_read(1)[0];
138 Common.SendToDebug("Param1: " + bp1); 135 Common.SendToDebug("Param1: " + bp1);
139 IL_CallBaseFunction(il, idesc, (UInt32)bp1); 136 IL_CallBaseFunction(il, idesc, (UInt32) bp1);
140 break; 137 break;
141 138
142 // NO ARGUMENTS 139 // NO ARGUMENTS
143 case LSO_Enums.Operation_Table.BITAND: 140 case LSO_Enums.Operation_Table.BITAND:
144 case LSO_Enums.Operation_Table.BITOR: 141 case LSO_Enums.Operation_Table.BITOR:
145 case LSO_Enums.Operation_Table.BITXOR: 142 case LSO_Enums.Operation_Table.BITXOR:
@@ -149,22 +146,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
149 case LSO_Enums.Operation_Table.BOOLNOT: 146 case LSO_Enums.Operation_Table.BOOLNOT:
150 IL_CallBaseFunction(il, idesc); 147 IL_CallBaseFunction(il, idesc);
151 break; 148 break;
152 // SHORT 149 // SHORT
153 case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: 150 case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE:
154 // TODO: What is size of short? 151 // TODO: What is size of short?
155 UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); 152 UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0);
156 Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString()); 153 Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " +
154 ((LSO_Enums.BuiltIn_Functions) U16p1).ToString());
157 //Common.SendToDebug("Param1: " + U16p1); 155 //Common.SendToDebug("Param1: " + U16p1);
158 string fname = ((LSO_Enums.BuiltIn_Functions)U16p1).ToString(); 156 string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString();
159 157
160 bool cmdFound = false; 158 bool cmdFound = false;
161 foreach (MethodInfo mi in typeof(LSL_BuiltIn_Commands_Interface).GetMethods()) 159 foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods())
162 { 160 {
163 // Found command 161 // Found command
164 if (mi.Name == fname) 162 if (mi.Name == fname)
165 { 163 {
166 il.Emit(OpCodes.Ldarg_0); 164 il.Emit(OpCodes.Ldarg_0);
167 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] { })); 165 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {}));
168 // Pop required number of items from my stack to .Net stack 166 // Pop required number of items from my stack to .Net stack
169 IL_PopToStack(il, mi.GetParameters().Length); 167 IL_PopToStack(il, mi.GetParameters().Length);
170 il.Emit(OpCodes.Callvirt, mi); 168 il.Emit(OpCodes.Callvirt, mi);
@@ -179,7 +177,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
179 177
180 break; 178 break;
181 179
182 // RETURN 180 // RETURN
183 case LSO_Enums.Operation_Table.RETURN: 181 case LSO_Enums.Operation_Table.RETURN:
184 182
185 Common.SendToDebug("OPCODE: RETURN"); 183 Common.SendToDebug("OPCODE: RETURN");
@@ -195,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
195 IL_Pop(il); 193 IL_Pop(il);
196 break; 194 break;
197 195
198 // LONG 196 // LONG
199 case LSO_Enums.Operation_Table.STORE: 197 case LSO_Enums.Operation_Table.STORE:
200 case LSO_Enums.Operation_Table.STORES: 198 case LSO_Enums.Operation_Table.STORES:
201 case LSO_Enums.Operation_Table.STOREL: 199 case LSO_Enums.Operation_Table.STOREL:
@@ -238,7 +236,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
238 IL_Pop(il); 236 IL_Pop(il);
239 break; 237 break;
240 238
241 // PUSH FROM LOCAL FRAME 239 // PUSH FROM LOCAL FRAME
242 case LSO_Enums.Operation_Table.PUSH: 240 case LSO_Enums.Operation_Table.PUSH:
243 case LSO_Enums.Operation_Table.PUSHS: 241 case LSO_Enums.Operation_Table.PUSHS:
244 case LSO_Enums.Operation_Table.PUSHL: 242 case LSO_Enums.Operation_Table.PUSHL:
@@ -250,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
250 248
251 break; 249 break;
252 250
253 // PUSH FROM STATIC FRAME 251 // PUSH FROM STATIC FRAME
254 case LSO_Enums.Operation_Table.PUSHG: 252 case LSO_Enums.Operation_Table.PUSHG:
255 case LSO_Enums.Operation_Table.PUSHGS: 253 case LSO_Enums.Operation_Table.PUSHGS:
256 case LSO_Enums.Operation_Table.PUSHGL: 254 case LSO_Enums.Operation_Table.PUSHGL:
@@ -262,26 +260,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
262 break; 260 break;
263 261
264 262
265 /*********************** 263 /***********************
266 * NOT IMPLEMENTED YET * 264 * NOT IMPLEMENTED YET *
267 ***********************/ 265 ***********************/
268 266
269 267
270
271 case LSO_Enums.Operation_Table.POPIP: 268 case LSO_Enums.Operation_Table.POPIP:
272 case LSO_Enums.Operation_Table.POPSP: 269 case LSO_Enums.Operation_Table.POPSP:
273 case LSO_Enums.Operation_Table.POPSLR: 270 case LSO_Enums.Operation_Table.POPSLR:
274 case LSO_Enums.Operation_Table.POPARG: 271 case LSO_Enums.Operation_Table.POPARG:
275 case LSO_Enums.Operation_Table.POPBP: 272 case LSO_Enums.Operation_Table.POPBP:
276 //Common.SendToDebug("Instruction " + idesc + ": Ignored"); 273 //Common.SendToDebug("Instruction " + idesc + ": Ignored");
277 Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); 274 Common.SendToDebug("Instruction " + idesc +
275 ": Description: Drop x bytes from the stack (TODO: Only popping 1)");
278 //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 276 //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
279 IL_Pop(il); 277 IL_Pop(il);
280 break; 278 break;
281 279
282 280
283 281 // None
284 // None
285 case LSO_Enums.Operation_Table.PUSHIP: 282 case LSO_Enums.Operation_Table.PUSHIP:
286 // PUSH INSTRUCTION POINTER 283 // PUSH INSTRUCTION POINTER
287 break; 284 break;
@@ -293,17 +290,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
293 break; 290 break;
294 291
295 292
296 // LONG 293 // LONG
297 case LSO_Enums.Operation_Table.JUMP: 294 case LSO_Enums.Operation_Table.JUMP:
298 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 295 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
299 break; 296 break;
300 // BYTE, LONG 297 // BYTE, LONG
301 case LSO_Enums.Operation_Table.JUMPIF: 298 case LSO_Enums.Operation_Table.JUMPIF:
302 case LSO_Enums.Operation_Table.JUMPNIF: 299 case LSO_Enums.Operation_Table.JUMPNIF:
303 Common.SendToDebug("Param1: " + br_read(1)[0]); 300 Common.SendToDebug("Param1: " + br_read(1)[0]);
304 Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); 301 Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0));
305 break; 302 break;
306 // LONG 303 // LONG
307 case LSO_Enums.Operation_Table.STATE: 304 case LSO_Enums.Operation_Table.STATE:
308 bp1 = br_read(1)[0]; 305 bp1 = br_read(1)[0];
309 //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack 306 //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack
@@ -315,12 +312,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
315 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 312 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
316 Common.SendToDebug("ERROR: Function CALL not implemented yet."); 313 Common.SendToDebug("ERROR: Function CALL not implemented yet.");
317 break; 314 break;
318 // BYTE 315 // BYTE
319 case LSO_Enums.Operation_Table.CAST: 316 case LSO_Enums.Operation_Table.CAST:
320 bp1 = br_read(1)[0]; 317 bp1 = br_read(1)[0];
321 Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)); 318 Common.SendToDebug("Instruction " + idesc + ": Cast to type: " +
319 ((LSO_Enums.OpCode_Cast_TypeDefs) bp1));
322 Common.SendToDebug("Param1: " + bp1); 320 Common.SendToDebug("Param1: " + bp1);
323 switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1) 321 switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)
324 { 322 {
325 case LSO_Enums.OpCode_Cast_TypeDefs.String: 323 case LSO_Enums.OpCode_Cast_TypeDefs.String:
326 Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); 324 Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());");
@@ -330,12 +328,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
330 break; 328 break;
331 } 329 }
332 break; 330 break;
333 // LONG 331 // LONG
334 case LSO_Enums.Operation_Table.STACKTOS: 332 case LSO_Enums.Operation_Table.STACKTOS:
335 case LSO_Enums.Operation_Table.STACKTOL: 333 case LSO_Enums.Operation_Table.STACKTOL:
336 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 334 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
337 break; 335 break;
338 // BYTE 336 // BYTE
339 case LSO_Enums.Operation_Table.PRINT: 337 case LSO_Enums.Operation_Table.PRINT:
340 case LSO_Enums.Operation_Table.CALLLIB: 338 case LSO_Enums.Operation_Table.CALLLIB:
341 Common.SendToDebug("Param1: " + br_read(1)[0]); 339 Common.SendToDebug("Param1: " + br_read(1)[0]);
@@ -348,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
348 { 346 {
349 IL_PopToStack(il, 1); 347 IL_PopToStack(il, 1);
350 } 348 }
349
351 private void IL_PopToStack(ILGenerator il, int count) 350 private void IL_PopToStack(ILGenerator il, int count)
352 { 351 {
353 Common.SendToDebug("IL_PopToStack();"); 352 Common.SendToDebug("IL_PopToStack();");
@@ -360,31 +359,35 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
360 // new Type[] { })); 359 // new Type[] { }));
361 } 360 }
362 } 361 }
362
363 private void IL_Pop(ILGenerator il) 363 private void IL_Pop(ILGenerator il)
364 { 364 {
365 Common.SendToDebug("IL_Pop();"); 365 Common.SendToDebug("IL_Pop();");
366 IL_CallBaseFunction(il, "POP"); 366 IL_CallBaseFunction(il, "POP");
367 } 367 }
368
368 private void IL_Debug(ILGenerator il, string text) 369 private void IL_Debug(ILGenerator il, string text)
369 { 370 {
370 il.Emit(OpCodes.Ldstr, text); 371 il.Emit(OpCodes.Ldstr, text);
371 il.Emit(OpCodes.Call, typeof(Common).GetMethod("SendToDebug", 372 il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug",
372 new Type[] { typeof(string) } 373 new Type[] {typeof (string)}
373 )); 374 ));
374 } 375 }
376
375 private void IL_CallBaseFunction(ILGenerator il, string methodname) 377 private void IL_CallBaseFunction(ILGenerator il, string methodname)
376 { 378 {
377 il.Emit(OpCodes.Ldarg_0); 379 il.Emit(OpCodes.Ldarg_0);
378 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { })); 380 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {}));
379 } 381 }
382
380 private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) 383 private void IL_CallBaseFunction(ILGenerator il, string methodname, object data)
381 { 384 {
382 il.Emit(OpCodes.Ldarg_0); 385 il.Emit(OpCodes.Ldarg_0);
383 if (data.GetType() == typeof(string)) 386 if (data.GetType() == typeof (string))
384 il.Emit(OpCodes.Ldstr, (string)data); 387 il.Emit(OpCodes.Ldstr, (string) data);
385 if (data.GetType() == typeof(UInt32)) 388 if (data.GetType() == typeof (UInt32))
386 il.Emit(OpCodes.Ldc_I4, (UInt32)data); 389 il.Emit(OpCodes.Ldc_I4, (UInt32) data);
387 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { data.GetType() })); 390 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()}));
388 } 391 }
389 392
390 private void IL_Push(ILGenerator il, object data) 393 private void IL_Push(ILGenerator il, object data)
@@ -394,43 +397,39 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
394 397
395 IL_PushDataTypeToILStack(il, data); 398 IL_PushDataTypeToILStack(il, data);
396 399
397 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("PUSH", new Type[] { data.GetType() })); 400 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()}));
398
399 } 401 }
400 402
401 private void IL_PushDataTypeToILStack(ILGenerator il, object data) 403 private void IL_PushDataTypeToILStack(ILGenerator il, object data)
402 { 404 {
403 if (data.GetType() == typeof(UInt16)) 405 if (data.GetType() == typeof (UInt16))
404 { 406 {
405 il.Emit(OpCodes.Ldc_I4, (UInt16)data); 407 il.Emit(OpCodes.Ldc_I4, (UInt16) data);
406 il.Emit(OpCodes.Box, data.GetType()); 408 il.Emit(OpCodes.Box, data.GetType());
407 } 409 }
408 if (data.GetType() == typeof(UInt32)) 410 if (data.GetType() == typeof (UInt32))
409 { 411 {
410 il.Emit(OpCodes.Ldc_I4, (UInt32)data); 412 il.Emit(OpCodes.Ldc_I4, (UInt32) data);
411 il.Emit(OpCodes.Box, data.GetType()); 413 il.Emit(OpCodes.Box, data.GetType());
412 } 414 }
413 if (data.GetType() == typeof(Int32)) 415 if (data.GetType() == typeof (Int32))
414 { 416 {
415 il.Emit(OpCodes.Ldc_I4, (Int32)data); 417 il.Emit(OpCodes.Ldc_I4, (Int32) data);
416 il.Emit(OpCodes.Box, data.GetType()); 418 il.Emit(OpCodes.Box, data.GetType());
417 } 419 }
418 if (data.GetType() == typeof(float)) 420 if (data.GetType() == typeof (float))
419 { 421 {
420 il.Emit(OpCodes.Ldc_I4, (float)data); 422 il.Emit(OpCodes.Ldc_I4, (float) data);
421 il.Emit(OpCodes.Box, data.GetType()); 423 il.Emit(OpCodes.Box, data.GetType());
422 } 424 }
423 if (data.GetType() == typeof(string)) 425 if (data.GetType() == typeof (string))
424 il.Emit(OpCodes.Ldstr, (string)data); 426 il.Emit(OpCodes.Ldstr, (string) data);
425 //if (data.GetType() == typeof(LSO_Enums.Rotation)) 427 //if (data.GetType() == typeof(LSO_Enums.Rotation))
426 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); 428 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data);
427 //if (data.GetType() == typeof(LSO_Enums.Vector)) 429 //if (data.GetType() == typeof(LSO_Enums.Vector))
428 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); 430 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data);
429 //if (data.GetType() == typeof(LSO_Enums.Key)) 431 //if (data.GetType() == typeof(LSO_Enums.Key))
430 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); 432 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data);
431
432 } 433 }
433
434
435 } 434 }
436} 435} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
index 30ce314..a7e3018 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
@@ -47,6 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
47 String = 51, 45 String = 51,
48 UInt32 = 17 46 UInt32 = 17
49 } 47 }
48
50 [Serializable] 49 [Serializable]
51 public enum OpCode_Cast_TypeDefs 50 public enum OpCode_Cast_TypeDefs
52 { 51 {
@@ -66,6 +65,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
66 public UInt32 Y; 65 public UInt32 Y;
67 public UInt32 X; 66 public UInt32 X;
68 } 67 }
68
69 [Serializable] 69 [Serializable]
70 public struct Rotation 70 public struct Rotation
71 { 71 {
@@ -74,6 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
74 public UInt32 Y; 74 public UInt32 Y;
75 public UInt32 X; 75 public UInt32 X;
76 } 76 }
77
77 [Serializable] 78 [Serializable]
78 public enum Variable_Type_Codes 79 public enum Variable_Type_Codes
79 { 80 {
@@ -87,6 +88,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
87 List = 7, 88 List = 7,
88 Null = 8 89 Null = 8
89 } 90 }
91
90 [Serializable] 92 [Serializable]
91 public enum Event_Mask_Values 93 public enum Event_Mask_Values
92 { 94 {
@@ -124,6 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
124 remote_data = 31, 126 remote_data = 31,
125 http_response = 32 127 http_response = 32
126 } 128 }
129
127 [Serializable] 130 [Serializable]
128 public enum Operation_Table 131 public enum Operation_Table
129 { 132 {
@@ -220,6 +223,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
220 SHL = 0xe0, 223 SHL = 0xe0,
221 SHR = 0xe1 224 SHR = 0xe1
222 } 225 }
226
223 [Serializable] 227 [Serializable]
224 public enum BuiltIn_Functions 228 public enum BuiltIn_Functions
225 { 229 {
@@ -552,6 +556,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
552 llGetParcelMaxPrims = 326, 556 llGetParcelMaxPrims = 326,
553 llGetParcelDetails = 327 557 llGetParcelDetails = 327
554 } 558 }
555
556 } 559 }
557} 560} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
index ba97375..a0b4977f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
@@ -27,15 +27,16 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Text;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34using System.Reflection.Emit; 34using System.Reflection.Emit;
35using System.Text;
35 36
36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 37namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
37{ 38{
38 partial class LSO_Parser 39 internal partial class LSO_Parser
39 { 40 {
40 private string FileName; 41 private string FileName;
41 private FileStream fs; 42 private FileStream fs;
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
45 //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); 46 //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable();
46 47
47 private TypeBuilder typeBuilder; 48 private TypeBuilder typeBuilder;
48 private System.Collections.Generic.List<string> EventList = new System.Collections.Generic.List<string>(); 49 private List<string> EventList = new List<string>();
49 50
50 public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) 51 public LSO_Parser(string _FileName, TypeBuilder _typeBuilder)
51 { 52 {
@@ -59,11 +60,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
59 Common.SendToDebug("Opening filename: " + FileName); 60 Common.SendToDebug("Opening filename: " + FileName);
60 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); 61 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
61 br = new BinaryReader(fs, Encoding.BigEndianUnicode); 62 br = new BinaryReader(fs, Encoding.BigEndianUnicode);
62
63 } 63 }
64
64 internal void CloseFile() 65 internal void CloseFile()
65 { 66 {
66
67 // Close 67 // Close
68 br.Close(); 68 br.Close();
69 fs.Close(); 69 fs.Close();
@@ -75,9 +75,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
75 /// </summary> 75 /// </summary>
76 public void Parse() 76 public void Parse()
77 { 77 {
78
79
80
81 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. 78 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
82 79
83 80
@@ -148,14 +145,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
148 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); 145 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
149 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); 146 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
150 myStaticBlock.ObjectType = br_read(1)[0]; 147 myStaticBlock.ObjectType = br_read(1)[0];
151 Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); 148 Common.SendToDebug("Static Block ObjectType: " +
149 ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
152 myStaticBlock.Unknown = br_read(1)[0]; 150 myStaticBlock.Unknown = br_read(1)[0];
153 // Size of datatype varies -- what about strings? 151 // Size of datatype varies -- what about strings?
154 if (myStaticBlock.ObjectType != 0) 152 if (myStaticBlock.ObjectType != 0)
155 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); 153 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
156 154
157 StaticBlocks.Add((UInt32)startReadPos, myStaticBlock); 155 StaticBlocks.Add((UInt32) startReadPos, myStaticBlock);
158
159 } 156 }
160 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); 157 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
161 158
@@ -183,7 +180,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
183 // TODO: ADD TO FUNCTION LIST (How do we identify it later?) 180 // TODO: ADD TO FUNCTION LIST (How do we identify it later?)
184 // Note! Absolute position 181 // Note! Absolute position
185 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; 182 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR;
186 Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); 183 Common.SendToDebug("Fuction " + i + " code chunk position: " +
184 myFunctionBlock.CodeChunkPointer[i]);
187 } 185 }
188 } 186 }
189 } 187 }
@@ -204,14 +202,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
204 Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); 202 Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position);
205 // Position is relative to state frame 203 // Position is relative to state frame
206 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); 204 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
207 myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); 205 myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8));
208 Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); 206 Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location);
209 Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); 207 Common.SendToDebug("Total potential EventMask bits: " +
208 myStateFrameBlock.StatePointer[i].EventMask.Count);
210 209
211 //// Read STATE BLOCK 210 //// Read STATE BLOCK
212 //long CurPos = fs.Position; 211 //long CurPos = fs.Position;
213 //fs.Seek(CurPos, SeekOrigin.Begin); 212 //fs.Seek(CurPos, SeekOrigin.Begin);
214
215 } 213 }
216 } 214 }
217 215
@@ -224,19 +222,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
224 // Go through all State Frame Pointers found 222 // Go through all State Frame Pointers found
225 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 223 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
226 { 224 {
227
228 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); 225 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin);
229 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); 226 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position);
230 227
231 // READ: STATE BLOCK HEADER 228 // READ: STATE BLOCK HEADER
232 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); 229 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock();
233 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note 230 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note
234 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); 231 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0);
235 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; 232 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0];
236 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note 233 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note
237 Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); 234 Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos);
238 Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); 235 Common.SendToDebug("State block Header Size: " +
239 Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); 236 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
237 Common.SendToDebug("State block Header End Pos: " +
238 myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
240 239
241 // We need to count number of bits flagged in EventMask? 240 // We need to count number of bits flagged in EventMask?
242 241
@@ -245,27 +244,36 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
245 244
246 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE 245 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
247 //TODO: Create event hooks 246 //TODO: Create event hooks
248 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; 247 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers =
248 new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
249 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 249 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
250 { 250 {
251
252 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) 251 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true)
253 { 252 {
254 // We got an event 253 // We got an event
255 // READ: STATE BLOCK HANDLER 254 // READ: STATE BLOCK HANDLER
256 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); 255 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii +
257 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); 256 " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " +
258 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); 257 fs.Position);
259 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); 258 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer =
260 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize); 259 myStateFrameBlock.StatePointer[i].StateBlock.EndPos +
260 BitConverter.ToUInt32(br_read(4), 0);
261 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize =
262 BitConverter.ToUInt32(br_read(4), 0);
263 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" +
264 ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " +
265 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].
266 CodeChunkPointer);
267 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" +
268 ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " +
269 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].
270 CallFrameSize);
261 } 271 }
262 } 272 }
263 } 273 }
264 } 274 }
265 275
266 276
267
268
269 //// READ FUNCTION CODE CHUNKS 277 //// READ FUNCTION CODE CHUNKS
270 //// Functions + Function start pos (GFR) 278 //// Functions + Function start pos (GFR)
271 //// TODO: Somehow be able to identify and reference this 279 //// TODO: Somehow be able to identify and reference this
@@ -291,37 +299,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
291 // two level search ain't no good 299 // two level search ain't no good
292 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 300 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
293 { 301 {
294
295
296 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) 302 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0)
297 { 303 {
298 Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); 304 Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " +
305 (LSO_Enums.Event_Mask_Values) ii);
299 306
300 307
301 // Override a Method / Function 308 // Override a Method / Function
302 string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii; 309 string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii;
303 Common.SendToDebug("Event Name: " + eventname); 310 Common.SendToDebug("Event Name: " + eventname);
304 if (Common.IL_ProcessCodeChunks) 311 if (Common.IL_ProcessCodeChunks)
305 { 312 {
306 EventList.Add(eventname); 313 EventList.Add(eventname);
307 314
308 // JUMP TO CODE PROCESSOR 315 // JUMP TO CODE PROCESSOR
309 ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname); 316 ProcessCodeChunk(
317 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer,
318 typeBuilder, eventname);
310 } 319 }
311 } 320 }
312
313 } 321 }
314
315 } 322 }
316
317 } 323 }
318 324
319 325
320
321
322 if (Common.IL_CreateFunctionList) 326 if (Common.IL_CreateFunctionList)
323 IL_INSERT_FUNCTIONLIST(); 327 IL_INSERT_FUNCTIONLIST();
324
325 } 328 }
326 329
327 internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) 330 internal LSO_Struct.HeapBlock GetHeap(UInt32 pos)
@@ -342,11 +345,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
342 345
343 346
344 Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); 347 Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize);
345 Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); 348 Common.SendToDebug("Heap Block ObjectType: " +
349 ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString());
346 Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); 350 Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount);
347 351
348 return myHeapBlock; 352 return myHeapBlock;
349 } 353 }
354
350 private byte[] br_read(int len) 355 private byte[] br_read(int len)
351 { 356 {
352 if (len <= 0) 357 if (len <= 0)
@@ -365,6 +370,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
365 throw (e); 370 throw (e);
366 } 371 }
367 } 372 }
373
368 //private byte[] br_read_smallendian(int len) 374 //private byte[] br_read_smallendian(int len)
369 //{ 375 //{
370 // byte[] bytes = new byte[len]; 376 // byte[] bytes = new byte[len];
@@ -373,29 +379,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
373 //} 379 //}
374 private Type getLLObjectType(byte objectCode) 380 private Type getLLObjectType(byte objectCode)
375 { 381 {
376 switch ((LSO_Enums.Variable_Type_Codes)objectCode) 382 switch ((LSO_Enums.Variable_Type_Codes) objectCode)
377 { 383 {
378 case LSO_Enums.Variable_Type_Codes.Void: return typeof(void); 384 case LSO_Enums.Variable_Type_Codes.Void:
379 case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32); 385 return typeof (void);
380 case LSO_Enums.Variable_Type_Codes.Float: return typeof(float); 386 case LSO_Enums.Variable_Type_Codes.Integer:
381 case LSO_Enums.Variable_Type_Codes.String: return typeof(string); 387 return typeof (UInt32);
382 case LSO_Enums.Variable_Type_Codes.Key: return typeof(string); 388 case LSO_Enums.Variable_Type_Codes.Float:
383 case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector); 389 return typeof (float);
384 case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation); 390 case LSO_Enums.Variable_Type_Codes.String:
391 return typeof (string);
392 case LSO_Enums.Variable_Type_Codes.Key:
393 return typeof (string);
394 case LSO_Enums.Variable_Type_Codes.Vector:
395 return typeof (LSO_Enums.Vector);
396 case LSO_Enums.Variable_Type_Codes.Rotation:
397 return typeof (LSO_Enums.Rotation);
385 case LSO_Enums.Variable_Type_Codes.List: 398 case LSO_Enums.Variable_Type_Codes.List:
386 Common.SendToDebug("TODO: List datatype not implemented yet!"); 399 Common.SendToDebug("TODO: List datatype not implemented yet!");
387 return typeof(System.Collections.ArrayList); 400 return typeof (ArrayList);
388 case LSO_Enums.Variable_Type_Codes.Null: 401 case LSO_Enums.Variable_Type_Codes.Null:
389 Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); 402 Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!");
390 return typeof(string); 403 return typeof (string);
391 default: 404 default:
392 Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); 405 Common.SendToDebug("Lookup of LSL datatype " + objectCode +
393 return typeof(object); 406 " to .Net datatype failed: Unknown LSL datatype. Defaulting to object.");
407 return typeof (object);
394 } 408 }
395 } 409 }
410
396 private int getObjectSize(byte ObjectType) 411 private int getObjectSize(byte ObjectType)
397 { 412 {
398 switch ((LSO_Enums.Variable_Type_Codes)ObjectType) 413 switch ((LSO_Enums.Variable_Type_Codes) ObjectType)
399 { 414 {
400 case LSO_Enums.Variable_Type_Codes.Integer: 415 case LSO_Enums.Variable_Type_Codes.Integer:
401 case LSO_Enums.Variable_Type_Codes.Float: 416 case LSO_Enums.Variable_Type_Codes.Float:
@@ -411,13 +426,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
411 return 0; 426 return 0;
412 } 427 }
413 } 428 }
429
414 private string Read_String() 430 private string Read_String()
415 { 431 {
416 string ret = ""; 432 string ret = "";
417 byte reader = br_read(1)[0]; 433 byte reader = br_read(1)[0];
418 while (reader != 0x000) 434 while (reader != 0x000)
419 { 435 {
420 ret += (char)reader; 436 ret += (char) reader;
421 reader = br_read(1)[0]; 437 reader = br_read(1)[0];
422 } 438 }
423 return ret; 439 return ret;
@@ -431,7 +447,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
431 /// <param name="eventname">Name of event (function) to generate</param> 447 /// <param name="eventname">Name of event (function) to generate</param>
432 private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) 448 private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname)
433 { 449 {
434
435 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); 450 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk();
436 451
437 Common.SendToDebug("Reading Function Code Chunk at: " + pos); 452 Common.SendToDebug("Reading Function Code Chunk at: " + pos);
@@ -442,12 +457,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
442 myCodeChunk.Comment = Read_String(); 457 myCodeChunk.Comment = Read_String();
443 Common.SendToDebug("Function comment: " + myCodeChunk.Comment); 458 Common.SendToDebug("Function comment: " + myCodeChunk.Comment);
444 myCodeChunk.ReturnTypePos = br_read(1)[0]; 459 myCodeChunk.ReturnTypePos = br_read(1)[0];
445 myCodeChunk.ReturnType = GetStaticBlock((long)myCodeChunk.ReturnTypePos + (long)myHeader.GVR); 460 myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR);
446 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + ((LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType.ObjectType).ToString()); 461 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " +
462 ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString());
447 463
448 464
449 // TODO: How to determine number of codechunks -- does this method work? 465 // TODO: How to determine number of codechunks -- does this method work?
450 myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); 466 myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>();
451 byte reader = br_read(1)[0]; 467 byte reader = br_read(1)[0];
452 reader = br_read(1)[0]; 468 reader = br_read(1)[0];
453 469
@@ -464,14 +480,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
464 CCA.NullString = reader; 480 CCA.NullString = reader;
465 CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); 481 CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR);
466 myCodeChunk.CodeChunkArguments.Add(CCA); 482 myCodeChunk.CodeChunkArguments.Add(CCA);
467 Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + ": " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType.ObjectType); 483 Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType +
484 ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType);
468 } 485 }
469 // Create string array 486 // Create string array
470 Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; 487 Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count];
471 for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) 488 for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++)
472 { 489 {
473 MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); 490 MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType);
474 Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).ToString()); 491 Common.SendToDebug("Method argument " + _ic + ": " +
492 getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).
493 ToString());
475 } 494 }
476 // End marker is 0x000 495 // End marker is 0x000
477 myCodeChunk.EndMarker = reader; 496 myCodeChunk.EndMarker = reader;
@@ -483,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
483 502
484 Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); 503 Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod...");
485 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 504 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
486 MethodAttributes.Public, 505 MethodAttributes.Public,
487 typeof(void), 506 typeof (void),
488 new Type[] { typeof(object) }); 507 new Type[] {typeof (object)});
489 //MethodArgs); 508 //MethodArgs);
490 //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), 509 //typeof(void), //getLLObjectType(myCodeChunk.ReturnType),
491 // new Type[] { typeof(object) }, //); 510 // new Type[] { typeof(object) }, //);
@@ -504,7 +523,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
504 IL_INSERT_TRY(il, eventname); 523 IL_INSERT_TRY(il, eventname);
505 524
506 525
507
508 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 526 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
509 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 527 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
510 //il.Emit(OpCodes.Call, typeof(Console).GetMethod 528 //il.Emit(OpCodes.Call, typeof(Console).GetMethod
@@ -520,7 +538,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
520 } 538 }
521 539
522 540
523
524 // 541 //
525 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL 542 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL
526 // 543 //
@@ -538,12 +555,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
538 il.Emit(OpCodes.Ret); 555 il.Emit(OpCodes.Ret);
539 556
540 return; 557 return;
541
542 } 558 }
543 559
544 private void IL_INSERT_FUNCTIONLIST() 560 private void IL_INSERT_FUNCTIONLIST()
545 { 561 {
546
547 Common.SendToDebug("Creating function list"); 562 Common.SendToDebug("Creating function list");
548 563
549 564
@@ -557,11 +572,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
557 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); 572 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private);
558 573
559 574
560
561 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 575 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
562 MethodAttributes.Public, 576 MethodAttributes.Public,
563 typeof(string[]), 577 typeof (string[]),
564 null); 578 null);
565 579
566 //typeBuilder.DefineMethodOverride(methodBuilder, 580 //typeBuilder.DefineMethodOverride(methodBuilder,
567 // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); 581 // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
@@ -569,8 +583,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
569 ILGenerator il = methodBuilder.GetILGenerator(); 583 ILGenerator il = methodBuilder.GetILGenerator();
570 584
571 585
572
573
574 // IL_INSERT_TRY(il, eventname); 586 // IL_INSERT_TRY(il, eventname);
575 587
576 // // Push string to stack 588 // // Push string to stack
@@ -586,37 +598,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
586 598
587 ////il.Emit(OpCodes.Ldarg_0); 599 ////il.Emit(OpCodes.Ldarg_0);
588 600
589 il.DeclareLocal(typeof(string[])); 601 il.DeclareLocal(typeof (string[]));
590 602
591 ////il.Emit(OpCodes.Ldarg_0); 603 ////il.Emit(OpCodes.Ldarg_0);
592 il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length 604 il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length
593 il.Emit(OpCodes.Newarr, typeof(String)); // create new string array 605 il.Emit(OpCodes.Newarr, typeof (String)); // create new string array
594 il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack 606 il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack
595 ////SetFunctionList 607 ////SetFunctionList
596 608
597 for (int lv = 0; lv < EventList.Count; lv++) 609 for (int lv = 0; lv < EventList.Count; lv++)
598 { 610 {
599 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack 611 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
600 il.Emit(OpCodes.Ldc_I4, lv); // Push index position 612 il.Emit(OpCodes.Ldc_I4, lv); // Push index position
601 il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value 613 il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
602 il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value 614 il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value
603 615
604 //il.Emit(OpCodes.Ldarg_0); 616 //il.Emit(OpCodes.Ldarg_0);
605 //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value 617 //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
606 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); 618 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) }));
607
608 } 619 }
609 620
610 621
611
612 // IL_INSERT_END_TRY(il, eventname); 622 // IL_INSERT_END_TRY(il, eventname);
613 623
614 624
615 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack 625 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
616 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); 626 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) }));
617 627
618 il.Emit(OpCodes.Ret); // Return 628 il.Emit(OpCodes.Ret); // Return
619
620 } 629 }
621 630
622 631
@@ -631,7 +640,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
631 // Push "Hello World!" string to stack 640 // Push "Hello World!" string to stack
632 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 641 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
633 //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); 642 //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname);
634
635 } 643 }
636 644
637 private void IL_INSERT_END_TRY(ILGenerator il, string eventname) 645 private void IL_INSERT_END_TRY(ILGenerator il, string eventname)
@@ -640,7 +648,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
640 * CATCH 648 * CATCH
641 */ 649 */
642 Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); 650 Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));");
643 il.BeginCatchBlock(typeof(Exception)); 651 il.BeginCatchBlock(typeof (Exception));
644 652
645 // Push "Hello World!" string to stack 653 // Push "Hello World!" string to stack
646 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 654 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
@@ -648,18 +656,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
648 656
649 //call void [mscorlib]System.Console::WriteLine(string) 657 //call void [mscorlib]System.Console::WriteLine(string)
650 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 658 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
651 il.Emit(OpCodes.Call, typeof(Console).GetMethod 659 il.Emit(OpCodes.Call, typeof (Console).GetMethod
652 ("Write", new Type[] { typeof(string) })); 660 ("Write", new Type[] {typeof (string)}));
653 661
654 //callvirt instance string [mscorlib]System.Exception::get_Message() 662 //callvirt instance string [mscorlib]System.Exception::get_Message()
655 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); 663 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt...");
656 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod 664 il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod
657 ("get_Message")); 665 ("get_Message"));
658 666
659 //call void [mscorlib]System.Console::WriteLine(string) 667 //call void [mscorlib]System.Console::WriteLine(string)
660 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 668 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
661 il.Emit(OpCodes.Call, typeof(Console).GetMethod 669 il.Emit(OpCodes.Call, typeof (Console).GetMethod
662 ("WriteLine", new Type[] { typeof(string) })); 670 ("WriteLine", new Type[] {typeof (string)}));
663 671
664 /* 672 /*
665 * CLR END TRY 673 * CLR END TRY
@@ -673,7 +681,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
673 long FirstPos = fs.Position; 681 long FirstPos = fs.Position;
674 try 682 try
675 { 683 {
676 UInt32 position = (UInt32)pos; 684 UInt32 position = (UInt32) pos;
677 // STATIC BLOCK 685 // STATIC BLOCK
678 Common.SendToDebug("Reading STATIC BLOCK at: " + position); 686 Common.SendToDebug("Reading STATIC BLOCK at: " + position);
679 fs.Seek(position, SeekOrigin.Begin); 687 fs.Seek(position, SeekOrigin.Begin);
@@ -683,7 +691,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
683 Common.SendToDebug("Found cached STATIC BLOCK"); 691 Common.SendToDebug("Found cached STATIC BLOCK");
684 692
685 693
686
687 return StaticBlocks[pos]; 694 return StaticBlocks[pos];
688 } 695 }
689 696
@@ -699,7 +706,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
699 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); 706 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
700 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); 707 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
701 myStaticBlock.ObjectType = br_read(1)[0]; 708 myStaticBlock.ObjectType = br_read(1)[0];
702 Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); 709 Common.SendToDebug("Static Block ObjectType: " +
710 ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
703 myStaticBlock.Unknown = br_read(1)[0]; 711 myStaticBlock.Unknown = br_read(1)[0];
704 // Size of datatype varies 712 // Size of datatype varies
705 if (myStaticBlock.ObjectType != 0) 713 if (myStaticBlock.ObjectType != 0)
@@ -715,8 +723,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
715 // Go back to original read pos 723 // Go back to original read pos
716 fs.Seek(FirstPos, SeekOrigin.Begin); 724 fs.Seek(FirstPos, SeekOrigin.Begin);
717 } 725 }
718
719 } 726 }
720
721 } 727 }
722} 728} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
index baeda38..cf64638 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
@@ -28,14 +28,13 @@
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29 29
30using System; 30using System;
31using System.Collections;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Text;
33 33
34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
35{ 35{
36 static class LSO_Struct 36 internal static class LSO_Struct
37 { 37 {
38
39 public struct Header 38 public struct Header
40 { 39 {
41 public UInt32 TM; 40 public UInt32 TM;
@@ -69,6 +68,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
69 public byte Unknown; 68 public byte Unknown;
70 public byte[] BlockVariable; 69 public byte[] BlockVariable;
71 } 70 }
71
72 /* Not actually a structure 72 /* Not actually a structure
73 public struct StaticBlockVariable 73 public struct StaticBlockVariable
74 { 74 {
@@ -80,6 +80,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
80 public byte[] Rotation_16; 80 public byte[] Rotation_16;
81 public UInt32 Pointer_List_Structure; 81 public UInt32 Pointer_List_Structure;
82 } */ 82 } */
83
83 public struct HeapBlock 84 public struct HeapBlock
84 { 85 {
85 public Int32 DataBlockSize; 86 public Int32 DataBlockSize;
@@ -87,17 +88,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
87 public UInt16 ReferenceCount; 88 public UInt16 ReferenceCount;
88 public byte[] Data; 89 public byte[] Data;
89 } 90 }
91
90 public struct StateFrameBlock 92 public struct StateFrameBlock
91 { 93 {
92 public UInt32 StateCount; 94 public UInt32 StateCount;
93 public StatePointerBlock[] StatePointer; 95 public StatePointerBlock[] StatePointer;
94 } 96 }
97
95 public struct StatePointerBlock 98 public struct StatePointerBlock
96 { 99 {
97 public UInt32 Location; 100 public UInt32 Location;
98 public System.Collections.BitArray EventMask; 101 public BitArray EventMask;
99 public StateBlock StateBlock; 102 public StateBlock StateBlock;
100 } 103 }
104
101 public struct StateBlock 105 public struct StateBlock
102 { 106 {
103 public UInt32 StartPos; 107 public UInt32 StartPos;
@@ -106,25 +110,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
106 public byte Unknown; 110 public byte Unknown;
107 public StateBlockHandler[] StateBlockHandlers; 111 public StateBlockHandler[] StateBlockHandlers;
108 } 112 }
113
109 public struct StateBlockHandler 114 public struct StateBlockHandler
110 { 115 {
111 public UInt32 CodeChunkPointer; 116 public UInt32 CodeChunkPointer;
112 public UInt32 CallFrameSize; 117 public UInt32 CallFrameSize;
113 } 118 }
119
114 public struct FunctionBlock 120 public struct FunctionBlock
115 { 121 {
116 public UInt32 FunctionCount; 122 public UInt32 FunctionCount;
117 public UInt32[] CodeChunkPointer; 123 public UInt32[] CodeChunkPointer;
118 } 124 }
125
119 public struct CodeChunk 126 public struct CodeChunk
120 { 127 {
121 public UInt32 CodeChunkHeaderSize; 128 public UInt32 CodeChunkHeaderSize;
122 public string Comment; 129 public string Comment;
123 public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; 130 public List<CodeChunkArgument> CodeChunkArguments;
124 public byte EndMarker; 131 public byte EndMarker;
125 public byte ReturnTypePos; 132 public byte ReturnTypePos;
126 public StaticBlock ReturnType; 133 public StaticBlock ReturnType;
127 } 134 }
135
128 public struct CodeChunkArgument 136 public struct CodeChunkArgument
129 { 137 {
130 public byte FunctionReturnTypePos; 138 public byte FunctionReturnTypePos;
@@ -132,4 +140,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
132 public StaticBlock FunctionReturnType; 140 public StaticBlock FunctionReturnType;
133 } 141 }
134 } 142 }
135} 143} \ No newline at end of file
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 b94cf90..737dee6 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
@@ -26,19 +26,18 @@
26* 26*
27*/ 27*/
28 28
29using Axiom.Math;
30using System; 29using System;
31using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Threading;
34using Axiom.Math;
33using libsecondlife; 35using libsecondlife;
34using OpenSim.Region.Environment.Scenes; 36using OpenSim.Framework;
35using OpenSim.Region.Environment.Scenes.Scripting;
36using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 38using OpenSim.Region.Environment.Scenes;
38using OpenSim.Region.ScriptEngine.Common; 39using OpenSim.Region.ScriptEngine.Common;
39using OpenSim.Framework.Console; 40using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
40using OpenSim.Framework;
41using System.Runtime.Remoting.Lifetime;
42 41
43namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler 42namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
44{ 43{
@@ -53,8 +52,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
53 /// </summary> 52 /// </summary>
54 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface 53 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
55 { 54 {
56 55 private ASCIIEncoding enc = new ASCIIEncoding();
57 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
58 private ScriptEngine m_ScriptEngine; 56 private ScriptEngine m_ScriptEngine;
59 private SceneObjectPart m_host; 57 private SceneObjectPart m_host;
60 private uint m_localID; 58 private uint m_localID;
@@ -86,7 +84,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
86 { 84 {
87 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); 85 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
88 // return null; 86 // return null;
89 ILease lease = (ILease)base.InitializeLifetimeService(); 87 ILease lease = (ILease) base.InitializeLifetimeService();
90 88
91 if (lease.CurrentState == LeaseState.Initial) 89 if (lease.CurrentState == LeaseState.Initial)
92 { 90 {
@@ -105,79 +103,130 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
105 103
106 //These are the implementations of the various ll-functions used by the LSL scripts. 104 //These are the implementations of the various ll-functions used by the LSL scripts.
107 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 105 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
108 public double llSin(double f) { return (double)Math.Sin(f); } 106 public double llSin(double f)
109 public double llCos(double f) { return (double)Math.Cos(f); } 107 {
110 public double llTan(double f) { return (double)Math.Tan(f); } 108 return (double) Math.Sin(f);
111 public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } 109 }
112 public double llSqrt(double f) { return (double)Math.Sqrt(f); } 110
113 public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } 111 public double llCos(double f)
114 public int llAbs(int i) { return (int)Math.Abs(i); } 112 {
115 public double llFabs(double f) { return (double)Math.Abs(f); } 113 return (double) Math.Cos(f);
114 }
115
116 public double llTan(double f)
117 {
118 return (double) Math.Tan(f);
119 }
120
121 public double llAtan2(double x, double y)
122 {
123 return (double) Math.Atan2(y, x);
124 }
125
126 public double llSqrt(double f)
127 {
128 return (double) Math.Sqrt(f);
129 }
130
131 public double llPow(double fbase, double fexponent)
132 {
133 return (double) Math.Pow(fbase, fexponent);
134 }
135
136 public int llAbs(int i)
137 {
138 return (int) Math.Abs(i);
139 }
140
141 public double llFabs(double f)
142 {
143 return (double) Math.Abs(f);
144 }
116 145
117 public double llFrand(double mag) 146 public double llFrand(double mag)
118 { 147 {
119 lock (Util.RandomClass) 148 lock (Util.RandomClass)
120 { 149 {
121 return Util.RandomClass.Next((int)mag); 150 return Util.RandomClass.Next((int) mag);
122 } 151 }
123 } 152 }
124 153
125 public int llFloor(double f) { return (int)Math.Floor(f); } 154 public int llFloor(double f)
126 public int llCeil(double f) { return (int)Math.Ceiling(f); } 155 {
127 public int llRound(double f) { return (int)Math.Round(f, 3); } 156 return (int) Math.Floor(f);
157 }
158
159 public int llCeil(double f)
160 {
161 return (int) Math.Ceiling(f);
162 }
163
164 public int llRound(double f)
165 {
166 return (int) Math.Round(f, 3);
167 }
128 168
129 //This next group are vector operations involving squaring and square root. ckrinke 169 //This next group are vector operations involving squaring and square root. ckrinke
130 public double llVecMag(LSL_Types.Vector3 v) 170 public double llVecMag(LSL_Types.Vector3 v)
131 { 171 {
132 return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); 172 return (v.X*v.X + v.Y*v.Y + v.Z*v.Z);
133 } 173 }
134 174
135 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 175 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
136 { 176 {
137 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; 177 double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z;
138 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 178 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
139 nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; 179 nor.X = v.X/mag;
180 nor.Y = v.Y/mag;
181 nor.Z = v.Z/mag;
140 return nor; 182 return nor;
141 } 183 }
142 184
143 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 185 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
144 { 186 {
145 double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; 187 double dx = a.X - b.X;
146 return Math.Sqrt(dx * dx + dy * dy + dz * dz); 188 double dy = a.Y - b.Y;
189 double dz = a.Z - b.Z;
190 return Math.Sqrt(dx*dx + dy*dy + dz*dz);
147 } 191 }
148 192
149 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke 193 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
150 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 194 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
151 { 195 {
152 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke 196 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
153 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); 197 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R);
154 double m = (t.X + t.Y + t.Z + t.R); 198 double m = (t.X + t.Y + t.Z + t.R);
155 if (m == 0) return new LSL_Types.Vector3(); 199 if (m == 0) return new LSL_Types.Vector3();
156 double n = 2 * (r.Y * r.R + r.X * r.Z); 200 double n = 2*(r.Y*r.R + r.X*r.Z);
157 double p = m * m - n * n; 201 double p = m*m - n*n;
158 if (p > 0) 202 if (p > 0)
159 return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)), 203 return new LSL_Types.Vector3(Math.Atan2(2.0*(r.X*r.R - r.Y*r.Z), (-t.X - t.Y + t.Z + t.R)),
160 Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R))); 204 Math.Atan2(n, Math.Sqrt(p)),
205 Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R)));
161 else if (n > 0) 206 else if (n > 0)
162 return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 207 return new LSL_Types.Vector3(0.0, Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z));
163 else 208 else
164 return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 209 return new LSL_Types.Vector3(0.0, -Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z));
165 } 210 }
166 211
167 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) 212 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
168 { 213 {
169 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 214 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
170 float err = 0.00001f; 215 float err = 0.00001f;
171 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); 216 double ax = Math.Sin(v.X/2);
172 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); 217 double aw = Math.Cos(v.X/2);
173 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); 218 double by = Math.Sin(v.Y/2);
219 double bw = Math.Cos(v.Y/2);
220 double cz = Math.Sin(v.Z/2);
221 double cw = Math.Cos(v.Z/2);
174 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); 222 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw);
175 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); 223 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
176 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); 224 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
177 LSL_Types.Quaternion a = new LSL_Types.Quaternion(); 225 LSL_Types.Quaternion a = new LSL_Types.Quaternion();
178 //This multiplication doesnt compile, yet. a = a1 * a2 * a3; 226 //This multiplication doesnt compile, yet. a = a1 * a2 * a3;
179 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, 227 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz,
180 aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); 228 aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw,
229 aw*bw*cw - ax*by*cz);
181 LSL_Types.Quaternion c = new LSL_Types.Quaternion(); 230 LSL_Types.Quaternion c = new LSL_Types.Quaternion();
182 //This addition doesnt compile yet c = a + b; 231 //This addition doesnt compile yet c = a + b;
183 LSL_Types.Quaternion d = new LSL_Types.Quaternion(); 232 LSL_Types.Quaternion d = new LSL_Types.Quaternion();
@@ -194,11 +243,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
194 return new LSL_Types.Quaternion(); 243 return new LSL_Types.Quaternion();
195 } 244 }
196 245
197 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } 246 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
198 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 247 {
199 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 248 return new LSL_Types.Quaternion();
200 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 249 }
201 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } 250
251 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r)
252 {
253 return new LSL_Types.Vector3();
254 }
255
256 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r)
257 {
258 return new LSL_Types.Vector3();
259 }
260
261 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r)
262 {
263 return new LSL_Types.Vector3();
264 }
265
266 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end)
267 {
268 return new LSL_Types.Quaternion();
269 }
202 270
203 public void llWhisper(int channelID, string text) 271 public void llWhisper(int channelID, string text)
204 { 272 {
@@ -214,7 +282,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
214 { 282 {
215 //type for say is 1 283 //type for say is 1
216 World.SimChat(Helpers.StringToField(text), 284 World.SimChat(Helpers.StringToField(text),
217 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 285 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
218 286
219 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 287 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
220 wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text); 288 wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text);
@@ -230,82 +298,217 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
230 wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text); 298 wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text);
231 } 299 }
232 300
233 public int llListen(int channelID, string name, string ID, string msg) { 301 public int llListen(int channelID, string name, string ID, string msg)
234 302 {
235 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 303 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
236 return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg); 304 return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg);
237
238 } 305 }
239 306
240 public void llListenControl(int number, int active) { 307 public void llListenControl(int number, int active)
241 308 {
242 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 309 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
243 wComm.ListenControl(number, active); 310 wComm.ListenControl(number, active);
244
245 } 311 }
246 312
247 public void llListenRemove(int number) { 313 public void llListenRemove(int number)
248 314 {
249 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 315 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
250 wComm.ListenRemove(number); 316 wComm.ListenRemove(number);
251 317 }
252 } 318
253 319 public void llSensor(string name, string id, int type, double range, double arc)
254 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } 320 {
255 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } 321 NotImplemented("llSensor");
256 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } 322 return;
257 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } 323 }
258 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } 324
259 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } 325 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
260 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } 326 {
261 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } 327 NotImplemented("llSensorRepeat");
262 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } 328 return;
263 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } 329 }
264 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } 330
265 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } 331 public void llSensorRemove()
266 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } 332 {
267 public void llDie() { NotImplemented("llDie"); return; } 333 NotImplemented("llSensorRemove");
268 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } 334 return;
269 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } 335 }
270 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } 336
271 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } 337 public string llDetectedName(int number)
272 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } 338 {
339 NotImplemented("llDetectedName");
340 return "";
341 }
342
343 public string llDetectedKey(int number)
344 {
345 NotImplemented("llDetectedKey");
346 return "";
347 }
348
349 public string llDetectedOwner(int number)
350 {
351 NotImplemented("llDetectedOwner");
352 return "";
353 }
354
355 public int llDetectedType(int number)
356 {
357 NotImplemented("llDetectedType");
358 return 0;
359 }
360
361 public LSL_Types.Vector3 llDetectedPos(int number)
362 {
363 NotImplemented("llDetectedPos");
364 return new LSL_Types.Vector3();
365 }
366
367 public LSL_Types.Vector3 llDetectedVel(int number)
368 {
369 NotImplemented("llDetectedVel");
370 return new LSL_Types.Vector3();
371 }
372
373 public LSL_Types.Vector3 llDetectedGrab(int number)
374 {
375 NotImplemented("llDetectedGrab");
376 return new LSL_Types.Vector3();
377 }
378
379 public LSL_Types.Quaternion llDetectedRot(int number)
380 {
381 NotImplemented("llDetectedRot");
382 return new LSL_Types.Quaternion();
383 }
384
385 public int llDetectedGroup(int number)
386 {
387 NotImplemented("llDetectedGroup");
388 return 0;
389 }
390
391 public int llDetectedLinkNumber(int number)
392 {
393 NotImplemented("llDetectedLinkNumber");
394 return 0;
395 }
396
397 public void llDie()
398 {
399 NotImplemented("llDie");
400 return;
401 }
402
403 public double llGround(LSL_Types.Vector3 offset)
404 {
405 NotImplemented("llGround");
406 return 0;
407 }
408
409 public double llCloud(LSL_Types.Vector3 offset)
410 {
411 NotImplemented("llCloud");
412 return 0;
413 }
414
415 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset)
416 {
417 NotImplemented("llWind");
418 return new LSL_Types.Vector3();
419 }
420
421 public void llSetStatus(int status, int value)
422 {
423 NotImplemented("llSetStatus");
424 return;
425 }
426
427 public int llGetStatus(int status)
428 {
429 NotImplemented("llGetStatus");
430 return 0;
431 }
273 432
274 public void llSetScale(LSL_Types.Vector3 scale) 433 public void llSetScale(LSL_Types.Vector3 scale)
275 { 434 {
276 // TODO: this needs to trigger a persistance save as well 435 // TODO: this needs to trigger a persistance save as well
277 LLVector3 tmp = m_host.Scale; 436 LLVector3 tmp = m_host.Scale;
278 tmp.X = (float)scale.X; 437 tmp.X = (float) scale.X;
279 tmp.Y = (float)scale.Y; 438 tmp.Y = (float) scale.Y;
280 tmp.Z = (float)scale.Z; 439 tmp.Z = (float) scale.Z;
281 m_host.Scale = tmp; 440 m_host.Scale = tmp;
282 return; 441 return;
283 } 442 }
443
284 public LSL_Types.Vector3 llGetScale() 444 public LSL_Types.Vector3 llGetScale()
285 { 445 {
286 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); 446 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
287 } 447 }
288 448
289 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } 449 public void llSetColor(LSL_Types.Vector3 color, int face)
290 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } 450 {
291 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } 451 NotImplemented("llSetColor");
292 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } 452 return;
293 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } 453 }
294 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } 454
295 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } 455 public double llGetAlpha(int face)
296 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } 456 {
457 NotImplemented("llGetAlpha");
458 return 0;
459 }
460
461 public void llSetAlpha(double alpha, int face)
462 {
463 NotImplemented("llSetAlpha");
464 return;
465 }
466
467 public LSL_Types.Vector3 llGetColor(int face)
468 {
469 NotImplemented("llGetColor");
470 return new LSL_Types.Vector3();
471 }
472
473 public void llSetTexture(string texture, int face)
474 {
475 NotImplemented("llSetTexture");
476 return;
477 }
478
479 public void llScaleTexture(double u, double v, int face)
480 {
481 NotImplemented("llScaleTexture");
482 return;
483 }
484
485 public void llOffsetTexture(double u, double v, int face)
486 {
487 NotImplemented("llOffsetTexture");
488 return;
489 }
297 490
298 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } 491 public void llRotateTexture(double rotation, int face)
492 {
493 NotImplemented("llRotateTexture");
494 return;
495 }
496
497 public string llGetTexture(int face)
498 {
499 NotImplemented("llGetTexture");
500 return "";
501 }
299 502
300 public void llSetPos(LSL_Types.Vector3 pos) 503 public void llSetPos(LSL_Types.Vector3 pos)
301 { 504 {
302 if (m_host.ParentID != 0) 505 if (m_host.ParentID != 0)
303 { 506 {
304 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 507 m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
305 } 508 }
306 else 509 else
307 { 510 {
308 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 511 m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
309 } 512 }
310 } 513 }
311 514
@@ -331,51 +534,183 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
331 m_host.AbsolutePosition.Z); 534 m_host.AbsolutePosition.Z);
332 } 535 }
333 } 536 }
537
334 public void llSetRot(LSL_Types.Quaternion rot) 538 public void llSetRot(LSL_Types.Quaternion rot)
335 { 539 {
336 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); 540 m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R));
337 } 541 }
542
338 public LSL_Types.Quaternion llGetRot() 543 public LSL_Types.Quaternion llGetRot()
339 { 544 {
340 LLQuaternion q = m_host.RotationOffset; 545 LLQuaternion q = m_host.RotationOffset;
341 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 546 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
342 } 547 }
343 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } 548
344 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } 549 public LSL_Types.Quaternion llGetLocalRot()
345 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } 550 {
346 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } 551 NotImplemented("llGetLocalRot");
347 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } 552 return new LSL_Types.Quaternion();
348 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } 553 }
349 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } 554
350 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } 555 public void llSetForce(LSL_Types.Vector3 force, int local)
351 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } 556 {
352 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } 557 NotImplemented("llSetForce");
353 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } 558 }
354 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } 559
355 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } 560 public LSL_Types.Vector3 llGetForce()
356 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } 561 {
357 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } 562 NotImplemented("llGetForce");
358 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } 563 return new LSL_Types.Vector3();
359 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } 564 }
360 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } 565
566 public int llTarget(LSL_Types.Vector3 position, double range)
567 {
568 NotImplemented("llTarget");
569 return 0;
570 }
571
572 public void llTargetRemove(int number)
573 {
574 NotImplemented("llTargetRemove");
575 }
576
577 public int llRotTarget(LSL_Types.Quaternion rot, double error)
578 {
579 NotImplemented("llRotTarget");
580 return 0;
581 }
582
583 public void llRotTargetRemove(int number)
584 {
585 NotImplemented("llRotTargetRemove");
586 }
587
588 public void llMoveToTarget(LSL_Types.Vector3 target, double tau)
589 {
590 NotImplemented("llMoveToTarget");
591 }
592
593 public void llStopMoveToTarget()
594 {
595 NotImplemented("llStopMoveToTarget");
596 }
597
598 public void llApplyImpulse(LSL_Types.Vector3 force, int local)
599 {
600 NotImplemented("llApplyImpulse");
601 }
602
603 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local)
604 {
605 NotImplemented("llApplyRotationalImpulse");
606 }
607
608 public void llSetTorque(LSL_Types.Vector3 torque, int local)
609 {
610 NotImplemented("llSetTorque");
611 }
612
613 public LSL_Types.Vector3 llGetTorque()
614 {
615 NotImplemented("llGetTorque");
616 return new LSL_Types.Vector3();
617 }
618
619 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local)
620 {
621 NotImplemented("llSetForceAndTorque");
622 }
623
624 public LSL_Types.Vector3 llGetVel()
625 {
626 NotImplemented("llGetVel");
627 return new LSL_Types.Vector3();
628 }
629
630 public LSL_Types.Vector3 llGetAccel()
631 {
632 NotImplemented("llGetAccel");
633 return new LSL_Types.Vector3();
634 }
635
636 public LSL_Types.Vector3 llGetOmega()
637 {
638 NotImplemented("llGetOmega");
639 return new LSL_Types.Vector3();
640 }
641
642 public double llGetTimeOfDay()
643 {
644 NotImplemented("llGetTimeOfDay");
645 return 0;
646 }
361 647
362 public double llGetWallclock() 648 public double llGetWallclock()
363 { 649 {
364 return DateTime.Now.TimeOfDay.TotalSeconds; 650 return DateTime.Now.TimeOfDay.TotalSeconds;
365 } 651 }
366 652
367 public double llGetTime() { NotImplemented("llGetTime"); return 0; } 653 public double llGetTime()
368 public void llResetTime() { NotImplemented("llResetTime"); } 654 {
369 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } 655 NotImplemented("llGetTime");
370 public void llSound() { NotImplemented("llSound"); } 656 return 0;
371 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } 657 }
372 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } 658
373 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } 659 public void llResetTime()
374 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } 660 {
375 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } 661 NotImplemented("llResetTime");
376 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } 662 }
377 public void llStopSound() { NotImplemented("llStopSound"); } 663
378 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } 664 public double llGetAndResetTime()
665 {
666 NotImplemented("llGetAndResetTime");
667 return 0;
668 }
669
670 public void llSound()
671 {
672 NotImplemented("llSound");
673 }
674
675 public void llPlaySound(string sound, double volume)
676 {
677 NotImplemented("llPlaySound");
678 }
679
680 public void llLoopSound(string sound, double volume)
681 {
682 NotImplemented("llLoopSound");
683 }
684
685 public void llLoopSoundMaster(string sound, double volume)
686 {
687 NotImplemented("llLoopSoundMaster");
688 }
689
690 public void llLoopSoundSlave(string sound, double volume)
691 {
692 NotImplemented("llLoopSoundSlave");
693 }
694
695 public void llPlaySoundSlave(string sound, double volume)
696 {
697 NotImplemented("llPlaySoundSlave");
698 }
699
700 public void llTriggerSound(string sound, double volume)
701 {
702 NotImplemented("llTriggerSound");
703 }
704
705 public void llStopSound()
706 {
707 NotImplemented("llStopSound");
708 }
709
710 public void llPreloadSound(string sound)
711 {
712 NotImplemented("llPreloadSound");
713 }
379 714
380 public string llGetSubString(string src, int start, int end) 715 public string llGetSubString(string src, int start, int end)
381 { 716 {
@@ -386,10 +721,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
386 { 721 {
387 return src.Remove(start, end - start); 722 return src.Remove(start, end - start);
388 } 723 }
724
389 public string llInsertString(string dst, int position, string src) 725 public string llInsertString(string dst, int position, string src)
390 { 726 {
391 return dst.Insert(position, src); 727 return dst.Insert(position, src);
392 } 728 }
729
393 public string llToUpper(string src) 730 public string llToUpper(string src)
394 { 731 {
395 return src.ToUpper(); 732 return src.ToUpper();
@@ -400,14 +737,46 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
400 return src.ToLower(); 737 return src.ToLower();
401 } 738 }
402 739
403 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } 740 public int llGiveMoney(string destination, int amount)
404 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } 741 {
405 public void llMakeFountain() { NotImplemented("llMakeFountain"); } 742 NotImplemented("llGiveMoney");
406 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } 743 return 0;
407 public void llMakeFire() { NotImplemented("llMakeFire"); } 744 }
408 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } 745
409 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } 746 public void llMakeExplosion()
410 public void llStopLookAt() { NotImplemented("llStopLookAt"); } 747 {
748 NotImplemented("llMakeExplosion");
749 }
750
751 public void llMakeFountain()
752 {
753 NotImplemented("llMakeFountain");
754 }
755
756 public void llMakeSmoke()
757 {
758 NotImplemented("llMakeSmoke");
759 }
760
761 public void llMakeFire()
762 {
763 NotImplemented("llMakeFire");
764 }
765
766 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param)
767 {
768 NotImplemented("llRezObject");
769 }
770
771 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping)
772 {
773 NotImplemented("llLookAt");
774 }
775
776 public void llStopLookAt()
777 {
778 NotImplemented("llStopLookAt");
779 }
411 780
412 public void llSetTimerEvent(double sec) 781 public void llSetTimerEvent(double sec)
413 { 782 {
@@ -417,38 +786,104 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
417 786
418 public void llSleep(double sec) 787 public void llSleep(double sec)
419 { 788 {
420 System.Threading.Thread.Sleep((int)(sec * 1000)); 789 Thread.Sleep((int) (sec*1000));
790 }
791
792 public double llGetMass()
793 {
794 NotImplemented("llGetMass");
795 return 0;
796 }
797
798 public void llCollisionFilter(string name, string id, int accept)
799 {
800 NotImplemented("llCollisionFilter");
801 }
802
803 public void llTakeControls(int controls, int accept, int pass_on)
804 {
805 NotImplemented("llTakeControls");
806 }
807
808 public void llReleaseControls()
809 {
810 NotImplemented("llReleaseControls");
811 }
812
813 public void llAttachToAvatar(int attachment)
814 {
815 NotImplemented("llAttachToAvatar");
816 }
817
818 public void llDetachFromAvatar()
819 {
820 NotImplemented("llDetachFromAvatar");
821 }
822
823 public void llTakeCamera()
824 {
825 NotImplemented("llTakeCamera");
421 } 826 }
422 827
423 public double llGetMass() { NotImplemented("llGetMass"); return 0; } 828 public void llReleaseCamera()
424 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } 829 {
425 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } 830 NotImplemented("llReleaseCamera");
426 public void llReleaseControls() { NotImplemented("llReleaseControls"); } 831 }
427 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); }
428 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); }
429 public void llTakeCamera() { NotImplemented("llTakeCamera"); }
430 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); }
431 832
432 public string llGetOwner() 833 public string llGetOwner()
433 { 834 {
434 return m_host.ObjectOwner.ToStringHyphenated(); 835 return m_host.ObjectOwner.ToStringHyphenated();
435 } 836 }
436 837
437 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } 838 public void llInstantMessage(string user, string message)
438 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } 839 {
439 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } 840 NotImplemented("llInstantMessage");
841 }
842
843 public void llEmail(string address, string subject, string message)
844 {
845 NotImplemented("llEmail");
846 }
847
848 public void llGetNextEmail(string address, string subject)
849 {
850 NotImplemented("llGetNextEmail");
851 }
440 852
441 public string llGetKey() 853 public string llGetKey()
442 { 854 {
443 return m_host.UUID.ToStringHyphenated(); 855 return m_host.UUID.ToStringHyphenated();
444 } 856 }
445 857
446 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } 858 public void llSetBuoyancy(double buoyancy)
447 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } 859 {
448 public void llStopHover() { NotImplemented("llStopHover"); } 860 NotImplemented("llSetBuoyancy");
449 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } 861 }
450 public void llSoundPreload() { NotImplemented("llSoundPreload"); } 862
451 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } 863 public void llSetHoverHeight(double height, int water, double tau)
864 {
865 NotImplemented("llSetHoverHeight");
866 }
867
868 public void llStopHover()
869 {
870 NotImplemented("llStopHover");
871 }
872
873 public void llMinEventDelay(double delay)
874 {
875 NotImplemented("llMinEventDelay");
876 }
877
878 public void llSoundPreload()
879 {
880 NotImplemented("llSoundPreload");
881 }
882
883 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping)
884 {
885 NotImplemented("llRotLookAt");
886 }
452 887
453 public int llStringLength(string str) 888 public int llStringLength(string str)
454 { 889 {
@@ -462,88 +897,289 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
462 } 897 }
463 } 898 }
464 899
465 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } 900 public void llStartAnimation(string anim)
466 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } 901 {
467 public void llPointAt() { NotImplemented("llPointAt"); } 902 NotImplemented("llStartAnimation");
468 public void llStopPointAt() { NotImplemented("llStopPointAt"); } 903 }
469 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } 904
470 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } 905 public void llStopAnimation(string anim)
471 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } 906 {
472 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } 907 NotImplemented("llStopAnimation");
473 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } 908 }
474 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } 909
475 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } 910 public void llPointAt()
476 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } 911 {
477 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } 912 NotImplemented("llPointAt");
478 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } 913 }
479 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } 914
480 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } 915 public void llStopPointAt()
481 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } 916 {
482 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } 917 NotImplemented("llStopPointAt");
483 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } 918 }
484 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } 919
485 public double llGetEnergy() { return 1.0f; } 920 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain)
486 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } 921 {
487 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } 922 NotImplemented("llTargetOmega");
923 }
924
925 public int llGetStartParameter()
926 {
927 NotImplemented("llGetStartParameter");
928 return 0;
929 }
930
931 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos)
932 {
933 NotImplemented("llGodLikeRezObject");
934 }
935
936 public void llRequestPermissions(string agent, int perm)
937 {
938 NotImplemented("llRequestPermissions");
939 }
940
941 public string llGetPermissionsKey()
942 {
943 NotImplemented("llGetPermissionsKey");
944 return "";
945 }
946
947 public int llGetPermissions()
948 {
949 NotImplemented("llGetPermissions");
950 return 0;
951 }
952
953 public int llGetLinkNumber()
954 {
955 NotImplemented("llGetLinkNumber");
956 return 0;
957 }
958
959 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face)
960 {
961 NotImplemented("llSetLinkColor");
962 }
963
964 public void llCreateLink(string target, int parent)
965 {
966 NotImplemented("llCreateLink");
967 }
968
969 public void llBreakLink(int linknum)
970 {
971 NotImplemented("llBreakLink");
972 }
973
974 public void llBreakAllLinks()
975 {
976 NotImplemented("llBreakAllLinks");
977 }
978
979 public string llGetLinkKey(int linknum)
980 {
981 NotImplemented("llGetLinkKey");
982 return "";
983 }
984
985 public void llGetLinkName(int linknum)
986 {
987 NotImplemented("llGetLinkName");
988 }
989
990 public int llGetInventoryNumber(int type)
991 {
992 NotImplemented("llGetInventoryNumber");
993 return 0;
994 }
995
996 public string llGetInventoryName(int type, int number)
997 {
998 NotImplemented("llGetInventoryName");
999 return "";
1000 }
1001
1002 public void llSetScriptState(string name, int run)
1003 {
1004 NotImplemented("llSetScriptState");
1005 }
1006
1007 public double llGetEnergy()
1008 {
1009 return 1.0f;
1010 }
1011
1012 public void llGiveInventory(string destination, string inventory)
1013 {
1014 NotImplemented("llGiveInventory");
1015 }
1016
1017 public void llRemoveInventory(string item)
1018 {
1019 NotImplemented("llRemoveInventory");
1020 }
488 1021
489 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 1022 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
490 { 1023 {
491 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); 1024 Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z);
492 m_host.SetText(text, av3, alpha); 1025 m_host.SetText(text, av3, alpha);
493 } 1026 }
494 1027
495 1028
496 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } 1029 public double llWater(LSL_Types.Vector3 offset)
497 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } 1030 {
498 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } 1031 NotImplemented("llWater");
499 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } 1032 return 0;
500 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } 1033 }
501 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } 1034
502 public void llModifyLand(int action, int brush) { } 1035 public void llPassTouches(int pass)
503 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } 1036 {
504 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } 1037 NotImplemented("llPassTouches");
505 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } 1038 }
506 public void llResetScript() 1039
1040 public string llRequestAgentData(string id, int data)
1041 {
1042 NotImplemented("llRequestAgentData");
1043 return "";
1044 }
1045
1046 public string llRequestInventoryData(string name)
1047 {
1048 NotImplemented("llRequestInventoryData");
1049 return "";
1050 }
1051
1052 public void llSetDamage(double damage)
1053 {
1054 NotImplemented("llSetDamage");
1055 }
1056
1057 public void llTeleportAgentHome(string agent)
1058 {
1059 NotImplemented("llTeleportAgentHome");
1060 }
1061
1062 public void llModifyLand(int action, int brush)
1063 {
1064 }
1065
1066 public void llCollisionSound(string impact_sound, double impact_volume)
1067 {
1068 NotImplemented("llCollisionSound");
1069 }
1070
1071 public void llCollisionSprite(string impact_sprite)
1072 {
1073 NotImplemented("llCollisionSprite");
1074 }
1075
1076 public string llGetAnimation(string id)
1077 {
1078 NotImplemented("llGetAnimation");
1079 return "";
1080 }
1081
1082 public void llResetScript()
507 { 1083 {
508 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); 1084 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
509 } 1085 }
510 public void llMessageLinked(int linknum, int num, string str, string id) { }
511 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { }
512 public void llPassCollisions(int pass) { }
513 public string llGetScriptName() { return ""; }
514 1086
515 public int llGetNumberOfSides() { return 0; } 1087 public void llMessageLinked(int linknum, int num, string str, string id)
1088 {
1089 }
1090
1091 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local)
1092 {
1093 }
1094
1095 public void llPassCollisions(int pass)
1096 {
1097 }
1098
1099 public string llGetScriptName()
1100 {
1101 return "";
1102 }
1103
1104 public int llGetNumberOfSides()
1105 {
1106 return 0;
1107 }
1108
1109 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle)
1110 {
1111 return new LSL_Types.Quaternion();
1112 }
1113
1114 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot)
1115 {
1116 return new LSL_Types.Vector3();
1117 }
516 1118
517 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } 1119 public void llRot2Angle()
518 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } 1120 {
519 public void llRot2Angle() { } 1121 }
520 1122
521 public double llAcos(double val) 1123 public double llAcos(double val)
522 { 1124 {
523 return (double)Math.Acos(val); 1125 return (double) Math.Acos(val);
524 } 1126 }
525 1127
526 public double llAsin(double val) 1128 public double llAsin(double val)
527 { 1129 {
528 return (double)Math.Asin(val); 1130 return (double) Math.Asin(val);
529 } 1131 }
530 1132
531 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } 1133 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b)
532 public string llGetInventoryKey(string name) { return ""; } 1134 {
533 public void llAllowInventoryDrop(int add) { } 1135 return 0;
534 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } 1136 }
535 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } 1137
536 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } 1138 public string llGetInventoryKey(string name)
537 public double llGetTextureRot(int side) { return 0; } 1139 {
1140 return "";
1141 }
1142
1143 public void llAllowInventoryDrop(int add)
1144 {
1145 }
1146
1147 public LSL_Types.Vector3 llGetSunDirection()
1148 {
1149 return new LSL_Types.Vector3();
1150 }
1151
1152 public LSL_Types.Vector3 llGetTextureOffset(int face)
1153 {
1154 return new LSL_Types.Vector3();
1155 }
1156
1157 public LSL_Types.Vector3 llGetTextureScale(int side)
1158 {
1159 return new LSL_Types.Vector3();
1160 }
1161
1162 public double llGetTextureRot(int side)
1163 {
1164 return 0;
1165 }
538 1166
539 public int llSubStringIndex(string source, string pattern) 1167 public int llSubStringIndex(string source, string pattern)
540 { 1168 {
541 return source.IndexOf(pattern); 1169 return source.IndexOf(pattern);
542 } 1170 }
543 1171
544 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } 1172 public string llGetOwnerKey(string id)
1173 {
1174 NotImplemented("llGetOwnerKey");
1175 return "";
1176 }
545 1177
546 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } 1178 public LSL_Types.Vector3 llGetCenterOfMass()
1179 {
1180 NotImplemented("llGetCenterOfMass");
1181 return new LSL_Types.Vector3();
1182 }
547 1183
548 public List<string> llListSort(List<string> src, int stride, int ascending) 1184 public List<string> llListSort(List<string> src, int stride, int ascending)
549 { 1185 {
@@ -577,7 +1213,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
577 ret.AddRange(ls); 1213 ret.AddRange(ls);
578 } 1214 }
579 1215
580 if (ascending == LSL.LSL_BaseClass.TRUE) 1216 if (ascending == LSL_BaseClass.TRUE)
581 return ret; 1217 return ret;
582 ret.Reverse(); 1218 ret.Reverse();
583 return ret; 1219 return ret;
@@ -616,12 +1252,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
616 1252
617 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 1253 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
618 { 1254 {
619 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); 1255 return
1256 new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]),
1257 double.Parse(src[index + 2]));
620 } 1258 }
1259
621 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 1260 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
622 { 1261 {
623 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); 1262 return
1263 new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]),
1264 double.Parse(src[index + 2]), double.Parse(src[index + 3]));
624 } 1265 }
1266
625 public List<string> llList2List(List<string> src, int start, int end) 1267 public List<string> llList2List(List<string> src, int start, int end)
626 { 1268 {
627 if (end > start) 1269 if (end > start)
@@ -638,18 +1280,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
638 ret.AddRange(src.GetRange(0, end)); 1280 ret.AddRange(src.GetRange(0, end));
639 return ret; 1281 return ret;
640 } 1282 }
641
642
643
644
645 } 1283 }
1284
646 public List<string> llDeleteSubList(List<string> src, int start, int end) 1285 public List<string> llDeleteSubList(List<string> src, int start, int end)
647 { 1286 {
648 List<string> ret = new List<string>(src); 1287 List<string> ret = new List<string>(src);
649 ret.RemoveRange(start, end - start); 1288 ret.RemoveRange(start, end - start);
650 return ret; 1289 return ret;
651 } 1290 }
652 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } 1291
1292 public int llGetListEntryType(List<string> src, int index)
1293 {
1294 NotImplemented("llGetListEntryType");
1295 return 0;
1296 }
1297
653 public string llList2CSV(List<string> src) 1298 public string llList2CSV(List<string> src)
654 { 1299 {
655 string ret = ""; 1300 string ret = "";
@@ -661,6 +1306,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
661 } 1306 }
662 return ret; 1307 return ret;
663 } 1308 }
1309
664 public List<string> llCSV2List(string src) 1310 public List<string> llCSV2List(string src)
665 { 1311 {
666 List<string> ret = new List<string>(); 1312 List<string> ret = new List<string>();
@@ -670,6 +1316,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
670 } 1316 }
671 return ret; 1317 return ret;
672 } 1318 }
1319
673 public List<string> llListRandomize(List<string> src, int stride) 1320 public List<string> llListRandomize(List<string> src, int stride)
674 { 1321 {
675 int s = stride; 1322 int s = stride;
@@ -711,9 +1358,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
711 } 1358 }
712 1359
713 return ret; 1360 return ret;
714
715
716 } 1361 }
1362
717 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 1363 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
718 { 1364 {
719 List<string> ret = new List<string>(); 1365 List<string> ret = new List<string>();
@@ -739,12 +1385,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
739 1385
740 public LSL_Types.Vector3 llGetRegionCorner() 1386 public LSL_Types.Vector3 llGetRegionCorner()
741 { 1387 {
742 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 1388 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0);
743 } 1389 }
744 1390
745 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 1391 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
746 { 1392 {
747
748 List<string> ret = new List<string>(dest); 1393 List<string> ret = new List<string>(dest);
749 //foreach (string s in src.Reverse()) 1394 //foreach (string s in src.Reverse())
750 for (int ci = src.Count - 1; ci > -1; ci--) 1395 for (int ci = src.Count - 1; ci > -1; ci--)
@@ -753,13 +1398,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
753 } 1398 }
754 return ret; 1399 return ret;
755 } 1400 }
1401
756 public int llListFindList(List<string> src, List<string> test) 1402 public int llListFindList(List<string> src, List<string> test)
757 { 1403 {
758 foreach (string s in test) 1404 foreach (string s in test)
759 { 1405 {
760 for (int ci = 0; ci < src.Count; ci++) 1406 for (int ci = 0; ci < src.Count; ci++)
761 { 1407 {
762
763 if (s == src[ci]) 1408 if (s == src[ci])
764 return ci; 1409 return ci;
765 } 1410 }
@@ -784,37 +1429,139 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
784 return result; 1429 return result;
785 } 1430 }
786 1431
787 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } 1432 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir)
788 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } 1433 {
789 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } 1434 NotImplemented("llEdgeOfWorld");
790 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } 1435 return 0;
791 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } 1436 }
792 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } 1437
793 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } 1438 public int llGetAgentInfo(string id)
794 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } 1439 {
795 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } 1440 NotImplemented("llGetAgentInfo");
796 1441 return 0;
797 public void llParseString2List() { NotImplemented("llParseString2List"); } 1442 }
798 1443
799 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } 1444 public void llAdjustSoundVolume(double volume)
800 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } 1445 {
801 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } 1446 NotImplemented("llAdjustSoundVolume");
802 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } 1447 }
803 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } 1448
804 public void llUnSit(string id) { NotImplemented("llUnSit"); } 1449 public void llSetSoundQueueing(int queue)
805 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } 1450 {
806 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } 1451 NotImplemented("llSetSoundQueueing");
807 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } 1452 }
808 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } 1453
809 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } 1454 public void llSetSoundRadius(double radius)
1455 {
1456 NotImplemented("llSetSoundRadius");
1457 }
1458
1459 public string llKey2Name(string id)
1460 {
1461 NotImplemented("llKey2Name");
1462 return "";
1463 }
1464
1465 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
1466 {
1467 NotImplemented("llSetTextureAnim");
1468 }
1469
1470 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
1471 LSL_Types.Vector3 bottom_south_west)
1472 {
1473 NotImplemented("llTriggerSoundLimited");
1474 }
1475
1476 public void llEjectFromLand(string pest)
1477 {
1478 NotImplemented("llEjectFromLand");
1479 }
1480
1481 public void llParseString2List()
1482 {
1483 NotImplemented("llParseString2List");
1484 }
1485
1486 public int llOverMyLand(string id)
1487 {
1488 NotImplemented("llOverMyLand");
1489 return 0;
1490 }
1491
1492 public string llGetLandOwnerAt(LSL_Types.Vector3 pos)
1493 {
1494 NotImplemented("llGetLandOwnerAt");
1495 return "";
1496 }
1497
1498 public string llGetNotecardLine(string name, int line)
1499 {
1500 NotImplemented("llGetNotecardLine");
1501 return "";
1502 }
1503
1504 public LSL_Types.Vector3 llGetAgentSize(string id)
1505 {
1506 NotImplemented("llGetAgentSize");
1507 return new LSL_Types.Vector3();
1508 }
1509
1510 public int llSameGroup(string agent)
1511 {
1512 NotImplemented("llSameGroup");
1513 return 0;
1514 }
1515
1516 public void llUnSit(string id)
1517 {
1518 NotImplemented("llUnSit");
1519 }
1520
1521 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset)
1522 {
1523 NotImplemented("llGroundSlope");
1524 return new LSL_Types.Vector3();
1525 }
1526
1527 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset)
1528 {
1529 NotImplemented("llGroundNormal");
1530 return new LSL_Types.Vector3();
1531 }
1532
1533 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset)
1534 {
1535 NotImplemented("llGroundContour");
1536 return new LSL_Types.Vector3();
1537 }
1538
1539 public int llGetAttached()
1540 {
1541 NotImplemented("llGetAttached");
1542 return 0;
1543 }
1544
1545 public int llGetFreeMemory()
1546 {
1547 NotImplemented("llGetFreeMemory");
1548 return 0;
1549 }
810 1550
811 public string llGetRegionName() 1551 public string llGetRegionName()
812 { 1552 {
813 return World.RegionInfo.RegionName; 1553 return World.RegionInfo.RegionName;
814 } 1554 }
815 1555
816 public double llGetRegionTimeDilation() { return 1.0f; } 1556 public double llGetRegionTimeDilation()
817 public double llGetRegionFPS() { return 10.0f; } 1557 {
1558 return 1.0f;
1559 }
1560
1561 public double llGetRegionFPS()
1562 {
1563 return 10.0f;
1564 }
818 1565
819 /* particle system rules should be coming into this routine as doubles, that is 1566 /* particle system rules should be coming into this routine as doubles, that is
820 rule[0] should be an integer from this list and rule[1] should be the arg 1567 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -824,6 +1571,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
824 We iterate through the list for 'Count' elements, incrementing by two for each 1571 We iterate through the list for 'Count' elements, incrementing by two for each
825 iteration and set the members of Primitive.ParticleSystem, one at a time. 1572 iteration and set the members of Primitive.ParticleSystem, one at a time.
826 */ 1573 */
1574
827 public enum PrimitiveRule : int 1575 public enum PrimitiveRule : int
828 { 1576 {
829 PSYS_PART_FLAGS = 0, 1577 PSYS_PART_FLAGS = 0,
@@ -854,109 +1602,152 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
854 Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); 1602 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
855 for (int i = 0; i < rules.Count; i += 2) 1603 for (int i = 0; i < rules.Count; i += 2)
856 { 1604 {
857 switch ((int)rules[i]) 1605 switch ((int) rules[i])
858 { 1606 {
859 case (int)PrimitiveRule.PSYS_PART_FLAGS: 1607 case (int) PrimitiveRule.PSYS_PART_FLAGS:
860 prules.PartFlags = (uint)rules[i + 1]; 1608 prules.PartFlags = (uint) rules[i + 1];
861 break; 1609 break;
862 1610
863 case (int)PrimitiveRule.PSYS_PART_START_COLOR: 1611 case (int) PrimitiveRule.PSYS_PART_START_COLOR:
864 prules.PartStartColor = (LLColor)rules[i + 1]; 1612 prules.PartStartColor = (LLColor) rules[i + 1];
865 break; 1613 break;
866 1614
867 case (int)PrimitiveRule.PSYS_PART_START_ALPHA: 1615 case (int) PrimitiveRule.PSYS_PART_START_ALPHA:
868 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1616 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
869 break; 1617 break;
870 1618
871 case (int)PrimitiveRule.PSYS_PART_END_COLOR: 1619 case (int) PrimitiveRule.PSYS_PART_END_COLOR:
872 prules.PartEndColor = (LLColor)rules[i + 1]; 1620 prules.PartEndColor = (LLColor) rules[i + 1];
873 break; 1621 break;
874 1622
875 case (int)PrimitiveRule.PSYS_PART_END_ALPHA: 1623 case (int) PrimitiveRule.PSYS_PART_END_ALPHA:
876 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1624 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
877 break; 1625 break;
878 1626
879 case (int)PrimitiveRule.PSYS_PART_START_SCALE: 1627 case (int) PrimitiveRule.PSYS_PART_START_SCALE:
880 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1628 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
881 break; 1629 break;
882 1630
883 case (int)PrimitiveRule.PSYS_PART_END_SCALE: 1631 case (int) PrimitiveRule.PSYS_PART_END_SCALE:
884 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1632 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
885 break; 1633 break;
886 1634
887 case (int)PrimitiveRule.PSYS_PART_MAX_AGE: 1635 case (int) PrimitiveRule.PSYS_PART_MAX_AGE:
888 prules.MaxAge = (float)rules[i + 1]; 1636 prules.MaxAge = (float) rules[i + 1];
889 break; 1637 break;
890 1638
891 case (int)PrimitiveRule.PSYS_SRC_ACCEL: 1639 case (int) PrimitiveRule.PSYS_SRC_ACCEL:
892 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1640 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
893 break; 1641 break;
894 1642
895 case (int)PrimitiveRule.PSYS_SRC_PATTERN: 1643 case (int) PrimitiveRule.PSYS_SRC_PATTERN:
896 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1644 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
897 break; 1645 break;
898 1646
899 case (int)PrimitiveRule.PSYS_SRC_TEXTURE: 1647 case (int) PrimitiveRule.PSYS_SRC_TEXTURE:
900 prules.Texture = (LLUUID)rules[i + 1]; 1648 prules.Texture = (LLUUID) rules[i + 1];
901 break; 1649 break;
902 1650
903 case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: 1651 case (int) PrimitiveRule.PSYS_SRC_BURST_RATE:
904 prules.BurstRate = (float)rules[i + 1]; 1652 prules.BurstRate = (float) rules[i + 1];
905 break; 1653 break;
906 1654
907 case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: 1655 case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
908 prules.BurstPartCount = (byte)rules[i + 1]; 1656 prules.BurstPartCount = (byte) rules[i + 1];
909 break; 1657 break;
910 1658
911 case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: 1659 case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS:
912 prules.BurstRadius = (float)rules[i + 1]; 1660 prules.BurstRadius = (float) rules[i + 1];
913 break; 1661 break;
914 1662
915 case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: 1663 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
916 prules.BurstSpeedMin = (float)rules[i + 1]; 1664 prules.BurstSpeedMin = (float) rules[i + 1];
917 break; 1665 break;
918 1666
919 case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: 1667 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
920 prules.BurstSpeedMax = (float)rules[i + 1]; 1668 prules.BurstSpeedMax = (float) rules[i + 1];
921 break; 1669 break;
922 1670
923 case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: 1671 case (int) PrimitiveRule.PSYS_SRC_MAX_AGE:
924 prules.MaxAge = (float)rules[i + 1]; 1672 prules.MaxAge = (float) rules[i + 1];
925 break; 1673 break;
926 1674
927 case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: 1675 case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY:
928 prules.Target = (LLUUID)rules[i + 1]; 1676 prules.Target = (LLUUID) rules[i + 1];
929 break; 1677 break;
930 1678
931 case (int)PrimitiveRule.PSYS_SRC_OMEGA: 1679 case (int) PrimitiveRule.PSYS_SRC_OMEGA:
932 //cast?? prules.MaxAge = (float)rules[i + 1]; 1680 //cast?? prules.MaxAge = (float)rules[i + 1];
933 break; 1681 break;
934 1682
935 case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: 1683 case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
936 prules.InnerAngle = (float)rules[i + 1]; 1684 prules.InnerAngle = (float) rules[i + 1];
937 break; 1685 break;
938 1686
939 case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: 1687 case (int) PrimitiveRule.PSYS_SRC_ANGLE_END:
940 prules.OuterAngle = (float)rules[i + 1]; 1688 prules.OuterAngle = (float) rules[i + 1];
941 break; 1689 break;
942
943 } 1690 }
944 } 1691 }
945 1692
946 m_host.AddNewParticleSystem(prules); 1693 m_host.AddNewParticleSystem(prules);
947 } 1694 }
948 1695
949 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } 1696 public void llGroundRepel(double height, int water, double tau)
950 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } 1697 {
951 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } 1698 NotImplemented("llGroundRepel");
952 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } 1699 }
953 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } 1700
954 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } 1701 public void llGiveInventoryList()
955 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } 1702 {
956 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } 1703 NotImplemented("llGiveInventoryList");
957 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } 1704 }
958 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } 1705
959 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } 1706 public void llSetVehicleType(int type)
1707 {
1708 NotImplemented("llSetVehicleType");
1709 }
1710
1711 public void llSetVehicledoubleParam(int param, double value)
1712 {
1713 NotImplemented("llSetVehicledoubleParam");
1714 }
1715
1716 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec)
1717 {
1718 NotImplemented("llSetVehicleVectorParam");
1719 }
1720
1721 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot)
1722 {
1723 NotImplemented("llSetVehicleRotationParam");
1724 }
1725
1726 public void llSetVehicleFlags(int flags)
1727 {
1728 NotImplemented("llSetVehicleFlags");
1729 }
1730
1731 public void llRemoveVehicleFlags(int flags)
1732 {
1733 NotImplemented("llRemoveVehicleFlags");
1734 }
1735
1736 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot)
1737 {
1738 NotImplemented("llSitTarget");
1739 }
1740
1741 public string llAvatarOnSitTarget()
1742 {
1743 NotImplemented("llAvatarOnSitTarget");
1744 return "";
1745 }
1746
1747 public void llAddToLandPassList(string avatar, double hours)
1748 {
1749 NotImplemented("llAddToLandPassList");
1750 }
960 1751
961 public void llSetTouchText(string text) 1752 public void llSetTouchText(string text)
962 { 1753 {
@@ -968,49 +1759,91 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
968 m_host.SitName = text; 1759 m_host.SitName = text;
969 } 1760 }
970 1761
971 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } 1762 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset)
972 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } 1763 {
973 public void llDumpList2String() { NotImplemented("llDumpList2String"); } 1764 NotImplemented("llSetCameraEyeOffset");
974 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } 1765 }
975 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); }
976 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); }
977 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); }
978 1766
979 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } 1767 public void llSetCameraAtOffset(LSL_Types.Vector3 offset)
1768 {
1769 NotImplemented("llSetCameraAtOffset");
1770 }
980 1771
981 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } 1772 public void llDumpList2String()
982 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } 1773 {
983 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } 1774 NotImplemented("llDumpList2String");
1775 }
1776
1777 public void llScriptDanger(LSL_Types.Vector3 pos)
1778 {
1779 NotImplemented("llScriptDanger");
1780 }
1781
1782 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1783 {
1784 NotImplemented("llDialog");
1785 }
1786
1787 public void llVolumeDetect(int detect)
1788 {
1789 NotImplemented("llVolumeDetect");
1790 }
1791
1792 public void llResetOtherScript(string name)
1793 {
1794 NotImplemented("llResetOtherScript");
1795 }
1796
1797 public int llGetScriptState(string name)
1798 {
1799 NotImplemented("llGetScriptState");
1800 return 0;
1801 }
1802
1803 public void llRemoteLoadScript()
1804 {
1805 NotImplemented("llRemoteLoadScript");
1806 }
1807
1808 public void llSetRemoteScriptAccessPin(int pin)
1809 {
1810 NotImplemented("llSetRemoteScriptAccessPin");
1811 }
1812
1813 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
1814 {
1815 NotImplemented("llRemoteLoadScriptPin");
1816 }
984 1817
985 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) 1818 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
986 // Not sure where these constants should live: 1819 // Not sure where these constants should live:
987 // REMOTE_DATA_CHANNEL = 1 1820 // REMOTE_DATA_CHANNEL = 1
988 // REMOTE_DATA_REQUEST = 2 1821 // REMOTE_DATA_REQUEST = 2
989 // REMOTE_DATA_REPLY = 3 1822 // REMOTE_DATA_REPLY = 3
990 public void llOpenRemoteDataChannel() { 1823 public void llOpenRemoteDataChannel()
991 1824 {
992 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 1825 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
993 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); 1826 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID);
994 object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" }; 1827 object[] resobj = new object[] {1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, ""};
995 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); 1828 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj);
996
997 } 1829 }
998 1830
999 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } 1831 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
1832 {
1833 NotImplemented("llSendRemoteData");
1834 return "";
1835 }
1000 1836
1001 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) 1837 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
1002 { 1838 {
1003
1004 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 1839 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
1005 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 1840 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
1006
1007 } 1841 }
1008
1009 public void llCloseRemoteDataChannel(string channel) {
1010 1842
1843 public void llCloseRemoteDataChannel(string channel)
1844 {
1011 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 1845 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
1012 xmlrpcMod.CloseXMLRPCChannel(channel); 1846 xmlrpcMod.CloseXMLRPCChannel(channel);
1013
1014 } 1847 }
1015 1848
1016 public string llMD5String(string src, int nonce) 1849 public string llMD5String(string src, int nonce)
@@ -1018,14 +1851,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1018 return Util.Md5Hash(src + ":" + nonce.ToString()); 1851 return Util.Md5Hash(src + ":" + nonce.ToString());
1019 } 1852 }
1020 1853
1021 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } 1854 public void llSetPrimitiveParams(List<string> rules)
1022 public string llStringToBase64(string str)
1023 { 1855 {
1856 NotImplemented("llSetPrimitiveParams");
1857 }
1024 1858
1859 public string llStringToBase64(string str)
1860 {
1025 try 1861 try
1026 { 1862 {
1027 byte[] encData_byte = new byte[str.Length]; 1863 byte[] encData_byte = new byte[str.Length];
1028 encData_byte = System.Text.Encoding.UTF8.GetBytes(str); 1864 encData_byte = Encoding.UTF8.GetBytes(str);
1029 string encodedData = Convert.ToBase64String(encData_byte); 1865 string encodedData = Convert.ToBase64String(encData_byte);
1030 return encodedData; 1866 return encodedData;
1031 } 1867 }
@@ -1037,11 +1873,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1037 1873
1038 public string llBase64ToString(string str) 1874 public string llBase64ToString(string str)
1039 { 1875 {
1040 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 1876 UTF8Encoding encoder = new UTF8Encoding();
1041 System.Text.Decoder utf8Decode = encoder.GetDecoder(); 1877 Decoder utf8Decode = encoder.GetDecoder();
1042 try 1878 try
1043 { 1879 {
1044
1045 byte[] todecode_byte = Convert.FromBase64String(str); 1880 byte[] todecode_byte = Convert.FromBase64String(str);
1046 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 1881 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
1047 char[] decoded_char = new char[charCount]; 1882 char[] decoded_char = new char[charCount];
@@ -1054,16 +1889,49 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1054 throw new Exception("Error in base64Decode" + e.Message); 1889 throw new Exception("Error in base64Decode" + e.Message);
1055 } 1890 }
1056 } 1891 }
1057 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); }
1058 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); }
1059 public double llLog10(double val) { return (double)Math.Log10(val); }
1060 public double llLog(double val) { return (double)Math.Log(val); }
1061 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); }
1062 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); }
1063 1892
1064 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } 1893 public void llXorBase64Strings()
1894 {
1895 throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead.");
1896 }
1897
1898 public void llRemoteDataSetRegion()
1899 {
1900 NotImplemented("llRemoteDataSetRegion");
1901 }
1902
1903 public double llLog10(double val)
1904 {
1905 return (double) Math.Log10(val);
1906 }
1065 1907
1066 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } 1908 public double llLog(double val)
1909 {
1910 return (double) Math.Log(val);
1911 }
1912
1913 public List<string> llGetAnimationList(string id)
1914 {
1915 NotImplemented("llGetAnimationList");
1916 return new List<string>();
1917 }
1918
1919 public void llSetParcelMusicURL(string url)
1920 {
1921 NotImplemented("llSetParcelMusicURL");
1922 }
1923
1924 public LSL_Types.Vector3 llGetRootPosition()
1925 {
1926 NotImplemented("llGetRootPosition");
1927 return new LSL_Types.Vector3();
1928 }
1929
1930 public LSL_Types.Quaternion llGetRootRotation()
1931 {
1932 NotImplemented("llGetRootRotation");
1933 return new LSL_Types.Quaternion();
1934 }
1067 1935
1068 public string llGetObjectDesc() 1936 public string llGetObjectDesc()
1069 { 1937 {
@@ -1080,20 +1948,55 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1080 return m_host.ObjectCreator.ToStringHyphenated(); 1948 return m_host.ObjectCreator.ToStringHyphenated();
1081 } 1949 }
1082 1950
1083 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } 1951 public string llGetTimestamp()
1084 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } 1952 {
1085 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } 1953 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
1086 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } 1954 }
1087 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } 1955
1088 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } 1956 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1089 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } 1957 {
1958 NotImplemented("llSetLinkAlpha");
1959 }
1960
1961 public int llGetNumberOfPrims()
1962 {
1963 NotImplemented("llGetNumberOfPrims");
1964 return 0;
1965 }
1966
1967 public string llGetNumberOfNotecardLines(string name)
1968 {
1969 NotImplemented("llGetNumberOfNotecardLines");
1970 return "";
1971 }
1972
1973 public List<string> llGetBoundingBox(string obj)
1974 {
1975 NotImplemented("llGetBoundingBox");
1976 return new List<string>();
1977 }
1978
1979 public LSL_Types.Vector3 llGetGeometricCenter()
1980 {
1981 NotImplemented("llGetGeometricCenter");
1982 return new LSL_Types.Vector3();
1983 }
1984
1985 public void llGetPrimitiveParams()
1986 {
1987 NotImplemented("llGetPrimitiveParams");
1988 }
1989
1090 public string llIntegerToBase64(int number) 1990 public string llIntegerToBase64(int number)
1091 { 1991 {
1092 NotImplemented("llIntegerToBase64"); return ""; 1992 NotImplemented("llIntegerToBase64");
1993 return "";
1093 } 1994 }
1995
1094 public int llBase64ToInteger(string str) 1996 public int llBase64ToInteger(string str)
1095 { 1997 {
1096 NotImplemented("llBase64ToInteger"); return 0; 1998 NotImplemented("llBase64ToInteger");
1999 return 0;
1097 } 2000 }
1098 2001
1099 public double llGetGMTclock() 2002 public double llGetGMTclock()
@@ -1106,31 +2009,92 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1106 return System.Environment.MachineName; 2009 return System.Environment.MachineName;
1107 } 2010 }
1108 2011
1109 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } 2012 public void llSetLocalRot(LSL_Types.Quaternion rot)
1110 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } 2013 {
1111 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } 2014 NotImplemented("llSetLocalRot");
2015 }
1112 2016
1113 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } 2017 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
2018 {
2019 NotImplemented("llParseStringKeepNulls");
2020 return new List<string>();
2021 }
1114 2022
1115 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } 2023 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
2024 LSL_Types.Quaternion rot, int param)
2025 {
2026 NotImplemented("llRezAtRoot");
2027 }
1116 2028
1117 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } 2029 public int llGetObjectPermMask(int mask)
1118 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } 2030 {
1119 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } 2031 NotImplemented("llGetObjectPermMask");
1120 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } 2032 return 0;
1121 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } 2033 }
1122 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } 2034
1123 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } 2035 public void llSetObjectPermMask(int mask, int value)
1124 public void llListReplaceList() { NotImplemented("llListReplaceList"); } 2036 {
2037 NotImplemented("llSetObjectPermMask");
2038 }
2039
2040 public void llGetInventoryPermMask(string item, int mask)
2041 {
2042 NotImplemented("llGetInventoryPermMask");
2043 }
2044
2045 public void llSetInventoryPermMask(string item, int mask, int value)
2046 {
2047 NotImplemented("llSetInventoryPermMask");
2048 }
2049
2050 public string llGetInventoryCreator(string item)
2051 {
2052 NotImplemented("llGetInventoryCreator");
2053 return "";
2054 }
2055
2056 public void llOwnerSay(string msg)
2057 {
2058 NotImplemented("llOwnerSay");
2059 }
2060
2061 public void llRequestSimulatorData(string simulator, int data)
2062 {
2063 NotImplemented("llRequestSimulatorData");
2064 }
2065
2066 public void llForceMouselook(int mouselook)
2067 {
2068 NotImplemented("llForceMouselook");
2069 }
2070
2071 public double llGetObjectMass(string id)
2072 {
2073 NotImplemented("llGetObjectMass");
2074 return 0;
2075 }
2076
2077 public void llListReplaceList()
2078 {
2079 NotImplemented("llListReplaceList");
2080 }
1125 2081
1126 public void llLoadURL(string avatar_id, string message, string url) 2082 public void llLoadURL(string avatar_id, string message, string url)
1127 { 2083 {
1128 LLUUID avatarId = new LLUUID(avatar_id); 2084 LLUUID avatarId = new LLUUID(avatar_id);
1129 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); 2085 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message,
2086 url);
1130 } 2087 }
1131 2088
1132 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } 2089 public void llParcelMediaCommandList(List<string> commandList)
1133 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } 2090 {
2091 NotImplemented("llParcelMediaCommandList");
2092 }
2093
2094 public void llParcelMediaQuery()
2095 {
2096 NotImplemented("llParcelMediaQuery");
2097 }
1134 2098
1135 public int llModPow(int a, int b, int c) 2099 public int llModPow(int a, int b, int c)
1136 { 2100 {
@@ -1139,13 +2103,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1139 return Convert.ToInt32(tmp); 2103 return Convert.ToInt32(tmp);
1140 } 2104 }
1141 2105
1142 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } 2106 public int llGetInventoryType(string name)
2107 {
2108 NotImplemented("llGetInventoryType");
2109 return 0;
2110 }
2111
2112 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
2113 {
2114 NotImplemented("llSetPayPrice");
2115 }
2116
2117 public LSL_Types.Vector3 llGetCameraPos()
2118 {
2119 NotImplemented("llGetCameraPos");
2120 return new LSL_Types.Vector3();
2121 }
2122
2123 public LSL_Types.Quaternion llGetCameraRot()
2124 {
2125 NotImplemented("llGetCameraRot");
2126 return new LSL_Types.Quaternion();
2127 }
2128
2129 public void llSetPrimURL()
2130 {
2131 NotImplemented("llSetPrimURL");
2132 }
1143 2133
1144 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } 2134 public void llRefreshPrimURL()
1145 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } 2135 {
1146 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } 2136 NotImplemented("llRefreshPrimURL");
1147 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } 2137 }
1148 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); }
1149 2138
1150 public string llEscapeURL(string url) 2139 public string llEscapeURL(string url)
1151 { 2140 {
@@ -1170,21 +2159,60 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1170 return "llUnescapeURL: " + ex.ToString(); 2159 return "llUnescapeURL: " + ex.ToString();
1171 } 2160 }
1172 } 2161 }
1173 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } 2162
1174 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } 2163 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at)
1175 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } 2164 {
1176 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } 2165 NotImplemented("llMapDestination");
1177 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } 2166 }
1178 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } 2167
1179 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } 2168 public void llAddToLandBanList(string avatar, double hours)
2169 {
2170 NotImplemented("llAddToLandBanList");
2171 }
2172
2173 public void llRemoveFromLandPassList(string avatar)
2174 {
2175 NotImplemented("llRemoveFromLandPassList");
2176 }
2177
2178 public void llRemoveFromLandBanList(string avatar)
2179 {
2180 NotImplemented("llRemoveFromLandBanList");
2181 }
2182
2183 public void llSetCameraParams(List<string> rules)
2184 {
2185 NotImplemented("llSetCameraParams");
2186 }
2187
2188 public void llClearCameraParams()
2189 {
2190 NotImplemented("llClearCameraParams");
2191 }
2192
2193 public double llListStatistics(int operation, List<string> src)
2194 {
2195 NotImplemented("llListStatistics");
2196 return 0;
2197 }
1180 2198
1181 public int llGetUnixTime() 2199 public int llGetUnixTime()
1182 { 2200 {
1183 return Util.UnixTimeSinceEpoch(); 2201 return Util.UnixTimeSinceEpoch();
1184 } 2202 }
1185 2203
1186 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } 2204 public int llGetParcelFlags(LSL_Types.Vector3 pos)
1187 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } 2205 {
2206 NotImplemented("llGetParcelFlags");
2207 return 0;
2208 }
2209
2210 public int llGetRegionFlags()
2211 {
2212 NotImplemented("llGetRegionFlags");
2213 return 0;
2214 }
2215
1188 public string llXorBase64StringsCorrect(string str1, string str2) 2216 public string llXorBase64StringsCorrect(string str1, string str2)
1189 { 2217 {
1190 string ret = ""; 2218 string ret = "";
@@ -1201,27 +2229,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1201 } 2229 }
1202 return llStringToBase64(ret); 2230 return llStringToBase64(ret);
1203 } 2231 }
2232
1204 public void llHTTPRequest(string url, List<string> parameters, string body) 2233 public void llHTTPRequest(string url, List<string> parameters, string body)
1205 { 2234 {
1206 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); 2235 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body);
1207 } 2236 }
1208 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } 2237
1209 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } 2238 public void llResetLandBanList()
1210 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } 2239 {
1211 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } 2240 NotImplemented("llResetLandBanList");
1212 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } 2241 }
1213 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } 2242
1214 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } 2243 public void llResetLandPassList()
2244 {
2245 NotImplemented("llResetLandPassList");
2246 }
2247
2248 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide)
2249 {
2250 NotImplemented("llGetParcelPrimCount");
2251 return 0;
2252 }
2253
2254 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos)
2255 {
2256 NotImplemented("llGetParcelPrimOwners");
2257 return new List<string>();
2258 }
2259
2260 public int llGetObjectPrimCount(string object_id)
2261 {
2262 NotImplemented("llGetObjectPrimCount");
2263 return 0;
2264 }
2265
2266 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide)
2267 {
2268 NotImplemented("llGetParcelMaxPrims");
2269 return 0;
2270 }
2271
2272 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param)
2273 {
2274 NotImplemented("llGetParcelDetails");
2275 return new List<string>();
2276 }
1215 2277
1216 // 2278 //
1217 // OpenSim functions 2279 // OpenSim functions
1218 // 2280 //
1219 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) 2281 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
2282 int timer)
1220 { 2283 {
1221 if (dynamicID == "") 2284 if (dynamicID == "")
1222 { 2285 {
1223 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); 2286 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
1224 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer); 2287 LLUUID createdTexture =
2288 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
2289 extraParams, timer);
1225 return createdTexture.ToStringHyphenated(); 2290 return createdTexture.ToStringHyphenated();
1226 } 2291 }
1227 else 2292 else
@@ -1237,6 +2302,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1237 if (throwErrorOnNotImplemented) 2302 if (throwErrorOnNotImplemented)
1238 throw new NotImplementedException("Command not implemented: " + Command); 2303 throw new NotImplementedException("Command not implemented: " + Command);
1239 } 2304 }
1240
1241 } 2305 }
1242} 2306} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 8f0a591..85ac597 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -27,11 +27,8 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 30using libsecondlife;
33using OpenSim.Framework; 31using OpenSim.Framework;
34using OpenSim.Region.Environment.Scenes.Scripting;
35 32
36namespace OpenSim.Region.ScriptEngine.DotNetEngine 33namespace OpenSim.Region.ScriptEngine.DotNetEngine
37{ 34{
@@ -39,7 +36,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
39 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. 36 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it.
40 /// </summary> 37 /// </summary>
41 [Serializable] 38 [Serializable]
42 class EventManager 39 internal class EventManager
43 { 40 {
44 private ScriptEngine myScriptEngine; 41 private ScriptEngine myScriptEngine;
45 //public IScriptHost TEMP_OBJECT_ID; 42 //public IScriptHost TEMP_OBJECT_ID;
@@ -55,7 +52,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
55 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 52 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
56 myScriptEngine.World.EventManager.OnRezScript += OnRezScript; 53 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
57 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; 54 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
58
59 } 55 }
60 56
61 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 57 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
@@ -63,17 +59,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
63 // Add to queue for all scripts in ObjectID object 59 // Add to queue for all scripts in ObjectID object
64 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); 60 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
65 //Console.WriteLine("touch_start localID: " + localID); 61 //Console.WriteLine("touch_start localID: " + localID);
66 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); 62 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1});
67 } 63 }
64
68 public void OnRezScript(uint localID, LLUUID itemID, string script) 65 public void OnRezScript(uint localID, LLUUID itemID, string script)
69 { 66 {
70 //myScriptEngine.myScriptManager.StartScript( 67 //myScriptEngine.myScriptManager.StartScript(
71 // Path.Combine("ScriptEngines", "Default.lsl"), 68 // Path.Combine("ScriptEngines", "Default.lsl"),
72 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() 69 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
73 //); 70 //);
74 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); 71 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +
72 script.Length);
75 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); 73 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
76 } 74 }
75
77 public void OnRemoveScript(uint localID, LLUUID itemID) 76 public void OnRemoveScript(uint localID, LLUUID itemID)
78 { 77 {
79 //myScriptEngine.myScriptManager.StartScript( 78 //myScriptEngine.myScriptManager.StartScript(
@@ -84,48 +83,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
84 myScriptEngine.m_ScriptManager.StopScript( 83 myScriptEngine.m_ScriptManager.StopScript(
85 localID, 84 localID,
86 itemID 85 itemID
87 ); 86 );
88
89 } 87 }
90 88
91 // TODO: Replace placeholders below 89 // TODO: Replace placeholders below
92 // These needs to be hooked up to OpenSim during init of this class 90 // These needs to be hooked up to OpenSim during init of this class
93 // then queued in EventQueueManager. 91 // then queued in EventQueueManager.
94 // When queued in EventQueueManager they need to be LSL compatible (name and params) 92 // When queued in EventQueueManager they need to be LSL compatible (name and params)
95 93
96 //public void state_entry() { } // 94 //public void state_entry() { } //
97 public void state_exit() { } 95 public void state_exit()
96 {
97 }
98
98 //public void touch_start() { } 99 //public void touch_start() { }
99 public void touch() { } 100 public void touch()
100 public void touch_end() { } 101 {
101 public void collision_start() { } 102 }
102 public void collision() { } 103
103 public void collision_end() { } 104 public void touch_end()
104 public void land_collision_start() { } 105 {
105 public void land_collision() { } 106 }
106 public void land_collision_end() { } 107
107 public void timer() { } 108 public void collision_start()
108 public void listen() { } 109 {
109 public void on_rez() { } 110 }
110 public void sensor() { } 111
111 public void no_sensor() { } 112 public void collision()
112 public void control() { } 113 {
113 public void money() { } 114 }
114 public void email() { } 115
115 public void at_target() { } 116 public void collision_end()
116 public void not_at_target() { } 117 {
117 public void at_rot_target() { } 118 }
118 public void not_at_rot_target() { } 119
119 public void run_time_permissions() { } 120 public void land_collision_start()
120 public void changed() { } 121 {
121 public void attach() { } 122 }
122 public void dataserver() { } 123
123 public void link_message() { } 124 public void land_collision()
124 public void moving_start() { } 125 {
125 public void moving_end() { } 126 }
126 public void object_rez() { } 127
127 public void remote_data() { } 128 public void land_collision_end()
128 public void http_response() { } 129 {
130 }
131
132 public void timer()
133 {
134 }
135
136 public void listen()
137 {
138 }
139
140 public void on_rez()
141 {
142 }
143
144 public void sensor()
145 {
146 }
147
148 public void no_sensor()
149 {
150 }
151
152 public void control()
153 {
154 }
155
156 public void money()
157 {
158 }
159
160 public void email()
161 {
162 }
163
164 public void at_target()
165 {
166 }
167
168 public void not_at_target()
169 {
170 }
171
172 public void at_rot_target()
173 {
174 }
175
176 public void not_at_rot_target()
177 {
178 }
179
180 public void run_time_permissions()
181 {
182 }
183
184 public void changed()
185 {
186 }
187
188 public void attach()
189 {
190 }
191
192 public void dataserver()
193 {
194 }
195
196 public void link_message()
197 {
198 }
199
200 public void moving_start()
201 {
202 }
203
204 public void moving_end()
205 {
206 }
207
208 public void object_rez()
209 {
210 }
211
212 public void remote_data()
213 {
214 }
129 215
216 public void http_response()
217 {
218 }
130 } 219 }
131} 220} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index aa36ea2..d7491d9 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -27,12 +27,11 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Reflection;
34using OpenSim.Region.Environment.Scenes.Scripting;
35using libsecondlife; 33using libsecondlife;
34using OpenSim.Region.Environment.Scenes.Scripting;
36using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 35using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
37 36
38namespace OpenSim.Region.ScriptEngine.DotNetEngine 37namespace OpenSim.Region.ScriptEngine.DotNetEngine
@@ -42,25 +41,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
42 /// Events are queued and executed in separate thread 41 /// Events are queued and executed in separate thread
43 /// </summary> 42 /// </summary>
44 [Serializable] 43 [Serializable]
45 class EventQueueManager 44 internal class EventQueueManager
46 { 45 {
47 /// <summary> 46 /// <summary>
48 /// List of threads processing event queue 47 /// List of threads processing event queue
49 /// </summary> 48 /// </summary>
50 private List<Thread> eventQueueThreads = new List<Thread>(); 49 private List<Thread> eventQueueThreads = new List<Thread>();
50
51 private object queueLock = new object(); // Mutex lock object 51 private object queueLock = new object(); // Mutex lock object
52
52 /// <summary> 53 /// <summary>
53 /// How many ms to sleep if queue is empty 54 /// How many ms to sleep if queue is empty
54 /// </summary> 55 /// </summary>
55 private int nothingToDoSleepms = 50; 56 private int nothingToDoSleepms = 50;
57
56 /// <summary> 58 /// <summary>
57 /// How many threads to process queue with 59 /// How many threads to process queue with
58 /// </summary> 60 /// </summary>
59 private int numberOfThreads = 2; 61 private int numberOfThreads = 2;
62
60 /// <summary> 63 /// <summary>
61 /// Queue containing events waiting to be executed 64 /// Queue containing events waiting to be executed
62 /// </summary> 65 /// </summary>
63 private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); 66 private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>();
67
64 /// <summary> 68 /// <summary>
65 /// Queue item structure 69 /// Queue item structure
66 /// </summary> 70 /// </summary>
@@ -76,9 +80,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
76 /// List of localID locks for mutex processing of script events 80 /// List of localID locks for mutex processing of script events
77 /// </summary> 81 /// </summary>
78 private List<uint> objectLocks = new List<uint>(); 82 private List<uint> objectLocks = new List<uint>();
83
79 private object tryLockLock = new object(); // Mutex lock object 84 private object tryLockLock = new object(); // Mutex lock object
80 85
81 private ScriptEngine m_ScriptEngine; 86 private ScriptEngine m_ScriptEngine;
87
82 public EventQueueManager(ScriptEngine _ScriptEngine) 88 public EventQueueManager(ScriptEngine _ScriptEngine)
83 { 89 {
84 m_ScriptEngine = _ScriptEngine; 90 m_ScriptEngine = _ScriptEngine;
@@ -96,11 +102,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
96 EventQueueThread.Start(); 102 EventQueueThread.Start();
97 } 103 }
98 } 104 }
105
99 ~EventQueueManager() 106 ~EventQueueManager()
100 { 107 {
101
102 // Kill worker threads 108 // Kill worker threads
103 foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads)) 109 foreach (Thread EventQueueThread in new ArrayList(eventQueueThreads))
104 { 110 {
105 if (EventQueueThread != null && EventQueueThread.IsAlive == true) 111 if (EventQueueThread != null && EventQueueThread.IsAlive == true)
106 { 112 {
@@ -118,7 +124,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
118 eventQueueThreads.Clear(); 124 eventQueueThreads.Clear();
119 // Todo: Clean up our queues 125 // Todo: Clean up our queues
120 eventQueue.Clear(); 126 eventQueue.Clear();
121
122 } 127 }
123 128
124 /// <summary> 129 /// <summary>
@@ -176,18 +181,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
176 // Execute function 181 // Execute function
177 try 182 try
178 { 183 {
179 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param); 184 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID,
185 QIS.functionName, QIS.param);
180 } 186 }
181 catch (Exception e) 187 catch (Exception e)
182 { 188 {
183 // DISPLAY ERROR INWORLD 189 // DISPLAY ERROR INWORLD
184 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; 190 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
185 if (e.InnerException != null) 191 if (e.InnerException != null)
186 { // Send inner exception 192 {
193 // Send inner exception
187 text += e.InnerException.Message.ToString(); 194 text += e.InnerException.Message.ToString();
188 } 195 }
189 else 196 else
190 { // Send normal 197 {
198 // Send normal
191 text += e.Message.ToString(); 199 text += e.Message.ToString();
192 } 200 }
193 try 201 try
@@ -195,28 +203,33 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
195 if (text.Length > 1500) 203 if (text.Length > 1500)
196 text = text.Substring(0, 1500); 204 text = text.Substring(0, 1500);
197 IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); 205 IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
198 //if (m_host != null) 206 //if (m_host != null)
199 //{ 207 //{
200 m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 208 m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0,
201 } catch { 209 m_host.AbsolutePosition, m_host.Name, m_host.UUID);
202 //} 210 }
203 //else 211 catch
204 //{ 212 {
213 //}
214 //else
215 //{
205 // T oconsole 216 // T oconsole
206 Console.WriteLine("Unable to send text in-world:\r\n" + text); 217 Console.WriteLine("Unable to send text in-world:\r\n" + text);
207 } 218 }
208
209 } 219 }
210 finally 220 finally
211 { 221 {
212 ReleaseLock(QIS.localID); 222 ReleaseLock(QIS.localID);
213 } 223 }
214 } 224 }
215
216 } // Something in queue 225 } // Something in queue
217 } catch (ThreadAbortException tae) { 226 }
227 catch (ThreadAbortException tae)
228 {
218 throw tae; 229 throw tae;
219 } catch (Exception e) { 230 }
231 catch (Exception e)
232 {
220 Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); 233 Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString());
221 } 234 }
222 } // while 235 } // while
@@ -283,15 +296,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
283 return; 296 return;
284 } 297 }
285 298
286 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); 299 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys =
300 m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
287 301
288 foreach ( LLUUID itemID in scriptKeys ) 302 foreach (LLUUID itemID in scriptKeys)
289 { 303 {
290 // Add to each script in that object 304 // Add to each script in that object
291 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? 305 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter?
292 AddToScriptQueue(localID, itemID, FunctionName, param); 306 AddToScriptQueue(localID, itemID, FunctionName, param);
293 } 307 }
294
295 } 308 }
296 309
297 /// <summary> 310 /// <summary>
@@ -316,6 +329,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
316 eventQueue.Enqueue(QIS); 329 eventQueue.Enqueue(QIS);
317 } 330 }
318 } 331 }
319
320 } 332 }
321} 333} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index e6c2c47..5061629 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -28,24 +28,23 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.Threading; 31using System.Threading;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Region.ScriptEngine.Common;
35using OpenSim.Region.Environment.Modules;
36using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Modules;
37 35
38namespace OpenSim.Region.ScriptEngine.DotNetEngine 36namespace OpenSim.Region.ScriptEngine.DotNetEngine
39{ 37{
40 /// <summary> 38 /// <summary>
41 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. 39 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
42 /// </summary> 40 /// </summary>
43 class LSLLongCmdHandler 41 internal class LSLLongCmdHandler
44 { 42 {
45 private Thread cmdHandlerThread; 43 private Thread cmdHandlerThread;
46 private int cmdHandlerThreadCycleSleepms = 100; 44 private int cmdHandlerThreadCycleSleepms = 100;
47 45
48 private ScriptEngine m_ScriptEngine; 46 private ScriptEngine m_ScriptEngine;
47
49 public LSLLongCmdHandler(ScriptEngine _ScriptEngine) 48 public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
50 { 49 {
51 m_ScriptEngine = _ScriptEngine; 50 m_ScriptEngine = _ScriptEngine;
@@ -56,8 +55,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
56 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 55 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
57 cmdHandlerThread.IsBackground = true; 56 cmdHandlerThread.IsBackground = true;
58 cmdHandlerThread.Start(); 57 cmdHandlerThread.Start();
59
60 } 58 }
59
61 ~LSLLongCmdHandler() 60 ~LSLLongCmdHandler()
62 { 61 {
63 // Shut down thread 62 // Shut down thread
@@ -72,7 +71,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
72 } 71 }
73 } 72 }
74 } 73 }
75 catch { } 74 catch
75 {
76 }
76 } 77 }
77 78
78 private void CmdHandlerThreadLoop() 79 private void CmdHandlerThreadLoop()
@@ -124,8 +125,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
124 public double interval; 125 public double interval;
125 public DateTime next; 126 public DateTime next;
126 } 127 }
128
127 private List<TimerClass> Timers = new List<TimerClass>(); 129 private List<TimerClass> Timers = new List<TimerClass>();
128 private object TimerListLock = new object(); 130 private object TimerListLock = new object();
131
129 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) 132 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec)
130 { 133 {
131 Console.WriteLine("SetTimerEvent"); 134 Console.WriteLine("SetTimerEvent");
@@ -146,6 +149,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
146 Timers.Add(ts); 149 Timers.Add(ts);
147 } 150 }
148 } 151 }
152
149 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) 153 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID)
150 { 154 {
151 // Remove from timer 155 // Remove from timer
@@ -163,6 +167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
163 Timers = NewTimers; 167 Timers = NewTimers;
164 } 168 }
165 } 169 }
170
166 public void CheckTimerEvents() 171 public void CheckTimerEvents()
167 { 172 {
168 // Nothing to do here? 173 // Nothing to do here?
@@ -171,7 +176,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
171 176
172 lock (TimerListLock) 177 lock (TimerListLock)
173 { 178 {
174
175 // Go through all timers 179 // Go through all timers
176 foreach (TimerClass ts in Timers) 180 foreach (TimerClass ts in Timers)
177 { 181 {
@@ -179,7 +183,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
179 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 183 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
180 { 184 {
181 // Add it to queue 185 // Add it to queue
182 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); 186 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer",
187 new object[] {});
183 // set next interval 188 // set next interval
184 189
185 190
@@ -188,6 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
188 } 193 }
189 } // lock 194 } // lock
190 } 195 }
196
191 #endregion 197 #endregion
192 198
193 #region HTTP REQUEST 199 #region HTTP REQUEST
@@ -213,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
213 { 219 {
214 // TODO: SEND REQUEST!!! 220 // TODO: SEND REQUEST!!!
215 } 221 }
222
216 public void Stop() 223 public void Stop()
217 { 224 {
218 // TODO: Cancel any ongoing request 225 // TODO: Cancel any ongoing request
219 } 226 }
227
220 public bool CheckResponse() 228 public bool CheckResponse()
221 { 229 {
222 // TODO: Check if we got a response yet, return true if so -- false if not 230 // TODO: Check if we got a response yet, return true if so -- false if not
@@ -227,11 +235,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
227 //response_status 235 //response_status
228 //response_metadata 236 //response_metadata
229 //response_body 237 //response_body
230
231 } 238 }
232 } 239 }
240
233 private List<HttpClass> HttpRequests = new List<HttpClass>(); 241 private List<HttpClass> HttpRequests = new List<HttpClass>();
234 private object HttpListLock = new object(); 242 private object HttpListLock = new object();
243
235 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 244 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
236 { 245 {
237 Console.WriteLine("StartHttpRequest"); 246 Console.WriteLine("StartHttpRequest");
@@ -244,11 +253,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
244 htc.body = body; 253 htc.body = body;
245 lock (HttpListLock) 254 lock (HttpListLock)
246 { 255 {
247
248 //ADD REQUEST 256 //ADD REQUEST
249 HttpRequests.Add(htc); 257 HttpRequests.Add(htc);
250 } 258 }
251 } 259 }
260
252 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 261 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
253 { 262 {
254 // Remove from list 263 // Remove from list
@@ -272,6 +281,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
272 HttpRequests = NewHttpList; 281 HttpRequests = NewHttpList;
273 } 282 }
274 } 283 }
284
275 public void CheckHttpRequests() 285 public void CheckHttpRequests()
276 { 286 {
277 // Nothing to do here? 287 // Nothing to do here?
@@ -282,68 +292,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
282 { 292 {
283 foreach (HttpClass ts in HttpRequests) 293 foreach (HttpClass ts in HttpRequests)
284 { 294 {
285
286 if (ts.CheckResponse() == true) 295 if (ts.CheckResponse() == true)
287 { 296 {
288 // Add it to event queue 297 // Add it to event queue
289 //key request_id, integer status, list metadata, string body 298 //key request_id, integer status, list metadata, string body
290 object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; 299 object[] resobj =
291 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); 300 new object[]
301 {ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body};
302 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response",
303 resobj);
292 // Now stop it 304 // Now stop it
293 StopHttpRequest(ts.localID, ts.itemID); 305 StopHttpRequest(ts.localID, ts.itemID);
294 } 306 }
295 } 307 }
296 } // lock 308 } // lock
297 } 309 }
310
298 #endregion 311 #endregion
299 312
300 public void CheckXMLRPCRequests() 313 public void CheckXMLRPCRequests()
301 { 314 {
302
303 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 315 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
304 316
305 while (xmlrpc.hasRequests()) 317 while (xmlrpc.hasRequests())
306 { 318 {
307 RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); 319 RPCRequestInfo rInfo = xmlrpc.GetNextRequest();
308 System.Console.WriteLine("PICKED REQUEST"); 320 Console.WriteLine("PICKED REQUEST");
309 321
310 //Deliver data to prim's remote_data handler 322 //Deliver data to prim's remote_data handler
311 object[] resobj = new object[] { 323 object[] resobj = new object[]
312 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), rInfo.GetStrVal() 324 {
313 }; 325 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(),
326 rInfo.GetStrVal()
327 };
314 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 328 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
315 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj 329 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj
316 ); 330 );
317
318 } 331 }
319
320 } 332 }
321 333
322 public void CheckListeners() 334 public void CheckListeners()
323 { 335 {
324
325 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 336 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
326 337
327 while (comms.HasMessages()) 338 while (comms.HasMessages())
328 { 339 {
329 ListenerInfo lInfo = comms.GetNextMessage(); 340 ListenerInfo lInfo = comms.GetNextMessage();
330 System.Console.WriteLine("PICKED LISTENER"); 341 Console.WriteLine("PICKED LISTENER");
331 342
332 //Deliver data to prim's listen handler 343 //Deliver data to prim's listen handler
333 object[] resobj = new object[] { 344 object[] resobj = new object[]
334 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() 345 {
335 }; 346 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
347 };
336 348
337 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 349 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
338 lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj 350 lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj
339 ); 351 );
340
341 } 352 }
342
343 } 353 }
344
345
346
347
348 } 354 }
349} 355} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
index 0aa1a0b..00027ca 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
@@ -1,26 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
4 3
5// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 6// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")]
14[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
15[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] 24
25[assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")]
24 26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices;
31// 33//
32// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below: 35// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")] 36
35[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 38bf746..eaa3a09 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -27,14 +27,10 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using Nini.Config;
31using System.Text;
32using OpenSim.Framework.Console; 31using OpenSim.Framework.Console;
33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Scenes.Scripting;
35using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
36using libsecondlife; 33using OpenSim.Region.Environment.Scenes;
37using Nini.Config;
38 34
39namespace OpenSim.Region.ScriptEngine.DotNetEngine 35namespace OpenSim.Region.ScriptEngine.DotNetEngine
40{ 36{
@@ -42,17 +38,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
42 /// This is the root object for ScriptEngine 38 /// This is the root object for ScriptEngine
43 /// </summary> 39 /// </summary>
44 [Serializable] 40 [Serializable]
45 public class ScriptEngine :IRegionModule 41 public class ScriptEngine : IRegionModule
46 { 42 {
47 43 internal Scene World;
48 internal OpenSim.Region.Environment.Scenes.Scene World; 44 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
49 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim 45 internal EventQueueManager m_EventQueueManager; // Executes events
50 internal EventQueueManager m_EventQueueManager; // Executes events 46 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
51 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
52 internal AppDomainManager m_AppDomainManager; 47 internal AppDomainManager m_AppDomainManager;
53 internal LSLLongCmdHandler m_LSLLongCmdHandler; 48 internal LSLLongCmdHandler m_LSLLongCmdHandler;
54 49
55 private OpenSim.Framework.Console.LogBase m_log; 50 private LogBase m_log;
56 51
57 public ScriptEngine() 52 public ScriptEngine()
58 { 53 {
@@ -65,9 +60,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
65 get { return m_log; } 60 get { return m_log; }
66 } 61 }
67 62
68 public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) 63 public void InitializeEngine(Scene Sceneworld, LogBase logger)
69 { 64 {
70
71 World = Sceneworld; 65 World = Sceneworld;
72 m_log = logger; 66 m_log = logger;
73 67
@@ -84,10 +78,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
84 78
85 // Should we iterate the region for scripts that needs starting? 79 // Should we iterate the region for scripts that needs starting?
86 // Or can we assume we are loaded before anything else so we can use proper events? 80 // Or can we assume we are loaded before anything else so we can use proper events?
87
88
89 } 81 }
90 82
91 public void Shutdown() 83 public void Shutdown()
92 { 84 {
93 // We are shutting down 85 // We are shutting down
@@ -106,12 +98,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
106 98
107 public void Initialise(Scene scene, IConfigSource config) 99 public void Initialise(Scene scene, IConfigSource config)
108 { 100 {
109 this.InitializeEngine(scene, MainLog.Instance); 101 InitializeEngine(scene, MainLog.Instance);
110 } 102 }
111 103
112 public void PostInitialise() 104 public void PostInitialise()
113 { 105 {
114
115 } 106 }
116 107
117 public void Close() 108 public void Close()
@@ -130,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
130 121
131 #endregion 122 #endregion
132 } 123 }
133} 124} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 381fd8c..54a5ef5 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -28,19 +28,14 @@
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.IO;
32using System.Threading;
33using System.Reflection; 32using System.Reflection;
34using System.Runtime.Remoting;
35using System.Runtime.Serialization;
36using System.Runtime.Serialization.Formatters.Binary; 33using System.Runtime.Serialization.Formatters.Binary;
34using System.Threading;
35using libsecondlife;
37using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
38using OpenSim.Region.Environment.Scenes.Scripting;
39using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 37using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
40using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 38using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
41using OpenSim.Region.ScriptEngine.Common;
42using libsecondlife;
43
44 39
45namespace OpenSim.Region.ScriptEngine.DotNetEngine 40namespace OpenSim.Region.ScriptEngine.DotNetEngine
46{ 41{
@@ -53,16 +48,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
53 public class ScriptManager 48 public class ScriptManager
54 { 49 {
55 #region Declares 50 #region Declares
51
56 private Thread scriptLoadUnloadThread; 52 private Thread scriptLoadUnloadThread;
57 private int scriptLoadUnloadThread_IdleSleepms = 100; 53 private int scriptLoadUnloadThread_IdleSleepms = 100;
58 private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>(); 54 private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>();
59 private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>(); 55 private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>();
56
60 private struct LoadStruct 57 private struct LoadStruct
61 { 58 {
62 public uint localID; 59 public uint localID;
63 public LLUUID itemID; 60 public LLUUID itemID;
64 public string script; 61 public string script;
65 } 62 }
63
66 private struct UnloadStruct 64 private struct UnloadStruct
67 { 65 {
68 public uint localID; 66 public uint localID;
@@ -72,17 +70,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
72 // Object<string, Script<string, script>> 70 // Object<string, Script<string, script>>
73 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. 71 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
74 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! 72 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
75 internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); 73 internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts =
74 new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>();
75
76 public Scene World 76 public Scene World
77 { 77 {
78 get 78 get { return m_scriptEngine.World; }
79 {
80 return m_scriptEngine.World;
81 }
82 } 79 }
83#endregion 80
81 #endregion
82
84 #region Object init/shutdown 83 #region Object init/shutdown
84
85 private ScriptEngine m_scriptEngine; 85 private ScriptEngine m_scriptEngine;
86
86 public ScriptManager(ScriptEngine scriptEngine) 87 public ScriptManager(ScriptEngine scriptEngine)
87 { 88 {
88 m_scriptEngine = scriptEngine; 89 m_scriptEngine = scriptEngine;
@@ -92,9 +93,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
92 scriptLoadUnloadThread.IsBackground = true; 93 scriptLoadUnloadThread.IsBackground = true;
93 scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; 94 scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal;
94 scriptLoadUnloadThread.Start(); 95 scriptLoadUnloadThread.Start();
95
96 } 96 }
97 ~ScriptManager () 97
98 ~ScriptManager()
98 { 99 {
99 // Abort load/unload thread 100 // Abort load/unload thread
100 try 101 try
@@ -112,8 +113,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
112 { 113 {
113 } 114 }
114 } 115 }
116
115 #endregion 117 #endregion
118
116 #region Load / Unload scripts (Thread loop) 119 #region Load / Unload scripts (Thread loop)
120
117 private void ScriptLoadUnloadThreadLoop() 121 private void ScriptLoadUnloadThreadLoop()
118 { 122 {
119 try 123 try
@@ -134,9 +138,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
134 UnloadStruct item = unloadQueue.Dequeue(); 138 UnloadStruct item = unloadQueue.Dequeue();
135 _StopScript(item.localID, item.itemID); 139 _StopScript(item.localID, item.itemID);
136 } 140 }
137
138
139
140 } 141 }
141 } 142 }
142 catch (ThreadAbortException tae) 143 catch (ThreadAbortException tae)
@@ -145,21 +146,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
145 a = ""; 146 a = "";
146 // Expected 147 // Expected
147 } 148 }
148
149 } 149 }
150
150 #endregion 151 #endregion
152
151 #region Helper functions 153 #region Helper functions
154
152 private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) 155 private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
153 { 156 {
154
155 //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); 157 //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name);
156 return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; 158 return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null;
157
158 } 159 }
159 160
160
161 #endregion 161 #endregion
162
162 #region Internal functions to keep track of script 163 #region Internal functions to keep track of script
164
163 internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID) 165 internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID)
164 { 166 {
165 if (Scripts.ContainsKey(localID) == false) 167 if (Scripts.ContainsKey(localID) == false)
@@ -169,7 +171,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
169 Scripts.TryGetValue(localID, out Obj); 171 Scripts.TryGetValue(localID, out Obj);
170 172
171 return Obj.Keys; 173 return Obj.Keys;
172
173 } 174 }
174 175
175 internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) 176 internal LSL_BaseClass GetScript(uint localID, LLUUID itemID)
@@ -187,8 +188,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
187 Obj.TryGetValue(itemID, out Script); 188 Obj.TryGetValue(itemID, out Script);
188 189
189 return Script; 190 return Script;
190
191 } 191 }
192
192 internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) 193 internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script)
193 { 194 {
194 // Create object if it doesn't exist 195 // Create object if it doesn't exist
@@ -205,8 +206,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
205 206
206 // Add to object 207 // Add to object
207 Obj.Add(itemID, Script); 208 Obj.Add(itemID, Script);
208
209 } 209 }
210
210 internal void RemoveScript(uint localID, LLUUID itemID) 211 internal void RemoveScript(uint localID, LLUUID itemID)
211 { 212 {
212 // Don't have that object? 213 // Don't have that object?
@@ -218,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
218 Scripts.TryGetValue(localID, out Obj); 219 Scripts.TryGetValue(localID, out Obj);
219 if (Obj.ContainsKey(itemID) == true) 220 if (Obj.ContainsKey(itemID) == true)
220 Obj.Remove(itemID); 221 Obj.Remove(itemID);
221
222 } 222 }
223
223 #endregion 224 #endregion
225
224 #region Start/Stop/Reset script 226 #region Start/Stop/Reset script
227
225 /// <summary> 228 /// <summary>
226 /// Fetches, loads and hooks up a script to an objects events 229 /// Fetches, loads and hooks up a script to an objects events
227 /// </summary> 230 /// </summary>
@@ -235,6 +238,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
235 ls.script = Script; 238 ls.script = Script;
236 loadQueue.Enqueue(ls); 239 loadQueue.Enqueue(ls);
237 } 240 }
241
238 /// <summary> 242 /// <summary>
239 /// Disables and unloads a script 243 /// Disables and unloads a script
240 /// </summary> 244 /// </summary>
@@ -247,6 +251,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
247 ls.itemID = itemID; 251 ls.itemID = itemID;
248 unloadQueue.Enqueue(ls); 252 unloadQueue.Enqueue(ls);
249 } 253 }
254
250 public void ResetScript(uint localID, LLUUID itemID) 255 public void ResetScript(uint localID, LLUUID itemID)
251 { 256 {
252 string script = GetScript(localID, itemID).SourceCode; 257 string script = GetScript(localID, itemID).SourceCode;
@@ -267,12 +272,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
267 272
268 try 273 try
269 { 274 {
270
271
272
273
274 // Create a new instance of the compiler (currently we don't want reuse) 275 // Create a new instance of the compiler (currently we don't want reuse)
275 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); 276 Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
276 // Compile (We assume LSL) 277 // Compile (We assume LSL)
277 ScriptSource = LSLCompiler.CompileFromLSLText(Script); 278 ScriptSource = LSLCompiler.CompileFromLSLText(Script);
278 //Console.WriteLine("Compilation of " + FileName + " done"); 279 //Console.WriteLine("Compilation of " + FileName + " done");
@@ -289,10 +290,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
289 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); 290 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
290 291
291#if DEBUG 292#if DEBUG
292 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 293 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
293#endif 294#endif
294 295
295 CompiledScript.SourceCode = ScriptSource; 296 CompiledScript.SourceCode = ScriptSource;
296 // Add it to our script memstruct 297 // Add it to our script memstruct
297 SetScript(localID, itemID, CompiledScript); 298 SetScript(localID, itemID, CompiledScript);
298 299
@@ -306,9 +307,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
306 CompiledScript.Start(LSLB); 307 CompiledScript.Start(LSLB);
307 308
308 // Fire the first start-event 309 // Fire the first start-event
309 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); 310 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {});
310
311
312 } 311 }
313 catch (Exception e) 312 catch (Exception e)
314 { 313 {
@@ -326,9 +325,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
326 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); 325 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
327 } 326 }
328 } 327 }
329
330
331
332 } 328 }
333 329
334 private void _StopScript(uint localID, LLUUID itemID) 330 private void _StopScript(uint localID, LLUUID itemID)
@@ -359,19 +355,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
359 // Tell AppDomain that we have stopped script 355 // Tell AppDomain that we have stopped script
360 m_scriptEngine.m_AppDomainManager.StopScript(ad); 356 m_scriptEngine.m_AppDomainManager.StopScript(ad);
361 } 357 }
362 catch(Exception e) 358 catch (Exception e)
363 { 359 {
364 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString()); 360 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
361 ": " + e.ToString());
365 } 362 }
366 } 363 }
367 private string ProcessYield(string FileName) 364
365 private string ProcessYield(string FileName)
368 { 366 {
369 // TODO: Create a new assembly and copy old but insert Yield Code 367 // TODO: Create a new assembly and copy old but insert Yield Code
370 //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); 368 //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName);
371 return FileName; 369 return FileName;
372 } 370 }
371
373 #endregion 372 #endregion
373
374 #region Perform event execution in script 374 #region Perform event execution in script
375
375 /// <summary> 376 /// <summary>
376 /// Execute a LL-event-function in Script 377 /// Execute a LL-event-function in Script
377 /// </summary> 378 /// </summary>
@@ -381,7 +382,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
381 /// <param name="args">Arguments to pass to function</param> 382 /// <param name="args">Arguments to pass to function</param>
382 internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) 383 internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args)
383 { 384 {
384
385 // Execute a function in the script 385 // Execute a function in the script
386 //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); 386 //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
387 LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); 387 LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID);
@@ -390,28 +390,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
390 390
391 // Must be done in correct AppDomain, so leaving it up to the script itself 391 // Must be done in correct AppDomain, so leaving it up to the script itself
392 Script.Exec.ExecuteEvent(FunctionName, args); 392 Script.Exec.ExecuteEvent(FunctionName, args);
393
394 } 393 }
394
395 #endregion 395 #endregion
396 396
397 #region Script serialization/deserialization 397 #region Script serialization/deserialization
398
398 public void GetSerializedScript(uint localID, LLUUID itemID) 399 public void GetSerializedScript(uint localID, LLUUID itemID)
399 { 400 {
400 // Serialize the script and return it 401 // Serialize the script and return it
401 // Should not be a problem 402 // Should not be a problem
402 System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID); 403 FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID);
403 BinaryFormatter b = new BinaryFormatter(); 404 BinaryFormatter b = new BinaryFormatter();
404 b.Serialize(fs, GetScript(localID,itemID)); 405 b.Serialize(fs, GetScript(localID, itemID));
405 fs.Close(); 406 fs.Close();
406
407
408 } 407 }
408
409 public void PutSerializedScript(uint localID, LLUUID itemID) 409 public void PutSerializedScript(uint localID, LLUUID itemID)
410 { 410 {
411 // Deserialize the script and inject it into an AppDomain 411 // Deserialize the script and inject it into an AppDomain
412 412
413 // How to inject into an AppDomain? 413 // How to inject into an AppDomain?
414 } 414 }
415
415 #endregion 416 #endregion
416 } 417 }
417} 418} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
index 8f935f1..072c249 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
@@ -27,12 +27,9 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.IO;
31using System.Text;
32using Rail.Transformation;
33using Rail.Reflect; 31using Rail.Reflect;
34using Rail.Exceptions; 32using Rail.Transformation;
35using Rail.MSIL;
36 33
37namespace OpenSim.Region.ScriptEngine.DotNetEngine 34namespace OpenSim.Region.ScriptEngine.DotNetEngine
38{ 35{
@@ -40,25 +37,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
40 /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! 37 /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes!
41 /// Its offspring will be the actual implementation. 38 /// Its offspring will be the actual implementation.
42 /// </summary> 39 /// </summary>
43 class TempDotNetMicroThreadingCodeInjector 40 internal class TempDotNetMicroThreadingCodeInjector
44 { 41 {
45 public static string TestFix(string FileName) 42 public static string TestFix(string FileName)
46 { 43 {
47 string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); 44 string ret = Path.GetFileNameWithoutExtension(FileName + "_fixed.dll");
48 45
49 Console.WriteLine("Loading: \"" + FileName + "\""); 46 Console.WriteLine("Loading: \"" + FileName + "\"");
50 RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); 47 RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName);
51 48
52 49
53 //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe 50 //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe
54 RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); 51 RTypeDef type = (RTypeDef) rAssembly.RModuleDef.GetType("SecondLife.Script");
55 52
56 //Get the methods in the type 53 //Get the methods in the type
57 RMethod[] m = type.GetMethods(); 54 RMethod[] m = type.GetMethods();
58 55
59 //Create a MethodPrologueAdder visitor object with the method to add 56 //Create a MethodPrologueAdder visitor object with the method to add
60 //and with the flag that enables local variable creation set to true 57 //and with the flag that enables local variable creation set to true
61 MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); 58 MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef) m[0], true);
62 59
63 //Apply the changes to the assembly 60 //Apply the changes to the assembly
64 rAssembly.Accept(mpa); 61 rAssembly.Accept(mpa);
@@ -67,7 +64,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
67 rAssembly.SaveAssembly(ret); 64 rAssembly.SaveAssembly(ret);
68 65
69 return ret; 66 return ret;
70
71 } 67 }
72 } 68 }
73} 69} \ No newline at end of file