* Enabled the Yield Prolog Script Engine
parent
5873ad3760
commit
7f9967d310
|
@ -54,7 +54,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
lsl = 0,
|
lsl = 0,
|
||||||
cs = 1,
|
cs = 1,
|
||||||
vb = 2,
|
vb = 2,
|
||||||
js = 3
|
js = 3,
|
||||||
|
yp = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -75,6 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
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();
|
||||||
|
private static YP2CSConverter YP_Converter = new YP2CSConverter();
|
||||||
|
|
||||||
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
|
||||||
|
@ -113,6 +115,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
LanguageMapping.Add(enumCompileType.vb.ToString(), enumCompileType.vb);
|
LanguageMapping.Add(enumCompileType.vb.ToString(), enumCompileType.vb);
|
||||||
LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl);
|
LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl);
|
||||||
LanguageMapping.Add(enumCompileType.js.ToString(), enumCompileType.js);
|
LanguageMapping.Add(enumCompileType.js.ToString(), enumCompileType.js);
|
||||||
|
LanguageMapping.Add(enumCompileType.yp.ToString(), enumCompileType.yp);
|
||||||
|
|
||||||
// Allowed compilers
|
// Allowed compilers
|
||||||
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl,cs,vb,js");
|
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl,cs,vb,js");
|
||||||
|
@ -254,6 +257,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
if (Script.StartsWith("//js", true, CultureInfo.InvariantCulture))
|
if (Script.StartsWith("//js", true, CultureInfo.InvariantCulture))
|
||||||
l = enumCompileType.js;
|
l = enumCompileType.js;
|
||||||
|
|
||||||
|
if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture))
|
||||||
|
l = enumCompileType.yp;
|
||||||
|
|
||||||
if (!AllowedCompilers.ContainsKey(l.ToString()))
|
if (!AllowedCompilers.ContainsKey(l.ToString()))
|
||||||
{
|
{
|
||||||
// Not allowed to compile to this language!
|
// Not allowed to compile to this language!
|
||||||
|
@ -271,6 +277,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
l = enumCompileType.cs;
|
l = enumCompileType.cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (l == enumCompileType.yp)
|
||||||
|
{
|
||||||
|
// Its LSL, convert it to C#
|
||||||
|
compileScript = YP_Converter.Convert(Script);
|
||||||
|
l = enumCompileType.cs;
|
||||||
|
}
|
||||||
|
|
||||||
// Insert additional assemblies here
|
// Insert additional assemblies here
|
||||||
|
|
||||||
//ADAM: Disabled for the moment until it's working right.
|
//ADAM: Disabled for the moment until it's working right.
|
||||||
|
@ -325,10 +338,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
|
|
||||||
|
|
||||||
compileScript = String.Empty +
|
compileScript = String.Empty +
|
||||||
|
"using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " +
|
||||||
"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
|
"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
|
||||||
String.Empty + "namespace SecondLife { " +
|
String.Empty + "namespace SecondLife { " +
|
||||||
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" +
|
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" +
|
||||||
@"public Script() { } " +
|
//@"public Script() { } " +
|
||||||
|
@"static OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP YP=null; " +
|
||||||
|
@"public Script() { YP= new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP(); } "+
|
||||||
|
|
||||||
compileScript +
|
compileScript +
|
||||||
"} }\r\n";
|
"} }\r\n";
|
||||||
return compileScript;
|
return compileScript;
|
||||||
|
|
Loading…
Reference in New Issue