Taken the old scripting engine out of Region.Environment and moved it into a separate module: OpenSim.Region.ExtensionsScriptModule (named as such because the purpose of it is to script server extensions, rather than "user scripting" like Tedd's engine.)

afrisby
MW 2007-08-28 18:30:28 +00:00
parent 5a149084d4
commit c16aafee09
45 changed files with 3727 additions and 3081 deletions

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules; using OpenSim.Region.Environment.Modules;
@ -37,6 +38,8 @@ namespace OpenSim.Region.Environment
avatarProfiles.Initialise(scene); avatarProfiles.Initialise(scene);
scene.AddModule(avatarProfiles.GetName(), avatarProfiles); scene.AddModule(avatarProfiles.GetName(), avatarProfiles);
this.LoadModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
// Post Initialise Modules // Post Initialise Modules
xferManager.PostInitialise(); xferManager.PostInitialise();
// chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot

View File

@ -21,7 +21,7 @@ namespace OpenSim.Region.Environment.Modules
private int m_port = 6668; private int m_port = 6668;
private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private string m_nick = "OpenSimBoT"; private string m_nick = "OpenSimBot";
private string m_channel = "#opensim"; private string m_channel = "#opensim";
private NetworkStream m_stream; private NetworkStream m_stream;

View File

@ -155,16 +155,6 @@ namespace OpenSim.Region.Environment.Scenes
}); });
} }
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
public void SendAvatarsToClient(IClientAPI remoteClient)
{
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -44,7 +44,6 @@ using OpenSim.Framework.Communications.Caches;
using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Scripting;
using OpenSim.Region.Terrain; using OpenSim.Region.Terrain;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using Caps = OpenSim.Region.Capabilities.Caps; using Caps = OpenSim.Region.Capabilities.Caps;
@ -122,13 +121,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_estateManager; } get { return m_estateManager; }
} }
private ScriptManager m_scriptManager;
public ScriptManager ScriptManager
{
get { return m_scriptManager; }
}
private PermissionManager m_permissionManager; private PermissionManager m_permissionManager;
public PermissionManager PermissionsMngr public PermissionManager PermissionsMngr
@ -174,7 +166,6 @@ namespace OpenSim.Region.Environment.Scenes
m_LandManager = new LandManager(this, m_regInfo); m_LandManager = new LandManager(this, m_regInfo);
m_estateManager = new EstateManager(this, m_regInfo); m_estateManager = new EstateManager(this, m_regInfo);
m_scriptManager = new ScriptManager(this);
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_permissionManager = new PermissionManager(this); m_permissionManager = new PermissionManager(this);

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
{
public class Byte : BaseType
{
}
}

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
{
public class Char : BaseType
{
}
}

View File

@ -1,102 +1,102 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.CSharp; using Microsoft.CSharp;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule.CSharp
{ {
public class CSharpScriptEngine : IScriptCompiler public class CSharpScriptEngine : IScriptCompiler
{ {
public string FileExt() public string FileExt()
{ {
return ".cs"; return ".cs";
} }
private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
{ {
CompilerParameters compilerParams = new CompilerParameters(); CompilerParameters compilerParams = new CompilerParameters();
CompilerResults compilerResults; CompilerResults compilerResults;
compilerParams.GenerateExecutable = false; compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true; compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false; compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll"); compilerParams.ReferencedAssemblies.Add("System.dll");
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
if (compilerResults.Errors.Count > 0) if (compilerResults.Errors.Count > 0)
{ {
MainLog.Instance.Error("Compile errors"); MainLog.Instance.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors) foreach (CompilerError error in compilerResults.Errors)
{ {
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
} }
} }
else else
{ {
Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); Dictionary<string,IScript> scripts = new Dictionary<string,IScript>();
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
{ {
Type testInterface = pluginType.GetInterface("IScript", true); Type testInterface = pluginType.GetInterface("IScript", true);
if (testInterface != null) if (testInterface != null)
{ {
IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
string scriptName = "C#/" + script.Name; string scriptName = "C#/" + script.Name;
Console.WriteLine("Script: " + scriptName + " loaded."); Console.WriteLine("Script: " + scriptName + " loaded.");
if (!scripts.ContainsKey(scriptName)) if (!scripts.ContainsKey(scriptName))
{ {
scripts.Add(scriptName, script); scripts.Add(scriptName, script);
} }
else else
{ {
scripts[scriptName] = script; scripts[scriptName] = script;
} }
} }
} }
return scripts; return scripts;
} }
return null; return null;
} }
public Dictionary<string,IScript> compile(string filename) public Dictionary<string,IScript> compile(string filename)
{ {
CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
return LoadDotNetScript(csharpProvider, filename); return LoadDotNetScript(csharpProvider, filename);
} }
} }
} }

View File

@ -1,72 +1,72 @@
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Scripting.Examples namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
{ {
public class LSLExportScript : IScript public class LSLExportScript : IScript
{ {
ScriptInfo script; ScriptInfo script;
public string Name public string Name
{ {
get { return "LSL Export Script 0.1"; } get { return "LSL Export Script 0.1"; }
} }
public void Initialise(ScriptInfo scriptInfo) public void Initialise(ScriptInfo scriptInfo)
{ {
script = scriptInfo; script = scriptInfo;
script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg);
} }
void ProcessConsoleMsg(string[] args) void ProcessConsoleMsg(string[] args)
{ {
/*if (args[0].ToLower() == "lslexport") /*if (args[0].ToLower() == "lslexport")
{ {
string sequence = ""; string sequence = "";
foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
{ {
SceneObject root = obj.Value; SceneObject root = obj.Value;
sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n";
string rootPrim = processPrimitiveToString(root.rootPrimitive); string rootPrim = processPrimitiveToString(root.rootPrimitive);
sequence += "ROOT:" + rootPrim; sequence += "ROOT:" + rootPrim;
foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
{ {
string child = processPrimitiveToString(prim.Value); string child = processPrimitiveToString(prim.Value);
sequence += "CHILD:" + child; sequence += "CHILD:" + child;
} }
} }
System.Console.WriteLine(sequence); System.Console.WriteLine(sequence);
}*/ }*/
} }
string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim)
{ {
/*string desc = prim.Description; /*string desc = prim.Description;
string name = prim.Name; string name = prim.Name;
LLVector3 pos = prim.Pos; LLVector3 pos = prim.Pos;
LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w);
LLVector3 scale = prim.Scale; LLVector3 scale = prim.Scale;
LLVector3 rootPos = prim.WorldPos; LLVector3 rootPos = prim.WorldPos;
string setPrimParams = ""; string setPrimParams = "";
setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
return setPrimParams; return setPrimParams;
*/ */
return ""; return "";
} }
} }
} }

View File

@ -1,102 +1,102 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.JScript; using Microsoft.JScript;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule.JScript
{ {
public class JScriptEngine : IScriptCompiler public class JScriptEngine : IScriptCompiler
{ {
public string FileExt() public string FileExt()
{ {
return ".js"; return ".js";
} }
private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
{ {
CompilerParameters compilerParams = new CompilerParameters(); CompilerParameters compilerParams = new CompilerParameters();
CompilerResults compilerResults; CompilerResults compilerResults;
compilerParams.GenerateExecutable = false; compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true; compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false; compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll"); compilerParams.ReferencedAssemblies.Add("System.dll");
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
if (compilerResults.Errors.Count > 0) if (compilerResults.Errors.Count > 0)
{ {
MainLog.Instance.Error("Compile errors"); MainLog.Instance.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors) foreach (CompilerError error in compilerResults.Errors)
{ {
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
} }
} }
else else
{ {
Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
{ {
Type testInterface = pluginType.GetInterface("IScript", true); Type testInterface = pluginType.GetInterface("IScript", true);
if (testInterface != null) if (testInterface != null)
{ {
IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
string scriptName = "JS.NET/" + script.Name; string scriptName = "JS.NET/" + script.Name;
Console.WriteLine("Script: " + scriptName + " loaded."); Console.WriteLine("Script: " + scriptName + " loaded.");
if (!scripts.ContainsKey(scriptName)) if (!scripts.ContainsKey(scriptName))
{ {
scripts.Add(scriptName, script); scripts.Add(scriptName, script);
} }
else else
{ {
scripts[scriptName] = script; scripts[scriptName] = script;
} }
} }
} }
return scripts; return scripts;
} }
return null; return null;
} }
public Dictionary<string, IScript> compile(string filename) public Dictionary<string, IScript> compile(string filename)
{ {
JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
return LoadDotNetScript(jscriptProvider, filename); return LoadDotNetScript(jscriptProvider, filename);
} }
} }
} }

View File

@ -1,46 +1,46 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Scripting.EmbeddedJVM.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class ClassInstance : Object public class ClassInstance : Object
{ {
public int Size; public int Size;
public ClassRecord ClassRec; public ClassRecord ClassRec;
public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
public ClassInstance() public ClassInstance()
{ {
} }
} }
} }

View File

@ -1,43 +1,43 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class Heap public class Heap
{ {
public List<ClassInstance> ClassObjects = new List<ClassInstance>(); public List<ClassInstance> ClassObjects = new List<ClassInstance>();
public Heap() public Heap()
{ {
} }
} }
} }

View File

@ -1,96 +1,96 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Scripting.EmbeddedJVM.Types; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; using OpenSim.Framework;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types;
using OpenSim.Framework; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
using OpenSim.Framework.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
partial class Thread partial class Thread
{ {
private partial class Interpreter private partial class Interpreter
{ {
private bool IsMethodOpCode(byte opcode) private bool IsMethodOpCode(byte opcode)
{ {
bool result = false; bool result = false;
switch (opcode) switch (opcode)
{ {
case 184: case 184:
short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]);
if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
{ {
string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value;
string typeparam = ""; string typeparam = "";
string typereturn = ""; string typereturn = "";
int firstbrak = 0; int firstbrak = 0;
int secondbrak = 0; int secondbrak = 0;
firstbrak = typ.LastIndexOf('('); firstbrak = typ.LastIndexOf('(');
secondbrak = typ.LastIndexOf(')'); secondbrak = typ.LastIndexOf(')');
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
{ {
//calling a method in this class //calling a method in this class
if (typeparam.Length == 0) if (typeparam.Length == 0)
{ {
this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2));
} }
else else
{ {
this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2));
} }
} }
else else
{ {
//calling a method of a different class //calling a method of a different class
// OpenSimAPI Class // OpenSimAPI Class
if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
{ {
this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null);
} }
} }
} }
else else
{ {
this.m_thread.PC += 2; this.m_thread.PC += 2;
} }
result = true; result = true;
break; break;
} }
return result; return result;
} }
} }
} }
} }

View File

@ -1,40 +1,40 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
partial class Thread partial class Thread
{ {
private partial class Interpreter private partial class Interpreter
{ {
} }
} }
} }

View File

@ -1,135 +1,135 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Scripting.EmbeddedJVM.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
partial class Thread partial class Thread
{ {
private partial class Interpreter private partial class Interpreter
{ {
private Thread m_thread; private Thread m_thread;
public Interpreter(Thread parentThread) public Interpreter(Thread parentThread)
{ {
m_thread = parentThread; m_thread = parentThread;
} }
public bool Excute() public bool Excute()
{ {
bool run = true; bool run = true;
byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++];
// Console.WriteLine("opCode is: " + currentOpCode); // Console.WriteLine("opCode is: " + currentOpCode);
bool handled = false; bool handled = false;
handled = this.IsLogicOpCode(currentOpCode); handled = this.IsLogicOpCode(currentOpCode);
if (!handled) if (!handled)
{ {
handled = this.IsMethodOpCode(currentOpCode); handled = this.IsMethodOpCode(currentOpCode);
} }
if (!handled) if (!handled)
{ {
if (currentOpCode == 172) if (currentOpCode == 172)
{ {
if (this.m_thread.stack.StackFrames.Count > 1) if (this.m_thread.stack.StackFrames.Count > 1)
{ {
Console.WriteLine("returning int from function"); Console.WriteLine("returning int from function");
int retPC1 = this.m_thread.m_currentFrame.ReturnPC; int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
this.m_thread.PC = retPC1; this.m_thread.PC = retPC1;
if (bas1 is Int) if (bas1 is Int)
{ {
this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); this.m_thread.m_currentFrame.OpStack.Push((Int)bas1);
} }
} }
else else
{ {
// Console.WriteLine("No parent function so ending program"); // Console.WriteLine("No parent function so ending program");
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
run = false; run = false;
} }
handled = true; handled = true;
} }
if (currentOpCode == 174) if (currentOpCode == 174)
{ {
if (this.m_thread.stack.StackFrames.Count > 1) if (this.m_thread.stack.StackFrames.Count > 1)
{ {
Console.WriteLine("returning float from function"); Console.WriteLine("returning float from function");
int retPC1 = this.m_thread.m_currentFrame.ReturnPC; int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
this.m_thread.PC = retPC1; this.m_thread.PC = retPC1;
if (bas1 is Float) if (bas1 is Float)
{ {
this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); this.m_thread.m_currentFrame.OpStack.Push((Float)bas1);
} }
} }
else else
{ {
// Console.WriteLine("No parent function so ending program"); // Console.WriteLine("No parent function so ending program");
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
run = false; run = false;
} }
handled = true; handled = true;
} }
if (currentOpCode == 177) if (currentOpCode == 177)
{ {
if (this.m_thread.stack.StackFrames.Count > 1) if (this.m_thread.stack.StackFrames.Count > 1)
{ {
Console.WriteLine("returning from function"); Console.WriteLine("returning from function");
int retPC = this.m_thread.m_currentFrame.ReturnPC; int retPC = this.m_thread.m_currentFrame.ReturnPC;
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
this.m_thread.PC = retPC; this.m_thread.PC = retPC;
} }
else else
{ {
// Console.WriteLine("No parent function so ending program"); // Console.WriteLine("No parent function so ending program");
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
run = false; run = false;
} }
handled = true; handled = true;
} }
} }
if (!handled) if (!handled)
{ {
Console.WriteLine("opcode " + currentOpCode + " not been handled "); Console.WriteLine("opcode " + currentOpCode + " not been handled ");
} }
return run; return run;
} }
} }
} }
} }

View File

@ -1,45 +1,45 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class MainMemory public class MainMemory
{ {
public Heap HeapArea; public Heap HeapArea;
public MethodMemory MethodArea; public MethodMemory MethodArea;
public MainMemory() public MainMemory()
{ {
MethodArea = new MethodMemory(); MethodArea = new MethodMemory();
HeapArea = new Heap(); HeapArea = new Heap();
} }
} }
} }

View File

@ -1,46 +1,46 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class MethodMemory public class MethodMemory
{ {
public byte[] MethodBuffer; public byte[] MethodBuffer;
public List<ClassRecord> Classes = new List<ClassRecord>(); public List<ClassRecord> Classes = new List<ClassRecord>();
public int NextMethodPC = 0; public int NextMethodPC = 0;
public int Methodcount = 0; public int Methodcount = 0;
public MethodMemory() public MethodMemory()
{ {
MethodBuffer = new byte[20000]; MethodBuffer = new byte[20000];
} }
} }
} }

View File

@ -1,37 +1,37 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class Object public class Object
{ {
} }
} }

View File

@ -1,56 +1,56 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public enum OpCode : byte public enum OpCode : byte
{ {
iconst_m1 = 2, iconst_m1 = 2,
iconst_0 = 3, iconst_0 = 3,
iconst_1 = 4, iconst_1 = 4,
iconst_2 = 5, iconst_2 = 5,
iconst_3 = 6, iconst_3 = 6,
iconst_4 = 7, iconst_4 = 7,
iconst_5 = 8, iconst_5 = 8,
fconst_0 = 11, fconst_0 = 11,
fconst_1 = 12, fconst_1 = 12,
fconst_2 = 13, fconst_2 = 13,
bipush = 16, bipush = 16,
sipush = 17, sipush = 17,
fload = 23, fload = 23,
iload_0 = 26, iload_0 = 26,
iload_1 = 27, iload_1 = 27,
fload_0 = 34, fload_0 = 34,
fload_1 = 35, fload_1 = 35,
fload_2 = 36, fload_2 = 36,
fload_3 = 37, fload_3 = 37,
istore = 54, istore = 54,
fstore = 56, fstore = 56,
istore_0 = 59, istore_0 = 59,
istore_1 = 60, istore_1 = 60,
istore_2 = 61, istore_2 = 61,
istore_3 = 62, istore_3 = 62,
fstore_0 = 67, fstore_0 = 67,
fstore_1 = 68, fstore_1 = 68,
fstore_2 = 69, fstore_2 = 69,
fstore_3 = 70, fstore_3 = 70,
pop = 87, pop = 87,
fadd = 98, fadd = 98,
fsub = 102, fsub = 102,
imul = 104, imul = 104,
iinc = 132, iinc = 132,
f2i = 139, f2i = 139,
fcmpl = 149, fcmpl = 149,
fcmpg = 150, fcmpg = 150,
ifge = 156, ifge = 156,
ifgt = 157, ifgt = 157,
ifle = 158, ifle = 158,
if_icmpge = 162, if_icmpge = 162,
if_icmpgt = 163, if_icmpgt = 163,
if_icmple = 164, if_icmple = 164,
_goto = 167, _goto = 167,
getstatic = 178, getstatic = 178,
putstatic = 179 putstatic = 179
} }
} }

View File

@ -1,42 +1,42 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class Stack public class Stack
{ {
public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); public Stack<StackFrame> StackFrames = new Stack<StackFrame>();
public Stack() public Stack()
{ {
} }
} }
} }

View File

@ -1,49 +1,49 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Scripting.EmbeddedJVM.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class StackFrame public class StackFrame
{ {
public BaseType[] LocalVariables; public BaseType[] LocalVariables;
public Stack<BaseType> OpStack = new Stack<BaseType>(); public Stack<BaseType> OpStack = new Stack<BaseType>();
public int ReturnPC = 0; public int ReturnPC = 0;
public ClassRecord CallingClass = null; public ClassRecord CallingClass = null;
public StackFrame() public StackFrame()
{ {
LocalVariables = new BaseType[20]; LocalVariables = new BaseType[20];
} }
} }
} }

View File

@ -1,119 +1,119 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Scripting.EmbeddedJVM.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Scripting; using OpenSim.Region.ExtensionsScriptModule;
namespace OpenSim.Region.Scripting.EmbeddedJVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public partial class Thread public partial class Thread
{ {
// Is this smart? // Is this smart?
public static MainMemory GlobalMemory; public static MainMemory GlobalMemory;
public static Scene World; public static Scene World;
private int PC = 0; private int PC = 0;
private Stack stack; private Stack stack;
private Interpreter m_Interpreter; private Interpreter m_Interpreter;
public ClassRecord currentClass; public ClassRecord currentClass;
public ClassInstance currentInstance; public ClassInstance currentInstance;
private StackFrame m_currentFrame; private StackFrame m_currentFrame;
public int excutionCounter = 0; public int excutionCounter = 0;
public bool running = false; public bool running = false;
public ScriptInfo scriptInfo; public ScriptInfo scriptInfo;
public Thread() public Thread()
{ {
this.m_Interpreter = new Interpreter(this); this.m_Interpreter = new Interpreter(this);
this.stack = new Stack(); this.stack = new Stack();
} }
public void SetPC(int methodpointer) public void SetPC(int methodpointer)
{ {
//Console.WriteLine("Thread PC has been set to " + methodpointer); //Console.WriteLine("Thread PC has been set to " + methodpointer);
PC = methodpointer; PC = methodpointer;
} }
public void StartMethod(ClassRecord rec, string methName) public void StartMethod(ClassRecord rec, string methName)
{ {
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
this.currentClass = rec; this.currentClass = rec;
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
public void StartMethod( string methName) public void StartMethod( string methName)
{ {
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
public void JumpToStaticVoidMethod(string methName, int returnPC) public void JumpToStaticVoidMethod(string methName, int returnPC)
{ {
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
m_currentFrame.ReturnPC = returnPC; m_currentFrame.ReturnPC = returnPC;
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
public void JumpToStaticParamMethod(string methName, string param, int returnPC) public void JumpToStaticParamMethod(string methName, string param, int returnPC)
{ {
if (param == "I") if (param == "I")
{ {
BaseType bs1 = m_currentFrame.OpStack.Pop(); BaseType bs1 = m_currentFrame.OpStack.Pop();
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
m_currentFrame.ReturnPC = returnPC; m_currentFrame.ReturnPC = returnPC;
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
m_currentFrame.LocalVariables[0] = ((Int)bs1); m_currentFrame.LocalVariables[0] = ((Int)bs1);
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
if (param == "F") if (param == "F")
{ {
} }
} }
public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
{ {
} }
public bool Excute() public bool Excute()
{ {
excutionCounter++; excutionCounter++;
return this.m_Interpreter.Excute(); return this.m_Interpreter.Excute();
} }
} }
} }

View File

@ -1,29 +1,28 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Scripting; using OpenSim.Region.ExtensionsScriptModule;
using OpenSim.Region.Scripting.EmbeddedJVM;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
namespace OpenSim.Region.Scripting {
{ public class JavaEngine : IScriptCompiler
public class JavaEngine : IScriptCompiler {
{ public string FileExt()
public string FileExt() {
{ return ".java";
return ".java"; }
}
public Dictionary<string, IScript> compile(string filename)
public Dictionary<string, IScript> compile(string filename) {
{ JVMScript script = new JVMScript();
JVMScript script = new JVMScript(); Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
script.LoadScript(filename);
script.LoadScript(filename);
returns.Add(filename, script);
returns.Add(filename, script);
return returns;
return returns; }
} }
} }
}

View File

@ -1,170 +1,171 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Scripting; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM;
using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread;
namespace OpenSim.Region.Scripting.EmbeddedJVM
{ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
public class JVMScript : IScript {
{ public class JVMScript : IScript
private List<Thread> _threads = new List<Thread>(); {
private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); private List<Thread> _threads = new List<Thread>();
private MainMemory _mainMemory; private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
private MainMemory _mainMemory;
ScriptInfo scriptInfo;
ScriptInfo scriptInfo;
public void Initialise(ScriptInfo info)
{ public void Initialise(ScriptInfo info)
scriptInfo = info; {
scriptInfo = info;
_mainMemory = new MainMemory();
Thread.GlobalMemory = this._mainMemory; _mainMemory = new MainMemory();
Thread.World = info.world; Thread.GlobalMemory = this._mainMemory;
CompileScript(); Thread.World = info.world;
CompileScript();
scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
} scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
}
void events_OnNewPresence(ScenePresence presence)
{ void events_OnNewPresence(ScenePresence presence)
for (int i = 0; i < this._threads.Count; i++) {
{ for (int i = 0; i < this._threads.Count; i++)
if (!this._threads[i].running) {
{ if (!this._threads[i].running)
this._threads[i].StartMethod("OnNewPresence"); {
bool run = true; this._threads[i].StartMethod("OnNewPresence");
while (run) bool run = true;
{ while (run)
run = this._threads[i].Excute(); {
} run = this._threads[i].Excute();
} }
} }
} }
}
void events_OnFrame()
{ void events_OnFrame()
for (int i = 0; i < this._threads.Count; i++) {
{ for (int i = 0; i < this._threads.Count; i++)
if (!this._threads[i].running) {
{ if (!this._threads[i].running)
this._threads[i].StartMethod("OnFrame"); {
bool run = true; this._threads[i].StartMethod("OnFrame");
while (run) bool run = true;
{ while (run)
run = this._threads[i].Excute(); {
} run = this._threads[i].Excute();
} }
} }
} }
}
public string Name
{ public string Name
get { return "JVM Scripting Engine"; } {
} get { return "JVM Scripting Engine"; }
}
public void LoadScript(string script)
{ public void LoadScript(string script)
Console.WriteLine("OpenSimJVM - loading new script: " + script); {
CompileInfo comp = new CompileInfo(); Console.WriteLine("OpenSimJVM - loading new script: " + script);
comp.script = script; CompileInfo comp = new CompileInfo();
comp.scriptName = script; comp.script = script;
this.CompileScripts.Enqueue(comp); comp.scriptName = script;
} this.CompileScripts.Enqueue(comp);
}
public void CompileScript()
{ public void CompileScript()
CompileInfo comp = this.CompileScripts.Dequeue(); {
string script = comp.script; CompileInfo comp = this.CompileScripts.Dequeue();
string scriptName = comp.scriptName; string script = comp.script;
try string scriptName = comp.scriptName;
{ try
//need to compile the script into a java class file {
//need to compile the script into a java class file
//first save it to a java source file
TextWriter tw = new StreamWriter(scriptName + ".java"); //first save it to a java source file
tw.WriteLine(script); TextWriter tw = new StreamWriter(scriptName + ".java");
tw.Close(); tw.WriteLine(script);
tw.Close();
//now compile
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); //now compile
// psi.RedirectStandardOutput = true; System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; // psi.RedirectStandardOutput = true;
psi.UseShellExecute = false; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
System.Diagnostics.Process javacomp;
javacomp = System.Diagnostics.Process.Start(psi); System.Diagnostics.Process javacomp;
javacomp.WaitForExit(); javacomp = System.Diagnostics.Process.Start(psi);
javacomp.WaitForExit();
//now load in class file
ClassRecord class1 = new ClassRecord(); //now load in class file
class1.LoadClassFromFile(scriptName + ".class"); ClassRecord class1 = new ClassRecord();
class1.PrintToConsole(); class1.LoadClassFromFile(scriptName + ".class");
//Console.WriteLine(); class1.PrintToConsole();
this._mainMemory.MethodArea.Classes.Add(class1); //Console.WriteLine();
class1.AddMethodsToMemory(this._mainMemory.MethodArea); this._mainMemory.MethodArea.Classes.Add(class1);
class1.AddMethodsToMemory(this._mainMemory.MethodArea);
Thread newThread = new Thread();
this._threads.Add(newThread); Thread newThread = new Thread();
newThread.currentClass = class1; this._threads.Add(newThread);
newThread.scriptInfo = scriptInfo; newThread.currentClass = class1;
newThread.scriptInfo = scriptInfo;
//now delete the created files
System.IO.File.Delete(scriptName + ".java"); //now delete the created files
System.IO.File.Delete(scriptName + ".class"); System.IO.File.Delete(scriptName + ".java");
//this.OnFrame(); System.IO.File.Delete(scriptName + ".class");
} //this.OnFrame();
catch (Exception e) }
{ catch (Exception e)
Console.WriteLine("exception"); {
Console.WriteLine(e.StackTrace); Console.WriteLine("exception");
Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace);
} Console.WriteLine(e.Message);
} }
}
private class CompileInfo
{ private class CompileInfo
public string script; {
public string scriptName; public string script;
public string scriptName;
public CompileInfo()
{ public CompileInfo()
{
}
} }
} }
} }
}

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
{ {
public class ArrayReference :BaseType public class ArrayReference :BaseType
{ {
} }
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
{ {
public class BaseType : Object public class BaseType : Object
{ {
} }
} }

View File

@ -1,16 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
{ {
public class ObjectReference : BaseType public class ObjectReference : BaseType
{ {
public ushort Reference; public ushort Reference;
public ObjectReference() public ObjectReference()
{ {
} }
} }
} }

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
{
public class Byte : BaseType
{
}
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
{
public class Char : BaseType
{
}
}

View File

@ -1,16 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
{ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
public class Float : BaseType {
{ public class Float : BaseType
public float mValue = 0; {
public float mValue = 0;
public Float()
{ public Float()
{
}
} }
} }
}

View File

@ -1,16 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
{ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
public class Int : BaseType {
{ public class Int : BaseType
public int mValue = 0; {
public int mValue = 0;
public Int()
{ public Int()
{
}
} }
} }
}

View File

@ -0,0 +1,213 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DD34045D-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region.ExtensionScriptEngine</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region.ExtensionScriptEngine</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="libsecondlife.dll">
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.JScript">
<HintPath>Microsoft.JScript.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Framework\General\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Framework\Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\Environment\OpenSim.Region.Environment.csproj">
<Name>OpenSim.Region.Environment</Name>
<Project>{DCBA491C-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="NullScriptHost.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Script.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptAPI.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptInterpretedAPI.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptInterpretedEvents.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\CSharpEngine\CSharpScriptEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\CSharpEngine\Examples\ExportRegionToLSL.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JScriptEngine\JScriptEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JavaEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\OpenSimJVM.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\ClassInstance.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\ClassRecord.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Heap.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.Logic.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.Methods.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.Return.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\MainMemory.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\MethodMemory.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Object.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\OpCodes.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Stack.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\StackFrame.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Thread.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\ArrayReference.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\BaseType.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\ObjectReference.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Byte.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Char.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Float.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Int.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,12 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim11-07\bin\</ReferencePath>
<LastOpenVersion>8.0.50727</LastOpenVersion>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
</Project>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" ?>
<project name="OpenSim.Region.ExtensionScriptEngine" default="build">
<target name="build">
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
<copy todir="${project::get-base-directory()}/${build.dir}">
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Region.ExtensionScriptEngine" dynamicprefix="true" >
</resources>
<sources failonempty="true">
<include name="IScriptHost.cs" />
<include name="NullScriptHost.cs" />
<include name="Script.cs" />
<include name="ScriptAPI.cs" />
<include name="ScriptInfo.cs" />
<include name="ScriptInterpretedAPI.cs" />
<include name="ScriptInterpretedEvents.cs" />
<include name="ScriptManager.cs" />
<include name="Engines/CSharpEngine/CSharpScriptEngine.cs" />
<include name="Engines/CSharpEngine/Examples/ExportRegionToLSL.cs" />
<include name="Engines/JScriptEngine/JScriptEngine.cs" />
<include name="Engines/JVMEngine/JavaEngine.cs" />
<include name="Engines/JVMEngine/OpenSimJVM.cs" />
<include name="Engines/JVMEngine/JVM/ClassInstance.cs" />
<include name="Engines/JVMEngine/JVM/ClassRecord.cs" />
<include name="Engines/JVMEngine/JVM/Heap.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.Logic.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.Methods.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.Return.cs" />
<include name="Engines/JVMEngine/JVM/MainMemory.cs" />
<include name="Engines/JVMEngine/JVM/MethodMemory.cs" />
<include name="Engines/JVMEngine/JVM/Object.cs" />
<include name="Engines/JVMEngine/JVM/OpCodes.cs" />
<include name="Engines/JVMEngine/JVM/Stack.cs" />
<include name="Engines/JVMEngine/JVM/StackFrame.cs" />
<include name="Engines/JVMEngine/JVM/Thread.cs" />
<include name="Engines/JVMEngine/Types/ArrayReference.cs" />
<include name="Engines/JVMEngine/Types/BaseType.cs" />
<include name="Engines/JVMEngine/Types/ObjectReference.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Char.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Float.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Int.cs" />
</sources>
<references basedir="${project::get-base-directory()}">
<lib>
<include name="${project::get-base-directory()}" />
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="../../../bin/libsecondlife.dll" />
<include name="Microsoft.JScript.dll" />
<include name="../../../bin/OpenSim.Framework.dll" />
<include name="../../../bin/OpenSim.Framework.Console.dll" />
<include name="../../../bin/OpenSim.Region.Environment.dll" />
<include name="System.dll" />
<include name="System.Xml.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
<mkdir dir="${project::get-base-directory()}/../../../bin/"/>
<copy todir="${project::get-base-directory()}/../../../bin/">
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
<include name="*.dll"/>
<include name="*.exe"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${bin.dir}" failonerror="false" />
<delete dir="${obj.dir}" failonerror="false" />
</target>
<target name="doc" description="Creates documentation.">
</target>
</project>

View File

@ -0,0 +1,207 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{512D761A-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region.ExtensionsScriptModule</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder>
<RootNamespace>OpenSim.Region.ExtensionsScriptModule</RootNamespace>
<StartupObject></StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Axiom.MathLib.dll" >
<HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll" >
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.JScript" >
<HintPath>Microsoft.JScript.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" >
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml" >
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Framework\General\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Framework\Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\Environment\OpenSim.Region.Environment.csproj">
<Name>OpenSim.Region.Environment</Name>
<Project>{DCBA491C-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Script.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptAPI.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptInterpretedAPI.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptInterpretedEvents.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ScriptManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\CSharp\CSharpScriptEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\CSharp\Examples\ExportRegionToLSL.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JScript\JScriptEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JavaEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\OpenSimJVM.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\ClassInstance.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\ClassRecord.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Heap.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.Logic.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.Methods.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Interpreter.Return.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\MainMemory.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\MethodMemory.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Object.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\OpCodes.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Stack.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\StackFrame.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\JVM\Thread.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\ArrayReference.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\BaseType.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\ObjectReference.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Byte.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Char.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Float.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Int.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,12 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim11-07\bin\</ReferencePath>
<LastOpenVersion>8.0.50727</LastOpenVersion>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
</Project>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" ?>
<project name="OpenSim.Region.ExtensionsScriptModule" default="build">
<target name="build">
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
<copy todir="${project::get-base-directory()}/${build.dir}">
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Region.ExtensionsScriptModule" dynamicprefix="true" >
</resources>
<sources failonempty="true">
<include name="Script.cs" />
<include name="ScriptAPI.cs" />
<include name="ScriptInfo.cs" />
<include name="ScriptInterpretedAPI.cs" />
<include name="ScriptInterpretedEvents.cs" />
<include name="ScriptManager.cs" />
<include name="Engines/CSharp/CSharpScriptEngine.cs" />
<include name="Engines/CSharp/Examples/ExportRegionToLSL.cs" />
<include name="Engines/JScript/JScriptEngine.cs" />
<include name="Engines/JVMEngine/JavaEngine.cs" />
<include name="Engines/JVMEngine/OpenSimJVM.cs" />
<include name="Engines/JVMEngine/JVM/ClassInstance.cs" />
<include name="Engines/JVMEngine/JVM/ClassRecord.cs" />
<include name="Engines/JVMEngine/JVM/Heap.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.Logic.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.Methods.cs" />
<include name="Engines/JVMEngine/JVM/Interpreter.Return.cs" />
<include name="Engines/JVMEngine/JVM/MainMemory.cs" />
<include name="Engines/JVMEngine/JVM/MethodMemory.cs" />
<include name="Engines/JVMEngine/JVM/Object.cs" />
<include name="Engines/JVMEngine/JVM/OpCodes.cs" />
<include name="Engines/JVMEngine/JVM/Stack.cs" />
<include name="Engines/JVMEngine/JVM/StackFrame.cs" />
<include name="Engines/JVMEngine/JVM/Thread.cs" />
<include name="Engines/JVMEngine/Types/ArrayReference.cs" />
<include name="Engines/JVMEngine/Types/BaseType.cs" />
<include name="Engines/JVMEngine/Types/ObjectReference.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Char.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Float.cs" />
<include name="Engines/JVMEngine/Types/PrimitiveTypes/Int.cs" />
</sources>
<references basedir="${project::get-base-directory()}">
<lib>
<include name="${project::get-base-directory()}" />
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="../../../bin/Axiom.MathLib.dll" />
<include name="../../../bin/libsecondlife.dll" />
<include name="Microsoft.JScript.dll" />
<include name="../../../bin/OpenSim.Framework.dll" />
<include name="../../../bin/OpenSim.Framework.Console.dll" />
<include name="../../../bin/OpenSim.Region.Environment.dll" />
<include name="System.dll" />
<include name="System.Xml.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
<mkdir dir="${project::get-base-directory()}/../../../bin/"/>
<copy todir="${project::get-base-directory()}/../../../bin/">
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
<include name="*.dll"/>
<include name="*.exe"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${bin.dir}" failonerror="false" />
<delete dir="${obj.dir}" failonerror="false" />
</target>
<target name="doc" description="Creates documentation.">
</target>
</project>

View File

@ -1,64 +1,64 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule
{ {
public interface IScript public interface IScript
{ {
void Initialise(ScriptInfo scriptInfo); void Initialise(ScriptInfo scriptInfo);
string Name { get; } string Name { get; }
} }
public class TestScript : IScript public class TestScript : IScript
{ {
ScriptInfo script; ScriptInfo script;
public string Name public string Name
{ {
get { return "TestScript 0.1"; } get { return "TestScript 0.1"; }
} }
public void Initialise(ScriptInfo scriptInfo) public void Initialise(ScriptInfo scriptInfo)
{ {
script = scriptInfo; script = scriptInfo;
script.events.OnFrame += events_OnFrame; script.events.OnFrame += events_OnFrame;
script.events.OnNewPresence += events_OnNewPresence; script.events.OnNewPresence += events_OnNewPresence;
} }
void events_OnNewPresence(ScenePresence presence) void events_OnNewPresence(ScenePresence presence)
{ {
script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!"); script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!");
} }
void events_OnFrame() void events_OnFrame()
{ {
//script.logger.Verbose("Hello World!"); //script.logger.Verbose("Hello World!");
} }
} }
} }

View File

@ -1,32 +1,32 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Key = libsecondlife.LLUUID; using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion; using Rotation = libsecondlife.LLQuaternion;
using Vector = libsecondlife.LLVector3; using Vector = libsecondlife.LLVector3;
using LSLList = System.Collections.Generic.List<string>; using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule
{ {
// This class is to be used for engines which may not be able to access the Scene directly. // 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. // Scene access is preffered, but obviously not possible on some non-.NET languages.
public class ScriptAPI public class ScriptAPI
{ {
Scene scene; Scene scene;
ScriptInterpretedAPI interpretedAPI; ScriptInterpretedAPI interpretedAPI;
public ScriptAPI(Scene world, Key taskID) public ScriptAPI(Scene world, Key taskID)
{ {
scene = world; scene = world;
interpretedAPI = new ScriptInterpretedAPI(world, taskID); interpretedAPI = new ScriptInterpretedAPI(world, taskID);
} }
public Object CallMethod(String method, Object[] args) public Object CallMethod(String method, Object[] args)
{ {
return null; return null;
} }
} }
} }

View File

@ -1,63 +1,63 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule
{ {
/// <summary> /// <summary>
/// Class which provides access to the world /// Class which provides access to the world
/// </summary> /// </summary>
public class ScriptInfo public class ScriptInfo
{ {
// Reference to world.eventsManager provided for convenience // Reference to world.eventsManager provided for convenience
public EventManager events; public EventManager events;
// The main world // The main world
public Scene world; public Scene world;
// The console // The console
public LogBase logger; public LogBase logger;
// API Access // API Access
public ScriptAPI api; public ScriptAPI api;
public ScriptInfo(Scene scene) public ScriptInfo(Scene scene)
{ {
world = scene; world = scene;
events = world.EventManager; events = world.EventManager;
logger = MainLog.Instance; logger = MainLog.Instance;
api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); api = new ScriptAPI(world, libsecondlife.LLUUID.Zero);
} }
public void CreateTaskAPI(libsecondlife.LLUUID task) public void CreateTaskAPI(libsecondlife.LLUUID task)
{ {
api = new ScriptAPI(world, task); api = new ScriptAPI(world, task);
} }
} }
} }

View File

@ -1,267 +1,267 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Key = libsecondlife.LLUUID; using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion; using Rotation = libsecondlife.LLQuaternion;
using Vector = libsecondlife.LLVector3; using Vector = libsecondlife.LLVector3;
using LSLList = System.Collections.Generic.List<string>; using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.LandManagement;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule
{ {
/// <summary> /// <summary>
/// A class inteded to act as an API for LSL-styled interpreted languages /// A class inteded to act as an API for LSL-styled interpreted languages
/// </summary> /// </summary>
/// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
class ScriptInterpretedAPI class ScriptInterpretedAPI
{ {
protected LLUUID m_object; protected LLUUID m_object;
protected Scene m_scene; protected Scene m_scene;
/// <summary> /// <summary>
/// The scene in which this script is acting /// The scene in which this script is acting
/// </summary> /// </summary>
public Scene Scene public Scene Scene
{ {
get { return m_scene; } get { return m_scene; }
} }
/// <summary> /// <summary>
/// The id of the object our script is supposed to be acting in /// The id of the object our script is supposed to be acting in
/// </summary> /// </summary>
public Key ObjectID public Key ObjectID
{ {
get { return m_object; } get { return m_object; }
} }
/// <summary> /// <summary>
/// The object our script is supposed to be in /// The object our script is supposed to be in
/// </summary> /// </summary>
public SceneObjectGroup Task public SceneObjectGroup Task
{ {
get { return Scene.Objects[ObjectID]; } get { return Scene.Objects[ObjectID]; }
} }
/// <summary> /// <summary>
/// Creates a new ScriptInterpretedAPI for a specified object /// Creates a new ScriptInterpretedAPI for a specified object
/// </summary> /// </summary>
/// <param name="world">The scene the object is located in</param> /// <param name="world">The scene the object is located in</param>
/// <param name="member">The specific member being 'occupied' by the script</param> /// <param name="member">The specific member being 'occupied' by the script</param>
public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member)
{ {
m_scene = world; m_scene = world;
m_object = member; m_object = member;
} }
/// <summary> /// <summary>
/// Returns the absolute number of a integer value. /// Returns the absolute number of a integer value.
/// </summary> /// </summary>
/// <param name="val">Input</param> /// <param name="val">Input</param>
/// <returns>Absolute number of input</returns> /// <returns>Absolute number of input</returns>
public int osAbs(int val) public int osAbs(int val)
{ {
return Math.Abs(val); return Math.Abs(val);
} }
public float osAcos(float val) public float osAcos(float val)
{ {
return (float)Math.Acos(val); return (float)Math.Acos(val);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAddToLandPassList(Key avatar, float hours) public void osAddToLandPassList(Key avatar, float hours)
{ {
Vector myPosition = Task.AbsolutePosition; Vector myPosition = Task.AbsolutePosition;
Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAdjustSoundVolume(float volume) public void osAdjustSoundVolume(float volume)
{ {
OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)");
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAllowInventoryDrop(int add) public void osAllowInventoryDrop(int add)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public float osAngleBetween(Rotation a, Rotation b) public float osAngleBetween(Rotation a, Rotation b)
{ {
Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z);
Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z);
return 0; return 0;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osApplyImpulse(Vector force, int local) public void osApplyImpulse(Vector force, int local)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osApplyRotationalImpulse(Vector force, int local) public void osApplyRotationalImpulse(Vector force, int local)
{ {
return; return;
} }
public float osAsin(float val) public float osAsin(float val)
{ {
return (float)Math.Asin(val); return (float)Math.Asin(val);
} }
public float osAtan2(float x, float y) public float osAtan2(float x, float y)
{ {
return (float)Math.Atan2(x, y); return (float)Math.Atan2(x, y);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAttachToAvatar(Key avatar, int attachmentPoint) public void osAttachToAvatar(Key avatar, int attachmentPoint)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public Key osAvatarOnSitTarget() public Key osAvatarOnSitTarget()
{ {
//TODO: Follow this as Children is chanced to be of type entity to support ScenePresences //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences
/* /*
foreach (KeyValuePair<Key, EntityBase> Child in Task.Children) foreach (KeyValuePair<Key, EntityBase> Child in Task.Children)
{ {
if (Child.Value is ScenePresence) if (Child.Value is ScenePresence)
{ {
return Child.Value.uuid; return Child.Value.uuid;
} }
} }
*/ */
return Key.Zero; return Key.Zero;
} }
public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
{ {
Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion();
Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z);
Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z);
Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z);
axQ.FromAxes(axFwd, axLeft, axUp); axQ.FromAxes(axFwd, axLeft, axUp);
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
} }
public Rotation osAxisAngle2Rot(Vector axis, float angle) public Rotation osAxisAngle2Rot(Vector axis, float angle)
{ {
Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z));
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
} }
public string osBase64ToString(string str) public string osBase64ToString(string str)
{ {
Encoding enc = System.Text.Encoding.UTF8; Encoding enc = System.Text.Encoding.UTF8;
return enc.GetString(Convert.FromBase64String(str)); return enc.GetString(Convert.FromBase64String(str));
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osBreakAllLinks() public void osBreakAllLinks()
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osBreakLink() public void osBreakLink()
{ {
return; return;
} }
public LSLList osCSV2List(string src) public LSLList osCSV2List(string src)
{ {
LSLList retVal = new LSLList(); LSLList retVal = new LSLList();
retVal.AddRange(src.Split(',')); retVal.AddRange(src.Split(','));
return retVal; return retVal;
} }
public int osCeil(float val) public int osCeil(float val)
{ {
return (int)Math.Ceiling(val); return (int)Math.Ceiling(val);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osCloseRemoteDataChannel(Key channel) public void osCloseRemoteDataChannel(Key channel)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public float osCloud(Vector offset) public float osCloud(Vector offset)
{ {
return 0.0f; return 0.0f;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osCollisionFilter(string name, Key id, int accept) public void osCollisionFilter(string name, Key id, int accept)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osCollisionSprite(string impact_sprite) public void osCollisionSprite(string impact_sprite)
{ {
return; return;
} }
public float osCos(float theta) public float osCos(float theta)
{ {
return (float)Math.Cos(theta); return (float)Math.Cos(theta);
} }
public void osCreateLink(Key target, int parent) public void osCreateLink(Key target, int parent)
{ {
if(Scene.Entities[target] is SceneObjectGroup) if(Scene.Entities[target] is SceneObjectGroup)
Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]);
return; return;
} }
[Obsolete("Partially Unimplemented")] [Obsolete("Partially Unimplemented")]
public LSLList osDeleteSubList(LSLList src, int start, int end) public LSLList osDeleteSubList(LSLList src, int start, int end)
{ {
if (start < 0 || end < 0) if (start < 0 || end < 0)
{ {
throw new Exception("Unsupported at this time."); throw new Exception("Unsupported at this time.");
} }
src.RemoveRange(start, start - end + 1); src.RemoveRange(start, start - end + 1);
return src; return src;
} }
[Obsolete("Partially Unimplemented")] [Obsolete("Partially Unimplemented")]
public string osDeleteSubString(string src, int start, int end) public string osDeleteSubString(string src, int start, int end)
{ {
if (start < 0 || end < 0) if (start < 0 || end < 0)
{ {
throw new Exception("Unsupported at this time."); throw new Exception("Unsupported at this time.");
} }
return src.Remove(start, start - end + 1); return src.Remove(start, start - end + 1);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osDetachFromAvatar(Key avatar) public void osDetachFromAvatar(Key avatar)
{ {
return; return;
} }
} }
} }

View File

@ -1,23 +1,23 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using libsecondlife; using libsecondlife;
using Key = libsecondlife.LLUUID; using Key = libsecondlife.LLUUID;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.ExtensionsScriptModule
{ {
public class ScriptInterpretedEvents public class ScriptInterpretedEvents
{ {
public delegate void OnTouchStartDelegate(Key user); public delegate void OnTouchStartDelegate(Key user);
public event OnTouchStartDelegate OnTouchStart; public event OnTouchStartDelegate OnTouchStart;
public void TriggerTouchStart(Key user) public void TriggerTouchStart(Key user)
{ {
if (OnTouchStart != null) if (OnTouchStart != null)
OnTouchStart(user); OnTouchStart(user);
} }
} }
} }

View File

@ -1,107 +1,138 @@
/* /*
* Copyright (c) Contributors, http://www.openmetaverse.org/ * Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Scripting using OpenSim.Region.Environment.Interfaces;
{ using OpenSim.Region.ExtensionsScriptModule.CSharp;
public class ScriptManager using OpenSim.Region.ExtensionsScriptModule.JScript;
{ using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
List<IScript> scripts = new List<IScript>();
Scene scene; namespace OpenSim.Region.ExtensionsScriptModule
Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); {
public class ScriptManager : IRegionModule
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) {
{ List<IScript> scripts = new List<IScript>();
foreach (KeyValuePair<string, IScript> script in compiledscripts) Scene m_scene;
{ Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
MainLog.Instance.Verbose("Loading " + script.Key); private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
script.Value.Initialise(scriptInfo); {
scripts.Add(script.Value); foreach (KeyValuePair<string, IScript> script in compiledscripts)
} {
MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); 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("Loading " + script.Key);
script.Value.Initialise(scriptInfo);
public ScriptManager(Scene world) scripts.Add(script.Value);
{ }
scene = world; MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
}
// Default Engines
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); public ScriptManager()
compilers.Add(csharpCompiler.FileExt(),csharpCompiler); {
// Default Engines
JScriptEngine jscriptCompiler = new JScriptEngine(); CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); compilers.Add(csharpCompiler.FileExt(),csharpCompiler);
JavaEngine javaCompiler = new JavaEngine(); JScriptEngine jscriptCompiler = new JScriptEngine();
compilers.Add(javaCompiler.FileExt(), javaCompiler); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
}
JavaEngine javaCompiler = new JavaEngine();
public void Compile(string filename) compilers.Add(javaCompiler.FileExt(), javaCompiler);
{ }
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
{ public void Initialise(Scene scene)
if (filename.EndsWith(compiler.Key)) {
{ System.Console.WriteLine("Initialising Extensions Scripting Module");
LoadFromCompiler(compiler.Value.compile(filename)); m_scene = scene;
break;
} m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod<bool, string, int>(Compile));
} m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod<bool, IScript, int>(AddPreCompiledScript));
} }
public void RunScriptCmd(string[] args) public void PostInitialise()
{ {
switch (args[0])
{ }
case "load":
Compile(args[1]); public void CloseDown()
break; {
default: }
MainLog.Instance.Error("Unknown script command");
break; public string GetName()
} {
} return "ExtensionsScriptingModule";
}
public void AddPreCompiledScript(IScript script)
{ public bool Compile(string filename, int dummyParam)
MainLog.Instance.Verbose("Loading script " + script.Name); {
ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
script.Initialise(scriptInfo); {
scripts.Add(script); if (filename.EndsWith(compiler.Key))
} {
} LoadFromCompiler(compiler.Value.compile(filename));
break;
interface IScriptCompiler }
{ }
Dictionary<string,IScript> compile(string filename);
string FileExt(); return true;
} }
}
public void RunScriptCmd(string[] args)
{
switch (args[0])
{
case "load":
Compile(args[1], 0);
break;
default:
MainLog.Instance.Error("Unknown script command");
break;
}
}
public bool AddPreCompiledScript(IScript script, int dummyParam)
{
MainLog.Instance.Verbose("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;
}
}
interface IScriptCompiler
{
Dictionary<string,IScript> compile(string filename);
string FileExt();
}
}

View File

@ -595,6 +595,34 @@
</Files> </Files>
</Project> </Project>
<Project name="OpenSim.Region.ExtensionsScriptModule" path="OpenSim/Region/ExtensionsScriptModule" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="Microsoft.JScript"/>
<Reference name="libsecondlife.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="Axiom.MathLib.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<!-- OpenSim app --> <!-- OpenSim app -->
<Project name="OpenSim" path="OpenSim/Region/Application" type="Exe"> <Project name="OpenSim" path="OpenSim/Region/Application" type="Exe">
<Configuration name="Debug"> <Configuration name="Debug">