aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler
diff options
context:
space:
mode:
authorTedd Hansen2008-02-02 04:35:08 +0000
committerTedd Hansen2008-02-02 04:35:08 +0000
commit7bd3ecfc2a98c978388768d259f0e6d479d76b85 (patch)
tree177a0d4875f8f8d71efdca9cc691c1e96795dc01 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler
parentAdd last entry "owner_uuid" back into regions table definition. (diff)
downloadopensim-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! ;)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs21
1 files changed, 12 insertions, 9 deletions
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;