aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs23
3 files changed, 28 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 3451cce..2f985e4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -40,7 +40,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
40{ 40{
41 public class Compiler 41 public class Compiler
42 { 42 {
43
44 // * Uses "LSL2Converter" to convert LSL to C# if necessary. 43 // * Uses "LSL2Converter" to convert LSL to C# if necessary.
45 // * Compiles C#-code into an assembly 44 // * Compiles C#-code into an assembly
46 // * Returns assembly name ready for AppDomain load. 45 // * Returns assembly name ready for AppDomain load.
@@ -113,7 +112,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
113 AllowedCompilers.Clear(); 112 AllowedCompilers.Clear();
114 113
115#if DEBUG 114#if DEBUG
116 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp); 115 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Allowed languages: " + allowComp);
117#endif 116#endif
118 117
119 118
@@ -122,18 +121,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
122 string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); 121 string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
123 if (!LanguageMapping.ContainsKey(strlan)) 122 if (!LanguageMapping.ContainsKey(strlan))
124 { 123 {
125 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); 124 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
126 } 125 }
127 else 126 else
128 { 127 {
129#if DEBUG 128#if DEBUG
130 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); 129 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
131#endif 130#endif
132 } 131 }
133 AllowedCompilers.Add(strlan, true); 132 AllowedCompilers.Add(strlan, true);
134 } 133 }
135 if (AllowedCompilers.Count == 0) 134 if (AllowedCompilers.Count == 0)
136 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); 135 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!");
137 136
138 // Default language 137 // Default language
139 string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); 138 string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower();
@@ -141,22 +140,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
141 // Is this language recognized at all? 140 // Is this language recognized at all?
142 if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) 141 if (!LanguageMapping.ContainsKey(defaultCompileLanguage))
143 { 142 {
144 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, 143 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " +
145 "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); 144 "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\".");
146 defaultCompileLanguage = "lsl"; 145 defaultCompileLanguage = "lsl";
147 } 146 }
148 147
149 // Is this language in allow-list? 148 // Is this language in allow-list?
150 if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) 149 if (!AllowedCompilers.ContainsKey(defaultCompileLanguage))
151 { 150 {
152 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, 151 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " +
153 "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); 152 "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!");
154 } 153 }
155 else 154 else
156 { 155 {
157#if DEBUG 156#if DEBUG
158 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, 157 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: " +
159 "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); 158 "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
160#endif 159#endif
161 // LANGUAGE IS IN ALLOW-LIST 160 // LANGUAGE IS IN ALLOW-LIST
162 DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage]; 161 DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage];
@@ -181,13 +180,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
181 } 180 }
182 catch (Exception ex) 181 catch (Exception ex)
183 { 182 {
184 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); 183 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString());
185 } 184 }
186 } 185 }
187 186
188 foreach (string file in Directory.GetFiles(ScriptEnginesPath)) 187 foreach (string file in Directory.GetFiles(ScriptEnginesPath))
189 { 188 {
190 //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "FILE FOUND: " + file); 189 //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: FILE FOUND: " + file);
191 190
192 if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || 191 if (file.ToLower().StartsWith(FilePrefix + "_compiled_") ||
193 file.ToLower().StartsWith(FilePrefix + "_source_")) 192 file.ToLower().StartsWith(FilePrefix + "_source_"))
@@ -198,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
198 } 197 }
199 catch (Exception ex) 198 catch (Exception ex)
200 { 199 {
201 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying delete old script file \"" + file + "\": " + ex.ToString()); 200 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying delete old script file \"" + file + "\": " + ex.ToString());
202 } 201 }
203 202
204 } 203 }
@@ -313,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
313 Path.Combine("ScriptEngines", 312 Path.Combine("ScriptEngines",
314 FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); 313 FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
315#if DEBUG 314#if DEBUG
316 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\"."); 315 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\".");
317#endif 316#endif
318 try 317 try
319 { 318 {
@@ -321,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
321 } 320 }
322 catch (Exception e) 321 catch (Exception e)
323 { 322 {
324 //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); 323 //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
325 throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); 324 throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
326 } 325 }
327 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); 326 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
@@ -338,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
338 } 337 }
339 catch (Exception ex) 338 catch (Exception ex)
340 { 339 {
341 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); 340 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString());
342 } 341 }
343 } 342 }
344 343
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 720f946..514c550 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
40 public override void Initialise(Scene scene, IConfigSource config) 40 public override void Initialise(Scene scene, IConfigSource config)
41 { 41 {
42 ConfigSource = config; 42 ConfigSource = config;
43 InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); 43 InitializeEngine(scene, config, true, GetScriptManager());
44 } 44 }
45 45
46 public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() 46 public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager()
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 61da6ef..c39d376 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -26,6 +26,7 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29
29using System; 30using System;
30using libsecondlife; 31using libsecondlife;
31using OpenSim.Framework; 32using OpenSim.Framework;
@@ -60,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
60 61
61 public override void _StartScript(uint localID, LLUUID itemID, string Script) 62 public override void _StartScript(uint localID, LLUUID itemID, string Script)
62 { 63 {
63 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); 64 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
64 65
65 66
66 //IScriptHost root = host.GetRoot(); 67 //IScriptHost root = host.GetRoot();
@@ -85,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
85 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); 86 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
86 87
87#if DEBUG 88#if DEBUG
88 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 89 m_scriptEngine.Log.Debug(String.Format("[" + m_scriptEngine.ScriptEngineName + "]: Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before));
89#endif 90#endif
90 91
91 CompiledScript.Source = Script; 92 CompiledScript.Source = Script;
@@ -106,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
106 } 107 }
107 catch (Exception e) 108 catch (Exception e)
108 { 109 {
109 //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); 110 //m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString());
110 try 111 try
111 { 112 {
112 // DISPLAY ERROR INWORLD 113 // DISPLAY ERROR INWORLD
@@ -118,9 +119,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
118 } 119 }
119 catch (Exception e2) 120 catch (Exception e2)
120 { 121 {
121 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString()); 122 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Error displaying error in-world: " + e2.ToString());
122 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, 123 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " +
123 "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); 124 "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
124 } 125 }
125 } 126 }
126 } 127 }
@@ -129,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
129 { 130 {
130 // Stop script 131 // Stop script
131#if DEBUG 132#if DEBUG
132 m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Stop script localID: " + localID + " LLUID: " + itemID.ToString()); 133 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Stop script localID: " + localID + " LLUID: " + itemID.ToString());
133#endif 134#endif
134 135
135 // Stop long command on script 136 // Stop long command on script
@@ -142,7 +143,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
142 // TEMP: First serialize it 143 // TEMP: First serialize it
143 //GetSerializedScript(localID, itemID); 144 //GetSerializedScript(localID, itemID);
144 145
145
146 try 146 try
147 { 147 {
148 // Get AppDomain 148 // Get AppDomain
@@ -156,10 +156,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
156 } 156 }
157 catch (Exception e) 157 catch (Exception e)
158 { 158 {
159 m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + 159 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
160 ": " + e.ToString()); 160 ": " + e.ToString());
161 } 161 }
162 } 162 }
163
164 } 163 }
165} \ No newline at end of file 164}