aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Grid
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs27
-rw-r--r--OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs29
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs44
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs274
-rw-r--r--OpenSim/Grid/GridServer/Main.cs37
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/Executor.cs88
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/IScript.cs6
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs15
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs26
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs48
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs16
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs38
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs82
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs2007
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs27
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs149
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs25
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs20
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs186
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs6
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs135
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs11
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs208
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs20
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs1819
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs173
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs64
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs74
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs33
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs103
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs22
-rw-r--r--OpenSim/Grid/ScriptServer/Application.cs17
-rw-r--r--OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs214
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs12
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs12
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs3
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs9
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServerMain.cs14
-rw-r--r--OpenSim/Grid/UserServer/Main.cs27
-rw-r--r--OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs39
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs17
46 files changed, 4505 insertions, 1826 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index e7e5d27..61427fa 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -29,17 +29,10 @@
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32
33using libsecondlife; 32using libsecondlife;
34using Nini.Config; 33using Nini.Config;
35
36using OpenSim.Framework;
37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Framework; 34using OpenSim.Framework;
39using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
40using OpenSim.Framework.Interfaces;
41using OpenSim.Framework.Servers;
42using OpenSim.Framework;
43using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
44 37
45namespace OpenSim.Grid.AssetServer 38namespace OpenSim.Grid.AssetServer
@@ -79,11 +72,12 @@ namespace OpenSim.Grid.AssetServer
79 72
80 private OpenAsset_Main() 73 private OpenAsset_Main()
81 { 74 {
82 if(!Directory.Exists(Util.logDir())) 75 if (!Directory.Exists(Util.logDir()))
83 { 76 {
84 Directory.CreateDirectory(Util.logDir()); 77 Directory.CreateDirectory(Util.logDir());
85 } 78 }
86 m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-AssetServer-console.log")), "OpenAsset", this, true); 79 m_console =
80 new LogBase((Path.Combine(Util.logDir(), "opengrid-AssetServer-console.log")), "OpenAsset", this, true);
87 MainLog.Instance = m_console; 81 MainLog.Instance = m_console;
88 } 82 }
89 83
@@ -96,9 +90,9 @@ namespace OpenSim.Grid.AssetServer
96 90
97 m_console.Verbose("ASSET", "Loading default asset set.."); 91 m_console.Verbose("ASSET", "Loading default asset set..");
98 LoadDefaultAssets(); 92 LoadDefaultAssets();
99 93
100 m_console.Verbose("ASSET", "Starting HTTP process"); 94 m_console.Verbose("ASSET", "Starting HTTP process");
101 BaseHttpServer httpServer = new BaseHttpServer((int)m_config.HttpPort); 95 BaseHttpServer httpServer = new BaseHttpServer((int) m_config.HttpPort);
102 96
103 httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider)); 97 httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider));
104 httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); 98 httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider));
@@ -125,7 +119,8 @@ namespace OpenSim.Grid.AssetServer
125 119
126 if (typeInterface != null) 120 if (typeInterface != null)
127 { 121 {
128 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 122 IAssetProvider plug =
123 (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
129 assetPlugin = plug; 124 assetPlugin = plug;
130 assetPlugin.Initialise(); 125 assetPlugin.Initialise();
131 126
@@ -174,7 +169,7 @@ namespace OpenSim.Grid.AssetServer
174 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 169 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
175 byte[] idata = new byte[numBytes]; 170 byte[] idata = new byte[numBytes];
176 BinaryReader br = new BinaryReader(fStream); 171 BinaryReader br = new BinaryReader(fStream);
177 idata = br.ReadBytes((int)numBytes); 172 idata = br.ReadBytes((int) numBytes);
178 br.Close(); 173 br.Close();
179 fStream.Close(); 174 fStream.Close();
180 info.Data = idata; 175 info.Data = idata;
@@ -213,8 +208,8 @@ namespace OpenSim.Grid.AssetServer
213 { 208 {
214 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); 209 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
215 string name = source.Configs[i].GetString("name", ""); 210 string name = source.Configs[i].GetString("name", "");
216 sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); 211 sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
217 sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); 212 sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
218 string fileName = source.Configs[i].GetString("fileName", ""); 213 string fileName = source.Configs[i].GetString("fileName", "");
219 214
220 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); 215 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);
@@ -247,4 +242,4 @@ namespace OpenSim.Grid.AssetServer
247 { 242 {
248 } 243 }
249 } 244 }
250} 245} \ No newline at end of file
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
index 63213f6..87a7f67 100644
--- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
@@ -27,25 +27,29 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// General Information about an assembly is controlled through the following 31// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 33// associated with an assembly.
33[assembly: AssemblyTitle("OGS-AssetServer")] 34
34[assembly: AssemblyDescription("")] 35[assembly : AssemblyTitle("OGS-AssetServer")]
35[assembly: AssemblyConfiguration("")] 36[assembly : AssemblyDescription("")]
36[assembly: AssemblyCompany("")] 37[assembly : AssemblyConfiguration("")]
37[assembly: AssemblyProduct("OGS-AssetServer")] 38[assembly : AssemblyCompany("")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 39[assembly : AssemblyProduct("OGS-AssetServer")]
39[assembly: AssemblyTrademark("")] 40[assembly : AssemblyCopyright("Copyright © 2007")]
40[assembly: AssemblyCulture("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
41 43
42// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 47
48[assembly : ComVisible(false)]
46 49
47// The following GUID is for the ID of the typelib if this project is exposed to COM 50// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 51
52[assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 53
50// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
51// 55//
@@ -54,5 +58,6 @@ using System.Runtime.InteropServices;
54// Build Number 58// Build Number
55// Revision 59// Revision
56// 60//
57[assembly: AssemblyVersion("1.0.0.0")] 61
58[assembly: AssemblyFileVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index 6993019..0cad643 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -1,29 +1,27 @@
1using System; 1using System;
2using System.IO; 2using System.IO;
3using System.Text;
3using System.Xml; 4using System.Xml;
4using System.Xml.Serialization; 5using System.Xml.Serialization;
5using System.Text;
6
7using libsecondlife; 6using libsecondlife;
8using OpenSim.Framework; 7using OpenSim.Framework;
9using OpenSim.Framework.Servers;
10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Servers;
12 10
13namespace OpenSim.Grid.AssetServer 11namespace OpenSim.Grid.AssetServer
14{ 12{
15 public class GetAssetStreamHandler : BaseStreamHandler 13 public class GetAssetStreamHandler : BaseStreamHandler
16 { 14 {
17 OpenAsset_Main m_assetManager; 15 private OpenAsset_Main m_assetManager;
18 IAssetProvider m_assetProvider; 16 private IAssetProvider m_assetProvider;
19 17
20 override public byte[] Handle(string path, Stream request) 18 public override byte[] Handle(string path, Stream request)
21 { 19 {
22 string param = GetParam(path); 20 string param = GetParam(path);
23 byte[] result = new byte[] { }; 21 byte[] result = new byte[] {};
24 try { 22 try
25 23 {
26 string[] p = param.Split(new char[] { '/', '?', '&' }, StringSplitOptions.RemoveEmptyEntries); 24 string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
27 25
28 if (p.Length > 0) 26 if (p.Length > 0)
29 { 27 {
@@ -42,7 +40,7 @@ namespace OpenSim.Grid.AssetServer
42 { 40 {
43 MainLog.Instance.Debug("REST", "GET:/asset found {0}, {1}", assetID, asset.Name); 41 MainLog.Instance.Debug("REST", "GET:/asset found {0}, {1}", assetID, asset.Name);
44 42
45 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 43 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
46 MemoryStream ms = new MemoryStream(); 44 MemoryStream ms = new MemoryStream();
47 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); 45 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
48 xw.Formatting = Formatting.Indented; 46 xw.Formatting = Formatting.Indented;
@@ -53,7 +51,7 @@ namespace OpenSim.Grid.AssetServer
53 StreamReader sr = new StreamReader(ms); 51 StreamReader sr = new StreamReader(ms);
54 52
55 result = ms.GetBuffer(); 53 result = ms.GetBuffer();
56 Array.Resize<byte>(ref result, (int)ms.Length); 54 Array.Resize<byte>(ref result, (int) ms.Length);
57 } 55 }
58 else 56 else
59 { 57 {
@@ -69,7 +67,7 @@ namespace OpenSim.Grid.AssetServer
69 } 67 }
70 68
71 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) 69 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
72 : base("GET", "/assets" ) 70 : base("GET", "/assets")
73 { 71 {
74 m_assetManager = assetManager; 72 m_assetManager = assetManager;
75 m_assetProvider = assetProvider; 73 m_assetProvider = assetProvider;
@@ -78,25 +76,25 @@ namespace OpenSim.Grid.AssetServer
78 76
79 public class PostAssetStreamHandler : BaseStreamHandler 77 public class PostAssetStreamHandler : BaseStreamHandler
80 { 78 {
81 OpenAsset_Main m_assetManager; 79 private OpenAsset_Main m_assetManager;
82 IAssetProvider m_assetProvider; 80 private IAssetProvider m_assetProvider;
83 81
84 override public byte[] Handle(string path, Stream request) 82 public override byte[] Handle(string path, Stream request)
85 { 83 {
86 string param = GetParam(path); 84 string param = GetParam(path);
87 85
88 LLUUID assetId; 86 LLUUID assetId;
89 if(param.Length > 0) 87 if (param.Length > 0)
90 LLUUID.TryParse(param, out assetId); 88 LLUUID.TryParse(param, out assetId);
91 byte[] txBuffer = new byte[4096]; 89 byte[] txBuffer = new byte[4096];
92 90
93 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 91 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
94 AssetBase asset = (AssetBase)xs.Deserialize(request); 92 AssetBase asset = (AssetBase) xs.Deserialize(request);
95 93
96 MainLog.Instance.Verbose("REST", "StoreAndCommitAsset {0}", asset.FullID); 94 MainLog.Instance.Verbose("REST", "StoreAndCommitAsset {0}", asset.FullID);
97 m_assetProvider.CreateAsset(asset); 95 m_assetProvider.CreateAsset(asset);
98 96
99 return new byte[] { }; 97 return new byte[] {};
100 } 98 }
101 99
102 public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) 100 public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
@@ -106,4 +104,4 @@ namespace OpenSim.Grid.AssetServer
106 m_assetProvider = assetProvider; 104 m_assetProvider = assetProvider;
107 } 105 }
108 } 106 }
109} 107} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 8ac7d6a..0d966dd 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -25,27 +25,24 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Xml; 33using System.Xml;
34using libsecondlife; 34using libsecondlife;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework;
36using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
37using OpenSim.Framework.Data; 38using OpenSim.Framework.Data;
38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework;
40
41using OpenSim.Framework;
42 39
43namespace OpenSim.Grid.GridServer 40namespace OpenSim.Grid.GridServer
44{ 41{
45 class GridManager 42 internal class GridManager
46 { 43 {
47 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 44 private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
48 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); 45 private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
49 46
50 public GridConfig config; 47 public GridConfig config;
51 48
@@ -54,13 +51,13 @@ namespace OpenSim.Grid.GridServer
54 /// </summary> 51 /// </summary>
55 /// <param name="FileName">The filename to the grid server plugin DLL</param> 52 /// <param name="FileName">The filename to the grid server plugin DLL</param>
56 public void AddPlugin(string FileName) 53 public void AddPlugin(string FileName)
57 { 54 {
58 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); 55 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName);
59 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 56 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
60 57
61 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 58 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
62 foreach (Type pluginType in pluginAssembly.GetTypes()) 59 foreach (Type pluginType in pluginAssembly.GetTypes())
63 { 60 {
64 if (!pluginType.IsAbstract) 61 if (!pluginType.IsAbstract)
65 { 62 {
66 // Regions go here 63 // Regions go here
@@ -68,9 +65,10 @@ namespace OpenSim.Grid.GridServer
68 65
69 if (typeInterface != null) 66 if (typeInterface != null)
70 { 67 {
71 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IGridData plug =
69 (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
72 plug.Initialise(); 70 plug.Initialise();
73 this._plugins.Add(plug.getName(), plug); 71 _plugins.Add(plug.getName(), plug);
74 MainLog.Instance.Verbose("Storage: Added IGridData Interface"); 72 MainLog.Instance.Verbose("Storage: Added IGridData Interface");
75 } 73 }
76 74
@@ -81,17 +79,18 @@ namespace OpenSim.Grid.GridServer
81 79
82 if (typeInterface != null) 80 if (typeInterface != null)
83 { 81 {
84 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 82 ILogData plug =
83 (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
85 plug.Initialise(); 84 plug.Initialise();
86 this._logplugins.Add(plug.getName(), plug); 85 _logplugins.Add(plug.getName(), plug);
87 MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); 86 MainLog.Instance.Verbose("Storage: Added ILogData Interface");
88 } 87 }
89 88
90 typeInterface = null; 89 typeInterface = null;
91 } 90 }
92 } 91 }
93 92
94 pluginAssembly = null; 93 pluginAssembly = null;
95 } 94 }
96 95
97 /// <summary> 96 /// <summary>
@@ -124,7 +123,8 @@ namespace OpenSim.Grid.GridServer
124 /// <returns>A SimProfileData for the region</returns> 123 /// <returns>A SimProfileData for the region</returns>
125 public RegionProfileData getRegion(LLUUID uuid) 124 public RegionProfileData getRegion(LLUUID uuid)
126 { 125 {
127 foreach(KeyValuePair<string,IGridData> kvp in _plugins) { 126 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
127 {
128 try 128 try
129 { 129 {
130 return kvp.Value.GetProfileByLLUUID(uuid); 130 return kvp.Value.GetProfileByLLUUID(uuid);
@@ -182,7 +182,6 @@ namespace OpenSim.Grid.GridServer
182 } 182 }
183 183
184 184
185
186 /// <summary> 185 /// <summary>
187 /// Returns a XML String containing a list of the neighbouring regions 186 /// Returns a XML String containing a list of the neighbouring regions
188 /// </summary> 187 /// </summary>
@@ -193,11 +192,18 @@ namespace OpenSim.Grid.GridServer
193 string response = ""; 192 string response = "";
194 RegionProfileData central_region = getRegion(reqhandle); 193 RegionProfileData central_region = getRegion(reqhandle);
195 RegionProfileData neighbour; 194 RegionProfileData neighbour;
196 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 195 for (int x = -1; x < 2; x++)
196 for (int y = -1; y < 2; y++)
197 { 197 {
198 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) 198 if (
199 getRegion(
200 Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256),
201 (uint) (central_region.regionLocY + y)*256)) != null)
199 { 202 {
200 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); 203 neighbour =
204 getRegion(
205 Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256),
206 (uint) (central_region.regionLocY + y)*256));
201 response += "<neighbour>"; 207 response += "<neighbour>";
202 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 208 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
203 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 209 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
@@ -205,7 +211,6 @@ namespace OpenSim.Grid.GridServer
205 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; 211 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
206 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; 212 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
207 response += "</neighbour>"; 213 response += "</neighbour>";
208
209 } 214 }
210 } 215 }
211 return response; 216 return response;
@@ -218,23 +223,21 @@ namespace OpenSim.Grid.GridServer
218 /// <returns>Startup parameters</returns> 223 /// <returns>Startup parameters</returns>
219 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) 224 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
220 { 225 {
221
222 XmlRpcResponse response = new XmlRpcResponse(); 226 XmlRpcResponse response = new XmlRpcResponse();
223 Hashtable responseData = new Hashtable(); 227 Hashtable responseData = new Hashtable();
224 response.Value = responseData; 228 response.Value = responseData;
225 229
226 RegionProfileData TheSim = null; 230 RegionProfileData TheSim = null;
227 Hashtable requestData = (Hashtable)request.Params[0]; 231 Hashtable requestData = (Hashtable) request.Params[0];
228 string myword; 232 string myword;
229 if (requestData.ContainsKey("UUID")) 233 if (requestData.ContainsKey("UUID"))
230 { 234 {
231 TheSim = getRegion(new LLUUID((string)requestData["UUID"])); 235 TheSim = getRegion(new LLUUID((string) requestData["UUID"]));
232 236
233// logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); 237// logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
234 } 238 }
235 else if (requestData.ContainsKey("region_handle")) 239 else if (requestData.ContainsKey("region_handle"))
236 { 240 {
237
238// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); 241// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
239// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); 242// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
240 } 243 }
@@ -254,65 +257,68 @@ namespace OpenSim.Grid.GridServer
254 myword = "connection"; 257 myword = "connection";
255 } 258 }
256 259
257 TheSim = new RegionProfileData(); 260 TheSim = new RegionProfileData();
258 261
259 TheSim.regionRecvKey = config.SimRecvKey; 262 TheSim.regionRecvKey = config.SimRecvKey;
260 TheSim.regionSendKey = config.SimSendKey; 263 TheSim.regionSendKey = config.SimSendKey;
261 TheSim.regionSecret = config.SimRecvKey; 264 TheSim.regionSecret = config.SimRecvKey;
262 TheSim.regionDataURI = ""; 265 TheSim.regionDataURI = "";
263 TheSim.regionAssetURI = config.DefaultAssetServer; 266 TheSim.regionAssetURI = config.DefaultAssetServer;
264 TheSim.regionAssetRecvKey = config.AssetRecvKey; 267 TheSim.regionAssetRecvKey = config.AssetRecvKey;
265 TheSim.regionAssetSendKey = config.AssetSendKey; 268 TheSim.regionAssetSendKey = config.AssetSendKey;
266 TheSim.regionUserURI = config.DefaultUserServer; 269 TheSim.regionUserURI = config.DefaultUserServer;
267 TheSim.regionUserSendKey = config.UserSendKey; 270 TheSim.regionUserSendKey = config.UserSendKey;
268 TheSim.regionUserRecvKey = config.UserRecvKey; 271 TheSim.regionUserRecvKey = config.UserRecvKey;
269
270 TheSim.serverIP = (string)requestData["sim_ip"];
271 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
272 TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
273 TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
274 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
275 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
276 TheSim.regionLocZ = 0;
277 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
278
279 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
280 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
281 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.serverURI);
282 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
283
284
285 TheSim.regionName = (string)requestData["sim_name"];
286 TheSim.UUID = new LLUUID((string)requestData["UUID"]);
287 272
288 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 273 TheSim.serverIP = (string) requestData["sim_ip"];
274 TheSim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]);
275 TheSim.httpPort = Convert.ToUInt32((string) requestData["http_port"]);
276 TheSim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]);
277 TheSim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]);
278 TheSim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]);
279 TheSim.regionLocZ = 0;
280 TheSim.regionMapTextureID = new LLUUID((string) requestData["map-image-id"]);
281
282 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
283 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
284 Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
285 TheSim.serverURI);
286 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
287
288
289 TheSim.regionName = (string) requestData["sim_name"];
290 TheSim.UUID = new LLUUID((string) requestData["UUID"]);
291
292 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
293 {
294 try
289 { 295 {
290 try 296 DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
291 { 297 switch (insertResponse)
292 DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
293 switch(insertResponse)
294 {
295 case DataResponse.RESPONSE_OK:
296 OpenSim.Framework.Console.MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName);
297 break;
298 case DataResponse.RESPONSE_ERROR:
299 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName);
300 break;
301 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
302 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Invalid Credentials): " + TheSim.regionName);
303 break;
304 case DataResponse.RESPONSE_AUTHREQUIRED:
305 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Authentication Required): " + TheSim.regionName);
306 break;
307 }
308
309 }
310 catch (Exception e)
311 { 298 {
312 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); 299 case DataResponse.RESPONSE_OK:
313 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", e.ToString()); 300 MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName);
301 break;
302 case DataResponse.RESPONSE_ERROR:
303 MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName);
304 break;
305 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
306 MainLog.Instance.Warn("storage",
307 "New sim creation failed (Invalid Credentials): " + TheSim.regionName);
308 break;
309 case DataResponse.RESPONSE_AUTHREQUIRED:
310 MainLog.Instance.Warn("storage",
311 "New sim creation failed (Authentication Required): " +
312 TheSim.regionName);
313 break;
314 } 314 }
315 315 }
316 catch (Exception e)
317 {
318 MainLog.Instance.Warn("storage",
319 "Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
320 MainLog.Instance.Warn("storage", e.ToString());
321 }
316 322
317 323
318 if (getRegion(TheSim.regionHandle) == null) 324 if (getRegion(TheSim.regionHandle) == null)
@@ -321,7 +327,7 @@ namespace OpenSim.Grid.GridServer
321 return response; 327 return response;
322 } 328 }
323 } 329 }
324 330
325 331
326 ArrayList SimNeighboursData = new ArrayList(); 332 ArrayList SimNeighboursData = new ArrayList();
327 333
@@ -332,7 +338,9 @@ namespace OpenSim.Grid.GridServer
332 338
333 if (fastMode) 339 if (fastMode)
334 { 340 {
335 Dictionary<ulong, RegionProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); 341 Dictionary<ulong, RegionProfileData> neighbours =
342 getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1,
343 TheSim.regionLocY + 1);
336 344
337 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 345 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
338 { 346 {
@@ -349,11 +357,18 @@ namespace OpenSim.Grid.GridServer
349 } 357 }
350 else 358 else
351 { 359 {
352 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 360 for (int x = -1; x < 2; x++)
361 for (int y = -1; y < 2; y++)
353 { 362 {
354 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) 363 if (
364 getRegion(
365 Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256),
366 (uint) (TheSim.regionLocY + y)*256)) != null)
355 { 367 {
356 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); 368 neighbour =
369 getRegion(
370 Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256),
371 (uint) (TheSim.regionLocY + y)*256));
357 372
358 NeighbourBlock = new Hashtable(); 373 NeighbourBlock = new Hashtable();
359 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); 374 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
@@ -386,24 +401,24 @@ namespace OpenSim.Grid.GridServer
386 401
387 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) 402 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
388 responseData["data_uri"] = TheSim.regionDataURI; 403 responseData["data_uri"] = TheSim.regionDataURI;
389
390 404
391 return response; 405
406 return response;
392 } 407 }
393 408
394 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 409 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
395 { 410 {
396 Hashtable requestData = (Hashtable)request.Params[0]; 411 Hashtable requestData = (Hashtable) request.Params[0];
397 Hashtable responseData = new Hashtable(); 412 Hashtable responseData = new Hashtable();
398 RegionProfileData simData = null; 413 RegionProfileData simData = null;
399 if (requestData.ContainsKey("region_UUID")) 414 if (requestData.ContainsKey("region_UUID"))
400 { 415 {
401 simData = getRegion(new LLUUID((string)requestData["region_UUID"])); 416 simData = getRegion(new LLUUID((string) requestData["region_UUID"]));
402 } 417 }
403 else if (requestData.ContainsKey("region_handle")) 418 else if (requestData.ContainsKey("region_handle"))
404 { 419 {
405 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); 420 Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
406 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); 421 simData = getRegion(Convert.ToUInt64((string) requestData["region_handle"]));
407 } 422 }
408 423
409 if (simData == null) 424 if (simData == null)
@@ -419,7 +434,7 @@ namespace OpenSim.Grid.GridServer
419 responseData["sim_port"] = simData.serverPort.ToString(); 434 responseData["sim_port"] = simData.serverPort.ToString();
420 responseData["http_port"] = simData.httpPort.ToString(); 435 responseData["http_port"] = simData.httpPort.ToString();
421 responseData["remoting_port"] = simData.remotingPort.ToString(); 436 responseData["remoting_port"] = simData.remotingPort.ToString();
422 responseData["region_locx"] = simData.regionLocX.ToString() ; 437 responseData["region_locx"] = simData.regionLocX.ToString();
423 responseData["region_locy"] = simData.regionLocY.ToString(); 438 responseData["region_locy"] = simData.regionLocY.ToString();
424 responseData["region_UUID"] = simData.UUID.UUID.ToString(); 439 responseData["region_UUID"] = simData.UUID.UUID.ToString();
425 responseData["region_name"] = simData.regionName; 440 responseData["region_name"] = simData.regionName;
@@ -432,24 +447,24 @@ namespace OpenSim.Grid.GridServer
432 447
433 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) 448 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
434 { 449 {
435 int xmin=980, ymin=980, xmax=1020, ymax=1020; 450 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
436 451
437 Hashtable requestData = (Hashtable)request.Params[0]; 452 Hashtable requestData = (Hashtable) request.Params[0];
438 if (requestData.ContainsKey("xmin")) 453 if (requestData.ContainsKey("xmin"))
439 { 454 {
440 xmin = (Int32)requestData["xmin"]; 455 xmin = (Int32) requestData["xmin"];
441 } 456 }
442 if (requestData.ContainsKey("ymin")) 457 if (requestData.ContainsKey("ymin"))
443 { 458 {
444 ymin = (Int32)requestData["ymin"]; 459 ymin = (Int32) requestData["ymin"];
445 } 460 }
446 if (requestData.ContainsKey("xmax")) 461 if (requestData.ContainsKey("xmax"))
447 { 462 {
448 xmax = (Int32)requestData["xmax"]; 463 xmax = (Int32) requestData["xmax"];
449 } 464 }
450 if (requestData.ContainsKey("ymax")) 465 if (requestData.ContainsKey("ymax"))
451 { 466 {
452 ymax = (Int32)requestData["ymax"]; 467 ymax = (Int32) requestData["ymax"];
453 } 468 }
454 469
455 XmlRpcResponse response = new XmlRpcResponse(); 470 XmlRpcResponse response = new XmlRpcResponse();
@@ -461,14 +476,16 @@ namespace OpenSim.Grid.GridServer
461 476
462 if (fastMode) 477 if (fastMode)
463 { 478 {
464 Dictionary<ulong, RegionProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); 479 Dictionary<ulong, RegionProfileData> neighbours =
480 getRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax);
465 481
466 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 482 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
467 { 483 {
468 Hashtable simProfileBlock = new Hashtable(); 484 Hashtable simProfileBlock = new Hashtable();
469 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 485 simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
470 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 486 simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
471 System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); 487 Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " +
488 aSim.Value.regionLocY.ToString());
472 simProfileBlock["name"] = aSim.Value.regionName; 489 simProfileBlock["name"] = aSim.Value.regionName;
473 simProfileBlock["access"] = 21; 490 simProfileBlock["access"] = 21;
474 simProfileBlock["region-flags"] = 512; 491 simProfileBlock["region-flags"] = 512;
@@ -486,16 +503,17 @@ namespace OpenSim.Grid.GridServer
486 503
487 simProfileList.Add(simProfileBlock); 504 simProfileList.Add(simProfileBlock);
488 } 505 }
489 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); 506 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() +
507 " region(s) in range via FastMode");
490 } 508 }
491 else 509 else
492 { 510 {
493 RegionProfileData simProfile; 511 RegionProfileData simProfile;
494 for (int x = xmin; x < xmax+1; x++) 512 for (int x = xmin; x < xmax + 1; x++)
495 { 513 {
496 for (int y = ymin; y < ymax+1; y++) 514 for (int y = ymin; y < ymax + 1; y++)
497 { 515 {
498 ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); 516 ulong regHandle = Helpers.UIntsToLong((uint) (x*256), (uint) (y*256));
499 simProfile = getRegion(regHandle); 517 simProfile = getRegion(regHandle);
500 if (simProfile != null) 518 if (simProfile != null)
501 { 519 {
@@ -520,7 +538,8 @@ namespace OpenSim.Grid.GridServer
520 } 538 }
521 } 539 }
522 } 540 }
523 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); 541 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() +
542 " region(s) in range via Standard Mode");
524 } 543 }
525 544
526 responseData["sim-profiles"] = simProfileList; 545 responseData["sim-profiles"] = simProfileList;
@@ -529,7 +548,6 @@ namespace OpenSim.Grid.GridServer
529 } 548 }
530 549
531 550
532
533 /// <summary> 551 /// <summary>
534 /// Performs a REST Get Operation 552 /// Performs a REST Get Operation
535 /// </summary> 553 /// </summary>
@@ -654,13 +672,13 @@ namespace OpenSim.Grid.GridServer
654 break; 672 break;
655 673
656 case "region_locx": 674 case "region_locx":
657 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 675 TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
658 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 676 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
659 break; 677 break;
660 678
661 case "region_locy": 679 case "region_locy":
662 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 680 TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
663 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 681 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
664 break; 682 break;
665 } 683 }
666 } 684 }
@@ -670,7 +688,10 @@ namespace OpenSim.Grid.GridServer
670 bool requirePublic = false; 688 bool requirePublic = false;
671 bool requireValid = true; 689 bool requireValid = true;
672 690
673 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) 691 if (requirePublic &&
692 (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") ||
693 TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") ||
694 TheSim.serverIP.StartsWith("255.")))
674 { 695 {
675 return "ERROR! Servers must register with public addresses."; 696 return "ERROR! Servers must register with public addresses.";
676 } 697 }
@@ -680,7 +701,7 @@ namespace OpenSim.Grid.GridServer
680 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; 701 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
681 } 702 }
682 703
683 704
684 try 705 try
685 { 706 {
686 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); 707 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
@@ -689,22 +710,28 @@ namespace OpenSim.Grid.GridServer
689 try 710 try
690 { 711 {
691 //Check reservations 712 //Check reservations
692 ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); 713 ReservationData reserveData =
693 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) 714 kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY);
715 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) ||
716 (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
694 { 717 {
695 kvp.Value.AddProfile(TheSim); 718 kvp.Value.AddProfile(TheSim);
696 MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); 719 MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")");
697 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); 720 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5,
721 "Region successfully updated and connected to grid.");
698 } 722 }
699 else 723 else
700 { 724 {
701 MainLog.Instance.Warn("grid", "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); 725 MainLog.Instance.Warn("grid",
726 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
727 // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
702 return "Unable to update region (RestSetSimMethod): Incorrect auth key."; 728 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
703 } 729 }
704 } 730 }
705 catch (Exception e) 731 catch (Exception e)
706 { 732 {
707 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); 733 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
734 e.ToString());
708 } 735 }
709 } 736 }
710 return "OK"; 737 return "OK";
@@ -714,6 +741,5 @@ namespace OpenSim.Grid.GridServer
714 return "ERROR! Could not save to database! (" + e.ToString() + ")"; 741 return "ERROR! Could not save to database! (" + e.ToString() + ")";
715 } 742 }
716 } 743 }
717
718 } 744 }
719} 745} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index ae1e244..9b1892d 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -28,16 +28,10 @@
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Reflection;
32using System.Threading;
33using System.Timers; 31using System.Timers;
32using OpenSim.Framework;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
37using OpenSim.Framework;
38using OpenSim.Framework;
39
40using Timer=System.Timers.Timer;
41 35
42namespace OpenSim.Grid.GridServer 36namespace OpenSim.Grid.GridServer
43{ 37{
@@ -90,10 +84,9 @@ namespace OpenSim.Grid.GridServer
90 { 84 {
91 Directory.CreateDirectory(Util.logDir()); 85 Directory.CreateDirectory(Util.logDir());
92 } 86 }
93 m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-gridserver-console.log")), "OpenGrid", this, true); 87 m_console =
88 new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true);
94 MainLog.Instance = m_console; 89 MainLog.Instance = m_console;
95
96
97 } 90 }
98 91
99 public void managercallback(string cmd) 92 public void managercallback(string cmd)
@@ -109,28 +102,28 @@ namespace OpenSim.Grid.GridServer
109 102
110 public void Startup() 103 public void Startup()
111 { 104 {
112 105 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
113 this.Cfg = new GridConfig("GRID SERVER",(Path.Combine(Util.configDir(),"GridServer_Config.xml"))); //Yeah srsly, that's it. 106 //Yeah srsly, that's it.
114 if (setuponly) Environment.Exit(0); 107 if (setuponly) Environment.Exit(0);
115 108
116 m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); 109 m_console.Verbose("Main.cs:Startup() - Connecting to Storage Server");
117 m_gridManager = new GridManager(); 110 m_gridManager = new GridManager();
118 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win 111 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win
119 m_gridManager.config = Cfg; 112 m_gridManager.config = Cfg;
120 113
121 m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); 114 m_console.Verbose("Main.cs:Startup() - Starting HTTP process");
122 BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); 115 BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort);
123 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 116 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
124 117
125 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); 118 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
126 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); 119 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod);
127 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); 120 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
128 121
129 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); 122 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod));
130 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); 123 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod));
131 124
132 httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); 125 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod));
133 httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); 126 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod));
134 127
135 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); 128 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
136 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); 129 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
@@ -139,9 +132,9 @@ namespace OpenSim.Grid.GridServer
139 132
140 httpServer.Start(); 133 httpServer.Start();
141 134
142 m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); 135 m_console.Verbose("Main.cs:Startup() - Starting sim status checker");
143 136
144 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 137 Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates.
145 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 138 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
146 simCheckTimer.Enabled = true; 139 simCheckTimer.Enabled = true;
147 } 140 }
@@ -225,4 +218,4 @@ namespace OpenSim.Grid.GridServer
225 } 218 }
226 }*/ 219 }*/
227 } 220 }
228} 221} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 5059199..d46be9e 100644
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -27,25 +27,29 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// General Information about an assembly is controlled through the following 31// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 33// associated with an assembly.
33[assembly: AssemblyTitle("OGS-GridServer")] 34
34[assembly: AssemblyDescription("")] 35[assembly : AssemblyTitle("OGS-GridServer")]
35[assembly: AssemblyConfiguration("")] 36[assembly : AssemblyDescription("")]
36[assembly: AssemblyCompany("")] 37[assembly : AssemblyConfiguration("")]
37[assembly: AssemblyProduct("OGS-GridServer")] 38[assembly : AssemblyCompany("")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 39[assembly : AssemblyProduct("OGS-GridServer")]
39[assembly: AssemblyTrademark("")] 40[assembly : AssemblyCopyright("Copyright © 2007")]
40[assembly: AssemblyCulture("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
41 43
42// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 47
48[assembly : ComVisible(false)]
46 49
47// The following GUID is for the ID of the typelib if this project is exposed to COM 50// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 51
52[assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 53
50// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
51// 55//
@@ -54,5 +58,6 @@ using System.Runtime.InteropServices;
54// Build Number 58// Build Number
55// Revision 59// Revision
56// 60//
57[assembly: AssemblyVersion("1.0.0.0")] 61
58[assembly: AssemblyFileVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptEngine/Common/Executor.cs b/OpenSim/Grid/ScriptEngine/Common/Executor.cs
index 0732cbc..495c267 100644
--- a/OpenSim/Grid/ScriptEngine/Common/Executor.cs
+++ b/OpenSim/Grid/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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/Common/IScript.cs b/OpenSim/Grid/ScriptEngine/Common/IScript.cs
index 7d51c50..eb8205b 100644
--- a/OpenSim/Grid/ScriptEngine/Common/IScript.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.Common 29namespace OpenSim.Grid.ScriptEngine.Common
34{ 30{
35 public interface IScript 31 public interface IScript
@@ -37,4 +33,4 @@ namespace OpenSim.Grid.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/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index 7bd6f43..9630d6e 100644
--- a/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.Common 31namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs
index 02f9e9a..d10a5ef 100644
--- a/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs
@@ -41,11 +41,12 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
index 44a4f29..1d5911b 100644
--- a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.Common")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Grid.ScriptEngine.Common")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.Common")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Grid.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/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs
index e5478ae..e6c1678 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; 33using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
39using OpenSim.Region.ScriptEngine.Common;
40using libsecondlife;
41 34
42namespace OpenSim.Grid.ScriptEngine.DotNetEngine 35namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs
index af5c675..3ded7bf 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine 29namespace OpenSim.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index bb3d12a..4be8a0b 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSL 35namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.ScriptEngine.DotNetEngine.dll")); 120 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 32188d2..9046db3 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSL 32namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL
@@ -51,9 +49,8 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; 308 "public class Script : OpenSim.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index a5fe7f1..1f5e6da 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Grid/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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
index e1ea916..25c3346 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
index cfae2c5..f3f4bea 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 36namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
index eef9d20..064166b 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 33namespace OpenSim.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
index ac3bc11..46da5f8 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler;
34using OpenSim.Region.ScriptEngine.Common; 31using OpenSim.Region.ScriptEngine.Common;
35 32
36namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 33namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
@@ -39,9 +36,9 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
index 8a43cc1..0b6970a 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
@@ -53,6 +51,7 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
index 5da1d71..ed07cfc 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 29namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 30{
35 public class LSL_CLRInterface 31 public class LSL_CLRInterface
@@ -76,4 +72,4 @@ namespace OpenSim.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
index 45cca25..d25644c 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 34namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
index 3de2a36..fef9ad2 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
@@ -47,6 +45,7 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
index 8b24e68..11c51c5 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 37namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
index f0203b3..2bb2c38 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine.Compiler.LSO 34namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 8e7b95e..7bc3ce4 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Grid/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; 37using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
36using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; 39using OpenSim.Region.Environment.Scenes;
38using OpenSim.Region.ScriptEngine.Common; 40using OpenSim.Region.ScriptEngine.Common;
39using OpenSim.Framework.Console;
40using OpenSim.Framework;
41using System.Runtime.Remoting.Lifetime;
42 41
43namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler 42namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
44{ 43{
@@ -53,8 +52,7 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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 {
@@ -212,7 +280,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
212 //type for say is 1 280 //type for say is 1
213 281
214 World.SimChat(Helpers.StringToField(text), 282 World.SimChat(Helpers.StringToField(text),
215 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 283 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
216 } 284 }
217 285
218 public void llShout(int channelID, string text) 286 public void llShout(int channelID, string text)
@@ -222,64 +290,217 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
222 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 290 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
223 } 291 }
224 292
225 public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; } 293 public int llListen(int channelID, string name, string ID, string msg)
226 public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; } 294 {
227 public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; } 295 NotImplemented("llListen");
228 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } 296 return 0;
229 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } 297 }
230 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } 298
231 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } 299 public void llListenControl(int number, int active)
232 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } 300 {
233 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } 301 NotImplemented("llListenControl");
234 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } 302 return;
235 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } 303 }
236 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } 304
237 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } 305 public void llListenRemove(int number)
238 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } 306 {
239 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } 307 NotImplemented("llListenRemove");
240 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } 308 return;
241 public void llDie() { NotImplemented("llDie"); return; } 309 }
242 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } 310
243 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } 311 public void llSensor(string name, string id, int type, double range, double arc)
244 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } 312 {
245 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } 313 NotImplemented("llSensor");
246 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } 314 return;
315 }
316
317 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
318 {
319 NotImplemented("llSensorRepeat");
320 return;
321 }
322
323 public void llSensorRemove()
324 {
325 NotImplemented("llSensorRemove");
326 return;
327 }
328
329 public string llDetectedName(int number)
330 {
331 NotImplemented("llDetectedName");
332 return "";
333 }
334
335 public string llDetectedKey(int number)
336 {
337 NotImplemented("llDetectedKey");
338 return "";
339 }
340
341 public string llDetectedOwner(int number)
342 {
343 NotImplemented("llDetectedOwner");
344 return "";
345 }
346
347 public int llDetectedType(int number)
348 {
349 NotImplemented("llDetectedType");
350 return 0;
351 }
352
353 public LSL_Types.Vector3 llDetectedPos(int number)
354 {
355 NotImplemented("llDetectedPos");
356 return new LSL_Types.Vector3();
357 }
358
359 public LSL_Types.Vector3 llDetectedVel(int number)
360 {
361 NotImplemented("llDetectedVel");
362 return new LSL_Types.Vector3();
363 }
364
365 public LSL_Types.Vector3 llDetectedGrab(int number)
366 {
367 NotImplemented("llDetectedGrab");
368 return new LSL_Types.Vector3();
369 }
370
371 public LSL_Types.Quaternion llDetectedRot(int number)
372 {
373 NotImplemented("llDetectedRot");
374 return new LSL_Types.Quaternion();
375 }
376
377 public int llDetectedGroup(int number)
378 {
379 NotImplemented("llDetectedGroup");
380 return 0;
381 }
382
383 public int llDetectedLinkNumber(int number)
384 {
385 NotImplemented("llDetectedLinkNumber");
386 return 0;
387 }
388
389 public void llDie()
390 {
391 NotImplemented("llDie");
392 return;
393 }
394
395 public double llGround(LSL_Types.Vector3 offset)
396 {
397 NotImplemented("llGround");
398 return 0;
399 }
400
401 public double llCloud(LSL_Types.Vector3 offset)
402 {
403 NotImplemented("llCloud");
404 return 0;
405 }
406
407 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset)
408 {
409 NotImplemented("llWind");
410 return new LSL_Types.Vector3();
411 }
412
413 public void llSetStatus(int status, int value)
414 {
415 NotImplemented("llSetStatus");
416 return;
417 }
418
419 public int llGetStatus(int status)
420 {
421 NotImplemented("llGetStatus");
422 return 0;
423 }
247 424
248 public void llSetScale(LSL_Types.Vector3 scale) 425 public void llSetScale(LSL_Types.Vector3 scale)
249 { 426 {
250 // TODO: this needs to trigger a persistance save as well 427 // TODO: this needs to trigger a persistance save as well
251 LLVector3 tmp = m_host.Scale; 428 LLVector3 tmp = m_host.Scale;
252 tmp.X = (float)scale.X; 429 tmp.X = (float) scale.X;
253 tmp.Y = (float)scale.Y; 430 tmp.Y = (float) scale.Y;
254 tmp.Z = (float)scale.Z; 431 tmp.Z = (float) scale.Z;
255 m_host.Scale = tmp; 432 m_host.Scale = tmp;
256 return; 433 return;
257 } 434 }
435
258 public LSL_Types.Vector3 llGetScale() 436 public LSL_Types.Vector3 llGetScale()
259 { 437 {
260 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); 438 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
261 } 439 }
262 440
263 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } 441 public void llSetColor(LSL_Types.Vector3 color, int face)
264 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } 442 {
265 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } 443 NotImplemented("llSetColor");
266 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } 444 return;
267 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } 445 }
268 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; }
269 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; }
270 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; }
271 446
272 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } 447 public double llGetAlpha(int face)
448 {
449 NotImplemented("llGetAlpha");
450 return 0;
451 }
452
453 public void llSetAlpha(double alpha, int face)
454 {
455 NotImplemented("llSetAlpha");
456 return;
457 }
458
459 public LSL_Types.Vector3 llGetColor(int face)
460 {
461 NotImplemented("llGetColor");
462 return new LSL_Types.Vector3();
463 }
464
465 public void llSetTexture(string texture, int face)
466 {
467 NotImplemented("llSetTexture");
468 return;
469 }
470
471 public void llScaleTexture(double u, double v, int face)
472 {
473 NotImplemented("llScaleTexture");
474 return;
475 }
476
477 public void llOffsetTexture(double u, double v, int face)
478 {
479 NotImplemented("llOffsetTexture");
480 return;
481 }
482
483 public void llRotateTexture(double rotation, int face)
484 {
485 NotImplemented("llRotateTexture");
486 return;
487 }
488
489 public string llGetTexture(int face)
490 {
491 NotImplemented("llGetTexture");
492 return "";
493 }
273 494
274 public void llSetPos(LSL_Types.Vector3 pos) 495 public void llSetPos(LSL_Types.Vector3 pos)
275 { 496 {
276 if (m_host.ParentID != 0) 497 if (m_host.ParentID != 0)
277 { 498 {
278 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 499 m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
279 } 500 }
280 else 501 else
281 { 502 {
282 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 503 m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
283 } 504 }
284 } 505 }
285 506
@@ -305,51 +526,183 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
305 m_host.AbsolutePosition.Z); 526 m_host.AbsolutePosition.Z);
306 } 527 }
307 } 528 }
529
308 public void llSetRot(LSL_Types.Quaternion rot) 530 public void llSetRot(LSL_Types.Quaternion rot)
309 { 531 {
310 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); 532 m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R));
311 } 533 }
534
312 public LSL_Types.Quaternion llGetRot() 535 public LSL_Types.Quaternion llGetRot()
313 { 536 {
314 LLQuaternion q = m_host.RotationOffset; 537 LLQuaternion q = m_host.RotationOffset;
315 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 538 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
316 } 539 }
317 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } 540
318 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } 541 public LSL_Types.Quaternion llGetLocalRot()
319 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } 542 {
320 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } 543 NotImplemented("llGetLocalRot");
321 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } 544 return new LSL_Types.Quaternion();
322 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } 545 }
323 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } 546
324 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } 547 public void llSetForce(LSL_Types.Vector3 force, int local)
325 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } 548 {
326 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } 549 NotImplemented("llSetForce");
327 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } 550 }
328 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } 551
329 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } 552 public LSL_Types.Vector3 llGetForce()
330 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } 553 {
331 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } 554 NotImplemented("llGetForce");
332 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } 555 return new LSL_Types.Vector3();
333 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } 556 }
334 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } 557
558 public int llTarget(LSL_Types.Vector3 position, double range)
559 {
560 NotImplemented("llTarget");
561 return 0;
562 }
563
564 public void llTargetRemove(int number)
565 {
566 NotImplemented("llTargetRemove");
567 }
568
569 public int llRotTarget(LSL_Types.Quaternion rot, double error)
570 {
571 NotImplemented("llRotTarget");
572 return 0;
573 }
574
575 public void llRotTargetRemove(int number)
576 {
577 NotImplemented("llRotTargetRemove");
578 }
579
580 public void llMoveToTarget(LSL_Types.Vector3 target, double tau)
581 {
582 NotImplemented("llMoveToTarget");
583 }
584
585 public void llStopMoveToTarget()
586 {
587 NotImplemented("llStopMoveToTarget");
588 }
589
590 public void llApplyImpulse(LSL_Types.Vector3 force, int local)
591 {
592 NotImplemented("llApplyImpulse");
593 }
594
595 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local)
596 {
597 NotImplemented("llApplyRotationalImpulse");
598 }
599
600 public void llSetTorque(LSL_Types.Vector3 torque, int local)
601 {
602 NotImplemented("llSetTorque");
603 }
604
605 public LSL_Types.Vector3 llGetTorque()
606 {
607 NotImplemented("llGetTorque");
608 return new LSL_Types.Vector3();
609 }
610
611 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local)
612 {
613 NotImplemented("llSetForceAndTorque");
614 }
615
616 public LSL_Types.Vector3 llGetVel()
617 {
618 NotImplemented("llGetVel");
619 return new LSL_Types.Vector3();
620 }
621
622 public LSL_Types.Vector3 llGetAccel()
623 {
624 NotImplemented("llGetAccel");
625 return new LSL_Types.Vector3();
626 }
627
628 public LSL_Types.Vector3 llGetOmega()
629 {
630 NotImplemented("llGetOmega");
631 return new LSL_Types.Vector3();
632 }
633
634 public double llGetTimeOfDay()
635 {
636 NotImplemented("llGetTimeOfDay");
637 return 0;
638 }
335 639
336 public double llGetWallclock() 640 public double llGetWallclock()
337 { 641 {
338 return DateTime.Now.TimeOfDay.TotalSeconds; 642 return DateTime.Now.TimeOfDay.TotalSeconds;
339 } 643 }
340 644
341 public double llGetTime() { NotImplemented("llGetTime"); return 0; } 645 public double llGetTime()
342 public void llResetTime() { NotImplemented("llResetTime"); } 646 {
343 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } 647 NotImplemented("llGetTime");
344 public void llSound() { NotImplemented("llSound"); } 648 return 0;
345 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } 649 }
346 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } 650
347 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } 651 public void llResetTime()
348 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } 652 {
349 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } 653 NotImplemented("llResetTime");
350 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } 654 }
351 public void llStopSound() { NotImplemented("llStopSound"); } 655
352 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } 656 public double llGetAndResetTime()
657 {
658 NotImplemented("llGetAndResetTime");
659 return 0;
660 }
661
662 public void llSound()
663 {
664 NotImplemented("llSound");
665 }
666
667 public void llPlaySound(string sound, double volume)
668 {
669 NotImplemented("llPlaySound");
670 }
671
672 public void llLoopSound(string sound, double volume)
673 {
674 NotImplemented("llLoopSound");
675 }
676
677 public void llLoopSoundMaster(string sound, double volume)
678 {
679 NotImplemented("llLoopSoundMaster");
680 }
681
682 public void llLoopSoundSlave(string sound, double volume)
683 {
684 NotImplemented("llLoopSoundSlave");
685 }
686
687 public void llPlaySoundSlave(string sound, double volume)
688 {
689 NotImplemented("llPlaySoundSlave");
690 }
691
692 public void llTriggerSound(string sound, double volume)
693 {
694 NotImplemented("llTriggerSound");
695 }
696
697 public void llStopSound()
698 {
699 NotImplemented("llStopSound");
700 }
701
702 public void llPreloadSound(string sound)
703 {
704 NotImplemented("llPreloadSound");
705 }
353 706
354 public string llGetSubString(string src, int start, int end) 707 public string llGetSubString(string src, int start, int end)
355 { 708 {
@@ -360,10 +713,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
360 { 713 {
361 return src.Remove(start, end - start); 714 return src.Remove(start, end - start);
362 } 715 }
716
363 public string llInsertString(string dst, int position, string src) 717 public string llInsertString(string dst, int position, string src)
364 { 718 {
365 return dst.Insert(position, src); 719 return dst.Insert(position, src);
366 } 720 }
721
367 public string llToUpper(string src) 722 public string llToUpper(string src)
368 { 723 {
369 return src.ToUpper(); 724 return src.ToUpper();
@@ -374,14 +729,46 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
374 return src.ToLower(); 729 return src.ToLower();
375 } 730 }
376 731
377 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } 732 public int llGiveMoney(string destination, int amount)
378 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } 733 {
379 public void llMakeFountain() { NotImplemented("llMakeFountain"); } 734 NotImplemented("llGiveMoney");
380 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } 735 return 0;
381 public void llMakeFire() { NotImplemented("llMakeFire"); } 736 }
382 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } 737
383 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } 738 public void llMakeExplosion()
384 public void llStopLookAt() { NotImplemented("llStopLookAt"); } 739 {
740 NotImplemented("llMakeExplosion");
741 }
742
743 public void llMakeFountain()
744 {
745 NotImplemented("llMakeFountain");
746 }
747
748 public void llMakeSmoke()
749 {
750 NotImplemented("llMakeSmoke");
751 }
752
753 public void llMakeFire()
754 {
755 NotImplemented("llMakeFire");
756 }
757
758 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param)
759 {
760 NotImplemented("llRezObject");
761 }
762
763 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping)
764 {
765 NotImplemented("llLookAt");
766 }
767
768 public void llStopLookAt()
769 {
770 NotImplemented("llStopLookAt");
771 }
385 772
386 public void llSetTimerEvent(double sec) 773 public void llSetTimerEvent(double sec)
387 { 774 {
@@ -391,38 +778,104 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
391 778
392 public void llSleep(double sec) 779 public void llSleep(double sec)
393 { 780 {
394 System.Threading.Thread.Sleep((int)(sec * 1000)); 781 Thread.Sleep((int) (sec*1000));
782 }
783
784 public double llGetMass()
785 {
786 NotImplemented("llGetMass");
787 return 0;
788 }
789
790 public void llCollisionFilter(string name, string id, int accept)
791 {
792 NotImplemented("llCollisionFilter");
793 }
794
795 public void llTakeControls(int controls, int accept, int pass_on)
796 {
797 NotImplemented("llTakeControls");
798 }
799
800 public void llReleaseControls()
801 {
802 NotImplemented("llReleaseControls");
803 }
804
805 public void llAttachToAvatar(int attachment)
806 {
807 NotImplemented("llAttachToAvatar");
395 } 808 }
396 809
397 public double llGetMass() { NotImplemented("llGetMass"); return 0; } 810 public void llDetachFromAvatar()
398 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } 811 {
399 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } 812 NotImplemented("llDetachFromAvatar");
400 public void llReleaseControls() { NotImplemented("llReleaseControls"); } 813 }
401 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } 814
402 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } 815 public void llTakeCamera()
403 public void llTakeCamera() { NotImplemented("llTakeCamera"); } 816 {
404 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } 817 NotImplemented("llTakeCamera");
818 }
819
820 public void llReleaseCamera()
821 {
822 NotImplemented("llReleaseCamera");
823 }
405 824
406 public string llGetOwner() 825 public string llGetOwner()
407 { 826 {
408 return m_host.ObjectOwner.ToStringHyphenated(); 827 return m_host.ObjectOwner.ToStringHyphenated();
409 } 828 }
410 829
411 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } 830 public void llInstantMessage(string user, string message)
412 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } 831 {
413 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } 832 NotImplemented("llInstantMessage");
833 }
834
835 public void llEmail(string address, string subject, string message)
836 {
837 NotImplemented("llEmail");
838 }
839
840 public void llGetNextEmail(string address, string subject)
841 {
842 NotImplemented("llGetNextEmail");
843 }
414 844
415 public string llGetKey() 845 public string llGetKey()
416 { 846 {
417 return m_host.UUID.ToStringHyphenated(); 847 return m_host.UUID.ToStringHyphenated();
418 } 848 }
419 849
420 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } 850 public void llSetBuoyancy(double buoyancy)
421 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } 851 {
422 public void llStopHover() { NotImplemented("llStopHover"); } 852 NotImplemented("llSetBuoyancy");
423 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } 853 }
424 public void llSoundPreload() { NotImplemented("llSoundPreload"); } 854
425 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } 855 public void llSetHoverHeight(double height, int water, double tau)
856 {
857 NotImplemented("llSetHoverHeight");
858 }
859
860 public void llStopHover()
861 {
862 NotImplemented("llStopHover");
863 }
864
865 public void llMinEventDelay(double delay)
866 {
867 NotImplemented("llMinEventDelay");
868 }
869
870 public void llSoundPreload()
871 {
872 NotImplemented("llSoundPreload");
873 }
874
875 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping)
876 {
877 NotImplemented("llRotLookAt");
878 }
426 879
427 public int llStringLength(string str) 880 public int llStringLength(string str)
428 { 881 {
@@ -436,88 +889,289 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
436 } 889 }
437 } 890 }
438 891
439 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } 892 public void llStartAnimation(string anim)
440 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } 893 {
441 public void llPointAt() { NotImplemented("llPointAt"); } 894 NotImplemented("llStartAnimation");
442 public void llStopPointAt() { NotImplemented("llStopPointAt"); } 895 }
443 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } 896
444 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } 897 public void llStopAnimation(string anim)
445 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } 898 {
446 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } 899 NotImplemented("llStopAnimation");
447 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } 900 }
448 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } 901
449 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } 902 public void llPointAt()
450 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } 903 {
451 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } 904 NotImplemented("llPointAt");
452 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } 905 }
453 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } 906
454 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } 907 public void llStopPointAt()
455 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } 908 {
456 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } 909 NotImplemented("llStopPointAt");
457 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } 910 }
458 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } 911
459 public double llGetEnergy() { return 1.0f; } 912 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain)
460 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } 913 {
461 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } 914 NotImplemented("llTargetOmega");
915 }
916
917 public int llGetStartParameter()
918 {
919 NotImplemented("llGetStartParameter");
920 return 0;
921 }
922
923 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos)
924 {
925 NotImplemented("llGodLikeRezObject");
926 }
927
928 public void llRequestPermissions(string agent, int perm)
929 {
930 NotImplemented("llRequestPermissions");
931 }
932
933 public string llGetPermissionsKey()
934 {
935 NotImplemented("llGetPermissionsKey");
936 return "";
937 }
938
939 public int llGetPermissions()
940 {
941 NotImplemented("llGetPermissions");
942 return 0;
943 }
944
945 public int llGetLinkNumber()
946 {
947 NotImplemented("llGetLinkNumber");
948 return 0;
949 }
950
951 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face)
952 {
953 NotImplemented("llSetLinkColor");
954 }
955
956 public void llCreateLink(string target, int parent)
957 {
958 NotImplemented("llCreateLink");
959 }
960
961 public void llBreakLink(int linknum)
962 {
963 NotImplemented("llBreakLink");
964 }
965
966 public void llBreakAllLinks()
967 {
968 NotImplemented("llBreakAllLinks");
969 }
970
971 public string llGetLinkKey(int linknum)
972 {
973 NotImplemented("llGetLinkKey");
974 return "";
975 }
976
977 public void llGetLinkName(int linknum)
978 {
979 NotImplemented("llGetLinkName");
980 }
981
982 public int llGetInventoryNumber(int type)
983 {
984 NotImplemented("llGetInventoryNumber");
985 return 0;
986 }
987
988 public string llGetInventoryName(int type, int number)
989 {
990 NotImplemented("llGetInventoryName");
991 return "";
992 }
993
994 public void llSetScriptState(string name, int run)
995 {
996 NotImplemented("llSetScriptState");
997 }
998
999 public double llGetEnergy()
1000 {
1001 return 1.0f;
1002 }
1003
1004 public void llGiveInventory(string destination, string inventory)
1005 {
1006 NotImplemented("llGiveInventory");
1007 }
1008
1009 public void llRemoveInventory(string item)
1010 {
1011 NotImplemented("llRemoveInventory");
1012 }
462 1013
463 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 1014 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
464 { 1015 {
465 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); 1016 Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z);
466 m_host.SetText(text, av3, alpha); 1017 m_host.SetText(text, av3, alpha);
467 } 1018 }
468 1019
469 1020
470 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } 1021 public double llWater(LSL_Types.Vector3 offset)
471 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } 1022 {
472 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } 1023 NotImplemented("llWater");
473 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } 1024 return 0;
474 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } 1025 }
475 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } 1026
476 public void llModifyLand(int action, int brush) { } 1027 public void llPassTouches(int pass)
477 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } 1028 {
478 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } 1029 NotImplemented("llPassTouches");
479 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } 1030 }
480 public void llResetScript() 1031
1032 public string llRequestAgentData(string id, int data)
1033 {
1034 NotImplemented("llRequestAgentData");
1035 return "";
1036 }
1037
1038 public string llRequestInventoryData(string name)
1039 {
1040 NotImplemented("llRequestInventoryData");
1041 return "";
1042 }
1043
1044 public void llSetDamage(double damage)
1045 {
1046 NotImplemented("llSetDamage");
1047 }
1048
1049 public void llTeleportAgentHome(string agent)
1050 {
1051 NotImplemented("llTeleportAgentHome");
1052 }
1053
1054 public void llModifyLand(int action, int brush)
1055 {
1056 }
1057
1058 public void llCollisionSound(string impact_sound, double impact_volume)
1059 {
1060 NotImplemented("llCollisionSound");
1061 }
1062
1063 public void llCollisionSprite(string impact_sprite)
1064 {
1065 NotImplemented("llCollisionSprite");
1066 }
1067
1068 public string llGetAnimation(string id)
1069 {
1070 NotImplemented("llGetAnimation");
1071 return "";
1072 }
1073
1074 public void llResetScript()
481 { 1075 {
482 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); 1076 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
483 } 1077 }
484 public void llMessageLinked(int linknum, int num, string str, string id) { }
485 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { }
486 public void llPassCollisions(int pass) { }
487 public string llGetScriptName() { return ""; }
488 1078
489 public int llGetNumberOfSides() { return 0; } 1079 public void llMessageLinked(int linknum, int num, string str, string id)
1080 {
1081 }
490 1082
491 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } 1083 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local)
492 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } 1084 {
493 public void llRot2Angle() { } 1085 }
1086
1087 public void llPassCollisions(int pass)
1088 {
1089 }
1090
1091 public string llGetScriptName()
1092 {
1093 return "";
1094 }
1095
1096 public int llGetNumberOfSides()
1097 {
1098 return 0;
1099 }
1100
1101 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle)
1102 {
1103 return new LSL_Types.Quaternion();
1104 }
1105
1106 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot)
1107 {
1108 return new LSL_Types.Vector3();
1109 }
1110
1111 public void llRot2Angle()
1112 {
1113 }
494 1114
495 public double llAcos(double val) 1115 public double llAcos(double val)
496 { 1116 {
497 return (double)Math.Acos(val); 1117 return (double) Math.Acos(val);
498 } 1118 }
499 1119
500 public double llAsin(double val) 1120 public double llAsin(double val)
501 { 1121 {
502 return (double)Math.Asin(val); 1122 return (double) Math.Asin(val);
503 } 1123 }
504 1124
505 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } 1125 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b)
506 public string llGetInventoryKey(string name) { return ""; } 1126 {
507 public void llAllowInventoryDrop(int add) { } 1127 return 0;
508 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } 1128 }
509 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } 1129
510 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } 1130 public string llGetInventoryKey(string name)
511 public double llGetTextureRot(int side) { return 0; } 1131 {
1132 return "";
1133 }
1134
1135 public void llAllowInventoryDrop(int add)
1136 {
1137 }
1138
1139 public LSL_Types.Vector3 llGetSunDirection()
1140 {
1141 return new LSL_Types.Vector3();
1142 }
1143
1144 public LSL_Types.Vector3 llGetTextureOffset(int face)
1145 {
1146 return new LSL_Types.Vector3();
1147 }
1148
1149 public LSL_Types.Vector3 llGetTextureScale(int side)
1150 {
1151 return new LSL_Types.Vector3();
1152 }
1153
1154 public double llGetTextureRot(int side)
1155 {
1156 return 0;
1157 }
512 1158
513 public int llSubStringIndex(string source, string pattern) 1159 public int llSubStringIndex(string source, string pattern)
514 { 1160 {
515 return source.IndexOf(pattern); 1161 return source.IndexOf(pattern);
516 } 1162 }
517 1163
518 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } 1164 public string llGetOwnerKey(string id)
1165 {
1166 NotImplemented("llGetOwnerKey");
1167 return "";
1168 }
519 1169
520 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } 1170 public LSL_Types.Vector3 llGetCenterOfMass()
1171 {
1172 NotImplemented("llGetCenterOfMass");
1173 return new LSL_Types.Vector3();
1174 }
521 1175
522 public List<string> llListSort(List<string> src, int stride, int ascending) 1176 public List<string> llListSort(List<string> src, int stride, int ascending)
523 { 1177 {
@@ -551,7 +1205,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
551 ret.AddRange(ls); 1205 ret.AddRange(ls);
552 } 1206 }
553 1207
554 if (ascending == LSL.LSL_BaseClass.TRUE) 1208 if (ascending == LSL_BaseClass.TRUE)
555 return ret; 1209 return ret;
556 ret.Reverse(); 1210 ret.Reverse();
557 return ret; 1211 return ret;
@@ -590,12 +1244,18 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
590 1244
591 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 1245 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
592 { 1246 {
593 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); 1247 return
1248 new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]),
1249 double.Parse(src[index + 2]));
594 } 1250 }
1251
595 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 1252 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
596 { 1253 {
597 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); 1254 return
1255 new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]),
1256 double.Parse(src[index + 2]), double.Parse(src[index + 3]));
598 } 1257 }
1258
599 public List<string> llList2List(List<string> src, int start, int end) 1259 public List<string> llList2List(List<string> src, int start, int end)
600 { 1260 {
601 if (end > start) 1261 if (end > start)
@@ -612,18 +1272,21 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
612 ret.AddRange(src.GetRange(0, end)); 1272 ret.AddRange(src.GetRange(0, end));
613 return ret; 1273 return ret;
614 } 1274 }
615
616
617
618
619 } 1275 }
1276
620 public List<string> llDeleteSubList(List<string> src, int start, int end) 1277 public List<string> llDeleteSubList(List<string> src, int start, int end)
621 { 1278 {
622 List<string> ret = new List<string>(src); 1279 List<string> ret = new List<string>(src);
623 ret.RemoveRange(start, end - start); 1280 ret.RemoveRange(start, end - start);
624 return ret; 1281 return ret;
625 } 1282 }
626 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } 1283
1284 public int llGetListEntryType(List<string> src, int index)
1285 {
1286 NotImplemented("llGetListEntryType");
1287 return 0;
1288 }
1289
627 public string llList2CSV(List<string> src) 1290 public string llList2CSV(List<string> src)
628 { 1291 {
629 string ret = ""; 1292 string ret = "";
@@ -635,6 +1298,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
635 } 1298 }
636 return ret; 1299 return ret;
637 } 1300 }
1301
638 public List<string> llCSV2List(string src) 1302 public List<string> llCSV2List(string src)
639 { 1303 {
640 List<string> ret = new List<string>(); 1304 List<string> ret = new List<string>();
@@ -644,6 +1308,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
644 } 1308 }
645 return ret; 1309 return ret;
646 } 1310 }
1311
647 public List<string> llListRandomize(List<string> src, int stride) 1312 public List<string> llListRandomize(List<string> src, int stride)
648 { 1313 {
649 int s = stride; 1314 int s = stride;
@@ -685,9 +1350,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
685 } 1350 }
686 1351
687 return ret; 1352 return ret;
688
689
690 } 1353 }
1354
691 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 1355 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
692 { 1356 {
693 List<string> ret = new List<string>(); 1357 List<string> ret = new List<string>();
@@ -713,12 +1377,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
713 1377
714 public LSL_Types.Vector3 llGetRegionCorner() 1378 public LSL_Types.Vector3 llGetRegionCorner()
715 { 1379 {
716 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 1380 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0);
717 } 1381 }
718 1382
719 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 1383 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
720 { 1384 {
721
722 List<string> ret = new List<string>(dest); 1385 List<string> ret = new List<string>(dest);
723 //foreach (string s in src.Reverse()) 1386 //foreach (string s in src.Reverse())
724 for (int ci = src.Count - 1; ci > -1; ci--) 1387 for (int ci = src.Count - 1; ci > -1; ci--)
@@ -727,13 +1390,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
727 } 1390 }
728 return ret; 1391 return ret;
729 } 1392 }
1393
730 public int llListFindList(List<string> src, List<string> test) 1394 public int llListFindList(List<string> src, List<string> test)
731 { 1395 {
732 foreach (string s in test) 1396 foreach (string s in test)
733 { 1397 {
734 for (int ci = 0; ci < src.Count; ci++) 1398 for (int ci = 0; ci < src.Count; ci++)
735 { 1399 {
736
737 if (s == src[ci]) 1400 if (s == src[ci])
738 return ci; 1401 return ci;
739 } 1402 }
@@ -758,37 +1421,139 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
758 return result; 1421 return result;
759 } 1422 }
760 1423
761 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } 1424 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir)
762 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } 1425 {
763 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } 1426 NotImplemented("llEdgeOfWorld");
764 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } 1427 return 0;
765 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } 1428 }
766 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } 1429
767 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } 1430 public int llGetAgentInfo(string id)
768 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } 1431 {
769 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } 1432 NotImplemented("llGetAgentInfo");
770 1433 return 0;
771 public void llParseString2List() { NotImplemented("llParseString2List"); } 1434 }
772 1435
773 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } 1436 public void llAdjustSoundVolume(double volume)
774 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } 1437 {
775 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } 1438 NotImplemented("llAdjustSoundVolume");
776 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } 1439 }
777 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } 1440
778 public void llUnSit(string id) { NotImplemented("llUnSit"); } 1441 public void llSetSoundQueueing(int queue)
779 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } 1442 {
780 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } 1443 NotImplemented("llSetSoundQueueing");
781 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } 1444 }
782 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } 1445
783 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } 1446 public void llSetSoundRadius(double radius)
1447 {
1448 NotImplemented("llSetSoundRadius");
1449 }
1450
1451 public string llKey2Name(string id)
1452 {
1453 NotImplemented("llKey2Name");
1454 return "";
1455 }
1456
1457 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
1458 {
1459 NotImplemented("llSetTextureAnim");
1460 }
1461
1462 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
1463 LSL_Types.Vector3 bottom_south_west)
1464 {
1465 NotImplemented("llTriggerSoundLimited");
1466 }
1467
1468 public void llEjectFromLand(string pest)
1469 {
1470 NotImplemented("llEjectFromLand");
1471 }
1472
1473 public void llParseString2List()
1474 {
1475 NotImplemented("llParseString2List");
1476 }
1477
1478 public int llOverMyLand(string id)
1479 {
1480 NotImplemented("llOverMyLand");
1481 return 0;
1482 }
1483
1484 public string llGetLandOwnerAt(LSL_Types.Vector3 pos)
1485 {
1486 NotImplemented("llGetLandOwnerAt");
1487 return "";
1488 }
1489
1490 public string llGetNotecardLine(string name, int line)
1491 {
1492 NotImplemented("llGetNotecardLine");
1493 return "";
1494 }
1495
1496 public LSL_Types.Vector3 llGetAgentSize(string id)
1497 {
1498 NotImplemented("llGetAgentSize");
1499 return new LSL_Types.Vector3();
1500 }
1501
1502 public int llSameGroup(string agent)
1503 {
1504 NotImplemented("llSameGroup");
1505 return 0;
1506 }
1507
1508 public void llUnSit(string id)
1509 {
1510 NotImplemented("llUnSit");
1511 }
1512
1513 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset)
1514 {
1515 NotImplemented("llGroundSlope");
1516 return new LSL_Types.Vector3();
1517 }
1518
1519 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset)
1520 {
1521 NotImplemented("llGroundNormal");
1522 return new LSL_Types.Vector3();
1523 }
1524
1525 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset)
1526 {
1527 NotImplemented("llGroundContour");
1528 return new LSL_Types.Vector3();
1529 }
1530
1531 public int llGetAttached()
1532 {
1533 NotImplemented("llGetAttached");
1534 return 0;
1535 }
1536
1537 public int llGetFreeMemory()
1538 {
1539 NotImplemented("llGetFreeMemory");
1540 return 0;
1541 }
784 1542
785 public string llGetRegionName() 1543 public string llGetRegionName()
786 { 1544 {
787 return World.RegionInfo.RegionName; 1545 return World.RegionInfo.RegionName;
788 } 1546 }
789 1547
790 public double llGetRegionTimeDilation() { return 1.0f; } 1548 public double llGetRegionTimeDilation()
791 public double llGetRegionFPS() { return 10.0f; } 1549 {
1550 return 1.0f;
1551 }
1552
1553 public double llGetRegionFPS()
1554 {
1555 return 10.0f;
1556 }
792 1557
793 /* particle system rules should be coming into this routine as doubles, that is 1558 /* particle system rules should be coming into this routine as doubles, that is
794 rule[0] should be an integer from this list and rule[1] should be the arg 1559 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -798,6 +1563,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
798 We iterate through the list for 'Count' elements, incrementing by two for each 1563 We iterate through the list for 'Count' elements, incrementing by two for each
799 iteration and set the members of Primitive.ParticleSystem, one at a time. 1564 iteration and set the members of Primitive.ParticleSystem, one at a time.
800 */ 1565 */
1566
801 public enum PrimitiveRule : int 1567 public enum PrimitiveRule : int
802 { 1568 {
803 PSYS_PART_FLAGS = 0, 1569 PSYS_PART_FLAGS = 0,
@@ -828,109 +1594,152 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
828 Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); 1594 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
829 for (int i = 0; i < rules.Count; i += 2) 1595 for (int i = 0; i < rules.Count; i += 2)
830 { 1596 {
831 switch ((int)rules[i]) 1597 switch ((int) rules[i])
832 { 1598 {
833 case (int)PrimitiveRule.PSYS_PART_FLAGS: 1599 case (int) PrimitiveRule.PSYS_PART_FLAGS:
834 prules.PartFlags = (uint)rules[i + 1]; 1600 prules.PartFlags = (uint) rules[i + 1];
835 break; 1601 break;
836 1602
837 case (int)PrimitiveRule.PSYS_PART_START_COLOR: 1603 case (int) PrimitiveRule.PSYS_PART_START_COLOR:
838 prules.PartStartColor = (LLColor)rules[i + 1]; 1604 prules.PartStartColor = (LLColor) rules[i + 1];
839 break; 1605 break;
840 1606
841 case (int)PrimitiveRule.PSYS_PART_START_ALPHA: 1607 case (int) PrimitiveRule.PSYS_PART_START_ALPHA:
842 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1608 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
843 break; 1609 break;
844 1610
845 case (int)PrimitiveRule.PSYS_PART_END_COLOR: 1611 case (int) PrimitiveRule.PSYS_PART_END_COLOR:
846 prules.PartEndColor = (LLColor)rules[i + 1]; 1612 prules.PartEndColor = (LLColor) rules[i + 1];
847 break; 1613 break;
848 1614
849 case (int)PrimitiveRule.PSYS_PART_END_ALPHA: 1615 case (int) PrimitiveRule.PSYS_PART_END_ALPHA:
850 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1616 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
851 break; 1617 break;
852 1618
853 case (int)PrimitiveRule.PSYS_PART_START_SCALE: 1619 case (int) PrimitiveRule.PSYS_PART_START_SCALE:
854 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1620 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
855 break; 1621 break;
856 1622
857 case (int)PrimitiveRule.PSYS_PART_END_SCALE: 1623 case (int) PrimitiveRule.PSYS_PART_END_SCALE:
858 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1624 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
859 break; 1625 break;
860 1626
861 case (int)PrimitiveRule.PSYS_PART_MAX_AGE: 1627 case (int) PrimitiveRule.PSYS_PART_MAX_AGE:
862 prules.MaxAge = (float)rules[i + 1]; 1628 prules.MaxAge = (float) rules[i + 1];
863 break; 1629 break;
864 1630
865 case (int)PrimitiveRule.PSYS_SRC_ACCEL: 1631 case (int) PrimitiveRule.PSYS_SRC_ACCEL:
866 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1632 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
867 break; 1633 break;
868 1634
869 case (int)PrimitiveRule.PSYS_SRC_PATTERN: 1635 case (int) PrimitiveRule.PSYS_SRC_PATTERN:
870 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1636 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
871 break; 1637 break;
872 1638
873 case (int)PrimitiveRule.PSYS_SRC_TEXTURE: 1639 case (int) PrimitiveRule.PSYS_SRC_TEXTURE:
874 prules.Texture = (LLUUID)rules[i + 1]; 1640 prules.Texture = (LLUUID) rules[i + 1];
875 break; 1641 break;
876 1642
877 case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: 1643 case (int) PrimitiveRule.PSYS_SRC_BURST_RATE:
878 prules.BurstRate = (float)rules[i + 1]; 1644 prules.BurstRate = (float) rules[i + 1];
879 break; 1645 break;
880 1646
881 case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: 1647 case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
882 prules.BurstPartCount = (byte)rules[i + 1]; 1648 prules.BurstPartCount = (byte) rules[i + 1];
883 break; 1649 break;
884 1650
885 case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: 1651 case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS:
886 prules.BurstRadius = (float)rules[i + 1]; 1652 prules.BurstRadius = (float) rules[i + 1];
887 break; 1653 break;
888 1654
889 case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: 1655 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
890 prules.BurstSpeedMin = (float)rules[i + 1]; 1656 prules.BurstSpeedMin = (float) rules[i + 1];
891 break; 1657 break;
892 1658
893 case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: 1659 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
894 prules.BurstSpeedMax = (float)rules[i + 1]; 1660 prules.BurstSpeedMax = (float) rules[i + 1];
895 break; 1661 break;
896 1662
897 case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: 1663 case (int) PrimitiveRule.PSYS_SRC_MAX_AGE:
898 prules.MaxAge = (float)rules[i + 1]; 1664 prules.MaxAge = (float) rules[i + 1];
899 break; 1665 break;
900 1666
901 case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: 1667 case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY:
902 prules.Target = (LLUUID)rules[i + 1]; 1668 prules.Target = (LLUUID) rules[i + 1];
903 break; 1669 break;
904 1670
905 case (int)PrimitiveRule.PSYS_SRC_OMEGA: 1671 case (int) PrimitiveRule.PSYS_SRC_OMEGA:
906 //cast?? prules.MaxAge = (float)rules[i + 1]; 1672 //cast?? prules.MaxAge = (float)rules[i + 1];
907 break; 1673 break;
908 1674
909 case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: 1675 case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
910 prules.InnerAngle = (float)rules[i + 1]; 1676 prules.InnerAngle = (float) rules[i + 1];
911 break; 1677 break;
912 1678
913 case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: 1679 case (int) PrimitiveRule.PSYS_SRC_ANGLE_END:
914 prules.OuterAngle = (float)rules[i + 1]; 1680 prules.OuterAngle = (float) rules[i + 1];
915 break; 1681 break;
916
917 } 1682 }
918 } 1683 }
919 1684
920 m_host.AddNewParticleSystem(prules); 1685 m_host.AddNewParticleSystem(prules);
921 } 1686 }
922 1687
923 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } 1688 public void llGroundRepel(double height, int water, double tau)
924 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } 1689 {
925 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } 1690 NotImplemented("llGroundRepel");
926 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } 1691 }
927 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } 1692
928 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } 1693 public void llGiveInventoryList()
929 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } 1694 {
930 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } 1695 NotImplemented("llGiveInventoryList");
931 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } 1696 }
932 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } 1697
933 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } 1698 public void llSetVehicleType(int type)
1699 {
1700 NotImplemented("llSetVehicleType");
1701 }
1702
1703 public void llSetVehicledoubleParam(int param, double value)
1704 {
1705 NotImplemented("llSetVehicledoubleParam");
1706 }
1707
1708 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec)
1709 {
1710 NotImplemented("llSetVehicleVectorParam");
1711 }
1712
1713 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot)
1714 {
1715 NotImplemented("llSetVehicleRotationParam");
1716 }
1717
1718 public void llSetVehicleFlags(int flags)
1719 {
1720 NotImplemented("llSetVehicleFlags");
1721 }
1722
1723 public void llRemoveVehicleFlags(int flags)
1724 {
1725 NotImplemented("llRemoveVehicleFlags");
1726 }
1727
1728 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot)
1729 {
1730 NotImplemented("llSitTarget");
1731 }
1732
1733 public string llAvatarOnSitTarget()
1734 {
1735 NotImplemented("llAvatarOnSitTarget");
1736 return "";
1737 }
1738
1739 public void llAddToLandPassList(string avatar, double hours)
1740 {
1741 NotImplemented("llAddToLandPassList");
1742 }
934 1743
935 public void llSetTouchText(string text) 1744 public void llSetTouchText(string text)
936 { 1745 {
@@ -942,37 +1751,99 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
942 m_host.SitName = text; 1751 m_host.SitName = text;
943 } 1752 }
944 1753
945 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } 1754 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset)
946 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } 1755 {
947 public void llDumpList2String() { NotImplemented("llDumpList2String"); } 1756 NotImplemented("llSetCameraEyeOffset");
948 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } 1757 }
949 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); }
950 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); }
951 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); }
952 1758
953 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } 1759 public void llSetCameraAtOffset(LSL_Types.Vector3 offset)
1760 {
1761 NotImplemented("llSetCameraAtOffset");
1762 }
1763
1764 public void llDumpList2String()
1765 {
1766 NotImplemented("llDumpList2String");
1767 }
1768
1769 public void llScriptDanger(LSL_Types.Vector3 pos)
1770 {
1771 NotImplemented("llScriptDanger");
1772 }
1773
1774 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1775 {
1776 NotImplemented("llDialog");
1777 }
1778
1779 public void llVolumeDetect(int detect)
1780 {
1781 NotImplemented("llVolumeDetect");
1782 }
1783
1784 public void llResetOtherScript(string name)
1785 {
1786 NotImplemented("llResetOtherScript");
1787 }
1788
1789 public int llGetScriptState(string name)
1790 {
1791 NotImplemented("llGetScriptState");
1792 return 0;
1793 }
1794
1795 public void llRemoteLoadScript()
1796 {
1797 NotImplemented("llRemoteLoadScript");
1798 }
1799
1800 public void llSetRemoteScriptAccessPin(int pin)
1801 {
1802 NotImplemented("llSetRemoteScriptAccessPin");
1803 }
954 1804
955 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } 1805 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
956 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } 1806 {
957 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } 1807 NotImplemented("llRemoteLoadScriptPin");
958 public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); } 1808 }
959 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } 1809
960 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); } 1810 public void llOpenRemoteDataChannel()
961 public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); } 1811 {
1812 NotImplemented("llOpenRemoteDataChannel");
1813 }
1814
1815 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
1816 {
1817 NotImplemented("llSendRemoteData");
1818 return "";
1819 }
1820
1821 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
1822 {
1823 NotImplemented("llRemoteDataReply");
1824 }
1825
1826 public void llCloseRemoteDataChannel(string channel)
1827 {
1828 NotImplemented("llCloseRemoteDataChannel");
1829 }
962 1830
963 public string llMD5String(string src, int nonce) 1831 public string llMD5String(string src, int nonce)
964 { 1832 {
965 return Util.Md5Hash(src + ":" + nonce.ToString()); 1833 return Util.Md5Hash(src + ":" + nonce.ToString());
966 } 1834 }
967 1835
968 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } 1836 public void llSetPrimitiveParams(List<string> rules)
969 public string llStringToBase64(string str)
970 { 1837 {
1838 NotImplemented("llSetPrimitiveParams");
1839 }
971 1840
1841 public string llStringToBase64(string str)
1842 {
972 try 1843 try
973 { 1844 {
974 byte[] encData_byte = new byte[str.Length]; 1845 byte[] encData_byte = new byte[str.Length];
975 encData_byte = System.Text.Encoding.UTF8.GetBytes(str); 1846 encData_byte = Encoding.UTF8.GetBytes(str);
976 string encodedData = Convert.ToBase64String(encData_byte); 1847 string encodedData = Convert.ToBase64String(encData_byte);
977 return encodedData; 1848 return encodedData;
978 } 1849 }
@@ -984,11 +1855,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
984 1855
985 public string llBase64ToString(string str) 1856 public string llBase64ToString(string str)
986 { 1857 {
987 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 1858 UTF8Encoding encoder = new UTF8Encoding();
988 System.Text.Decoder utf8Decode = encoder.GetDecoder(); 1859 Decoder utf8Decode = encoder.GetDecoder();
989 try 1860 try
990 { 1861 {
991
992 byte[] todecode_byte = Convert.FromBase64String(str); 1862 byte[] todecode_byte = Convert.FromBase64String(str);
993 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 1863 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
994 char[] decoded_char = new char[charCount]; 1864 char[] decoded_char = new char[charCount];
@@ -1001,16 +1871,49 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1001 throw new Exception("Error in base64Decode" + e.Message); 1871 throw new Exception("Error in base64Decode" + e.Message);
1002 } 1872 }
1003 } 1873 }
1004 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); }
1005 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); }
1006 public double llLog10(double val) { return (double)Math.Log10(val); }
1007 public double llLog(double val) { return (double)Math.Log(val); }
1008 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); }
1009 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); }
1010 1874
1011 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } 1875 public void llXorBase64Strings()
1876 {
1877 throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead.");
1878 }
1012 1879
1013 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } 1880 public void llRemoteDataSetRegion()
1881 {
1882 NotImplemented("llRemoteDataSetRegion");
1883 }
1884
1885 public double llLog10(double val)
1886 {
1887 return (double) Math.Log10(val);
1888 }
1889
1890 public double llLog(double val)
1891 {
1892 return (double) Math.Log(val);
1893 }
1894
1895 public List<string> llGetAnimationList(string id)
1896 {
1897 NotImplemented("llGetAnimationList");
1898 return new List<string>();
1899 }
1900
1901 public void llSetParcelMusicURL(string url)
1902 {
1903 NotImplemented("llSetParcelMusicURL");
1904 }
1905
1906 public LSL_Types.Vector3 llGetRootPosition()
1907 {
1908 NotImplemented("llGetRootPosition");
1909 return new LSL_Types.Vector3();
1910 }
1911
1912 public LSL_Types.Quaternion llGetRootRotation()
1913 {
1914 NotImplemented("llGetRootRotation");
1915 return new LSL_Types.Quaternion();
1916 }
1014 1917
1015 public string llGetObjectDesc() 1918 public string llGetObjectDesc()
1016 { 1919 {
@@ -1027,20 +1930,55 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1027 return m_host.ObjectCreator.ToStringHyphenated(); 1930 return m_host.ObjectCreator.ToStringHyphenated();
1028 } 1931 }
1029 1932
1030 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } 1933 public string llGetTimestamp()
1031 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } 1934 {
1032 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } 1935 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
1033 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } 1936 }
1034 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } 1937
1035 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } 1938 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1036 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } 1939 {
1940 NotImplemented("llSetLinkAlpha");
1941 }
1942
1943 public int llGetNumberOfPrims()
1944 {
1945 NotImplemented("llGetNumberOfPrims");
1946 return 0;
1947 }
1948
1949 public string llGetNumberOfNotecardLines(string name)
1950 {
1951 NotImplemented("llGetNumberOfNotecardLines");
1952 return "";
1953 }
1954
1955 public List<string> llGetBoundingBox(string obj)
1956 {
1957 NotImplemented("llGetBoundingBox");
1958 return new List<string>();
1959 }
1960
1961 public LSL_Types.Vector3 llGetGeometricCenter()
1962 {
1963 NotImplemented("llGetGeometricCenter");
1964 return new LSL_Types.Vector3();
1965 }
1966
1967 public void llGetPrimitiveParams()
1968 {
1969 NotImplemented("llGetPrimitiveParams");
1970 }
1971
1037 public string llIntegerToBase64(int number) 1972 public string llIntegerToBase64(int number)
1038 { 1973 {
1039 NotImplemented("llIntegerToBase64"); return ""; 1974 NotImplemented("llIntegerToBase64");
1975 return "";
1040 } 1976 }
1977
1041 public int llBase64ToInteger(string str) 1978 public int llBase64ToInteger(string str)
1042 { 1979 {
1043 NotImplemented("llBase64ToInteger"); return 0; 1980 NotImplemented("llBase64ToInteger");
1981 return 0;
1044 } 1982 }
1045 1983
1046 public double llGetGMTclock() 1984 public double llGetGMTclock()
@@ -1050,34 +1988,95 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1050 1988
1051 public string llGetSimulatorHostname() 1989 public string llGetSimulatorHostname()
1052 { 1990 {
1053 return System.Environment.MachineName; 1991 return Environment.MachineName;
1054 } 1992 }
1055 1993
1056 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } 1994 public void llSetLocalRot(LSL_Types.Quaternion rot)
1057 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } 1995 {
1058 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } 1996 NotImplemented("llSetLocalRot");
1997 }
1059 1998
1060 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } 1999 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
2000 {
2001 NotImplemented("llParseStringKeepNulls");
2002 return new List<string>();
2003 }
1061 2004
1062 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } 2005 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
2006 LSL_Types.Quaternion rot, int param)
2007 {
2008 NotImplemented("llRezAtRoot");
2009 }
1063 2010
1064 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } 2011 public int llGetObjectPermMask(int mask)
1065 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } 2012 {
1066 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } 2013 NotImplemented("llGetObjectPermMask");
1067 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } 2014 return 0;
1068 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } 2015 }
1069 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } 2016
1070 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } 2017 public void llSetObjectPermMask(int mask, int value)
1071 public void llListReplaceList() { NotImplemented("llListReplaceList"); } 2018 {
2019 NotImplemented("llSetObjectPermMask");
2020 }
2021
2022 public void llGetInventoryPermMask(string item, int mask)
2023 {
2024 NotImplemented("llGetInventoryPermMask");
2025 }
2026
2027 public void llSetInventoryPermMask(string item, int mask, int value)
2028 {
2029 NotImplemented("llSetInventoryPermMask");
2030 }
2031
2032 public string llGetInventoryCreator(string item)
2033 {
2034 NotImplemented("llGetInventoryCreator");
2035 return "";
2036 }
2037
2038 public void llOwnerSay(string msg)
2039 {
2040 NotImplemented("llOwnerSay");
2041 }
2042
2043 public void llRequestSimulatorData(string simulator, int data)
2044 {
2045 NotImplemented("llRequestSimulatorData");
2046 }
2047
2048 public void llForceMouselook(int mouselook)
2049 {
2050 NotImplemented("llForceMouselook");
2051 }
2052
2053 public double llGetObjectMass(string id)
2054 {
2055 NotImplemented("llGetObjectMass");
2056 return 0;
2057 }
2058
2059 public void llListReplaceList()
2060 {
2061 NotImplemented("llListReplaceList");
2062 }
1072 2063
1073 public void llLoadURL(string avatar_id, string message, string url) 2064 public void llLoadURL(string avatar_id, string message, string url)
1074 { 2065 {
1075 LLUUID avatarId = new LLUUID(avatar_id); 2066 LLUUID avatarId = new LLUUID(avatar_id);
1076 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); 2067 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message,
2068 url);
2069 }
2070
2071 public void llParcelMediaCommandList(List<string> commandList)
2072 {
2073 NotImplemented("llParcelMediaCommandList");
1077 } 2074 }
1078 2075
1079 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } 2076 public void llParcelMediaQuery()
1080 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } 2077 {
2078 NotImplemented("llParcelMediaQuery");
2079 }
1081 2080
1082 public int llModPow(int a, int b, int c) 2081 public int llModPow(int a, int b, int c)
1083 { 2082 {
@@ -1086,13 +2085,38 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1086 return Convert.ToInt32(tmp); 2085 return Convert.ToInt32(tmp);
1087 } 2086 }
1088 2087
1089 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } 2088 public int llGetInventoryType(string name)
2089 {
2090 NotImplemented("llGetInventoryType");
2091 return 0;
2092 }
2093
2094 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
2095 {
2096 NotImplemented("llSetPayPrice");
2097 }
2098
2099 public LSL_Types.Vector3 llGetCameraPos()
2100 {
2101 NotImplemented("llGetCameraPos");
2102 return new LSL_Types.Vector3();
2103 }
2104
2105 public LSL_Types.Quaternion llGetCameraRot()
2106 {
2107 NotImplemented("llGetCameraRot");
2108 return new LSL_Types.Quaternion();
2109 }
1090 2110
1091 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } 2111 public void llSetPrimURL()
1092 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } 2112 {
1093 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } 2113 NotImplemented("llSetPrimURL");
1094 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } 2114 }
1095 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } 2115
2116 public void llRefreshPrimURL()
2117 {
2118 NotImplemented("llRefreshPrimURL");
2119 }
1096 2120
1097 public string llEscapeURL(string url) 2121 public string llEscapeURL(string url)
1098 { 2122 {
@@ -1117,21 +2141,60 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1117 return "llUnescapeURL: " + ex.ToString(); 2141 return "llUnescapeURL: " + ex.ToString();
1118 } 2142 }
1119 } 2143 }
1120 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } 2144
1121 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } 2145 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at)
1122 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } 2146 {
1123 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } 2147 NotImplemented("llMapDestination");
1124 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } 2148 }
1125 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } 2149
1126 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } 2150 public void llAddToLandBanList(string avatar, double hours)
2151 {
2152 NotImplemented("llAddToLandBanList");
2153 }
2154
2155 public void llRemoveFromLandPassList(string avatar)
2156 {
2157 NotImplemented("llRemoveFromLandPassList");
2158 }
2159
2160 public void llRemoveFromLandBanList(string avatar)
2161 {
2162 NotImplemented("llRemoveFromLandBanList");
2163 }
2164
2165 public void llSetCameraParams(List<string> rules)
2166 {
2167 NotImplemented("llSetCameraParams");
2168 }
2169
2170 public void llClearCameraParams()
2171 {
2172 NotImplemented("llClearCameraParams");
2173 }
2174
2175 public double llListStatistics(int operation, List<string> src)
2176 {
2177 NotImplemented("llListStatistics");
2178 return 0;
2179 }
1127 2180
1128 public int llGetUnixTime() 2181 public int llGetUnixTime()
1129 { 2182 {
1130 return Util.UnixTimeSinceEpoch(); 2183 return Util.UnixTimeSinceEpoch();
1131 } 2184 }
1132 2185
1133 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } 2186 public int llGetParcelFlags(LSL_Types.Vector3 pos)
1134 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } 2187 {
2188 NotImplemented("llGetParcelFlags");
2189 return 0;
2190 }
2191
2192 public int llGetRegionFlags()
2193 {
2194 NotImplemented("llGetRegionFlags");
2195 return 0;
2196 }
2197
1135 public string llXorBase64StringsCorrect(string str1, string str2) 2198 public string llXorBase64StringsCorrect(string str1, string str2)
1136 { 2199 {
1137 string ret = ""; 2200 string ret = "";
@@ -1148,27 +2211,64 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1148 } 2211 }
1149 return llStringToBase64(ret); 2212 return llStringToBase64(ret);
1150 } 2213 }
2214
1151 public void llHTTPRequest(string url, List<string> parameters, string body) 2215 public void llHTTPRequest(string url, List<string> parameters, string body)
1152 { 2216 {
1153 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); 2217 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body);
1154 } 2218 }
1155 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } 2219
1156 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } 2220 public void llResetLandBanList()
1157 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } 2221 {
1158 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } 2222 NotImplemented("llResetLandBanList");
1159 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } 2223 }
1160 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } 2224
1161 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } 2225 public void llResetLandPassList()
2226 {
2227 NotImplemented("llResetLandPassList");
2228 }
2229
2230 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide)
2231 {
2232 NotImplemented("llGetParcelPrimCount");
2233 return 0;
2234 }
2235
2236 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos)
2237 {
2238 NotImplemented("llGetParcelPrimOwners");
2239 return new List<string>();
2240 }
2241
2242 public int llGetObjectPrimCount(string object_id)
2243 {
2244 NotImplemented("llGetObjectPrimCount");
2245 return 0;
2246 }
2247
2248 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide)
2249 {
2250 NotImplemented("llGetParcelMaxPrims");
2251 return 0;
2252 }
2253
2254 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param)
2255 {
2256 NotImplemented("llGetParcelDetails");
2257 return new List<string>();
2258 }
1162 2259
1163 // 2260 //
1164 // OpenSim functions 2261 // OpenSim functions
1165 // 2262 //
1166 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) 2263 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
2264 int timer)
1167 { 2265 {
1168 if (dynamicID == "") 2266 if (dynamicID == "")
1169 { 2267 {
1170 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); 2268 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
1171 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer); 2269 LLUUID createdTexture =
2270 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
2271 extraParams, timer);
1172 return createdTexture.ToStringHyphenated(); 2272 return createdTexture.ToStringHyphenated();
1173 } 2273 }
1174 else 2274 else
@@ -1184,6 +2284,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
1184 if (throwErrorOnNotImplemented) 2284 if (throwErrorOnNotImplemented)
1185 throw new NotImplementedException("Command not implemented: " + Command); 2285 throw new NotImplementedException("Command not implemented: " + Command);
1186 } 2286 }
1187
1188 } 2287 }
1189} 2288} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs
index 44ed123..1847e87 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine 33namespace OpenSim.Grid.ScriptEngine.DotNetEngine
37{ 34{
@@ -39,7 +36,7 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 8ee005a..31d090f 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -27,13 +27,12 @@
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;
36using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; 34using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
35using OpenSim.Region.Environment.Scenes.Scripting;
37 36
38namespace OpenSim.Grid.ScriptEngine.DotNetEngine 37namespace OpenSim.Grid.ScriptEngine.DotNetEngine
39{ 38{
@@ -42,25 +41,30 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index 13979ba..303bddb 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine 36namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
index e1e025c..a0ac023 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Grid.ScriptEngine.DotNetEngine")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.DotNetEngine")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Grid.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/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 5ec77f3..6373d3c 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine 35namespace OpenSim.Grid.ScriptEngine.DotNetEngine
40{ 36{
@@ -42,17 +38,16 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.ScriptEngine.DotNetEngine
130 121
131 #endregion 122 #endregion
132 } 123 }
133} 124} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
index 988230f..2149bf0 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Grid/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;
37using OpenSim.Region.Environment.Scenes; 34using System.Threading;
38using OpenSim.Region.Environment.Scenes.Scripting; 35using libsecondlife;
39using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; 36using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler;
40using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; 37using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
41using OpenSim.Region.ScriptEngine.Common; 38using OpenSim.Region.Environment.Scenes;
42using libsecondlife;
43
44 39
45namespace OpenSim.Grid.ScriptEngine.DotNetEngine 40namespace OpenSim.Grid.ScriptEngine.DotNetEngine
46{ 41{
@@ -53,16 +48,19 @@ namespace OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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.Grid.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/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
index 0498ef3..8a8c96d 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
+++ b/OpenSim/Grid/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.Grid.ScriptEngine.DotNetEngine 34namespace OpenSim.Grid.ScriptEngine.DotNetEngine
38{ 35{
@@ -40,26 +37,26 @@ namespace OpenSim.Grid.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);
65 62
@@ -67,7 +64,6 @@ namespace OpenSim.Grid.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
diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs
index 7fc9a53..e049fd7 100644
--- a/OpenSim/Grid/ScriptServer/Application.cs
+++ b/OpenSim/Grid/ScriptServer/Application.cs
@@ -26,25 +26,23 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
30using System.Text;
31 29
32namespace OpenSim.Grid.ScriptServer 30namespace OpenSim.Grid.ScriptServer
33{ 31{
34 class OpenScript_Main 32 internal class OpenScript_Main
35 { 33 {
36
37 public static ScriptServerMain SE; 34 public static ScriptServerMain SE;
38 35
39 static void Main(string[] args) 36 private static void Main(string[] args)
40 { 37 {
41 // Application is starting 38 // Application is starting
42 SE = new ScriptServerMain(); 39 SE = new ScriptServerMain();
43 40
44 System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 41 AppDomain.CurrentDomain.UnhandledException +=
42 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
45 } 43 }
46 44
47 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 45 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
48 { 46 {
49 Console.WriteLine(""); 47 Console.WriteLine("");
50 Console.WriteLine("APPLICATION EXCEPTION DETECTED"); 48 Console.WriteLine("APPLICATION EXCEPTION DETECTED");
@@ -53,6 +51,5 @@ namespace OpenSim.Grid.ScriptServer
53 Console.WriteLine("Exception:"); 51 Console.WriteLine("Exception:");
54 Console.WriteLine(e.ExceptionObject.ToString()); 52 Console.WriteLine(e.ExceptionObject.ToString());
55 } 53 }
56
57 } 54 }
58} 55} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
index 63f40d4..2886ec7 100644
--- a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/ScriptServer/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.Grid.ScriptServer")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Grid.ScriptServer")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Grid.ScriptServer")]
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("b6861b87-5203-4040-b756-fd4774932f82")] 24
25[assembly : Guid("b6861b87-5203-4040-b756-fd4774932f82")]
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/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
index b18bda2..cb6734f 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Grid.ScriptServer 29namespace OpenSim.Grid.ScriptServer
34{ 30{
35 public abstract class RegionBase 31 public abstract class RegionBase
@@ -73,42 +69,176 @@ namespace OpenSim.Grid.ScriptServer
73 public event DefaultDelegate onobject_rez; 69 public event DefaultDelegate onobject_rez;
74 public event DefaultDelegate onremote_data; 70 public event DefaultDelegate onremote_data;
75 public event DefaultDelegate onhttp_response; 71 public event DefaultDelegate onhttp_response;
76 72
77 73
78 public void ScriptRez() { onScriptRez(); } 74 public void ScriptRez()
79 public void state_entry() { onstate_entry(); } 75 {
80 public void state_exit() { onstate_exit(); } 76 onScriptRez();
81 public void touch_start() { ontouch_start(); } 77 }
82 public void touch() { ontouch(); } 78
83 public void touch_end() { ontouch_end(); } 79 public void state_entry()
84 public void collision_start() { oncollision_start(); } 80 {
85 public void collision() { oncollision(); } 81 onstate_entry();
86 public void collision_end() { oncollision_end(); } 82 }
87 public void land_collision_start() { onland_collision_start(); } 83
88 public void land_collision() { onland_collision(); } 84 public void state_exit()
89 public void land_collision_end() { onland_collision_end(); } 85 {
90 public void timer() { ontimer(); } 86 onstate_exit();
91 public void listen() { onlisten(); } 87 }
92 public void on_rez() { onon_rez(); } 88
93 public void sensor() { onsensor(); } 89 public void touch_start()
94 public void no_sensor() { onno_sensor(); } 90 {
95 public void control() { oncontrol(); } 91 ontouch_start();
96 public void money() { onmoney(); } 92 }
97 public void email() { onemail(); } 93
98 public void at_target() { onat_target(); } 94 public void touch()
99 public void not_at_target() { onnot_at_target(); } 95 {
100 public void at_rot_target() { onat_rot_target(); } 96 ontouch();
101 public void not_at_rot_target() { onnot_at_rot_target(); } 97 }
102 public void run_time_permissions() { onrun_time_permissions(); } 98
103 public void changed() { onchanged(); } 99 public void touch_end()
104 public void attach() { onattach(); } 100 {
105 public void dataserver() { ondataserver(); } 101 ontouch_end();
106 public void link_message() { onlink_message(); } 102 }
107 public void moving_start() { onmoving_start(); } 103
108 public void moving_end() { onmoving_end(); } 104 public void collision_start()
109 public void object_rez() { onobject_rez(); } 105 {
110 public void remote_data() { onremote_data(); } 106 oncollision_start();
111 public void http_response() { onhttp_response(); } 107 }
112 108
109 public void collision()
110 {
111 oncollision();
112 }
113
114 public void collision_end()
115 {
116 oncollision_end();
117 }
118
119 public void land_collision_start()
120 {
121 onland_collision_start();
122 }
123
124 public void land_collision()
125 {
126 onland_collision();
127 }
128
129 public void land_collision_end()
130 {
131 onland_collision_end();
132 }
133
134 public void timer()
135 {
136 ontimer();
137 }
138
139 public void listen()
140 {
141 onlisten();
142 }
143
144 public void on_rez()
145 {
146 onon_rez();
147 }
148
149 public void sensor()
150 {
151 onsensor();
152 }
153
154 public void no_sensor()
155 {
156 onno_sensor();
157 }
158
159 public void control()
160 {
161 oncontrol();
162 }
163
164 public void money()
165 {
166 onmoney();
167 }
168
169 public void email()
170 {
171 onemail();
172 }
173
174 public void at_target()
175 {
176 onat_target();
177 }
178
179 public void not_at_target()
180 {
181 onnot_at_target();
182 }
183
184 public void at_rot_target()
185 {
186 onat_rot_target();
187 }
188
189 public void not_at_rot_target()
190 {
191 onnot_at_rot_target();
192 }
193
194 public void run_time_permissions()
195 {
196 onrun_time_permissions();
197 }
198
199 public void changed()
200 {
201 onchanged();
202 }
203
204 public void attach()
205 {
206 onattach();
207 }
208
209 public void dataserver()
210 {
211 ondataserver();
212 }
213
214 public void link_message()
215 {
216 onlink_message();
217 }
218
219 public void moving_start()
220 {
221 onmoving_start();
222 }
223
224 public void moving_end()
225 {
226 onmoving_end();
227 }
228
229 public void object_rez()
230 {
231 onobject_rez();
232 }
233
234 public void remote_data()
235 {
236 onremote_data();
237 }
238
239 public void http_response()
240 {
241 onhttp_response();
242 }
113 } 243 }
114} 244} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
index fa13807..819a037 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
@@ -26,19 +26,17 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
33 30
34namespace OpenSim.Grid.ScriptServer 31namespace OpenSim.Grid.ScriptServer
35{ 32{
36 // Maintains connection and communication to a region 33 // Maintains connection and communication to a region
37 public class RegionConnectionManager: RegionBase 34 public class RegionConnectionManager : RegionBase
38 { 35 {
39 private LogBase m_log; 36 private LogBase m_log;
40 private ScriptServerMain m_ScriptServerMain; 37 private ScriptServerMain m_ScriptServerMain;
41 private object m_Connection; 38 private object m_Connection;
39
42 public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) 40 public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection)
43 { 41 {
44 m_ScriptServerMain = scm; 42 m_ScriptServerMain = scm;
@@ -56,8 +54,6 @@ namespace OpenSim.Grid.ScriptServer
56 54
57 // EVENT? DELIVER EVENT DIRECTLY TO SCRIPTENGINE 55 // EVENT? DELIVER EVENT DIRECTLY TO SCRIPTENGINE
58 touch_start(); 56 touch_start();
59
60 } 57 }
61
62 } 58 }
63} 59} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
index ac56fbe..45bf88d 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
@@ -25,9 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Text;
31using System.Threading; 29using System.Threading;
32using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
33 31
@@ -42,11 +40,13 @@ namespace OpenSim.Grid.ScriptServer
42 40
43 private LogBase m_log; 41 private LogBase m_log;
44 private ScriptServerMain m_ScriptServerMain; 42 private ScriptServerMain m_ScriptServerMain;
43
45 public RegionCommManager(ScriptServerMain scm, LogBase logger) 44 public RegionCommManager(ScriptServerMain scm, LogBase logger)
46 { 45 {
47 m_ScriptServerMain = scm; 46 m_ScriptServerMain = scm;
48 m_log = logger; 47 m_log = logger;
49 } 48 }
49
50 ~RegionCommManager() 50 ~RegionCommManager()
51 { 51 {
52 Stop(); 52 Stop();
@@ -64,6 +64,7 @@ namespace OpenSim.Grid.ScriptServer
64 listenThread.IsBackground = true; 64 listenThread.IsBackground = true;
65 listenThread.Start(); 65 listenThread.Start();
66 } 66 }
67
67 /// <summary> 68 /// <summary>
68 /// Stops listening for region requests 69 /// Stops listening for region requests
69 /// </summary> 70 /// </summary>
@@ -78,7 +79,9 @@ namespace OpenSim.Grid.ScriptServer
78 listenThread.Abort(); 79 listenThread.Abort();
79 listenThread.Join(1000); // Wait 1 second for thread to shut down 80 listenThread.Join(1000); // Wait 1 second for thread to shut down
80 } 81 }
81 catch { } 82 catch
83 {
84 }
82 listenThread = null; 85 listenThread = null;
83 } 86 }
84 } 87 }
@@ -97,6 +100,5 @@ namespace OpenSim.Grid.ScriptServer
97 // TODO: FAKING A CONNECTION 100 // TODO: FAKING A CONNECTION
98 Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); 101 Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null));
99 } 102 }
100
101 } 103 }
102} 104} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
index a259b1b..3dbd42d 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
@@ -121,5 +121,4 @@ namespace OpenSim.Grid.ScriptServer
121 return ret; 121 return ret;
122 } 122 }
123 } 123 }
124} 124} \ No newline at end of file
125
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
index 4ec2b35..7b49127 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.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 OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
33 31
34namespace OpenSim.Grid.ScriptServer 32namespace OpenSim.Grid.ScriptServer
@@ -46,10 +44,11 @@ namespace OpenSim.Grid.ScriptServer
46 m_ScriptServerMain = scm; 44 m_ScriptServerMain = scm;
47 m_log = logger; 45 m_log = logger;
48 ScriptEngineLoader = new ScriptEngineLoader(m_log); 46 ScriptEngineLoader = new ScriptEngineLoader(m_log);
49 47
50 // Temp - we should not load during initialize... Loading should be done later. 48 // Temp - we should not load during initialize... Loading should be done later.
51 LoadEngine("DotNetScriptEngine"); 49 LoadEngine("DotNetScriptEngine");
52 } 50 }
51
53 ~ScriptEngineManager() 52 ~ScriptEngineManager()
54 { 53 {
55 } 54 }
@@ -63,7 +62,5 @@ namespace OpenSim.Grid.ScriptServer
63 scriptEngines.Add(sei); 62 scriptEngines.Add(sei);
64 } 63 }
65 } 64 }
66
67
68 } 65 }
69} 66} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
index 82035ac..1749376 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
@@ -26,20 +26,17 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO; 29using System.IO;
33using OpenSim.Framework.Console;
34using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Console;
35 32
36namespace OpenSim.Grid.ScriptServer 33namespace OpenSim.Grid.ScriptServer
37{ 34{
38 public class ScriptServerMain : conscmd_callback 35 public class ScriptServerMain : conscmd_callback
39 { 36 {
40 private readonly string m_logFilename = ("region-console.log"); 37 private readonly string m_logFilename = ("region-console.log");
41 internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region 38 internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
42 internal ScriptEngineManager ScriptEngines; // Loads scriptengines 39 internal ScriptEngineManager ScriptEngines; // Loads scriptengines
43 private LogBase m_log; 40 private LogBase m_log;
44 41
45 public ScriptServerMain() 42 public ScriptServerMain()
@@ -48,7 +45,6 @@ namespace OpenSim.Grid.ScriptServer
48 45
49 RegionScriptDaemon = new RegionCommManager(this, m_log); 46 RegionScriptDaemon = new RegionCommManager(this, m_log);
50 ScriptEngines = new ScriptEngineManager(this, m_log); 47 ScriptEngines = new ScriptEngineManager(this, m_log);
51
52 } 48 }
53 49
54 ~ScriptServerMain() 50 ~ScriptServerMain()
@@ -68,9 +64,9 @@ namespace OpenSim.Grid.ScriptServer
68 public void RunCmd(string command, string[] cmdparams) 64 public void RunCmd(string command, string[] cmdparams)
69 { 65 {
70 } 66 }
67
71 public void Show(string ShowWhat) 68 public void Show(string ShowWhat)
72 { 69 {
73 } 70 }
74
75 } 71 }
76} 72} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 492f67f..779a72b 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -27,28 +27,23 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.IO; 30using System.IO;
32using System.Reflection; 31using OpenSim.Framework;
33using libsecondlife;
34using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
37using OpenSim.Framework;
38using OpenSim.Framework;
39 34
40namespace OpenSim.Grid.UserServer 35namespace OpenSim.Grid.UserServer
41{ 36{
42 /// <summary> 37 /// <summary>
43 /// </summary> 38 /// </summary>
44 public class OpenUser_Main : conscmd_callback 39 public class OpenUser_Main : conscmd_callback
45 { 40 {
46 private UserConfig Cfg; 41 private UserConfig Cfg;
47 42
48 public UserManager m_userManager; 43 public UserManager m_userManager;
49 public UserLoginService m_loginService; 44 public UserLoginService m_loginService;
50 45
51 LogBase m_console; 46 private LogBase m_console;
52 47
53 [STAThread] 48 [STAThread]
54 public static void Main(string[] args) 49 public static void Main(string[] args)
@@ -67,7 +62,8 @@ namespace OpenSim.Grid.UserServer
67 { 62 {
68 Directory.CreateDirectory(Util.logDir()); 63 Directory.CreateDirectory(Util.logDir());
69 } 64 }
70 m_console = new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); 65 m_console =
66 new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true);
71 MainLog.Instance = m_console; 67 MainLog.Instance = m_console;
72 } 68 }
73 69
@@ -83,7 +79,7 @@ namespace OpenSim.Grid.UserServer
83 79
84 public void Startup() 80 public void Startup()
85 { 81 {
86 this.Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 82 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
87 83
88 MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); 84 MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection");
89 m_userManager = new UserManager(); 85 m_userManager = new UserManager();
@@ -93,15 +89,16 @@ namespace OpenSim.Grid.UserServer
93 m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); 89 m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg);
94 90
95 MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); 91 MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
96 BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); 92 BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort);
97 93
98 httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); 94 httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
99 95
100 httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); 96 httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
101 httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); 97 httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
102 98
103 httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); 99 httpServer.AddStreamHandler(
104 100 new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
101
105 httpServer.Start(); 102 httpServer.Start();
106 m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); 103 m_console.Status("SERVER", "Userserver 0.4 - Startup complete");
107 } 104 }
@@ -126,7 +123,7 @@ namespace OpenSim.Grid.UserServer
126 123
127 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 124 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
128 125
129 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 126 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
130 break; 127 break;
131 } 128 }
132 } 129 }
@@ -178,4 +175,4 @@ namespace OpenSim.Grid.UserServer
178 { 175 {
179 } 176 }
180 } 177 }
181} 178} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
index 877f02f..079e05e 100644
--- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
@@ -1,24 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OGS-UserServer")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OGS-UserServer")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OGS-UserServer")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OGS-UserServer")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// 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
16// 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
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// 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
21[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] 24
25[assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices;
27// Build Number 31// Build Number
28// Revision 32// Revision
29// 33//
30[assembly: AssemblyVersion("1.0.0.0")] 34
31[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/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 1523f81..bbef4b2 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -30,12 +30,10 @@ using System;
30using System.Collections; 30using System.Collections;
31using System.Net; 31using System.Net;
32using Nwc.XmlRpc; 32using Nwc.XmlRpc;
33using OpenSim.Framework.Data;
34using OpenSim.Framework.UserManagement;
35using OpenSim.Framework;
36using OpenSim.Framework;
37using OpenSim.Framework; 33using OpenSim.Framework;
38using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Data;
36using OpenSim.Framework.UserManagement;
39 37
40namespace OpenSim.Grid.UserServer 38namespace OpenSim.Grid.UserServer
41{ 39{
@@ -58,18 +56,24 @@ namespace OpenSim.Grid.UserServer
58 { 56 {
59 // Load information from the gridserver 57 // Load information from the gridserver
60 RegionProfileData SimInfo = new RegionProfileData(); 58 RegionProfileData SimInfo = new RegionProfileData();
61 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 59 SimInfo =
60 SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL,
61 m_config.GridSendKey, m_config.GridRecvKey);
62 62
63 // Customise the response 63 // Customise the response
64 // Home Location 64 // Home Location
65 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + 65 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
66 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 66 (SimInfo.regionLocY*256).ToString() + "], " +
67 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 67 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
68 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
69 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
70 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
68 71
69 // Destination 72 // Destination
70 MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); 73 MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
74 SimInfo.regionLocY);
71 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); 75 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
72 response.SimPort = (Int32)SimInfo.serverPort; 76 response.SimPort = (Int32) SimInfo.serverPort;
73 response.RegionX = SimInfo.regionLocX; 77 response.RegionX = SimInfo.regionLocX;
74 response.RegionY = SimInfo.regionLocY; 78 response.RegionY = SimInfo.regionLocY;
75 79
@@ -87,7 +91,7 @@ namespace OpenSim.Grid.UserServer
87 SimParams["firstname"] = theUser.username; 91 SimParams["firstname"] = theUser.username;
88 SimParams["lastname"] = theUser.surname; 92 SimParams["lastname"] = theUser.surname;
89 SimParams["agent_id"] = theUser.UUID.ToString(); 93 SimParams["agent_id"] = theUser.UUID.ToString();
90 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 94 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
91 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 95 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
92 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 96 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
93 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 97 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
@@ -107,21 +111,20 @@ namespace OpenSim.Grid.UserServer
107 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 111 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
108 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 112 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
109 } 113 }
110 catch( WebException e ) 114 catch (WebException e)
111 { 115 {
112 switch( e.Status ) 116 switch (e.Status)
113 { 117 {
114 case WebExceptionStatus.Timeout: 118 case WebExceptionStatus.Timeout:
115 //TODO: Send him to nearby or default region instead 119 //TODO: Send him to nearby or default region instead
116 MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); 120 MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI +
121 ")");
117 break; 122 break;
118 123
119 default: 124 default:
120 throw; 125 throw;
121 } 126 }
122 } 127 }
123 } 128 }
124 } 129 }
125} 130} \ No newline at end of file
126
127
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 2b2bf72..96cdfb3 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -27,12 +27,10 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Net; 30using libsecondlife;
31using Nwc.XmlRpc; 31using Nwc.XmlRpc;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.UserManagement; 33using OpenSim.Framework.UserManagement;
34using OpenSim.Framework;
35using libsecondlife;
36 34
37namespace OpenSim.Grid.UserServer 35namespace OpenSim.Grid.UserServer
38{ 36{
@@ -118,11 +116,11 @@ namespace OpenSim.Grid.UserServer
118 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) 116 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
119 { 117 {
120 XmlRpcResponse response = new XmlRpcResponse(); 118 XmlRpcResponse response = new XmlRpcResponse();
121 Hashtable requestData = (Hashtable)request.Params[0]; 119 Hashtable requestData = (Hashtable) request.Params[0];
122 UserProfileData userProfile; 120 UserProfileData userProfile;
123 if (requestData.Contains("avatar_name")) 121 if (requestData.Contains("avatar_name"))
124 { 122 {
125 userProfile = GetUserProfile((string)requestData["avatar_name"]); 123 userProfile = GetUserProfile((string) requestData["avatar_name"]);
126 if (userProfile == null) 124 if (userProfile == null)
127 { 125 {
128 return CreateUnknownUserErrorResponse(); 126 return CreateUnknownUserErrorResponse();
@@ -139,12 +137,12 @@ namespace OpenSim.Grid.UserServer
139 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) 137 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request)
140 { 138 {
141 XmlRpcResponse response = new XmlRpcResponse(); 139 XmlRpcResponse response = new XmlRpcResponse();
142 Hashtable requestData = (Hashtable)request.Params[0]; 140 Hashtable requestData = (Hashtable) request.Params[0];
143 UserProfileData userProfile; 141 UserProfileData userProfile;
144 System.Console.WriteLine("METHOD BY UUID CALLED"); 142 Console.WriteLine("METHOD BY UUID CALLED");
145 if (requestData.Contains("avatar_uuid")) 143 if (requestData.Contains("avatar_uuid"))
146 { 144 {
147 userProfile = GetUserProfile((LLUUID)(string)requestData["avatar_uuid"]); 145 userProfile = GetUserProfile((LLUUID) (string) requestData["avatar_uuid"]);
148 if (userProfile == null) 146 if (userProfile == null)
149 { 147 {
150 return CreateUnknownUserErrorResponse(); 148 return CreateUnknownUserErrorResponse();
@@ -158,6 +156,7 @@ namespace OpenSim.Grid.UserServer
158 156
159 return ProfileToXmlRPCResponse(userProfile); 157 return ProfileToXmlRPCResponse(userProfile);
160 } 158 }
159
161 #endregion 160 #endregion
162 161
163 public override UserProfileData SetupMasterUser(string firstName, string lastName) 162 public override UserProfileData SetupMasterUser(string firstName, string lastName)
@@ -170,4 +169,4 @@ namespace OpenSim.Grid.UserServer
170 throw new Exception("The method or operation is not implemented."); 169 throw new Exception("The method or operation is not implemented.");
171 } 170 }
172 } 171 }
173} 172} \ No newline at end of file