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.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
|
||||
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);
|
||||
try
|
||||
{
|
||||
|
|
|
@ -112,9 +112,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
{
|
||||
m_scriptEngine = scriptEngine;
|
||||
}
|
||||
public abstract void Initialize();
|
||||
public void Start()
|
||||
{
|
||||
ReadConfig();
|
||||
Initialize();
|
||||
|
||||
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 VBCodeProvider VBcodeProvider = new VBCodeProvider();
|
||||
|
||||
private static UInt64 scriptCompileCounter = 0;
|
||||
|
||||
private static int instanceID = new Random().Next(0, int.MaxValue);
|
||||
// Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;)
|
||||
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
|
||||
|
||||
public Common.ScriptEngineBase.ScriptEngine m_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);
|
||||
|
||||
// Allowed compilers
|
||||
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb");
|
||||
string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl,cs,vb");
|
||||
AllowedCompilers.Clear();
|
||||
|
||||
#if DEBUG
|
||||
|
@ -115,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
#endif
|
||||
|
||||
|
||||
foreach (string strl in allowComp.Split(';'))
|
||||
foreach (string strl in allowComp.Split(','))
|
||||
{
|
||||
string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
|
||||
if (!LanguageMapping.ContainsKey(strlan))
|
||||
|
@ -299,6 +297,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
string OutFile =
|
||||
Path.Combine("ScriptEngines",
|
||||
FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\".");
|
||||
#endif
|
||||
try
|
||||
{
|
||||
File.Delete(OutFile);
|
||||
|
@ -313,14 +314,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
// DEBUG - write source to disk
|
||||
if (WriteScriptSourceToDebugFile)
|
||||
{
|
||||
string srcFileName = FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext;
|
||||
try
|
||||
{
|
||||
File.WriteAllText(
|
||||
Path.Combine("ScriptEngines", FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext),
|
||||
Path.Combine("ScriptEngines", srcFileName),
|
||||
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.OutputAssembly = OutFile;
|
||||
parameters.IncludeDebugInformation = CompileWithDebugInformation;
|
||||
parameters.WarningLevel = 4;
|
||||
parameters.WarningLevel = 1; // Should be 4?
|
||||
parameters.TreatWarningsAsErrors = false;
|
||||
|
||||
CompilerResults results;
|
||||
|
|
|
@ -43,6 +43,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
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>
|
||||
//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
|
||||
// PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim
|
||||
|
||||
private Compiler.LSL.Compiler LSLCompiler;
|
||||
|
||||
public override void _StartScript(uint localID, LLUUID itemID, string Script)
|
||||
{
|
||||
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();
|
||||
|
||||
|
|
|
@ -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
|
||||
; 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:
|
||||
;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:
|
||||
script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll
|
||||
|
@ -222,7 +222,7 @@ DefaultCompileLanguage=lsl
|
|||
|
||||
; Specify what compilers are allowed to be used
|
||||
; Valid languages are: lsl, cs and vb
|
||||
AllowedCompilers=lsl;cs;vb
|
||||
AllowedCompilers=lsl,cs,vb
|
||||
|
||||
; Compile scripts with debugging
|
||||
; Probably a thousand times slower, but gives you a line number when something goes wrong.
|
||||
|
|
Loading…
Reference in New Issue