mirror of
https://github.com/opensim/opensim.git
synced 2026-07-14 03:15:36 +08:00
Bugfixes. Now it even reads configuration before it uses it! ;)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -118,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
catch (Exception e2)
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,5 +155,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user