diff options
author | Tedd Hansen | 2007-08-18 19:54:04 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-08-18 19:54:04 +0000 |
commit | 1d41fd4984308a4b811f40aca18a90a79f243020 (patch) | |
tree | 8752672490125f9809e3801088a7a53b74103432 /OpenSim/Region | |
parent | Moved LSL_BuiltIn_Commands_Interface.cs to a separate library (OpenSim.Region... (diff) | |
download | opensim-SC_OLD-1d41fd4984308a4b811f40aca18a90a79f243020.zip opensim-SC_OLD-1d41fd4984308a4b811f40aca18a90a79f243020.tar.gz opensim-SC_OLD-1d41fd4984308a4b811f40aca18a90a79f243020.tar.bz2 opensim-SC_OLD-1d41fd4984308a4b811f40aca18a90a79f243020.tar.xz |
Working on AppDomains. Scripting is now officially broken. :]
Diffstat (limited to '')
8 files changed, 64 insertions, 60 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 58ade0b..c56ff2f 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -34,6 +34,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
34 | { | 34 | { |
35 | public interface LSL_BuiltIn_Commands_Interface | 35 | public interface LSL_BuiltIn_Commands_Interface |
36 | { | 36 | { |
37 | string State(); | ||
38 | |||
37 | double llSin(double f); | 39 | double llSin(double f); |
38 | double llCos(double f); | 40 | double llCos(double f); |
39 | double llTan(double f); | 41 | double llTan(double f); |
diff --git a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..def3910 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
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 | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // 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 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 6e992be..4c2ceb0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -52,10 +52,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
52 | System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); | 52 | System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); |
53 | parameters.IncludeDebugInformation = true; | 53 | parameters.IncludeDebugInformation = true; |
54 | // Add all available assemblies | 54 | // Add all available assemblies |
55 | foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) | 55 | //foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) |
56 | { | 56 | //{ |
57 | parameters.ReferencedAssemblies.Add(asm.Location); | 57 | // Console.WriteLine("Adding assembly: " + asm.Location); |
58 | } | 58 | // parameters.ReferencedAssemblies.Add(asm.Location); |
59 | //} | ||
60 | |||
61 | parameters.ReferencedAssemblies.Add(this.GetType().Assembly.CodeBase); | ||
59 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); | 62 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); |
60 | parameters.GenerateExecutable = false; | 63 | parameters.GenerateExecutable = false; |
61 | parameters.OutputAssembly = OutFile; | 64 | parameters.OutputAssembly = OutFile; |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 2427cc2..81f8e2d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -228,7 +228,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
228 | 228 | ||
229 | // Add namespace, class name and inheritance | 229 | // Add namespace, class name and inheritance |
230 | Return = "namespace SecondLife {\r\n"; | 230 | Return = "namespace SecondLife {\r\n"; |
231 | Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; | 231 | Return += "[Serializable] public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; |
232 | Return += @"public Script() { }"+"\r\n"; | 232 | Return += @"public Script() { }"+"\r\n"; |
233 | Return += Script; | 233 | Return += Script; |
234 | Return += "} }\r\n"; | 234 | Return += "} }\r\n"; |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index bdae95d..eb3d871 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -7,21 +7,22 @@ using System.Threading; | |||
7 | 7 | ||
8 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 8 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
9 | { | 9 | { |
10 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface | 10 | [Serializable] |
11 | public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface | ||
11 | { | 12 | { |
12 | 13 | ||
13 | public LSL_BuiltIn_Commands m_LSL_Functions; | 14 | public LSL_BuiltIn_Commands_Interface m_LSL_Functions; |
14 | 15 | ||
15 | public LSL_BaseClass() | 16 | public LSL_BaseClass() |
16 | { | 17 | { |
17 | } | 18 | } |
18 | public string State | 19 | public string State() |
19 | { | 20 | { |
20 | get { return m_LSL_Functions.State; } | 21 | return m_LSL_Functions.State(); |
21 | } | 22 | } |
22 | 23 | ||
23 | 24 | ||
24 | public void Start(LSL_BuiltIn_Commands LSL_Functions) | 25 | public void Start(LSL_BuiltIn_Commands_Interface LSL_Functions) |
25 | { | 26 | { |
26 | m_LSL_Functions = LSL_Functions; | 27 | m_LSL_Functions = LSL_Functions; |
27 | 28 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 8c2e799..6401163 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -14,7 +14,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
14 | /// <summary> | 14 | /// <summary> |
15 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. | 15 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. |
16 | /// </summary> | 16 | /// </summary> |
17 | [Serializable] | ||
18 | public class LSL_BuiltIn_Commands: LSL_BuiltIn_Commands_Interface | 17 | public class LSL_BuiltIn_Commands: LSL_BuiltIn_Commands_Interface |
19 | { | 18 | { |
20 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 19 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); |
@@ -30,7 +29,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
30 | } | 29 | } |
31 | 30 | ||
32 | 31 | ||
33 | public string State = "default"; | 32 | private string m_state = "default"; |
33 | public string State() { | ||
34 | return m_state; | ||
35 | } | ||
34 | 36 | ||
35 | public Scene World | 37 | public Scene World |
36 | { | 38 | { |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/MarshalByRefType.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/MarshalByRefType.cs deleted file mode 100644 index 36bb146..0000000 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/MarshalByRefType.cs +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Threading; | ||
5 | |||
6 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | ||
7 | { | ||
8 | // Because this class is derived from MarshalByRefObject, a proxy | ||
9 | // to a MarshalByRefType object can be returned across an AppDomain | ||
10 | // boundary. | ||
11 | public class MarshalByRefType : MarshalByRefObject | ||
12 | { | ||
13 | // Call this method via a proxy. | ||
14 | public void SomeMethod(string callingDomainName) | ||
15 | { | ||
16 | // Get this AppDomain's settings and display some of them. | ||
17 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; | ||
18 | Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", | ||
19 | ads.ApplicationName, | ||
20 | ads.ApplicationBase, | ||
21 | ads.ConfigurationFile | ||
22 | ); | ||
23 | |||
24 | // Display the name of the calling AppDomain and the name | ||
25 | // of the second domain. | ||
26 | // NOTE: The application's thread has transitioned between | ||
27 | // AppDomains. | ||
28 | Console.WriteLine("Calling from '{0}' to '{1}'.", | ||
29 | callingDomainName, | ||
30 | Thread.GetDomain().FriendlyName | ||
31 | ); | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 1d2689d..2cbdfd3 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -65,6 +65,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
65 | 65 | ||
66 | 66 | ||
67 | // Object<string, Script<string, script>> | 67 | // Object<string, Script<string, script>> |
68 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. | ||
69 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | ||
68 | internal Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>(); | 70 | internal Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>(); |
69 | public Scene World | 71 | public Scene World |
70 | { | 72 | { |
@@ -221,23 +223,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
221 | /// <returns></returns> | 223 | /// <returns></returns> |
222 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host) | 224 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host) |
223 | { | 225 | { |
224 | //object[] ADargs = new object[] | ||
225 | // { | ||
226 | // this, | ||
227 | // host | ||
228 | // }; | ||
229 | 226 | ||
230 | ////LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CreateInstanceAndUnwrap(FileName, "SecondLife.Script"); | 227 | //LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CreateInstanceAndUnwrap(FileName, "SecondLife.Script"); |
231 | //Console.WriteLine("Base directory: " + AppDomain.CurrentDomain.BaseDirectory); | 228 | Console.WriteLine("Base directory: " + AppDomain.CurrentDomain.BaseDirectory); |
232 | 229 | ||
233 | //LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); | 230 | LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); |
234 | //Type mytype = mbrt.GetType(); | 231 | Type mytype = mbrt.GetType(); |
235 | 232 | ||
236 | //Console.WriteLine("is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); | 233 | Console.WriteLine("is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); |
237 | 234 | ||
238 | 235 | ||
239 | ////mbrt.Start(); | 236 | //mbrt.Start(); |
240 | //return mbrt; | 237 | return mbrt; |
241 | 238 | ||
242 | 239 | ||
243 | 240 | ||
@@ -301,11 +298,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
301 | Type type = Script.GetType(); | 298 | Type type = Script.GetType(); |
302 | 299 | ||
303 | 300 | ||
304 | m_scriptEngine.Log.Verbose("ScriptEngine", "Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); | 301 | m_scriptEngine.Log.Verbose("ScriptEngine", "Invoke: \"" + Script.State() + "_event_" + FunctionName + "\""); |
305 | 302 | ||
306 | try | 303 | try |
307 | { | 304 | { |
308 | type.InvokeMember(Script.State + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, Script, args); | 305 | type.InvokeMember(Script.State() + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, Script, args); |
309 | } | 306 | } |
310 | catch (Exception e) | 307 | catch (Exception e) |
311 | { | 308 | { |