aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-01-23 02:28:27 +0000
committerJustin Clark-Casey (justincc)2013-01-23 02:36:43 +0000
commitcf168194e5968c1fab33266bdbb57465f303860b (patch)
tree7fbf7f668bd48a9831df7eefdf47c09baa47a522 /OpenSim/Region/ScriptEngine/Shared/CodeTools
parentAdd co-op termination regression test for infinite recursive manual call on e... (diff)
downloadopensim-SC_OLD-cf168194e5968c1fab33266bdbb57465f303860b.zip
opensim-SC_OLD-cf168194e5968c1fab33266bdbb57465f303860b.tar.gz
opensim-SC_OLD-cf168194e5968c1fab33266bdbb57465f303860b.tar.bz2
opensim-SC_OLD-cf168194e5968c1fab33266bdbb57465f303860b.tar.xz
If ScriptStopStrategy hasn't been set to co-op in [XEngine] config, then continue to generate C# that is functionality identical to historical generation
This is to eliminate disruption until co-op termination has been well-tested. In non co-op mode, XEngine will continue to load DLLs of the existing Script class and the new XEngineScript class. Moving to co-op mode still requires existing script DLL deletion to force recompilation, either manually or by setting DeleteScriptsOnStartup = true for one run. This change also means that scripts which fail to initialize do not still show up as running scripts.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs30
1 files changed, 18 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 7432202..002e852 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -416,16 +416,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
416 case enumCompileType.cs: 416 case enumCompileType.cs:
417 case enumCompileType.lsl: 417 case enumCompileType.lsl:
418 compileScript = CreateCSCompilerScript( 418 compileScript = CreateCSCompilerScript(
419 compileScript, m_scriptEngine.ScriptBaseClassName, m_scriptEngine.ScriptBaseClassParameters); 419 compileScript,
420 m_scriptEngine.ScriptClassName,
421 m_scriptEngine.ScriptBaseClassName,
422 m_scriptEngine.ScriptBaseClassParameters);
420 break; 423 break;
421 case enumCompileType.vb: 424 case enumCompileType.vb:
422 compileScript = CreateVBCompilerScript(compileScript, m_scriptEngine.ScriptBaseClassName); 425 compileScript = CreateVBCompilerScript(
426 compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName);
423 break; 427 break;
424// case enumCompileType.js: 428// case enumCompileType.js:
425// compileScript = CreateJSCompilerScript(compileScript, m_scriptEngine.ScriptBaseClassName); 429// compileScript = CreateJSCompilerScript(compileScript, m_scriptEngine.ScriptBaseClassName);
426// break; 430// break;
427 case enumCompileType.yp: 431 case enumCompileType.yp:
428 compileScript = CreateYPCompilerScript(compileScript, m_scriptEngine.ScriptBaseClassName); 432 compileScript = CreateYPCompilerScript(
433 compileScript, m_scriptEngine.ScriptClassName,m_scriptEngine.ScriptBaseClassName);
429 break; 434 break;
430 } 435 }
431 436
@@ -457,7 +462,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
457// } 462// }
458 463
459 private static string CreateCSCompilerScript( 464 private static string CreateCSCompilerScript(
460 string compileScript, string baseClassName, ParameterInfo[] constructorParameters) 465 string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters)
461 { 466 {
462 compileScript = string.Format( 467 compileScript = string.Format(
463@"using OpenSim.Region.ScriptEngine.Shared; 468@"using OpenSim.Region.ScriptEngine.Shared;
@@ -465,12 +470,13 @@ using System.Collections.Generic;
465 470
466namespace SecondLife 471namespace SecondLife
467{{ 472{{
468 public class Script : {0} 473 public class {0} : {1}
469 {{ 474 {{
470 public Script({1}) : base({2}) {{}} 475 public {0}({2}) : base({3}) {{}}
471{3} 476{4}
472 }} 477 }}
473}}", 478}}",
479 className,
474 baseClassName, 480 baseClassName,
475 constructorParameters != null 481 constructorParameters != null
476 ? string.Join(", ", Array.ConvertAll<ParameterInfo, string>(constructorParameters, pi => pi.ToString())) 482 ? string.Join(", ", Array.ConvertAll<ParameterInfo, string>(constructorParameters, pi => pi.ToString()))
@@ -483,28 +489,28 @@ namespace SecondLife
483 return compileScript; 489 return compileScript;
484 } 490 }
485 491
486 private static string CreateYPCompilerScript(string compileScript, string baseClassName) 492 private static string CreateYPCompilerScript(string compileScript, string className, string baseClassName)
487 { 493 {
488 compileScript = String.Empty + 494 compileScript = String.Empty +
489 "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " + 495 "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " +
490 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + 496 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
491 String.Empty + "namespace SecondLife { " + 497 String.Empty + "namespace SecondLife { " +
492 String.Empty + "public class Script : " + baseClassName + " { \r\n" + 498 String.Empty + "public class " + className + " : " + baseClassName + " { \r\n" +
493 //@"public Script() { } " + 499 //@"public Script() { } " +
494 @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " + 500 @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " +
495 @"public Script() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " + 501 @"public " + className + "() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " +
496 compileScript + 502 compileScript +
497 "} }\r\n"; 503 "} }\r\n";
498 504
499 return compileScript; 505 return compileScript;
500 } 506 }
501 507
502 private static string CreateVBCompilerScript(string compileScript, string baseClassName) 508 private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName)
503 { 509 {
504 compileScript = String.Empty + 510 compileScript = String.Empty +
505 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + 511 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
506 String.Empty + "NameSpace SecondLife:" + 512 String.Empty + "NameSpace SecondLife:" +
507 String.Empty + "Public Class Script: Inherits " + baseClassName + 513 String.Empty + "Public Class " + className + ": Inherits " + baseClassName +
508 "\r\nPublic Sub New()\r\nEnd Sub: " + 514 "\r\nPublic Sub New()\r\nEnd Sub: " +
509 compileScript + 515 compileScript +
510 ":End Class :End Namespace\r\n"; 516 ":End Class :End Namespace\r\n";