aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJeff Ames2008-05-18 23:06:50 +0000
committerJeff Ames2008-05-18 23:06:50 +0000
commit6ec680918bc6876f1c1382fb534b653fc34da052 (patch)
tree7eedbb3fa05b9540de9bba4a583795f1ba919de4 /OpenSim/Region/ScriptEngine
parentUpdate svn properties. (diff)
downloadopensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.zip
opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.tar.gz
opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.tar.bz2
opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.tar.xz
Formatting cleanup, minor refactoring. Fixed some comparisons of value types and null.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs21
2 files changed, 13 insertions, 23 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 2469107..765eb5d 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -39,13 +39,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
39 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); 39 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled);
40 private Dictionary<string, string> dataTypes = new Dictionary<string, string>(); 40 private Dictionary<string, string> dataTypes = new Dictionary<string, string>();
41 private Dictionary<string, string> quotes = new Dictionary<string, string>(); 41 private Dictionary<string, string> quotes = new Dictionary<string, string>();
42 // c Style 42 // c Style
43 private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline); 43 private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline);
44 // c# one liners 44 // c# one liners
45 private Regex conelinecomments = new Regex(@".?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline); 45 private Regex conelinecomments = new Regex(@".?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline);
46 // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"]) 46 // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"])
47
48
49 47
50 // value we're looking for: (?:[a-zA-Z])\.[a-zA-Z] 48 // value we're looking for: (?:[a-zA-Z])\.[a-zA-Z]
51 public LSL2CSConverter() 49 public LSL2CSConverter()
@@ -89,16 +87,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
89 bool last_was_escape = false; 87 bool last_was_escape = false;
90 int quote_replaced_count = 0; 88 int quote_replaced_count = 0;
91 89
92
93
94 string removecomments = conelinecomments.Replace(Script, ""); 90 string removecomments = conelinecomments.Replace(Script, "");
95 removecomments = cstylecomments.Replace(removecomments, ""); 91 removecomments = cstylecomments.Replace(removecomments, "");
96 string[] localscript = removecomments.Split('"'); 92 string[] localscript = removecomments.Split('"');
97 string checkscript = String.Empty; 93 string checkscript = String.Empty;
98 bool flip = true; 94 bool flip = true;
99 95
100
101
102 for (int p = 0; p < localscript.Length; p++) 96 for (int p = 0; p < localscript.Length; p++)
103 { 97 {
104 if (localscript[p].Length >= 1) 98 if (localscript[p].Length >= 1)
@@ -115,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
115 if (!flip) 109 if (!flip)
116 checkscript += "\"" + localscript[p]; 110 checkscript += "\"" + localscript[p];
117 } 111 }
118 112
119 //System.Console.WriteLine("SCRIPT:" + checkscript); 113 //System.Console.WriteLine("SCRIPT:" + checkscript);
120 114
121 // checks for alpha.alpha way of referring to objects in C# 115 // checks for alpha.alpha way of referring to objects in C#
@@ -132,9 +126,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
132 if (SecurityM.Success) 126 if (SecurityM.Success)
133 throw new Exception("CS0103: 'The object.GetType method isn't allowed in LSL'"); 127 throw new Exception("CS0103: 'The object.GetType method isn't allowed in LSL'");
134 128
135
136
137
138 for (int p = 0; p < Script.Length; p++) 129 for (int p = 0; p < Script.Length; p++)
139 { 130 {
140 C = Script.Substring(p, 1); 131 C = Script.Substring(p, 1);
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs
index 603808e..2a51b91 100644
--- a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs
+++ b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs
@@ -45,27 +45,25 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
45 ChannelServices.RegisterChannel(chan, true); 45 ChannelServices.RegisterChannel(chan, true);
46 } 46 }
47 47
48 /// <summary>
49 /// Create a channel for communicating w/ the remote object
50 /// Notice no port is specified on the client
51 /// </summary>
48 public ScriptServerInterfaces.ServerRemotingObject Connect(string hostname, int port) 52 public ScriptServerInterfaces.ServerRemotingObject Connect(string hostname, int port)
49 { 53 {
50 // Create a channel for communicating w/ the remote object 54 ScriptServerInterfaces.ServerRemotingObject obj = null;
51 // Notice no port is specified on the client 55
52
53 try 56 try
54 { 57 {
55 // Create an instance of the remote object 58 // Create an instance of the remote object
56 ScriptServerInterfaces.ServerRemotingObject obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( 59 obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject(
57 typeof(ScriptServerInterfaces.ServerRemotingObject), 60 typeof(ScriptServerInterfaces.ServerRemotingObject),
58 "tcp://" + hostname + ":" + port + "/DotNetEngine"); 61 "tcp://" + hostname + ":" + port + "/DotNetEngine");
59 62
60 // Use the object 63 if (obj == null)
61 if (obj.Equals(null))
62 { 64 {
63 Console.WriteLine("Error: unable to locate server"); 65 Console.WriteLine("Error: unable to locate server");
64 } 66 }
65 else
66 {
67 return obj;
68 }
69 } 67 }
70 catch (SocketException) 68 catch (SocketException)
71 { 69 {
@@ -75,7 +73,8 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
75 { 73 {
76 Console.WriteLine("Error: unable to connect to server"); 74 Console.WriteLine("Error: unable to connect to server");
77 } 75 }
78 return null; 76
77 return obj;
79 } 78 }
80 } 79 }
81} 80}