* Rex merge, Regions/ExtensionsScript
parent
9559c3f6e6
commit
8df0331405
|
@ -1,104 +1,106 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CSharp;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.CSharp
|
||||
{
|
||||
public class CSharpScriptEngine : IScriptCompiler
|
||||
{
|
||||
public string FileExt()
|
||||
{
|
||||
return ".cs";
|
||||
}
|
||||
|
||||
private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
|
||||
{
|
||||
CompilerParameters compilerParams = new CompilerParameters();
|
||||
CompilerResults compilerResults;
|
||||
compilerParams.GenerateExecutable = false;
|
||||
compilerParams.GenerateInMemory = true;
|
||||
compilerParams.IncludeDebugInformation = false;
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||
|
||||
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
|
||||
|
||||
if (compilerResults.Errors.Count > 0)
|
||||
{
|
||||
MainLog.Instance.Error("Compile errors");
|
||||
foreach (CompilerError error in compilerResults.Errors)
|
||||
{
|
||||
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
|
||||
|
||||
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
|
||||
{
|
||||
Type testInterface = pluginType.GetInterface("IScript", true);
|
||||
|
||||
if (testInterface != null)
|
||||
{
|
||||
IScript script =
|
||||
(IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
|
||||
|
||||
string scriptName = "C#/" + script.Name;
|
||||
Console.WriteLine("Script: " + scriptName + " loaded.");
|
||||
|
||||
if (!scripts.ContainsKey(scriptName))
|
||||
{
|
||||
scripts.Add(scriptName, script);
|
||||
}
|
||||
else
|
||||
{
|
||||
scripts[scriptName] = script;
|
||||
}
|
||||
}
|
||||
}
|
||||
return scripts;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
|
||||
return LoadDotNetScript(csharpProvider, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CSharp;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
|
||||
{
|
||||
CompilerParameters compilerParams = new CompilerParameters();
|
||||
CompilerResults compilerResults;
|
||||
compilerParams.GenerateExecutable = false;
|
||||
compilerParams.GenerateInMemory = true;
|
||||
compilerParams.IncludeDebugInformation = false;
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||
|
||||
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
|
||||
|
||||
if (compilerResults.Errors.Count > 0)
|
||||
{
|
||||
m_log.Error("Compile errors");
|
||||
foreach (CompilerError error in compilerResults.Errors)
|
||||
{
|
||||
m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
|
||||
|
||||
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
|
||||
{
|
||||
Type testInterface = pluginType.GetInterface("IScript", true);
|
||||
|
||||
if (testInterface != null)
|
||||
{
|
||||
IScript script =
|
||||
(IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
|
||||
|
||||
string scriptName = "C#/" + script.Name;
|
||||
Console.WriteLine("Script: " + scriptName + " loaded.");
|
||||
|
||||
if (!scripts.ContainsKey(scriptName))
|
||||
{
|
||||
scripts.Add(scriptName, script);
|
||||
}
|
||||
else
|
||||
{
|
||||
scripts[scriptName] = script;
|
||||
}
|
||||
}
|
||||
}
|
||||
return scripts;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
|
||||
return LoadDotNetScript(csharpProvider, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,94 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
|
||||
{
|
||||
public class LSLExportScript : IScript
|
||||
{
|
||||
private ScriptInfo script;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LSL Export Script 0.1"; }
|
||||
}
|
||||
|
||||
public void Initialise(ScriptInfo scriptInfo)
|
||||
{
|
||||
script = scriptInfo;
|
||||
|
||||
script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg);
|
||||
}
|
||||
|
||||
private void ProcessConsoleMsg(string[] args)
|
||||
{
|
||||
/*if (args[0].ToLower() == "lslexport")
|
||||
{
|
||||
string sequence = "";
|
||||
|
||||
foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
|
||||
{
|
||||
SceneObject root = obj.Value;
|
||||
|
||||
sequence += "NEWOBJ::" + obj.Key.ToString() + "\n";
|
||||
|
||||
string rootPrim = processPrimitiveToString(root.rootPrimitive);
|
||||
|
||||
sequence += "ROOT:" + rootPrim;
|
||||
|
||||
foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
|
||||
{
|
||||
string child = processPrimitiveToString(prim.Value);
|
||||
sequence += "CHILD:" + child;
|
||||
}
|
||||
}
|
||||
|
||||
System.Console.WriteLine(sequence);
|
||||
}*/
|
||||
}
|
||||
|
||||
private string processPrimitiveToString(SceneObjectPart prim)
|
||||
{
|
||||
/*string desc = prim.Description;
|
||||
string name = prim.Name;
|
||||
LLVector3 pos = prim.Pos;
|
||||
LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w);
|
||||
LLVector3 scale = prim.Scale;
|
||||
LLVector3 rootPos = prim.WorldPos;
|
||||
|
||||
string setPrimParams = "";
|
||||
|
||||
setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
|
||||
|
||||
return setPrimParams;
|
||||
*/
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
|
||||
{
|
||||
public class LSLExportScript : IScript
|
||||
{
|
||||
private ScriptInfo script;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LSL Export Script 0.1"; }
|
||||
}
|
||||
|
||||
public void Initialise(ScriptInfo scriptInfo)
|
||||
{
|
||||
script = scriptInfo;
|
||||
|
||||
script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg);
|
||||
}
|
||||
|
||||
private void ProcessConsoleMsg(string[] args)
|
||||
{
|
||||
/*if (args[0].ToLower() == "lslexport")
|
||||
{
|
||||
string sequence = String.Empty;
|
||||
|
||||
foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
|
||||
{
|
||||
SceneObject root = obj.Value;
|
||||
|
||||
sequence += "NEWOBJ::" + obj.Key.ToString() + "\n";
|
||||
|
||||
string rootPrim = processPrimitiveToString(root.rootPrimitive);
|
||||
|
||||
sequence += "ROOT:" + rootPrim;
|
||||
|
||||
foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
|
||||
{
|
||||
string child = processPrimitiveToString(prim.Value);
|
||||
sequence += "CHILD:" + child;
|
||||
}
|
||||
}
|
||||
|
||||
System.Console.WriteLine(sequence);
|
||||
}*/
|
||||
}
|
||||
|
||||
private string processPrimitiveToString(SceneObjectPart prim)
|
||||
{
|
||||
/*string desc = prim.Description;
|
||||
string name = prim.Name;
|
||||
LLVector3 pos = prim.Pos;
|
||||
LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w);
|
||||
LLVector3 scale = prim.Scale;
|
||||
LLVector3 rootPos = prim.WorldPos;
|
||||
|
||||
string setPrimParams = String.Empty;
|
||||
|
||||
setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
|
||||
|
||||
return setPrimParams;
|
||||
*/
|
||||
return System.String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,104 +1,106 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.JScript;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JScript
|
||||
{
|
||||
public class JScriptEngine : IScriptCompiler
|
||||
{
|
||||
public string FileExt()
|
||||
{
|
||||
return ".js";
|
||||
}
|
||||
|
||||
private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
|
||||
{
|
||||
CompilerParameters compilerParams = new CompilerParameters();
|
||||
CompilerResults compilerResults;
|
||||
compilerParams.GenerateExecutable = false;
|
||||
compilerParams.GenerateInMemory = true;
|
||||
compilerParams.IncludeDebugInformation = false;
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||
|
||||
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
|
||||
|
||||
if (compilerResults.Errors.Count > 0)
|
||||
{
|
||||
MainLog.Instance.Error("Compile errors");
|
||||
foreach (CompilerError error in compilerResults.Errors)
|
||||
{
|
||||
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
|
||||
|
||||
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
|
||||
{
|
||||
Type testInterface = pluginType.GetInterface("IScript", true);
|
||||
|
||||
if (testInterface != null)
|
||||
{
|
||||
IScript script =
|
||||
(IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
|
||||
|
||||
string scriptName = "JS.NET/" + script.Name;
|
||||
Console.WriteLine("Script: " + scriptName + " loaded.");
|
||||
|
||||
if (!scripts.ContainsKey(scriptName))
|
||||
{
|
||||
scripts.Add(scriptName, script);
|
||||
}
|
||||
else
|
||||
{
|
||||
scripts[scriptName] = script;
|
||||
}
|
||||
}
|
||||
}
|
||||
return scripts;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
|
||||
return LoadDotNetScript(jscriptProvider, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.JScript;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
|
||||
{
|
||||
CompilerParameters compilerParams = new CompilerParameters();
|
||||
CompilerResults compilerResults;
|
||||
compilerParams.GenerateExecutable = false;
|
||||
compilerParams.GenerateInMemory = true;
|
||||
compilerParams.IncludeDebugInformation = false;
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||
|
||||
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
|
||||
|
||||
if (compilerResults.Errors.Count > 0)
|
||||
{
|
||||
m_log.Error("Compile errors");
|
||||
foreach (CompilerError error in compilerResults.Errors)
|
||||
{
|
||||
m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
|
||||
|
||||
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
|
||||
{
|
||||
Type testInterface = pluginType.GetInterface("IScript", true);
|
||||
|
||||
if (testInterface != null)
|
||||
{
|
||||
IScript script =
|
||||
(IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
|
||||
|
||||
string scriptName = "JS.NET/" + script.Name;
|
||||
Console.WriteLine("Script: " + scriptName + " loaded.");
|
||||
|
||||
if (!scripts.ContainsKey(scriptName))
|
||||
{
|
||||
scripts.Add(scriptName, script);
|
||||
}
|
||||
else
|
||||
{
|
||||
scripts[scriptName] = script;
|
||||
}
|
||||
}
|
||||
}
|
||||
return scripts;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
|
||||
return LoadDotNetScript(jscriptProvider, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,102 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private bool IsMethodOpCode(byte opcode)
|
||||
{
|
||||
bool result = false;
|
||||
switch (opcode)
|
||||
{
|
||||
case 184:
|
||||
short refIndex =
|
||||
(short)
|
||||
((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
|
||||
GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
|
||||
if (m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
|
||||
{
|
||||
string typ =
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
|
||||
mNameType.Type.Value;
|
||||
string typeparam = "";
|
||||
string typereturn = "";
|
||||
int firstbrak = 0;
|
||||
int secondbrak = 0;
|
||||
firstbrak = typ.LastIndexOf('(');
|
||||
secondbrak = typ.LastIndexOf(')');
|
||||
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
|
||||
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
|
||||
if (
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass
|
||||
.Name.Value == m_thread.currentClass.MClass.Name.Value)
|
||||
{
|
||||
//calling a method in this class
|
||||
if (typeparam.Length == 0)
|
||||
{
|
||||
m_thread.JumpToStaticVoidMethod(
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
|
||||
.mNameType.Name.Value, (m_thread.PC + 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thread.JumpToStaticParamMethod(
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
|
||||
.mNameType.Name.Value, typeparam, (m_thread.PC + 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//calling a method of a different class
|
||||
|
||||
// OpenSimAPI Class
|
||||
if (
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
|
||||
mClass.Name.Value == "OpenSimAPI")
|
||||
{
|
||||
m_thread.scriptInfo.api.CallMethod(
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
|
||||
.mNameType.Name.Value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private bool IsMethodOpCode(byte opcode)
|
||||
{
|
||||
bool result = false;
|
||||
switch (opcode)
|
||||
{
|
||||
case 184:
|
||||
short refIndex =
|
||||
(short)
|
||||
((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
|
||||
GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
|
||||
if (m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
|
||||
{
|
||||
string typ =
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
|
||||
mNameType.Type.Value;
|
||||
string typeparam = System.String.Empty;
|
||||
string typereturn = System.String.Empty;
|
||||
int firstbrak = 0;
|
||||
int secondbrak = 0;
|
||||
firstbrak = typ.LastIndexOf('(');
|
||||
secondbrak = typ.LastIndexOf(')');
|
||||
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
|
||||
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
|
||||
if (
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass
|
||||
.Name.Value == m_thread.currentClass.MClass.Name.Value)
|
||||
{
|
||||
//calling a method in this class
|
||||
if (typeparam.Length == 0)
|
||||
{
|
||||
m_thread.JumpToStaticVoidMethod(
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
|
||||
.mNameType.Name.Value, (m_thread.PC + 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thread.JumpToStaticParamMethod(
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
|
||||
.mNameType.Name.Value, typeparam, (m_thread.PC + 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//calling a method of a different class
|
||||
|
||||
// OpenSimAPI Class
|
||||
if (
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
|
||||
mClass.Name.Value == "OpenSimAPI")
|
||||
{
|
||||
m_thread.scriptInfo.api.CallMethod(
|
||||
((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
|
||||
.mNameType.Name.Value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
|
||||
{
|
||||
public enum OpCode : byte
|
||||
{
|
||||
iconst_m1 = 2,
|
||||
iconst_0 = 3,
|
||||
iconst_1 = 4,
|
||||
iconst_2 = 5,
|
||||
iconst_3 = 6,
|
||||
iconst_4 = 7,
|
||||
iconst_5 = 8,
|
||||
fconst_0 = 11,
|
||||
fconst_1 = 12,
|
||||
fconst_2 = 13,
|
||||
bipush = 16,
|
||||
sipush = 17,
|
||||
fload = 23,
|
||||
iload_0 = 26,
|
||||
iload_1 = 27,
|
||||
fload_0 = 34,
|
||||
fload_1 = 35,
|
||||
fload_2 = 36,
|
||||
fload_3 = 37,
|
||||
istore = 54,
|
||||
fstore = 56,
|
||||
istore_0 = 59,
|
||||
istore_1 = 60,
|
||||
istore_2 = 61,
|
||||
istore_3 = 62,
|
||||
fstore_0 = 67,
|
||||
fstore_1 = 68,
|
||||
fstore_2 = 69,
|
||||
fstore_3 = 70,
|
||||
pop = 87,
|
||||
fadd = 98,
|
||||
fsub = 102,
|
||||
imul = 104,
|
||||
iinc = 132,
|
||||
f2i = 139,
|
||||
fcmpl = 149,
|
||||
fcmpg = 150,
|
||||
ifge = 156,
|
||||
ifgt = 157,
|
||||
ifle = 158,
|
||||
if_icmpge = 162,
|
||||
if_icmpgt = 163,
|
||||
if_icmple = 164,
|
||||
_goto = 167,
|
||||
getstatic = 178,
|
||||
putstatic = 179
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
|
||||
{
|
||||
public enum OpCode : byte
|
||||
{
|
||||
iconst_m1 = 2,
|
||||
iconst_0 = 3,
|
||||
iconst_1 = 4,
|
||||
iconst_2 = 5,
|
||||
iconst_3 = 6,
|
||||
iconst_4 = 7,
|
||||
iconst_5 = 8,
|
||||
fconst_0 = 11,
|
||||
fconst_1 = 12,
|
||||
fconst_2 = 13,
|
||||
bipush = 16,
|
||||
sipush = 17,
|
||||
fload = 23,
|
||||
iload_0 = 26,
|
||||
iload_1 = 27,
|
||||
fload_0 = 34,
|
||||
fload_1 = 35,
|
||||
fload_2 = 36,
|
||||
fload_3 = 37,
|
||||
istore = 54,
|
||||
fstore = 56,
|
||||
istore_0 = 59,
|
||||
istore_1 = 60,
|
||||
istore_2 = 61,
|
||||
istore_3 = 62,
|
||||
fstore_0 = 67,
|
||||
fstore_1 = 68,
|
||||
fstore_2 = 69,
|
||||
fstore_3 = 70,
|
||||
pop = 87,
|
||||
fadd = 98,
|
||||
fsub = 102,
|
||||
imul = 104,
|
||||
iinc = 132,
|
||||
f2i = 139,
|
||||
fcmpl = 149,
|
||||
fcmpg = 150,
|
||||
ifge = 156,
|
||||
ifgt = 157,
|
||||
ifle = 158,
|
||||
if_icmpge = 162,
|
||||
if_icmpgt = 163,
|
||||
if_icmple = 164,
|
||||
_goto = 167,
|
||||
getstatic = 178,
|
||||
putstatic = 179
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
|
||||
{
|
||||
public class JavaEngine : IScriptCompiler
|
||||
{
|
||||
public string FileExt()
|
||||
{
|
||||
return ".java";
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
JVMScript script = new JVMScript();
|
||||
Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
|
||||
|
||||
script.LoadScript(filename);
|
||||
|
||||
returns.Add(filename, script);
|
||||
|
||||
return returns;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
|
||||
{
|
||||
public class JavaEngine : IScriptCompiler
|
||||
{
|
||||
public string FileExt()
|
||||
{
|
||||
return ".java";
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
JVMScript script = new JVMScript();
|
||||
Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
|
||||
|
||||
script.LoadScript(filename);
|
||||
|
||||
returns.Add(filename, script);
|
||||
|
||||
return returns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
|
||||
{
|
||||
public class ArrayReference : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
|
||||
{
|
||||
public class ArrayReference : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
|
||||
{
|
||||
public class BaseType : Object
|
||||
{
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
|
||||
{
|
||||
public class BaseType : Object
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
|
||||
{
|
||||
public class ObjectReference : BaseType
|
||||
{
|
||||
public ushort Reference;
|
||||
|
||||
public ObjectReference()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
|
||||
{
|
||||
public class ObjectReference : BaseType
|
||||
{
|
||||
public ushort Reference;
|
||||
|
||||
public ObjectReference()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Byte : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Byte : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Char : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Char : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Float : BaseType
|
||||
{
|
||||
public float mValue = 0;
|
||||
|
||||
public Float()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Float : BaseType
|
||||
{
|
||||
public float mValue = 0;
|
||||
|
||||
public Float()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Int : BaseType
|
||||
{
|
||||
public int mValue = 0;
|
||||
|
||||
public Int()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
|
||||
{
|
||||
public class Int : BaseType
|
||||
{
|
||||
public int mValue = 0;
|
||||
|
||||
public Int()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
public interface IScript
|
||||
{
|
||||
void Initialise(ScriptInfo scriptInfo);
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
public class TestScript : IScript
|
||||
{
|
||||
private ScriptInfo script;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "TestScript 0.1"; }
|
||||
}
|
||||
|
||||
public void Initialise(ScriptInfo scriptInfo)
|
||||
{
|
||||
script = scriptInfo;
|
||||
script.events.OnFrame += events_OnFrame;
|
||||
script.events.OnNewPresence += events_OnNewPresence;
|
||||
}
|
||||
|
||||
private void events_OnNewPresence(ScenePresence presence)
|
||||
{
|
||||
script.logger.Verbose("TESTSCRIPT", "Hello " + presence.Firstname.ToString() + "!");
|
||||
}
|
||||
|
||||
private void events_OnFrame()
|
||||
{
|
||||
//script.logger.Verbose("TESTSCRIPT", "Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
public interface IScript
|
||||
{
|
||||
void Initialise(ScriptInfo scriptInfo);
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
public class TestScript : IScript
|
||||
{
|
||||
private ScriptInfo script;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "TestScript 0.1"; }
|
||||
}
|
||||
|
||||
public void Initialise(ScriptInfo scriptInfo)
|
||||
{
|
||||
script = scriptInfo;
|
||||
script.events.OnFrame += events_OnFrame;
|
||||
script.events.OnNewPresence += events_OnNewPresence;
|
||||
}
|
||||
|
||||
private void events_OnNewPresence(ScenePresence presence)
|
||||
{
|
||||
script.Log.Info("[TESTSCRIPT]: Hello " + presence.Firstname.ToString() + "!");
|
||||
}
|
||||
|
||||
private void events_OnFrame()
|
||||
{
|
||||
//script.logger.Info("[TESTSCRIPT]: Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using Key = libsecondlife.LLUUID;
|
||||
using Rotation = libsecondlife.LLQuaternion;
|
||||
using Vector = libsecondlife.LLVector3;
|
||||
using LSLList = System.Collections.Generic.List<string>;
|
||||
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
// This class is to be used for engines which may not be able to access the Scene directly.
|
||||
// Scene access is preffered, but obviously not possible on some non-.NET languages.
|
||||
public class ScriptAPI
|
||||
{
|
||||
private Scene scene;
|
||||
private ScriptInterpretedAPI interpretedAPI;
|
||||
|
||||
public ScriptAPI(Scene world, Key taskID)
|
||||
{
|
||||
scene = world;
|
||||
interpretedAPI = new ScriptInterpretedAPI(world, taskID);
|
||||
}
|
||||
|
||||
public Object CallMethod(String method, Object[] args)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using Key = libsecondlife.LLUUID;
|
||||
using Rotation = libsecondlife.LLQuaternion;
|
||||
using Vector = libsecondlife.LLVector3;
|
||||
using LSLList = System.Collections.Generic.List<string>;
|
||||
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
// This class is to be used for engines which may not be able to access the Scene directly.
|
||||
// Scene access is preffered, but obviously not possible on some non-.NET languages.
|
||||
public class ScriptAPI
|
||||
{
|
||||
private Scene scene;
|
||||
private ScriptInterpretedAPI interpretedAPI;
|
||||
|
||||
public ScriptAPI(Scene world, Key taskID)
|
||||
{
|
||||
scene = world;
|
||||
interpretedAPI = new ScriptInterpretedAPI(world, taskID);
|
||||
}
|
||||
|
||||
public Object CallMethod(String method, Object[] args)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Class which provides access to the world
|
||||
/// </summary>
|
||||
public class ScriptInfo
|
||||
{
|
||||
// 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 ScriptInfo(Scene scene)
|
||||
{
|
||||
world = scene;
|
||||
events = world.EventManager;
|
||||
logger = MainLog.Instance;
|
||||
api = new ScriptAPI(world, LLUUID.Zero);
|
||||
}
|
||||
|
||||
public void CreateTaskAPI(LLUUID task)
|
||||
{
|
||||
api = new ScriptAPI(world, task);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Class which provides access to the world
|
||||
/// </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;
|
||||
|
||||
// API Access
|
||||
public ScriptAPI api;
|
||||
|
||||
public log4net.ILog Log
|
||||
{
|
||||
get { return m_log; }
|
||||
}
|
||||
|
||||
public ScriptInfo(Scene scene)
|
||||
{
|
||||
world = scene;
|
||||
events = world.EventManager;
|
||||
api = new ScriptAPI(world, LLUUID.Zero);
|
||||
}
|
||||
|
||||
public void CreateTaskAPI(LLUUID task)
|
||||
{
|
||||
api = new ScriptAPI(world, task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,300 +1,302 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Axiom.Math;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using Key = libsecondlife.LLUUID;
|
||||
using Rotation = libsecondlife.LLQuaternion;
|
||||
using Vector = libsecondlife.LLVector3;
|
||||
using LSLList = System.Collections.Generic.List<string>;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
/// <summary>
|
||||
/// A class inteded to act as an API for LSL-styled interpreted languages
|
||||
/// </summary>
|
||||
/// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
|
||||
internal class ScriptInterpretedAPI
|
||||
{
|
||||
protected Key m_object;
|
||||
protected Scene m_scene;
|
||||
|
||||
/// <summary>
|
||||
/// The scene in which this script is acting
|
||||
/// </summary>
|
||||
public Scene Scene
|
||||
{
|
||||
get { return m_scene; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The id of the object our script is supposed to be acting in
|
||||
/// </summary>
|
||||
public Key ObjectID
|
||||
{
|
||||
get { return m_object; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The object our script is supposed to be in
|
||||
/// </summary>
|
||||
public SceneObjectGroup Task
|
||||
{
|
||||
// XXX Casting not ideal, but previous Scene.Objects propery wasn't actually populated, so
|
||||
// wouldn't have worked anyway.
|
||||
get { return (SceneObjectGroup)Scene.Entities[ObjectID]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ScriptInterpretedAPI for a specified object
|
||||
/// </summary>
|
||||
/// <param name="world">The scene the object is located in</param>
|
||||
/// <param name="member">The specific member being 'occupied' by the script</param>
|
||||
public ScriptInterpretedAPI(Scene world, Key member)
|
||||
{
|
||||
m_scene = world;
|
||||
m_object = member;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the absolute number of a integer value.
|
||||
/// </summary>
|
||||
/// <param name="val">Input</param>
|
||||
/// <returns>Absolute number of input</returns>
|
||||
public int osAbs(int val)
|
||||
{
|
||||
return Math.Abs(val);
|
||||
}
|
||||
|
||||
public float osAcos(float val)
|
||||
{
|
||||
return (float) Math.Acos(val);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAddToLandPassList(Key avatar, float hours)
|
||||
{
|
||||
Vector myPosition = Task.AbsolutePosition;
|
||||
Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
|
||||
if (myParcel == null)
|
||||
{
|
||||
//Dont do anything!
|
||||
}
|
||||
MainLog.Instance.Warn("script",
|
||||
"Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAdjustSoundVolume(float volume)
|
||||
{
|
||||
MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)");
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAllowInventoryDrop(int add)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public float osAngleBetween(Rotation a, Rotation b)
|
||||
{
|
||||
Quaternion axA = new Quaternion(a.W, a.X, a.Y, a.Z);
|
||||
Quaternion axB = new Quaternion(b.W, b.X, b.Y, b.Z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osApplyImpulse(Vector force, int local)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osApplyRotationalImpulse(Vector force, int local)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public float osAsin(float val)
|
||||
{
|
||||
return (float) Math.Asin(val);
|
||||
}
|
||||
|
||||
public float osAtan2(float x, float y)
|
||||
{
|
||||
return (float) Math.Atan2(x, y);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAttachToAvatar(Key avatar, int attachmentPoint)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public Key osAvatarOnSitTarget()
|
||||
{
|
||||
//TODO: Follow this as Children is chanced to be of type entity to support ScenePresences
|
||||
/*
|
||||
foreach (KeyValuePair<Key, EntityBase> Child in Task.Children)
|
||||
{
|
||||
if (Child.Value is ScenePresence)
|
||||
{
|
||||
return Child.Value.uuid;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return Key.Zero;
|
||||
}
|
||||
|
||||
public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
|
||||
{
|
||||
Quaternion axQ = new Quaternion();
|
||||
Vector3 axFwd = new Vector3(fwd.X, fwd.Y, fwd.Z);
|
||||
Vector3 axLeft = new Vector3(left.X, left.Y, left.Z);
|
||||
Vector3 axUp = new Vector3(up.X, up.Y, up.Z);
|
||||
|
||||
axQ.FromAxes(axFwd, axLeft, axUp);
|
||||
|
||||
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
|
||||
}
|
||||
|
||||
public Rotation osAxisAngle2Rot(Vector axis, float angle)
|
||||
{
|
||||
Quaternion axQ = Quaternion.FromAngleAxis(angle, new Vector3(axis.X, axis.Y, axis.Z));
|
||||
|
||||
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
|
||||
}
|
||||
|
||||
public string osBase64ToString(string str)
|
||||
{
|
||||
Encoding enc = Encoding.UTF8;
|
||||
return enc.GetString(Convert.FromBase64String(str));
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osBreakAllLinks()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osBreakLink()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public LSLList osCSV2List(string src)
|
||||
{
|
||||
LSLList retVal = new LSLList();
|
||||
retVal.AddRange(src.Split(','));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public int osCeil(float val)
|
||||
{
|
||||
return (int) Math.Ceiling(val);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osCloseRemoteDataChannel(Key channel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public float osCloud(Vector offset)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osCollisionFilter(string name, Key id, int accept)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osCollisionSprite(string impact_sprite)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public float osCos(float theta)
|
||||
{
|
||||
return (float) Math.Cos(theta);
|
||||
}
|
||||
|
||||
public void osCreateLink(Key target, int parent)
|
||||
{
|
||||
if (Scene.Entities[target] is SceneObjectGroup)
|
||||
Task.LinkToGroup((SceneObjectGroup) Scene.Entities[target]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Partially Unimplemented")]
|
||||
public LSLList osDeleteSubList(LSLList src, int start, int end)
|
||||
{
|
||||
if (start < 0 || end < 0)
|
||||
{
|
||||
throw new Exception("Unsupported at this time.");
|
||||
}
|
||||
|
||||
src.RemoveRange(start, start - end + 1);
|
||||
return src;
|
||||
}
|
||||
|
||||
[Obsolete("Partially Unimplemented")]
|
||||
public string osDeleteSubString(string src, int start, int end)
|
||||
{
|
||||
if (start < 0 || end < 0)
|
||||
{
|
||||
throw new Exception("Unsupported at this time.");
|
||||
}
|
||||
|
||||
return src.Remove(start, start - end + 1);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osDetachFromAvatar(Key avatar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Axiom.Math;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using Key = libsecondlife.LLUUID;
|
||||
using Rotation = libsecondlife.LLQuaternion;
|
||||
using Vector = libsecondlife.LLVector3;
|
||||
using LSLList = System.Collections.Generic.List<string>;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
/// <summary>
|
||||
/// A class inteded to act as an API for LSL-styled interpreted languages
|
||||
/// </summary>
|
||||
/// <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;
|
||||
|
||||
/// <summary>
|
||||
/// The scene in which this script is acting
|
||||
/// </summary>
|
||||
public Scene Scene
|
||||
{
|
||||
get { return m_scene; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The id of the object our script is supposed to be acting in
|
||||
/// </summary>
|
||||
public Key ObjectID
|
||||
{
|
||||
get { return m_object; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The object our script is supposed to be in
|
||||
/// </summary>
|
||||
public SceneObjectGroup Task
|
||||
{
|
||||
// XXX Casting not ideal, but previous Scene.Objects propery wasn't actually populated, so
|
||||
// wouldn't have worked anyway.
|
||||
get { return (SceneObjectGroup)Scene.Entities[ObjectID]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ScriptInterpretedAPI for a specified object
|
||||
/// </summary>
|
||||
/// <param name="world">The scene the object is located in</param>
|
||||
/// <param name="member">The specific member being 'occupied' by the script</param>
|
||||
public ScriptInterpretedAPI(Scene world, Key member)
|
||||
{
|
||||
m_scene = world;
|
||||
m_object = member;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the absolute number of a integer value.
|
||||
/// </summary>
|
||||
/// <param name="val">Input</param>
|
||||
/// <returns>Absolute number of input</returns>
|
||||
public int osAbs(int val)
|
||||
{
|
||||
return Math.Abs(val);
|
||||
}
|
||||
|
||||
public float osAcos(float val)
|
||||
{
|
||||
return (float) Math.Acos(val);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAddToLandPassList(Key avatar, float hours)
|
||||
{
|
||||
Vector myPosition = Task.AbsolutePosition;
|
||||
Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
|
||||
if (myParcel == null)
|
||||
{
|
||||
//Dont do anything!
|
||||
}
|
||||
m_log.Warn("[script]: " +
|
||||
"Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAdjustSoundVolume(float volume)
|
||||
{
|
||||
m_log.Warn("[script]: Unimplemented function called by script: osAdjustSoundVolume(float volume)");
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAllowInventoryDrop(int add)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public float osAngleBetween(Rotation a, Rotation b)
|
||||
{
|
||||
Quaternion axA = new Quaternion(a.W, a.X, a.Y, a.Z);
|
||||
Quaternion axB = new Quaternion(b.W, b.X, b.Y, b.Z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osApplyImpulse(Vector force, int local)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osApplyRotationalImpulse(Vector force, int local)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public float osAsin(float val)
|
||||
{
|
||||
return (float) Math.Asin(val);
|
||||
}
|
||||
|
||||
public float osAtan2(float x, float y)
|
||||
{
|
||||
return (float) Math.Atan2(x, y);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osAttachToAvatar(Key avatar, int attachmentPoint)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public Key osAvatarOnSitTarget()
|
||||
{
|
||||
//TODO: Follow this as Children is chanced to be of type entity to support ScenePresences
|
||||
/*
|
||||
foreach (KeyValuePair<Key, EntityBase> Child in Task.Children)
|
||||
{
|
||||
if (Child.Value is ScenePresence)
|
||||
{
|
||||
return Child.Value.uuid;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return Key.Zero;
|
||||
}
|
||||
|
||||
public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
|
||||
{
|
||||
Quaternion axQ = new Quaternion();
|
||||
Vector3 axFwd = new Vector3(fwd.X, fwd.Y, fwd.Z);
|
||||
Vector3 axLeft = new Vector3(left.X, left.Y, left.Z);
|
||||
Vector3 axUp = new Vector3(up.X, up.Y, up.Z);
|
||||
|
||||
axQ.FromAxes(axFwd, axLeft, axUp);
|
||||
|
||||
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
|
||||
}
|
||||
|
||||
public Rotation osAxisAngle2Rot(Vector axis, float angle)
|
||||
{
|
||||
Quaternion axQ = Quaternion.FromAngleAxis(angle, new Vector3(axis.X, axis.Y, axis.Z));
|
||||
|
||||
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
|
||||
}
|
||||
|
||||
public string osBase64ToString(string str)
|
||||
{
|
||||
Encoding enc = Encoding.UTF8;
|
||||
return enc.GetString(Convert.FromBase64String(str));
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osBreakAllLinks()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osBreakLink()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public LSLList osCSV2List(string src)
|
||||
{
|
||||
LSLList retVal = new LSLList();
|
||||
retVal.AddRange(src.Split(','));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public int osCeil(float val)
|
||||
{
|
||||
return (int) Math.Ceiling(val);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osCloseRemoteDataChannel(Key channel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public float osCloud(Vector offset)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osCollisionFilter(string name, Key id, int accept)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osCollisionSprite(string impact_sprite)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public float osCos(float theta)
|
||||
{
|
||||
return (float) Math.Cos(theta);
|
||||
}
|
||||
|
||||
public void osCreateLink(Key target, int parent)
|
||||
{
|
||||
if (Scene.Entities[target] is SceneObjectGroup)
|
||||
Task.LinkToGroup((SceneObjectGroup) Scene.Entities[target]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
[Obsolete("Partially Unimplemented")]
|
||||
public LSLList osDeleteSubList(LSLList src, int start, int end)
|
||||
{
|
||||
if (start < 0 || end < 0)
|
||||
{
|
||||
throw new Exception("Unsupported at this time.");
|
||||
}
|
||||
|
||||
src.RemoveRange(start, start - end + 1);
|
||||
return src;
|
||||
}
|
||||
|
||||
[Obsolete("Partially Unimplemented")]
|
||||
public string osDeleteSubString(string src, int start, int end)
|
||||
{
|
||||
if (start < 0 || end < 0)
|
||||
{
|
||||
throw new Exception("Unsupported at this time.");
|
||||
}
|
||||
|
||||
return src.Remove(start, start - end + 1);
|
||||
}
|
||||
|
||||
[Obsolete("Unimplemented")]
|
||||
public void osDetachFromAvatar(Key avatar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using Key = libsecondlife.LLUUID;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
public class ScriptInterpretedEvents
|
||||
{
|
||||
public delegate void OnTouchStartDelegate(Key user);
|
||||
|
||||
public event OnTouchStartDelegate OnTouchStart;
|
||||
|
||||
|
||||
public void TriggerTouchStart(Key user)
|
||||
{
|
||||
if (OnTouchStart != null)
|
||||
OnTouchStart(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using Key = libsecondlife.LLUUID;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
public class ScriptInterpretedEvents
|
||||
{
|
||||
public delegate void OnTouchStartDelegate(Key user);
|
||||
|
||||
public event OnTouchStartDelegate OnTouchStart;
|
||||
|
||||
|
||||
public void TriggerTouchStart(Key user)
|
||||
{
|
||||
if (OnTouchStart != null)
|
||||
OnTouchStart(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,149 +1,151 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.ExtensionsScriptModule.CSharp;
|
||||
using OpenSim.Region.ExtensionsScriptModule.JScript;
|
||||
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
|
||||
|
||||
namespace OpenSim.Region.ExtensionsScriptModule
|
||||
{
|
||||
public class ScriptManager : IRegionModule, IExtensionScriptModule
|
||||
{
|
||||
private readonly List<IScript> scripts = new List<IScript>();
|
||||
private Scene m_scene;
|
||||
private readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
|
||||
|
||||
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
|
||||
{
|
||||
foreach (KeyValuePair<string, IScript> script in compiledscripts)
|
||||
{
|
||||
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);
|
||||
script.Value.Initialise(scriptInfo);
|
||||
scripts.Add(script.Value);
|
||||
}
|
||||
|
||||
MainLog.Instance.Verbose("SCRIPT", string.Format("Finished loading {0} script(s)", compiledscripts.Count));
|
||||
}
|
||||
|
||||
public ScriptManager()
|
||||
{
|
||||
// Default Engines
|
||||
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
|
||||
compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
|
||||
|
||||
JScriptEngine jscriptCompiler = new JScriptEngine();
|
||||
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
|
||||
|
||||
JavaEngine javaCompiler = new JavaEngine();
|
||||
compilers.Add(javaCompiler.FileExt(), javaCompiler);
|
||||
}
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module");
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "ExtensionsScriptingModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Compile(string filename)
|
||||
{
|
||||
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
|
||||
{
|
||||
if (filename.EndsWith(compiler.Key))
|
||||
{
|
||||
LoadFromCompiler(compiler.Value.compile(filename));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RunScriptCmd(string[] args)
|
||||
{
|
||||
switch (args[0])
|
||||
{
|
||||
case "load":
|
||||
Compile(args[1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
MainLog.Instance.Error("Unknown script command");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddPreCompiledScript(IScript script)
|
||||
{
|
||||
MainLog.Instance.Verbose("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);
|
||||
scripts.Add(script);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IExtensionScriptModule
|
||||
{
|
||||
bool Compile(string filename);
|
||||
bool AddPreCompiledScript(IScript script);
|
||||
}
|
||||
|
||||
internal interface IScriptCompiler
|
||||
{
|
||||
Dictionary<string, IScript> compile(string filename);
|
||||
string FileExt();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* 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
|
||||
* 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
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.ExtensionsScriptModule.CSharp;
|
||||
using OpenSim.Region.ExtensionsScriptModule.JScript;
|
||||
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
|
||||
|
||||
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>();
|
||||
|
||||
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
|
||||
{
|
||||
foreach (KeyValuePair<string, IScript> script in compiledscripts)
|
||||
{
|
||||
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.
|
||||
m_log.Info("[SCRIPT]: Loading " + script.Key);
|
||||
script.Value.Initialise(scriptInfo);
|
||||
scripts.Add(script.Value);
|
||||
}
|
||||
|
||||
m_log.Info("[SCRIPT]: " + string.Format("Finished loading {0} script(s)", compiledscripts.Count));
|
||||
}
|
||||
|
||||
public ScriptManager()
|
||||
{
|
||||
// Default Engines
|
||||
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
|
||||
compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
|
||||
|
||||
JScriptEngine jscriptCompiler = new JScriptEngine();
|
||||
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
|
||||
|
||||
JavaEngine javaCompiler = new JavaEngine();
|
||||
compilers.Add(javaCompiler.FileExt(), javaCompiler);
|
||||
}
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_log.Info("[SCRIPTMODULE]: Initialising Extensions Scripting Module");
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "ExtensionsScriptingModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Compile(string filename)
|
||||
{
|
||||
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
|
||||
{
|
||||
if (filename.EndsWith(compiler.Key))
|
||||
{
|
||||
LoadFromCompiler(compiler.Value.compile(filename));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RunScriptCmd(string[] args)
|
||||
{
|
||||
switch (args[0])
|
||||
{
|
||||
case "load":
|
||||
Compile(args[1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
m_log.Error("Unknown script command");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddPreCompiledScript(IScript script)
|
||||
{
|
||||
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);
|
||||
scripts.Add(script);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IExtensionScriptModule
|
||||
{
|
||||
bool Compile(string filename);
|
||||
bool AddPreCompiledScript(IScript script);
|
||||
}
|
||||
|
||||
internal interface IScriptCompiler
|
||||
{
|
||||
Dictionary<string, IScript> compile(string filename);
|
||||
string FileExt();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue