diff options
author | Tedd Hansen | 2008-02-02 04:35:08 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-02-02 04:35:08 +0000 |
commit | 7bd3ecfc2a98c978388768d259f0e6d479d76b85 (patch) | |
tree | 177a0d4875f8f8d71efdca9cc691c1e96795dc01 | |
parent | Add last entry "owner_uuid" back into regions table definition. (diff) | |
download | opensim-SC-7bd3ecfc2a98c978388768d259f0e6d479d76b85.zip opensim-SC-7bd3ecfc2a98c978388768d259f0e6d479d76b85.tar.gz opensim-SC-7bd3ecfc2a98c978388768d259f0e6d479d76b85.tar.bz2 opensim-SC-7bd3ecfc2a98c978388768d259f0e6d479d76b85.tar.xz |
Bugfixes. Now it even reads configuration before it uses it! ;)
6 files changed, 32 insertions, 21 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 7d3f7b8..8934be2 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -455,9 +455,9 @@ namespace OpenSim | |||
455 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); | 455 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); |
456 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); | 456 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); |
457 | MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules"); | 457 | MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules"); |
458 | foreach (string module in m_scriptEngine.Split(';')) | 458 | foreach (string module in m_scriptEngine.Split(',')) |
459 | { | 459 | { |
460 | string mod = module.Trim(" \t\r\n".ToCharArray()); // Clean up name | 460 | string mod = module.Trim(" \t".ToCharArray()); // Clean up name |
461 | MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod); | 461 | MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod); |
462 | try | 462 | try |
463 | { | 463 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 53ef217..e346f68 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -112,9 +112,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
112 | { | 112 | { |
113 | m_scriptEngine = scriptEngine; | 113 | m_scriptEngine = scriptEngine; |
114 | } | 114 | } |
115 | public abstract void Initialize(); | ||
115 | public void Start() | 116 | public void Start() |
116 | { | 117 | { |
117 | ReadConfig(); | 118 | ReadConfig(); |
119 | Initialize(); | ||
118 | 120 | ||
119 | AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); | 121 | AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); |
120 | 122 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 2e0d1a3..6d8bfa8 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -67,10 +67,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
67 | private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); | 67 | private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); |
68 | private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); | 68 | private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); |
69 | 69 | ||
70 | private static UInt64 scriptCompileCounter = 0; | 70 | private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files |
71 | 71 | private static UInt64 scriptCompileCounter = 0; // And a counter | |
72 | private static int instanceID = new Random().Next(0, int.MaxValue); | ||
73 | // Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;) | ||
74 | 72 | ||
75 | public Common.ScriptEngineBase.ScriptEngine m_scriptEngine; | 73 | public Common.ScriptEngineBase.ScriptEngine m_scriptEngine; |
76 | public Compiler(Common.ScriptEngineBase.ScriptEngine scriptEngine) | 74 | public Compiler(Common.ScriptEngineBase.ScriptEngine scriptEngine) |
@@ -107,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
107 | LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl); | 105 | LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl); |
108 | 106 | ||
109 | // Allowed compilers | 107 | // Allowed compilers |
110 | string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb"); | 108 | string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl,cs,vb"); |
111 | AllowedCompilers.Clear(); | 109 | AllowedCompilers.Clear(); |
112 | 110 | ||
113 | #if DEBUG | 111 | #if DEBUG |
@@ -115,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
115 | #endif | 113 | #endif |
116 | 114 | ||
117 | 115 | ||
118 | foreach (string strl in allowComp.Split(';')) | 116 | foreach (string strl in allowComp.Split(',')) |
119 | { | 117 | { |
120 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); | 118 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); |
121 | if (!LanguageMapping.ContainsKey(strlan)) | 119 | if (!LanguageMapping.ContainsKey(strlan)) |
@@ -299,6 +297,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
299 | string OutFile = | 297 | string OutFile = |
300 | Path.Combine("ScriptEngines", | 298 | Path.Combine("ScriptEngines", |
301 | FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); | 299 | FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); |
300 | #if DEBUG | ||
301 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\"."); | ||
302 | #endif | ||
302 | try | 303 | try |
303 | { | 304 | { |
304 | File.Delete(OutFile); | 305 | File.Delete(OutFile); |
@@ -313,14 +314,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
313 | // DEBUG - write source to disk | 314 | // DEBUG - write source to disk |
314 | if (WriteScriptSourceToDebugFile) | 315 | if (WriteScriptSourceToDebugFile) |
315 | { | 316 | { |
317 | string srcFileName = FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext; | ||
316 | try | 318 | try |
317 | { | 319 | { |
318 | File.WriteAllText( | 320 | File.WriteAllText( |
319 | Path.Combine("ScriptEngines", FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext), | 321 | Path.Combine("ScriptEngines", srcFileName), |
320 | Script); | 322 | Script); |
321 | } | 323 | } |
322 | catch | 324 | catch (Exception ex) |
323 | { | 325 | { |
326 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); | ||
324 | } | 327 | } |
325 | } | 328 | } |
326 | 329 | ||
@@ -346,7 +349,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
346 | parameters.GenerateExecutable = false; | 349 | parameters.GenerateExecutable = false; |
347 | parameters.OutputAssembly = OutFile; | 350 | parameters.OutputAssembly = OutFile; |
348 | parameters.IncludeDebugInformation = CompileWithDebugInformation; | 351 | parameters.IncludeDebugInformation = CompileWithDebugInformation; |
349 | parameters.WarningLevel = 4; | 352 | parameters.WarningLevel = 1; // Should be 4? |
350 | parameters.TreatWarningsAsErrors = false; | 353 | parameters.TreatWarningsAsErrors = false; |
351 | 354 | ||
352 | CompilerResults results; | 355 | CompilerResults results; |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 2f90c16..4e20d95 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -43,6 +43,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
43 | base.m_scriptEngine = scriptEngine; | 43 | base.m_scriptEngine = scriptEngine; |
44 | 44 | ||
45 | } | 45 | } |
46 | private Compiler.LSL.Compiler LSLCompiler; | ||
47 | |||
48 | |||
49 | public override void Initialize() | ||
50 | { | ||
51 | // Create our compiler | ||
52 | LSLCompiler = new Compiler.LSL.Compiler(m_scriptEngine); | ||
53 | } | ||
46 | 54 | ||
47 | // KEEP TRACK OF SCRIPTS <int id, whatever script> | 55 | // KEEP TRACK OF SCRIPTS <int id, whatever script> |
48 | //internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); | 56 | //internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); |
@@ -50,17 +58,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
50 | // UNLOAD SCRIPT | 58 | // UNLOAD SCRIPT |
51 | // PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim | 59 | // PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim |
52 | 60 | ||
53 | private Compiler.LSL.Compiler LSLCompiler; | ||
54 | 61 | ||
55 | public override void _StartScript(uint localID, LLUUID itemID, string Script) | 62 | public override void _StartScript(uint localID, LLUUID itemID, string Script) |
56 | { | 63 | { |
57 | 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); |
58 | 65 | ||
59 | // First time start? Lets fire up our compiler... | ||
60 | if (LSLCompiler == null) | ||
61 | { | ||
62 | LSLCompiler = new Compiler.LSL.Compiler(m_scriptEngine); | ||
63 | } | ||
64 | 66 | ||
65 | //IScriptHost root = host.GetRoot(); | 67 | //IScriptHost root = host.GetRoot(); |
66 | 68 | ||
@@ -118,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
118 | catch (Exception e2) | 120 | catch (Exception e2) |
119 | { | 121 | { |
120 | 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()); |
121 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, | 123 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, |
122 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); | 124 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); |
123 | } | 125 | } |
124 | } | 126 | } |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs index 6664025..652c24c 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs | |||
@@ -155,5 +155,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | public override void Initialize() | ||
159 | { | ||
160 | |||
161 | } | ||
158 | } | 162 | } |
159 | } \ No newline at end of file | 163 | } \ No newline at end of file |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 495f4ce..7b2198b 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -116,10 +116,10 @@ shout_distance = 100 | |||
116 | ; ## | 116 | ; ## |
117 | ; These are region modules loaded into each region to provide script support | 117 | ; These are region modules loaded into each region to provide script support |
118 | ; Scripts may be everything from LSL or C# scripts put in prims to whole game systems that controls the whole grid. | 118 | ; Scripts may be everything from LSL or C# scripts put in prims to whole game systems that controls the whole grid. |
119 | ; You can load multiple modules by separating them with ;. | 119 | ; You can load multiple modules by separating them with a coma. |
120 | ; | 120 | ; |
121 | ; Example: | 121 | ; Example: |
122 | ;script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll;OpenSim.Region.ScriptEngine.RemoteServer.dll | 122 | ;script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll,OpenSim.Region.ScriptEngine.RemoteServer.dll |
123 | ; | 123 | ; |
124 | ; This is the current and most stable ScriptEngine: | 124 | ; This is the current and most stable ScriptEngine: |
125 | script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll | 125 | script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll |
@@ -222,7 +222,7 @@ DefaultCompileLanguage=lsl | |||
222 | 222 | ||
223 | ; Specify what compilers are allowed to be used | 223 | ; Specify what compilers are allowed to be used |
224 | ; Valid languages are: lsl, cs and vb | 224 | ; Valid languages are: lsl, cs and vb |
225 | AllowedCompilers=lsl;cs;vb | 225 | AllowedCompilers=lsl,cs,vb |
226 | 226 | ||
227 | ; Compile scripts with debugging | 227 | ; Compile scripts with debugging |
228 | ; Probably a thousand times slower, but gives you a line number when something goes wrong. | 228 | ; Probably a thousand times slower, but gives you a line number when something goes wrong. |