aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
authorAdam Frisby2008-01-15 02:09:55 +0000
committerAdam Frisby2008-01-15 02:09:55 +0000
commitb25f9f322cdbcde7fd8c043137bf07992e5ef318 (patch)
tree7c1a5115b2849dfe388b825dd271271d347f9574 /OpenSim/Region/ScriptEngine/DotNetEngine
parentSet svn:eol-style. (diff)
downloadopensim-SC_OLD-b25f9f322cdbcde7fd8c043137bf07992e5ef318.zip
opensim-SC_OLD-b25f9f322cdbcde7fd8c043137bf07992e5ef318.tar.gz
opensim-SC_OLD-b25f9f322cdbcde7fd8c043137bf07992e5ef318.tar.bz2
opensim-SC_OLD-b25f9f322cdbcde7fd8c043137bf07992e5ef318.tar.xz
* Mother of all commits:
* Cleaned up copyright notices in AssemblyInfo.cs's * Added Copyright headers to a bunch of files missing them * Replaced several common string instances with a static constant to prevent reallocation of the same strings thousands of times. "" -> String.Empty is the first such candidate.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs37
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs30
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs2
4 files changed, 50 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 9cd22e2..2adc060 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -143,7 +143,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
143 // TODO: Return errors to user somehow 143 // TODO: Return errors to user somehow
144 if (results.Errors.Count > 0) 144 if (results.Errors.Count > 0)
145 { 145 {
146 string errtext = ""; 146 string errtext = String.Empty;
147 foreach (CompilerError CompErr in results.Errors) 147 foreach (CompilerError CompErr in results.Errors)
148 { 148 {
149 errtext += "Line number " + (CompErr.Line - 1) + 149 errtext += "Line number " + (CompErr.Line - 1) +
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 724d8f5..f3302ee 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -28,6 +28,7 @@
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text.RegularExpressions; 30using System.Text.RegularExpressions;
31using System;
31 32
32namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
33{ 34{
@@ -58,7 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
58 public string Convert(string Script) 59 public string Convert(string Script)
59 { 60 {
60 quotes.Clear(); 61 quotes.Clear();
61 string Return = ""; 62 string Return = System.String.Empty;
62 Script = " \r\n" + Script; 63 Script = " \r\n" + Script;
63 64
64 // 65 //
@@ -72,13 +73,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
72 73
73 // QUOTE REPLACEMENT 74 // QUOTE REPLACEMENT
74 // temporarily replace quotes so we can work our magic on the script without 75 // temporarily replace quotes so we can work our magic on the script without
75 // always considering if we are inside our outside ""'s 76 // always considering if we are inside our outside String.Empty's
76 string _Script = ""; 77 string _Script = System.String.Empty;
77 string C; 78 string C;
78 bool in_quote = false; 79 bool in_quote = false;
79 bool quote_replaced = false; 80 bool quote_replaced = false;
80 string quote_replacement_string = "Q_U_O_T_E_REPLACEMENT_"; 81 string quote_replacement_string = "Q_U_O_T_E_REPLACEMENT_";
81 string quote = ""; 82 string quote = System.String.Empty;
82 bool last_was_escape = false; 83 bool last_was_escape = false;
83 int quote_replaced_count = 0; 84 int quote_replaced_count = 0;
84 for (int p = 0; p < Script.Length; p++) 85 for (int p = 0; p < Script.Length; p++)
@@ -97,7 +98,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
97 } 98 }
98 else 99 else
99 { 100 {
100 if (quote == "") 101 if (quote == System.String.Empty)
101 { 102 {
102 // We didn't replace quote, probably because of empty string? 103 // We didn't replace quote, probably because of empty string?
103 _Script += quote_replacement_string + 104 _Script += quote_replacement_string +
@@ -107,7 +108,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
107 quotes.Add( 108 quotes.Add(
108 quote_replacement_string + 109 quote_replacement_string +
109 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); 110 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
110 quote = ""; 111 quote = System.String.Empty;
111 } 112 }
112 break; 113 break;
113 } 114 }
@@ -151,10 +152,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
151 // 152 //
152 int ilevel = 0; 153 int ilevel = 0;
153 int lastlevel = 0; 154 int lastlevel = 0;
154 string ret = ""; 155 string ret = System.String.Empty;
155 string cache = ""; 156 string cache = System.String.Empty;
156 bool in_state = false; 157 bool in_state = false;
157 string current_statename = ""; 158 string current_statename = System.String.Empty;
158 for (int p = 0; p < Script.Length; p++) 159 for (int p = 0; p < Script.Length; p++)
159 { 160 {
160 C = Script.Substring(p, 1); 161 C = Script.Substring(p, 1);
@@ -191,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
191 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 192 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
192 } 193 }
193 ret += cache; 194 ret += cache;
194 cache = ""; 195 cache = String.Empty;
195 } 196 }
196 if (ilevel == 0 && lastlevel == 1) 197 if (ilevel == 0 && lastlevel == 1)
197 { 198 {
@@ -199,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
199 if (in_state == true) 200 if (in_state == true)
200 { 201 {
201 cache = cache.Remove(cache.Length - 1, 1); 202 cache = cache.Remove(cache.Length - 1, 1);
202 //cache = Regex.Replace(cache, "}$", "", RegexOptions.Multiline | RegexOptions.Singleline); 203 //cache = Regex.Replace(cache, "}$", String.Empty, RegexOptions.Multiline | RegexOptions.Singleline);
203 204
204 //Replace function names 205 //Replace function names
205 // void dataserver(key query_id, string data) { 206 // void dataserver(key query_id, string data) {
@@ -213,9 +214,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
213 } 214 }
214 215
215 ret += cache; 216 ret += cache;
216 cache = ""; 217 cache = String.Empty;
217 in_state = true; 218 in_state = true;
218 current_statename = ""; 219 current_statename = String.Empty;
219 } 220 }
220 221
221 break; 222 break;
@@ -223,10 +224,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
223 lastlevel = ilevel; 224 lastlevel = ilevel;
224 } 225 }
225 ret += cache; 226 ret += cache;
226 cache = ""; 227 cache = String.Empty;
227 228
228 Script = ret; 229 Script = ret;
229 ret = ""; 230 ret = String.Empty;
230 231
231 232
232 foreach (string key in dataTypes.Keys) 233 foreach (string key in dataTypes.Keys)
@@ -287,7 +288,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
287 288
288 // Add namespace, class name and inheritance 289 // Add namespace, class name and inheritance
289 290
290 Return = "" + 291 Return = String.Empty +
291 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;"; 292 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;";
292 //"using System; " + 293 //"using System; " +
293 //"using System.Collections.Generic; " + 294 //"using System.Collections.Generic; " +
@@ -309,9 +310,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
309 //} 310 //}
310 311
311 312
312 Return += "" + 313 Return += String.Empty +
313 "namespace SecondLife { "; 314 "namespace SecondLife { ";
314 Return += "" + 315 Return += String.Empty +
315 //"[Serializable] " + 316 //"[Serializable] " +
316 "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { "; 317 "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { ";
317 Return += @"public Script() { } "; 318 Return += @"public Script() { } ";
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
index 00027ca..e484906 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
@@ -1,3 +1,31 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
1using System.Reflection; 29using System.Reflection;
2using System.Runtime.InteropServices; 30using System.Runtime.InteropServices;
3 31
@@ -10,7 +38,7 @@ using System.Runtime.InteropServices;
10[assembly : AssemblyConfiguration("")] 38[assembly : AssemblyConfiguration("")]
11[assembly : AssemblyCompany("")] 39[assembly : AssemblyCompany("")]
12[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] 40[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")]
13[assembly : AssemblyCopyright("Copyright © 2007")] 41[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
14[assembly : AssemblyTrademark("")] 42[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")] 43[assembly : AssemblyCulture("")]
16 44
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 0c28ac7..2bb40ee 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
64 64
65 // We will initialize and start the script. 65 // We will initialize and start the script.
66 // It will be up to the script itself to hook up the correct events. 66 // It will be up to the script itself to hook up the correct events.
67 string ScriptSource = ""; 67 string ScriptSource = String.Empty;
68 68
69 SceneObjectPart m_host = World.GetSceneObjectPart(localID); 69 SceneObjectPart m_host = World.GetSceneObjectPart(localID);
70 70