aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
authorTedd Hansen2007-12-30 16:32:29 +0000
committerTedd Hansen2007-12-30 16:32:29 +0000
commit7ef09a12020f1665bcd4e99fd420d411d5f4d95d (patch)
tree6953b5ce873ee73d96bd9b4a404f15d151f61865 /OpenSim/Region/ScriptEngine/DotNetEngine
parent* re-applied AddNewPrim refactoring... third time now... (diff)
downloadopensim-SC_OLD-7ef09a12020f1665bcd4e99fd420d411d5f4d95d.zip
opensim-SC_OLD-7ef09a12020f1665bcd4e99fd420d411d5f4d95d.tar.gz
opensim-SC_OLD-7ef09a12020f1665bcd4e99fd420d411d5f4d95d.tar.bz2
opensim-SC_OLD-7ef09a12020f1665bcd4e99fd420d411d5f4d95d.tar.xz
Added comments to ScriptEngine classes that explains what their purpose is
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs11
6 files changed, 68 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 0623cc5..441c952 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -36,6 +36,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
36{ 36{
37 public class Compiler 37 public class Compiler
38 { 38 {
39
40 // * Uses "LSL2Converter" to convert LSL to C# if necessary.
41 // * Compiles C#-code into an assembly
42 // * Returns assembly name ready for AppDomain load.
43 //
44 // Assembly is compiled using LSL_BaseClass as base. Look at debug C# code file created when LSL script is compiled for full details.
45 //
46
39 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 47 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
40 private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); 48 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
41 private static UInt64 scriptCompileCounter = 0; 49 private static UInt64 scriptCompileCounter = 0;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index 2796b64..65db510 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -41,6 +41,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
41 //[Serializable] 41 //[Serializable]
42 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript 42 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
43 { 43 {
44
45 //
46 // Included as base for any LSL-script that is compiled.
47 // Any function added here will be accessible to the LSL script. But it must also be added to "LSL_BuiltIn_Commands_Interface" in "OpenSim.Region.ScriptEngine.Common" class.
48 //
49 // Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted.zxs
50 //
51
44 // Object never expires 52 // Object never expires
45 public override Object InitializeLifetimeService() 53 public override Object InitializeLifetimeService()
46 { 54 {
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 d5a31fb..e6a9fe2 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
@@ -47,6 +47,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
47 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status 47 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status
48 // 48 //
49 49
50 // Notes:
51 // * If any function here needs to execute a LSL event in the script, use instance of "EventQueueManager" in "ScriptEngine".
52 // * If any function here needs to do some more advanced stuff like waiting for IO callbacks or similar that takes a long time then use "llSetTimerEvent" function as example.
53 // There is a class called "LSLLongCmdHandler" that is used for long LSL commands.
54
55
50 /// <summary> 56 /// <summary>
51 /// Contains all LSL ll-functions. This class will be in Default AppDomain. 57 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
52 /// </summary> 58 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 8dfd908..ced5025 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -38,6 +38,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
38 [Serializable] 38 [Serializable]
39 internal class EventManager 39 internal class EventManager
40 { 40 {
41
42 //
43 // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine".
44 // This class needs a bit of explaining:
45 //
46 // This class it the link between an event inside OpenSim and the corresponding event in a user script being executed.
47 //
48 // For example when an user touches an object then the "myScriptEngine.World.EventManager.OnObjectGrab" event is fired inside OpenSim.
49 // We hook up to this event and queue a touch_start in EventQueueManager with the proper LSL parameters. It will then be delivered to the script by EventQueueManager.
50 // You can check debug C# dump of an LSL script if you need to verify what exact parameters are needed.
51 //
52
53
41 private ScriptEngine myScriptEngine; 54 private ScriptEngine myScriptEngine;
42 //public IScriptHost TEMP_OBJECT_ID; 55 //public IScriptHost TEMP_OBJECT_ID;
43 public EventManager(ScriptEngine _ScriptEngine) 56 public EventManager(ScriptEngine _ScriptEngine)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 2d0d69d..e2b11cc 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -44,6 +44,28 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
44 [Serializable] 44 [Serializable]
45 internal class EventQueueManager 45 internal class EventQueueManager
46 { 46 {
47
48 //
49 // Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine".
50 //
51 // Class purpose is to queue and execute functions that are received by "EventManager":
52 // - allowing "EventManager" to release its event thread immediately, thus not interrupting server execution.
53 // - allowing us to prioritize and control execution of script functions.
54 // Class can use multiple threads for simultaneous execution. Mutexes are used for thread safety.
55 //
56 // 1. Hold an execution queue for scripts
57 // 2. Use threads to process queue, each thread executes one script function on each pass.
58 // 3. Catch any script error and process it
59 //
60 //
61 // Notes:
62 // * Current execution load balancing is optimized for 1 thread, and can cause unfair execute balancing between scripts.
63 // Not noticeable unless server is under high load.
64 // * This class contains the number of threads used for script executions. Since we are not microthreading scripts yet,
65 // increase number of threads to allow more concurrent script executions in OpenSim.
66 //
67
68
47 /// <summary> 69 /// <summary>
48 /// List of threads processing event queue 70 /// List of threads processing event queue
49 /// </summary> 71 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index e211902..ac378ae 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -45,6 +45,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
45 /// Compiles them if necessary 45 /// Compiles them if necessary
46 /// Execute functions for EventQueueManager (Sends them to script on other AppDomain for execution) 46 /// Execute functions for EventQueueManager (Sends them to script on other AppDomain for execution)
47 /// </summary> 47 /// </summary>
48 ///
49
50 // This class is as close as you get to the script without being inside script class. It handles all the dirty work for other classes.
51 // * Keeps track of running scripts
52 // * Compiles script if necessary (through "Compiler")
53 // * Loads script (through "AppDomainManager" called from for example "EventQueueManager")
54 // * Executes functions inside script (called from for example "EventQueueManager" class)
55 // * Unloads script (through "AppDomainManager" called from for example "EventQueueManager")
56 // * Dedicated load/unload thread, and queues loading/unloading.
57 // This so that scripts starting or stopping will not slow down other theads or whole system.
58 //
48 [Serializable] 59 [Serializable]
49 public class ScriptManager 60 public class ScriptManager
50 { 61 {