* Rex merge, Regions/ExtensionsScript

afrisby-3
Adam Frisby 2008-02-23 04:10:30 +00:00
parent 9559c3f6e6
commit 8df0331405
20 changed files with 2130 additions and 2119 deletions

View File

@ -35,6 +35,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
{
public class CSharpScriptEngine : IScriptCompiler
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public string FileExt()
{
return ".cs";
@ -58,10 +60,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
if (compilerResults.Errors.Count > 0)
{
MainLog.Instance.Error("Compile errors");
m_log.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors)
{
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
}
}
else

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
@ -50,7 +50,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
{
/*if (args[0].ToLower() == "lslexport")
{
string sequence = "";
string sequence = String.Empty;
foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
{
@ -82,13 +82,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
LLVector3 scale = prim.Scale;
LLVector3 rootPos = prim.WorldPos;
string setPrimParams = "";
string setPrimParams = String.Empty;
setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
return setPrimParams;
*/
return "";
return System.String.Empty;
}
}
}

View File

@ -35,6 +35,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
{
public class JScriptEngine : IScriptCompiler
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public string FileExt()
{
return ".js";
@ -58,10 +60,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
if (compilerResults.Errors.Count > 0)
{
MainLog.Instance.Error("Compile errors");
m_log.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors)
{
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
}
}
else

View File

@ -237,7 +237,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
public class PoolUtf8 : PoolItem
{
public string Value = "";
public string Value = String.Empty;
public void readValue(byte[] data, ref int pointer, int length)
{
@ -274,7 +274,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
public class PoolClass : PoolItem
{
//public string name = "";
//public string name = String.Empty;
public ushort namePointer = 0;
private ClassRecord parent;
public PoolUtf8 Name;
@ -384,7 +384,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{
public ushort AccessFlags = 0;
public ushort NameIndex = 0;
public string Name = "";
public string Name = String.Empty;
public ushort DescriptorIndex = 0;
public ushort AttributeCount = 0;
public List<MethodAttribute> Attributes = new List<MethodAttribute>();
@ -436,7 +436,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
public class MethodAttribute
{
public ushort NameIndex = 0;
public string Name = "";
public string Name = String.Empty;
public Int32 Length = 0;
//for now only support code attribute
public ushort MaxStack = 0;
@ -502,7 +502,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
public class SubAttribute
{
public ushort NameIndex = 0;
public string Name = "";
public string Name = String.Empty;
public Int32 Length = 0;
public byte[] Data;
private ClassRecord parent;
@ -546,7 +546,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{
public ushort AccessFlags = 0;
public ushort NameIndex = 0;
public string Name = "";
public string Name = String.Empty;
public ushort DescriptorIndex = 0;
public ushort AttributeCount = 0;
public List<FieldAttribute> Attributes = new List<FieldAttribute>();
@ -605,7 +605,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
public class FieldAttribute
{
public ushort NameIndex = 0;
public string Name = "";
public string Name = String.Empty;
public Int32 Length = 0;
public byte[] Data;
private ClassRecord parent;

View File

@ -46,8 +46,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
string typ =
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
mNameType.Type.Value;
string typeparam = "";
string typereturn = "";
string typeparam = System.String.Empty;
string typereturn = System.String.Empty;
int firstbrak = 0;
int secondbrak = 0;
firstbrak = typ.LastIndexOf('(');

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -53,12 +53,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
private void events_OnNewPresence(ScenePresence presence)
{
script.logger.Verbose("TESTSCRIPT", "Hello " + presence.Firstname.ToString() + "!");
script.Log.Info("[TESTSCRIPT]: Hello " + presence.Firstname.ToString() + "!");
}
private void events_OnFrame()
{
//script.logger.Verbose("TESTSCRIPT", "Hello World!");
//script.logger.Info("[TESTSCRIPT]: Hello World!");
}
}
}

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -36,23 +36,26 @@ namespace OpenSim.Region.ExtensionsScriptModule
/// </summary>
public class ScriptInfo
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Reference to world.eventsManager provided for convenience
public EventManager events;
// The main world
public Scene world;
// The console
public LogBase logger;
// API Access
public ScriptAPI api;
public log4net.ILog Log
{
get { return m_log; }
}
public ScriptInfo(Scene scene)
{
world = scene;
events = world.EventManager;
logger = MainLog.Instance;
api = new ScriptAPI(world, LLUUID.Zero);
}

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
@ -45,6 +45,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
/// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
internal class ScriptInterpretedAPI
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected Key m_object;
protected Scene m_scene;
@ -109,7 +111,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
{
//Dont do anything!
}
MainLog.Instance.Warn("script",
m_log.Warn("[script]: " +
"Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
return;
}
@ -117,7 +119,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
[Obsolete("Unimplemented")]
public void osAdjustSoundVolume(float volume)
{
MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)");
m_log.Warn("[script]: Unimplemented function called by script: osAdjustSoundVolume(float volume)");
return;
}

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY

View File

@ -38,6 +38,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
{
public class ScriptManager : IRegionModule, IExtensionScriptModule
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<IScript> scripts = new List<IScript>();
private Scene m_scene;
private readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
@ -48,12 +50,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
{
ScriptInfo scriptInfo = new ScriptInfo(m_scene);
// Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
MainLog.Instance.Verbose("SCRIPT", "Loading " + script.Key);
m_log.Info("[SCRIPT]: Loading " + script.Key);
script.Value.Initialise(scriptInfo);
scripts.Add(script.Value);
}
MainLog.Instance.Verbose("SCRIPT", string.Format("Finished loading {0} script(s)", compiledscripts.Count));
m_log.Info("[SCRIPT]: " + string.Format("Finished loading {0} script(s)", compiledscripts.Count));
}
public ScriptManager()
@ -71,7 +73,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
public void Initialise(Scene scene, IConfigSource config)
{
MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module");
m_log.Info("[SCRIPTMODULE]: Initialising Extensions Scripting Module");
m_scene = scene;
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
@ -118,14 +120,14 @@ namespace OpenSim.Region.ExtensionsScriptModule
break;
default:
MainLog.Instance.Error("Unknown script command");
m_log.Error("Unknown script command");
break;
}
}
public bool AddPreCompiledScript(IScript script)
{
MainLog.Instance.Verbose("SCRIPT", "Loading script " + script.Name);
m_log.Info("[SCRIPT]: Loading script " + script.Name);
ScriptInfo scriptInfo = new ScriptInfo(m_scene);
// Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
script.Initialise(scriptInfo);