Use new LSL compiler by default in DotNetEngine and XEngine. Fix issues 1651, 1339.

0.6.0-stable
Mike Mazur 2008-07-27 23:53:18 +00:00
parent 50f2e88c99
commit 9e58ce60c0
2 changed files with 24 additions and 21 deletions

View File

@ -72,9 +72,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
private string FilePrefix; private string FilePrefix;
private string ScriptEnginesPath = "ScriptEngines"; private string ScriptEnginesPath = "ScriptEngines";
private static LSL2CSConverter LSL_Converter = new LSL2CSConverter(); //private static LSL2CSConverter LSL_Converter = new LSL2CSConverter();
//private static CSCodeGenerator LSL_Converter = new CSCodeGenerator(); private static CSCodeGenerator LSL_Converter = new CSCodeGenerator();
//private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; // mapping between LSL and C# line/column numbers private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; // mapping between LSL and C# line/column numbers
private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider(); private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider();
@ -277,8 +277,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
{ {
// Its LSL, convert it to C# // Its LSL, convert it to C#
compileScript = LSL_Converter.Convert(Script); compileScript = LSL_Converter.Convert(Script);
//compileScript = LSL_Converter.Convert(Script); m_positionMap = LSL_Converter.PositionMap;
//m_positionMap = LSL_Converter.PositionMap;
l = enumCompileType.cs; l = enumCompileType.cs;
} }
@ -483,24 +482,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
string errtext = String.Empty; string errtext = String.Empty;
foreach (CompilerError CompErr in results.Errors) foreach (CompilerError CompErr in results.Errors)
{ {
//KeyValuePair<int, int> lslPos; KeyValuePair<int, int> lslPos;
//try try
//{ {
// lslPos = m_positionMap[new KeyValuePair<int, int>(CompErr.Line, CompErr.Column)]; lslPos = m_positionMap[new KeyValuePair<int, int>(CompErr.Line, CompErr.Column)];
//} }
//catch (KeyNotFoundException) // we don't have this line/column mapped catch (KeyNotFoundException) // we don't have this line/column mapped
//{ {
// m_scriptEngine.Log.Debug(String.Format("[{0}]: Lookup of C# line {1}, column {2} failed.", m_scriptEngine.ScriptEngineName, CompErr.Line, CompErr.Column)); m_scriptEngine.Log.Debug(String.Format("[{0}]: Lookup of C# line {1}, column {2} failed.", m_scriptEngine.ScriptEngineName, CompErr.Line, CompErr.Column));
// lslPos = new KeyValuePair<int, int>(-CompErr.Line, -CompErr.Column); lslPos = new KeyValuePair<int, int>(-CompErr.Line, -CompErr.Column);
//} }
// The Second Life viewer's script editor begins // The Second Life viewer's script editor begins
// countingn lines and columns at 0, so we subtract 1. // countingn lines and columns at 0, so we subtract 1.
//errtext += String.Format("Line {0}, column {1}, Error Number: {2}, '{3}'\r\n", lslPos.Key - 1, lslPos.Value - 1, CompErr.ErrorNumber, CompErr.ErrorText); errtext += String.Format("Line {0}, column {1}, Error Number: {2}, '{3}'\r\n", lslPos.Key - 1, lslPos.Value - 1, CompErr.ErrorNumber, CompErr.ErrorText);
errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) + //errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) +
", Error Number: " + CompErr.ErrorNumber + // ", Error Number: " + CompErr.ErrorNumber +
", '" + CompErr.ErrorText + "'\r\n"; // ", '" + CompErr.ErrorText + "'\r\n";
} }
Console.WriteLine("[COMPILER ERROR]:" + errtext); Console.WriteLine("[COMPILER ERROR]:" + errtext);
if (!File.Exists(OutFile)) if (!File.Exists(OutFile))

View File

@ -82,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
private static UInt64 scriptCompileCounter = 0; // And a counter private static UInt64 scriptCompileCounter = 0; // And a counter
private bool m_UseCompiler = false; private bool m_UseCompiler = true;
public IScriptEngine m_scriptEngine; public IScriptEngine m_scriptEngine;
public Compiler(IScriptEngine scriptEngine) public Compiler(IScriptEngine scriptEngine)
@ -93,9 +93,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
public bool in_startup = true; public bool in_startup = true;
public void ReadConfig() public void ReadConfig()
{ {
// Turning on the compiler by default so hardcoding this option to
// true. Once it's clear we won't be going back to the old
// "compiler" this code will be removed completely.
// Mike, 2008.07.28
//m_UseCompiler = m_scriptEngine.Config.GetBoolean("UseNewCompiler", true);
// Get some config // Get some config
m_UseCompiler = m_scriptEngine.Config.GetBoolean("UseNewCompiler", true);
WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", true); WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", true);
CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true);