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.
This commit is contained in:
Melanie Thielker
2008-07-12 01:34:36 +00:00
parent f6c7f167b9
commit d85774c101
6 changed files with 128 additions and 82 deletions

View File

@@ -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.
/// </summary>
/// <param name="script">String containing LSL source.</param>
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();
}
/// <summary>
@@ -63,8 +59,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
/// Generate the code from the AST we have.
/// </summary>
/// <returns>String containing the generated C# code.</returns>
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