aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs2
4 files changed, 16 insertions, 35 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 1d71182..f661162 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -39,9 +39,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
39{ 39{
40 public class Compiler 40 public class Compiler
41 { 41 {
42 private static readonly log4net.ILog m_log 42 private static readonly log4net.ILog m_log
43 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 // * Uses "LSL2Converter" to convert LSL to C# if necessary. 45 // * Uses "LSL2Converter" to convert LSL to C# if necessary.
46 // * Compiles C#-code into an assembly 46 // * Compiles C#-code into an assembly
47 // * Returns assembly name ready for AppDomain load. 47 // * Returns assembly name ready for AppDomain load.
@@ -278,8 +278,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
278 278
279 if (enableCommanderLSL == true && l == enumCompileType.cs) 279 if (enableCommanderLSL == true && l == enumCompileType.cs)
280 { 280 {
281 foreach (KeyValuePair<string, 281 foreach (KeyValuePair<string,
282 ICommander> com 282 ICommander> com
283 in m_scriptEngine.World.GetCommanders()) 283 in m_scriptEngine.World.GetCommanders())
284 { 284 {
285 compileScript = com.Value.GenerateRuntimeAPI() + compileScript; 285 compileScript = com.Value.GenerateRuntimeAPI() + compileScript;
@@ -305,7 +305,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
305 m_log.Debug("[ScriptEngine.DotNetEngine]: Preparing to compile the following LSL to C# translated code"); 305 m_log.Debug("[ScriptEngine.DotNetEngine]: Preparing to compile the following LSL to C# translated code");
306 m_log.Debug(""); 306 m_log.Debug("");
307 m_log.Debug(compileScript); 307 m_log.Debug(compileScript);
308 308
309 return CompileFromDotNetText(compileScript, l); 309 return CompileFromDotNetText(compileScript, l);
310 } 310 }
311 311
@@ -322,7 +322,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
322 322
323 private static string CreateCSCompilerScript(string compileScript) 323 private static string CreateCSCompilerScript(string compileScript)
324 { 324 {
325 325
326 326
327 compileScript = String.Empty + 327 compileScript = String.Empty +
328 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + 328 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 2100900..1832864 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -23,7 +23,7 @@
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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 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. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
@@ -32,17 +32,13 @@ using System.Text.RegularExpressions;
32 32
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
34{ 34{
35
36 public class LSL2CSConverter 35 public class LSL2CSConverter
37 { 36 {
38
39
40 // Uses regex to convert LSL code to C# code. 37 // Uses regex to convert LSL code to C# code.
41 38
42 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); 39 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled);
43 private Dictionary<string, string> dataTypes = new Dictionary<string, string>(); 40 private Dictionary<string, string> dataTypes = new Dictionary<string, string>();
44 private Dictionary<string, string> quotes = new Dictionary<string, string>(); 41 private Dictionary<string, string> quotes = new Dictionary<string, string>();
45
46 42
47 public LSL2CSConverter() 43 public LSL2CSConverter()
48 { 44 {
@@ -72,7 +68,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
72 Script = Regex.Replace(Script, @"\r\n", "\n"); 68 Script = Regex.Replace(Script, @"\r\n", "\n");
73 Script = Regex.Replace(Script, @"\n", "\r\n"); 69 Script = Regex.Replace(Script, @"\n", "\r\n");
74 70
75
76 // QUOTE REPLACEMENT 71 // QUOTE REPLACEMENT
77 // temporarily replace quotes so we can work our magic on the script without 72 // temporarily replace quotes so we can work our magic on the script without
78 // always considering if we are inside our outside quotes's 73 // always considering if we are inside our outside quotes's
@@ -86,21 +81,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
86 bool last_was_escape = false; 81 bool last_was_escape = false;
87 int quote_replaced_count = 0; 82 int quote_replaced_count = 0;
88 83
89
90
91 string[] blocked = new string[] {"Axiom","Db4objects","libsecondlife","log4net","Microsoft", 84 string[] blocked = new string[] {"Axiom","Db4objects","libsecondlife","log4net","Microsoft",
92 "Modified","Mono","MonoXnaCompactMaths","mscorlib","MySql", 85 "Modified","Mono","MonoXnaCompactMaths","mscorlib","MySql",
93 "NHibernate","Nini","nunit","Ode","OpenSim","PhysX_Wrapper_Dotnet", 86 "NHibernate","Nini","nunit","Ode","OpenSim","PhysX_Wrapper_Dotnet",
94 "PumaCode","RAIL","XMLRPC","System"}; 87 "PumaCode","RAIL","XMLRPC","System"};
95
96 88
97 for (int p = 0; p < blocked.Length;p++) 89 for (int p = 0; p < blocked.Length;p++)
98 { 90 {
99
100 Match SecurityM = Regex.Match(Script, "[;}][^\"']+" + blocked[p].Replace(".", "\\.") + "\\.[^\"']", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 91 Match SecurityM = Regex.Match(Script, "[;}][^\"']+" + blocked[p].Replace(".", "\\.") + "\\.[^\"']", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
101 if (SecurityM.Success) 92 if (SecurityM.Success)
102 throw new Exception("CS0103: 'The name '" + blocked[p] + "' does not exist in the current context'"); 93 throw new Exception("CS0103: 'The name '" + blocked[p] + "' does not exist in the current context'");
103
104 } 94 }
105 95
106 for (int p = 0; p < Script.Length; p++) 96 for (int p = 0; p < Script.Length; p++)
@@ -166,7 +156,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
166 // END OF QUOTE REPLACEMENT 156 // END OF QUOTE REPLACEMENT
167 // 157 //
168 158
169
170 // 159 //
171 // PROCESS STATES 160 // PROCESS STATES
172 // Remove state definitions and add state names to start of each event within state 161 // Remove state definitions and add state names to start of each event within state
@@ -194,7 +183,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
194 // if level == 0, add to return 183 // if level == 0, add to return
195 if (ilevel == 1 && lastlevel == 0) 184 if (ilevel == 1 && lastlevel == 0)
196 { 185 {
197 // 0 => 1: Get last 186 // 0 => 1: Get last
198 Match m = 187 Match m =
199 //Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", 188 //Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{",
200 Regex.Match(cache, @"(?![a-zA-Z_]+)\s*(state\s+)?(?<statename>[a-zA-Z_][a-zA-Z_0-9]*)[^a-zA-Z_0-9\(\)]*{", 189 Regex.Match(cache, @"(?![a-zA-Z_]+)\s*(state\s+)?(?<statename>[a-zA-Z_][a-zA-Z_0-9]*)[^a-zA-Z_0-9\(\)]*{",
@@ -253,7 +242,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
253 Script = ret; 242 Script = ret;
254 ret = String.Empty; 243 ret = String.Empty;
255 244
256
257 foreach (string key in dataTypes.Keys) 245 foreach (string key in dataTypes.Keys)
258 { 246 {
259 string val; 247 string val;
@@ -291,7 +279,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
291 Regex.Replace(Script, @"\[([^\]]*)\]", @"new LSL_Types.list($1)", 279 Regex.Replace(Script, @"\[([^\]]*)\]", @"new LSL_Types.list($1)",
292 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 280 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
293 281
294
295 // Replace (string) to .ToString() // 282 // Replace (string) to .ToString() //
296 Script = 283 Script =
297 Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.ToString()", 284 Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.ToString()",
@@ -313,12 +300,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
313 Script = Script.Replace(key, "\"" + val + "\""); 300 Script = Script.Replace(key, "\"" + val + "\"");
314 } 301 }
315 302
316
317
318 //System.Console.WriteLine(Script); 303 //System.Console.WriteLine(Script);
319 Return = String.Empty;// + 304 Return = String.Empty;// +
320 //"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;"; 305 //"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;";
321
322 306
323 //Return += String.Empty + 307 //Return += String.Empty +
324 // "namespace SecondLife { "; 308 // "namespace SecondLife { ";
@@ -328,13 +312,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
328 //Return += @"public Script() { } "; 312 //Return += @"public Script() { } ";
329 Return += Script; 313 Return += Script;
330 //Return += "} }\r\n"; 314 //Return += "} }\r\n";
331 315
332 quotes.Clear(); 316 quotes.Clear();
333 317
334 return Return; 318 return Return;
335 } 319 }
336
337 } 320 }
338
339
340} 321}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
index bce9cfc..799aa92 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
@@ -28,7 +28,7 @@
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30 30
31// General Information about an assembly is controlled through the following 31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly. 33// associated with an assembly.
34 34
@@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
41[assembly : AssemblyTrademark("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")] 42[assembly : AssemblyCulture("")]
43 43
44// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
47 47
48[assembly : ComVisible(false)] 48[assembly : ComVisible(false)]
@@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
54// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
55// 55//
56// Major Version 56// Major Version
57// Minor Version 57// Minor Version
58// Build Number 58// Build Number
59// Revision 59// Revision
60// 60//
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index ed2c0a3..55289d9 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
102 102
103 // Fire the first start-event 103 // Fire the first start-event
104 int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID); 104 int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID);
105 m_host.SetScriptEvents(itemID, eventFlags); 105 m_host.SetScriptEvents(itemID, eventFlags);
106 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", EventQueueManager.llDetectNull, new object[] { }); 106 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", EventQueueManager.llDetectNull, new object[] { });
107 } 107 }
108 catch (Exception e) // LEGIT: User Scripting 108 catch (Exception e) // LEGIT: User Scripting