Temporarily disabled AllowedCompilers so all 3 compilers are allowed.

Fixed bug in how code is handled, hopefully we can now run all 3 languages? :)
ThreadPoolClientBranch
Tedd Hansen 2008-02-02 04:06:51 +00:00
parent d4f32649cd
commit b1f97f9e77
2 changed files with 30 additions and 36 deletions

View File

@ -107,19 +107,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl);
// Allowed compilers
string allowedCompilers = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb");
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb");
AllowedCompilers.Clear();
foreach (string strl in allowedCompilers.Split(';'))
#if DEBUG
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp);
#endif
foreach (string strl in allowComp.Split(';'))
{
string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
if (!LanguageMapping.ContainsKey(strlan))
{
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strl + "\" specified in \"AllowedCompilers\".");
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
}
else
{
#if DEBUG
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strl + "\" specified in \"AllowedCompilers\".");
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
#endif
}
AllowedCompilers.Add(strlan, true);
@ -228,19 +234,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
l = enumCompileType.cs;
if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture))
{
l = enumCompileType.vb;
// We need to remove //vb, it won't compile with that
Script = Script.Substring(4, Script.Length - 4);
}
if (Script.StartsWith("//lsl", true, CultureInfo.InvariantCulture))
l = enumCompileType.lsl;
if (!AllowedCompilers.ContainsKey(l.ToString()))
{
// Not allowed to compile to this language!
string errtext = String.Empty;
errtext += "The compiler for language \"" + l.ToString() + "\" is not in list of allowed compilers. Script will not be executed!";
throw new Exception(errtext);
//throw new Exception(errtext);
}
string compileScript;
string compileScript = Script;
if (l == enumCompileType.lsl)
{
@ -257,7 +269,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
String.Empty + "namespace SecondLife { " +
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { " +
@"public Script() { } " +
Script +
compileScript +
"} }\r\n";
break;
case enumCompileType.vb:
@ -266,7 +278,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
String.Empty + "NameSpace SecondLife { " +
String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
@"Public Sub New(): End Sub: " +
Script +
compileScript +
":End Class :End Namespace\r\n";
break;
}

View File

@ -289,36 +289,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
// Add namespace, class name and inheritance
Return = String.Empty +
"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;";
//"using System; " +
//"using System.Collections.Generic; " +
//"using System.Text; " +
//"using OpenSim.Region.ScriptEngine.Common; " +
//"using integer = System.Int32; " +
//"using key = System.String; ";
Return = String.Empty;// +
//"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;";
//// Make a Using out of DataTypes
//// Using integer = System.Int32;
//string _val;
//foreach (string key in DataTypes.Keys)
//{
// DataTypes.TryGetValue(key, out _val);
// if (key != _val)
// {
// Return += "using " + key + " = " + _val + "; ";
// }
//}
Return += String.Empty +
"namespace SecondLife { ";
Return += String.Empty +
//"[Serializable] " +
"public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { ";
Return += @"public Script() { } ";
//Return += String.Empty +
// "namespace SecondLife { ";
//Return += String.Empty +
// //"[Serializable] " +
// "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { ";
//Return += @"public Script() { } ";
Return += Script;
Return += "} }\r\n";
//Return += "} }\r\n";
quotes.Clear();