diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 101 |
1 files changed, 28 insertions, 73 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index f3b8e1d..20f9770 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -79,12 +79,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
79 | 79 | ||
80 | private List<string> m_warnings = new List<string>(); | 80 | private List<string> m_warnings = new List<string>(); |
81 | 81 | ||
82 | // private object m_syncy = new object(); | ||
83 | |||
84 | // private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); | ||
85 | // private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); | ||
86 | |||
87 | // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files | ||
88 | private static UInt64 scriptCompileCounter = 0; // And a counter | 82 | private static UInt64 scriptCompileCounter = 0; // And a counter |
89 | 83 | ||
90 | public IScriptEngine m_scriptEngine; | 84 | public IScriptEngine m_scriptEngine; |
@@ -251,23 +245,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
251 | } | 245 | } |
252 | } | 246 | } |
253 | 247 | ||
254 | ////private ICodeCompiler icc = codeProvider.CreateCompiler(); | ||
255 | //public string CompileFromFile(string LSOFileName) | ||
256 | //{ | ||
257 | // switch (Path.GetExtension(LSOFileName).ToLower()) | ||
258 | // { | ||
259 | // case ".txt": | ||
260 | // case ".lsl": | ||
261 | // Common.ScriptEngineBase.Shared.SendToDebug("Source code is LSL, converting to CS"); | ||
262 | // return CompileFromLSLText(File.ReadAllText(LSOFileName)); | ||
263 | // case ".cs": | ||
264 | // Common.ScriptEngineBase.Shared.SendToDebug("Source code is CS"); | ||
265 | // return CompileFromCSText(File.ReadAllText(LSOFileName)); | ||
266 | // default: | ||
267 | // throw new Exception("Unknown script type."); | ||
268 | // } | ||
269 | //} | ||
270 | |||
271 | public string GetCompilerOutput(string assetID) | 248 | public string GetCompilerOutput(string assetID) |
272 | { | 249 | { |
273 | return Path.Combine(ScriptEnginesPath, Path.Combine( | 250 | return Path.Combine(ScriptEnginesPath, Path.Combine( |
@@ -578,8 +555,6 @@ namespace SecondLife | |||
578 | switch (lang) | 555 | switch (lang) |
579 | { | 556 | { |
580 | case enumCompileType.vb: | 557 | case enumCompileType.vb: |
581 | // results = VBcodeProvider.CompileAssemblyFromSource( | ||
582 | // parameters, Script); | ||
583 | provider = CodeDomProvider.CreateProvider("VisualBasic"); | 558 | provider = CodeDomProvider.CreateProvider("VisualBasic"); |
584 | break; | 559 | break; |
585 | case enumCompileType.cs: | 560 | case enumCompileType.cs: |
@@ -594,56 +569,36 @@ namespace SecondLife | |||
594 | if(provider == null) | 569 | if(provider == null) |
595 | throw new Exception("Compiler failed to load "); | 570 | throw new Exception("Compiler failed to load "); |
596 | 571 | ||
572 | bool complete = false; | ||
573 | bool retried = false; | ||
597 | 574 | ||
598 | bool complete = false; | 575 | do |
599 | bool retried = false; | 576 | { |
600 | 577 | results = provider.CompileAssemblyFromSource( | |
601 | do | 578 | parameters, Script); |
579 | // Deal with an occasional segv in the compiler. | ||
580 | // Rarely, if ever, occurs twice in succession. | ||
581 | // Line # == 0 and no file name are indications that | ||
582 | // this is a native stack trace rather than a normal | ||
583 | // error log. | ||
584 | if (results.Errors.Count > 0) | ||
585 | { | ||
586 | if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) && | ||
587 | results.Errors[0].Line == 0) | ||
602 | { | 588 | { |
603 | // lock (CScodeProvider) | 589 | // System.Console.WriteLine("retrying failed compilation"); |
604 | // { | 590 | retried = true; |
605 | // results = CScodeProvider.CompileAssemblyFromSource( | 591 | } |
606 | // parameters, Script); | 592 | else |
607 | // } | 593 | { |
608 | 594 | complete = true; | |
609 | results = provider.CompileAssemblyFromSource( | 595 | } |
610 | parameters, Script); | 596 | } |
611 | // Deal with an occasional segv in the compiler. | 597 | else |
612 | // Rarely, if ever, occurs twice in succession. | 598 | { |
613 | // Line # == 0 and no file name are indications that | 599 | complete = true; |
614 | // this is a native stack trace rather than a normal | 600 | } |
615 | // error log. | 601 | } while (!complete); |
616 | if (results.Errors.Count > 0) | ||
617 | { | ||
618 | if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) && | ||
619 | results.Errors[0].Line == 0) | ||
620 | { | ||
621 | // System.Console.WriteLine("retrying failed compilation"); | ||
622 | retried = true; | ||
623 | } | ||
624 | else | ||
625 | { | ||
626 | complete = true; | ||
627 | } | ||
628 | } | ||
629 | else | ||
630 | { | ||
631 | complete = true; | ||
632 | } | ||
633 | } while (!complete); | ||
634 | // break; | ||
635 | // default: | ||
636 | // throw new Exception("Compiler is not able to recongnize " + | ||
637 | // "language type \"" + lang.ToString() + "\""); | ||
638 | // } | ||
639 | |||
640 | // foreach (Type type in results.CompiledAssembly.GetTypes()) | ||
641 | // { | ||
642 | // foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)) | ||
643 | // { | ||
644 | // m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name); | ||
645 | // } | ||
646 | // } | ||
647 | 602 | ||
648 | // | 603 | // |
649 | // WARNINGS AND ERRORS | 604 | // WARNINGS AND ERRORS |