From f3afa68a2af6ad5999e6efe3e4725cb17293108d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 14 Feb 2008 12:16:33 +0000 Subject: * Made new Framework.Constants class, added RegionSize member. * Converted all instances of "256" spotted to use RegionSize instead. Some approximations used for border crossings (ie 255.9f) are still using that value, but should be updated to use something based on RegionSize. * Moving Terrain to a RegionModule, implemented ITerrainChannel and TerrainModule - nonfunctional, but will be soon. --- .../DotNetEngine/Compiler/LSL/Compiler.cs | 64 ++++++++++++++-------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 5c8b4b5..58586c0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs @@ -272,41 +272,59 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL switch (l) { case enumCompileType.cs: - compileScript = String.Empty + - "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + - String.Empty + "namespace SecondLife { " + - String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + - @"public Script() { } " + - compileScript + - "} }\r\n"; + compileScript = CreateCSCompilerScript(compileScript); break; case enumCompileType.vb: - compileScript = String.Empty + - "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " + - String.Empty + "NameSpace SecondLife:" + - String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " + - "\r\nPublic Sub New()\r\nEnd Sub: " + - compileScript + - ":End Class :End Namespace\r\n"; + compileScript = CreateVBCompilerScript(compileScript); break; case enumCompileType.js: - compileScript = String.Empty + - "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" + - "package SecondLife {\r\n" + - "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + - compileScript + - "} }\r\n"; + compileScript = CreateJSCompilerScript(compileScript); break; } - return CompileFromCSorVBText(compileScript, l); + return CompileFromDotNetText(compileScript, l); + } + + private static string CreateJSCompilerScript(string compileScript) + { + compileScript = String.Empty + + "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" + + "package SecondLife {\r\n" + + "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + + compileScript + + "} }\r\n"; + return compileScript; + } + + private static string CreateCSCompilerScript(string compileScript) + { + compileScript = String.Empty + + "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + + String.Empty + "namespace SecondLife { " + + String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + + @"public Script() { } " + + compileScript + + "} }\r\n"; + return compileScript; + } + + private static string CreateVBCompilerScript(string compileScript) + { + compileScript = String.Empty + + "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " + + String.Empty + "NameSpace SecondLife:" + + String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " + + "\r\nPublic Sub New()\r\nEnd Sub: " + + compileScript + + ":End Class :End Namespace\r\n"; + return compileScript; } /// - /// Compile CS script to .Net assembly (.dll) + /// Compile .NET script to .Net assembly (.dll) /// /// CS script /// Filename to .dll assembly - internal string CompileFromCSorVBText(string Script, enumCompileType lang) + internal string CompileFromDotNetText(string Script, enumCompileType lang) { string ext = "." + lang.ToString(); -- cgit v1.1