From d85774c101f5509672fc8d791fa3c923fc2071c9 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 12 Jul 2008 01:34:36 +0000 Subject: Patch #9142 (No mantis) Add a config option to OpenSim.ini to select between script compilers in the XEngine without recompile. Set UseNewCompiler=true in OpenSim.ini and try it out. Creates the ICodeConverter interface and adapts the new compiler to it. --- .../ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 82c7eda..7d7384e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -32,7 +32,7 @@ using Tools; namespace OpenSim.Region.ScriptEngine.Shared.CodeTools { - public class CSCodeGenerator + public class CSCodeGenerator : ICodeConverter { private SYMBOL m_astRoot = null; private int m_braceCount; // for indentation @@ -41,12 +41,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools /// Pass the new CodeGenerator a string containing the LSL source. /// /// String containing LSL source. - public CSCodeGenerator(string script) + public CSCodeGenerator() { - Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); - // Obviously this needs to be in a try/except block. - LSL2CSCodeTransformer codeTransformer = new LSL2CSCodeTransformer(p.Parse(script)); - m_astRoot = codeTransformer.Transform(); } /// @@ -63,8 +59,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools /// Generate the code from the AST we have. /// /// String containing the generated C# code. - public string Generate() + public string Convert(string script) { + Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); + // Obviously this needs to be in a try/except block. + LSL2CSCodeTransformer codeTransformer = new LSL2CSCodeTransformer(p.Parse(script)); + m_astRoot = codeTransformer.Transform(); string retstr = String.Empty; // standard preamble -- cgit v1.1