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
parent
d4f32649cd
commit
b1f97f9e77
|
@ -107,19 +107,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl);
|
LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl);
|
||||||
|
|
||||||
// Allowed compilers
|
// Allowed compilers
|
||||||
string allowedCompilers = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb");
|
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb");
|
||||||
AllowedCompilers.Clear();
|
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();
|
string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
|
||||||
if (!LanguageMapping.ContainsKey(strlan))
|
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
|
else
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
AllowedCompilers.Add(strlan, true);
|
AllowedCompilers.Add(strlan, true);
|
||||||
|
@ -228,19 +234,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
|
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
|
||||||
l = enumCompileType.cs;
|
l = enumCompileType.cs;
|
||||||
if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture))
|
if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture))
|
||||||
|
{
|
||||||
l = enumCompileType.vb;
|
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))
|
if (Script.StartsWith("//lsl", true, CultureInfo.InvariantCulture))
|
||||||
l = enumCompileType.lsl;
|
l = enumCompileType.lsl;
|
||||||
|
|
||||||
|
|
||||||
if (!AllowedCompilers.ContainsKey(l.ToString()))
|
if (!AllowedCompilers.ContainsKey(l.ToString()))
|
||||||
{
|
{
|
||||||
// Not allowed to compile to this language!
|
// Not allowed to compile to this language!
|
||||||
string errtext = String.Empty;
|
string errtext = String.Empty;
|
||||||
errtext += "The compiler for language \"" + l.ToString() + "\" is not in list of allowed compilers. Script will not be executed!";
|
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)
|
if (l == enumCompileType.lsl)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +269,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
String.Empty + "namespace SecondLife { " +
|
String.Empty + "namespace SecondLife { " +
|
||||||
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { " +
|
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { " +
|
||||||
@"public Script() { } " +
|
@"public Script() { } " +
|
||||||
Script +
|
compileScript +
|
||||||
"} }\r\n";
|
"} }\r\n";
|
||||||
break;
|
break;
|
||||||
case enumCompileType.vb:
|
case enumCompileType.vb:
|
||||||
|
@ -266,7 +278,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
String.Empty + "NameSpace SecondLife { " +
|
String.Empty + "NameSpace SecondLife { " +
|
||||||
String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
|
String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
|
||||||
@"Public Sub New(): End Sub: " +
|
@"Public Sub New(): End Sub: " +
|
||||||
Script +
|
compileScript +
|
||||||
":End Class :End Namespace\r\n";
|
":End Class :End Namespace\r\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,36 +289,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
|
|
||||||
// Add namespace, class name and inheritance
|
// Add namespace, class name and inheritance
|
||||||
|
|
||||||
Return = String.Empty +
|
Return = String.Empty;// +
|
||||||
"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;";
|
//"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; ";
|
|
||||||
|
|
||||||
//// Make a Using out of DataTypes
|
//Return += String.Empty +
|
||||||
//// Using integer = System.Int32;
|
// "namespace SecondLife { ";
|
||||||
//string _val;
|
//Return += String.Empty +
|
||||||
//foreach (string key in DataTypes.Keys)
|
// //"[Serializable] " +
|
||||||
//{
|
// "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { ";
|
||||||
// DataTypes.TryGetValue(key, out _val);
|
//Return += @"public Script() { } ";
|
||||||
// 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 += Script;
|
Return += Script;
|
||||||
Return += "} }\r\n";
|
//Return += "} }\r\n";
|
||||||
|
|
||||||
|
|
||||||
quotes.Clear();
|
quotes.Clear();
|
||||||
|
|
Loading…
Reference in New Issue