Bugfixes. Now it even reads configuration before it uses it! ;)
parent
599f8b884b
commit
7bd3ecfc2a
|
@ -455,9 +455,9 @@ namespace OpenSim
|
||||||
//m_moduleLoader.PickupModules(scene, "ScriptEngines");
|
//m_moduleLoader.PickupModules(scene, "ScriptEngines");
|
||||||
//m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
|
//m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
|
||||||
MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules");
|
MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules");
|
||||||
foreach (string module in m_scriptEngine.Split(';'))
|
foreach (string module in m_scriptEngine.Split(','))
|
||||||
{
|
{
|
||||||
string mod = module.Trim(" \t\r\n".ToCharArray()); // Clean up name
|
string mod = module.Trim(" \t".ToCharArray()); // Clean up name
|
||||||
MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod);
|
MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,9 +112,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
{
|
{
|
||||||
m_scriptEngine = scriptEngine;
|
m_scriptEngine = scriptEngine;
|
||||||
}
|
}
|
||||||
|
public abstract void Initialize();
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
Initialize();
|
||||||
|
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,8 @@ 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 UInt64 scriptCompileCounter = 0;
|
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 int instanceID = new Random().Next(0, int.MaxValue);
|
|
||||||
// Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;)
|
|
||||||
|
|
||||||
public Common.ScriptEngineBase.ScriptEngine m_scriptEngine;
|
public Common.ScriptEngineBase.ScriptEngine m_scriptEngine;
|
||||||
public Compiler(Common.ScriptEngineBase.ScriptEngine scriptEngine)
|
public Compiler(Common.ScriptEngineBase.ScriptEngine scriptEngine)
|
||||||
|
@ -107,7 +105,7 @@ 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 allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb");
|
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl,cs,vb");
|
||||||
AllowedCompilers.Clear();
|
AllowedCompilers.Clear();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -115,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
foreach (string strl in allowComp.Split(';'))
|
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))
|
||||||
|
@ -299,6 +297,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
string OutFile =
|
string OutFile =
|
||||||
Path.Combine("ScriptEngines",
|
Path.Combine("ScriptEngines",
|
||||||
FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
||||||
|
#if DEBUG
|
||||||
|
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\".");
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(OutFile);
|
File.Delete(OutFile);
|
||||||
|
@ -313,14 +314,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
// DEBUG - write source to disk
|
// DEBUG - write source to disk
|
||||||
if (WriteScriptSourceToDebugFile)
|
if (WriteScriptSourceToDebugFile)
|
||||||
{
|
{
|
||||||
|
string srcFileName = FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(
|
File.WriteAllText(
|
||||||
Path.Combine("ScriptEngines", FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext),
|
Path.Combine("ScriptEngines", srcFileName),
|
||||||
Script);
|
Script);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +349,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
parameters.GenerateExecutable = false;
|
parameters.GenerateExecutable = false;
|
||||||
parameters.OutputAssembly = OutFile;
|
parameters.OutputAssembly = OutFile;
|
||||||
parameters.IncludeDebugInformation = CompileWithDebugInformation;
|
parameters.IncludeDebugInformation = CompileWithDebugInformation;
|
||||||
parameters.WarningLevel = 4;
|
parameters.WarningLevel = 1; // Should be 4?
|
||||||
parameters.TreatWarningsAsErrors = false;
|
parameters.TreatWarningsAsErrors = false;
|
||||||
|
|
||||||
CompilerResults results;
|
CompilerResults results;
|
||||||
|
|
|
@ -43,6 +43,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
base.m_scriptEngine = scriptEngine;
|
base.m_scriptEngine = scriptEngine;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private Compiler.LSL.Compiler LSLCompiler;
|
||||||
|
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
// Create our compiler
|
||||||
|
LSLCompiler = new Compiler.LSL.Compiler(m_scriptEngine);
|
||||||
|
}
|
||||||
|
|
||||||
// KEEP TRACK OF SCRIPTS <int id, whatever script>
|
// KEEP TRACK OF SCRIPTS <int id, whatever script>
|
||||||
//internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>();
|
//internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>();
|
||||||
|
@ -50,17 +58,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
// UNLOAD SCRIPT
|
// UNLOAD SCRIPT
|
||||||
// PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim
|
// PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim
|
||||||
|
|
||||||
private Compiler.LSL.Compiler LSLCompiler;
|
|
||||||
|
|
||||||
public override void _StartScript(uint localID, LLUUID itemID, string Script)
|
public override void _StartScript(uint localID, LLUUID itemID, string Script)
|
||||||
{
|
{
|
||||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
|
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
|
||||||
|
|
||||||
// First time start? Lets fire up our compiler...
|
|
||||||
if (LSLCompiler == null)
|
|
||||||
{
|
|
||||||
LSLCompiler = new Compiler.LSL.Compiler(m_scriptEngine);
|
|
||||||
}
|
|
||||||
|
|
||||||
//IScriptHost root = host.GetRoot();
|
//IScriptHost root = host.GetRoot();
|
||||||
|
|
||||||
|
@ -118,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
catch (Exception e2)
|
catch (Exception e2)
|
||||||
{
|
{
|
||||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString());
|
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString());
|
||||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName,
|
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName,
|
||||||
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,5 +155,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -116,10 +116,10 @@ shout_distance = 100
|
||||||
; ##
|
; ##
|
||||||
; These are region modules loaded into each region to provide script support
|
; These are region modules loaded into each region to provide script support
|
||||||
; Scripts may be everything from LSL or C# scripts put in prims to whole game systems that controls the whole grid.
|
; Scripts may be everything from LSL or C# scripts put in prims to whole game systems that controls the whole grid.
|
||||||
; You can load multiple modules by separating them with ;.
|
; You can load multiple modules by separating them with a coma.
|
||||||
;
|
;
|
||||||
; Example:
|
; Example:
|
||||||
;script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll;OpenSim.Region.ScriptEngine.RemoteServer.dll
|
;script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll,OpenSim.Region.ScriptEngine.RemoteServer.dll
|
||||||
;
|
;
|
||||||
; This is the current and most stable ScriptEngine:
|
; This is the current and most stable ScriptEngine:
|
||||||
script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll
|
script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll
|
||||||
|
@ -222,7 +222,7 @@ DefaultCompileLanguage=lsl
|
||||||
|
|
||||||
; Specify what compilers are allowed to be used
|
; Specify what compilers are allowed to be used
|
||||||
; Valid languages are: lsl, cs and vb
|
; Valid languages are: lsl, cs and vb
|
||||||
AllowedCompilers=lsl;cs;vb
|
AllowedCompilers=lsl,cs,vb
|
||||||
|
|
||||||
; Compile scripts with debugging
|
; Compile scripts with debugging
|
||||||
; Probably a thousand times slower, but gives you a line number when something goes wrong.
|
; Probably a thousand times slower, but gives you a line number when something goes wrong.
|
||||||
|
|
Loading…
Reference in New Issue