From 3456d951d89fbc83f742d40ca8ca2a1a79d414eb Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 13:13:17 +0000 Subject: Imported the scripting changes, so now should be up to date with sugilite. --- .../Environment/Scenes/scripting/ScriptManager.cs | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs new file mode 100644 index 0000000..5d1d188 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -0,0 +1,99 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Scripting +{ + public class ScriptManager + { + List scripts = new List(); + OpenSim.Region.Environment.Scenes.Scene scene; + Dictionary compilers = new Dictionary(); + + private void LoadFromCompiler(Dictionary compiledscripts) + { + foreach (KeyValuePair script in compiledscripts) + { + ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. + OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading " + script.Key); + script.Value.Initialise(scriptInfo); + scripts.Add(script.Value); + } + OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); + } + + public ScriptManager(OpenSim.Region.Environment.Scenes.Scene world) + { + scene = world; + + // Default Engines + CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); + compilers.Add(csharpCompiler.FileExt(),csharpCompiler); + + JScriptEngine jscriptCompiler = new JScriptEngine(); + compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); + + JSharpScriptEngine jsharpCompiler = new JSharpScriptEngine(); + compilers.Add(jsharpCompiler.FileExt(), jsharpCompiler); + } + + public void Compile(string filename) + { + foreach (KeyValuePair compiler in compilers) + { + if (filename.EndsWith(compiler.Key)) + { + LoadFromCompiler(compiler.Value.compile(filename)); + break; + } + } + } + + public void RunScriptCmd(string[] args) + { + switch (args[0]) + { + case "load": + Compile(args[1]); + break; + + default: + OpenSim.Framework.Console.MainLog.Instance.Error("Unknown script command"); + break; + } + } + } + + interface IScriptCompiler + { + Dictionary compile(string filename); + string FileExt(); + } +} -- cgit v1.1 From 561db23e5fbfcd110423c6a408ac0a11bebbedac Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 14:10:05 +0000 Subject: Finished removing the old scripting code, Scene.Scripting.cs and OpenSim.Framework.Interfaces.Scripting. --- OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 5d1d188..576b7a5 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Scripting +namespace OpenSim.Region.Enviorment.Scripting { public class ScriptManager { -- cgit v1.1 From 135e9b1f538ae77dfd8bf68139c960fb8e016c16 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 28 Jun 2007 19:35:20 +0000 Subject: * Removed J# language support because it has issues with Mono. --- OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 576b7a5..eb1c1d9 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -59,9 +59,6 @@ namespace OpenSim.Region.Enviorment.Scripting JScriptEngine jscriptCompiler = new JScriptEngine(); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); - - JSharpScriptEngine jsharpCompiler = new JSharpScriptEngine(); - compilers.Add(jsharpCompiler.FileExt(), jsharpCompiler); } public void Compile(string filename) -- cgit v1.1 From 9b6b6d05d45cf0f754a0b26bf6240ef50be66563 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 14:37:29 +0000 Subject: * Optimized usings (the 'LL ate my scripts' commit) * added some licensing info --- .../Region/Environment/Scenes/scripting/ScriptManager.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index eb1c1d9..1d47c24 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -25,16 +25,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using System.Collections.Generic; -using System.Text; +using OpenSim.Framework.Console; +using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Enviorment.Scripting { public class ScriptManager { List scripts = new List(); - OpenSim.Region.Environment.Scenes.Scene scene; + Scene scene; Dictionary compilers = new Dictionary(); private void LoadFromCompiler(Dictionary compiledscripts) @@ -42,14 +42,14 @@ namespace OpenSim.Region.Enviorment.Scripting foreach (KeyValuePair script in compiledscripts) { ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. - OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading " + script.Key); + MainLog.Instance.Verbose("Loading " + script.Key); script.Value.Initialise(scriptInfo); scripts.Add(script.Value); } - OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); + MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); } - public ScriptManager(OpenSim.Region.Environment.Scenes.Scene world) + public ScriptManager(Scene world) { scene = world; @@ -82,7 +82,7 @@ namespace OpenSim.Region.Enviorment.Scripting break; default: - OpenSim.Framework.Console.MainLog.Instance.Error("Unknown script command"); + MainLog.Instance.Error("Unknown script command"); break; } } -- cgit v1.1 From 3c46e5b170991e41e8c82e25bae65cf46152b924 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 5 Jul 2007 00:09:45 +0000 Subject: * Added Java support back into Sugilite (although it still needs a calling host to be added). --- OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 1d47c24..250a4f0 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using OpenSim.Framework.Console; using OpenSim.Region.Environment.Scenes; -namespace OpenSim.Region.Enviorment.Scripting +namespace OpenSim.Region.Environment.Scripting { public class ScriptManager { -- cgit v1.1 From c570b107f890180bcaf5e5a030525af04feab1d4 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 5 Jul 2007 00:24:40 +0000 Subject: * Java engine fully back in Sugilite --- OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs index 250a4f0..153f4d7 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs @@ -59,6 +59,9 @@ namespace OpenSim.Region.Environment.Scripting JScriptEngine jscriptCompiler = new JScriptEngine(); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); + + JavaEngine javaCompiler = new JavaEngine(); + compilers.Add(javaCompiler.FileExt(), javaCompiler); } public void Compile(string filename) -- cgit v1.1