diff options
author | Tedd Hansen | 2008-02-02 04:06:51 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-02-02 04:06:51 +0000 |
commit | b1f97f9e776ace017cf652eaa07e37ab2ab42029 (patch) | |
tree | 9e9b3c164ec08633be348d81089c444d0a2b34a1 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |
parent | * Committing some untested stuff regarding texture animations. This won't br... (diff) | |
download | opensim-SC-b1f97f9e776ace017cf652eaa07e37ab2ab42029.zip opensim-SC-b1f97f9e776ace017cf652eaa07e37ab2ab42029.tar.gz opensim-SC-b1f97f9e776ace017cf652eaa07e37ab2ab42029.tar.bz2 opensim-SC-b1f97f9e776ace017cf652eaa07e37ab2ab42029.tar.xz |
Temporarily disabled AllowedCompilers so all 3 compilers are allowed.
Fixed bug in how code is handled, hopefully we can now run all 3 languages? :)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 883ed5e..2e0d1a3 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -107,19 +107,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
107 | LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl); | 107 | LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl); |
108 | 108 | ||
109 | // Allowed compilers | 109 | // Allowed compilers |
110 | string allowedCompilers = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb"); | 110 | string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl;cs;vb"); |
111 | AllowedCompilers.Clear(); | 111 | AllowedCompilers.Clear(); |
112 | foreach (string strl in allowedCompilers.Split(';')) | 112 | |
113 | #if DEBUG | ||
114 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp); | ||
115 | #endif | ||
116 | |||
117 | |||
118 | foreach (string strl in allowComp.Split(';')) | ||
113 | { | 119 | { |
114 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); | 120 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); |
115 | if (!LanguageMapping.ContainsKey(strlan)) | 121 | if (!LanguageMapping.ContainsKey(strlan)) |
116 | { | 122 | { |
117 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strl + "\" specified in \"AllowedCompilers\"."); | 123 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); |
118 | } | 124 | } |
119 | else | 125 | else |
120 | { | 126 | { |
121 | #if DEBUG | 127 | #if DEBUG |
122 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strl + "\" specified in \"AllowedCompilers\"."); | 128 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); |
123 | #endif | 129 | #endif |
124 | } | 130 | } |
125 | AllowedCompilers.Add(strlan, true); | 131 | AllowedCompilers.Add(strlan, true); |
@@ -228,19 +234,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
228 | if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) | 234 | if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) |
229 | l = enumCompileType.cs; | 235 | l = enumCompileType.cs; |
230 | if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture)) | 236 | if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture)) |
237 | { | ||
231 | l = enumCompileType.vb; | 238 | l = enumCompileType.vb; |
239 | // We need to remove //vb, it won't compile with that | ||
240 | |||
241 | Script = Script.Substring(4, Script.Length - 4); | ||
242 | } | ||
232 | if (Script.StartsWith("//lsl", true, CultureInfo.InvariantCulture)) | 243 | if (Script.StartsWith("//lsl", true, CultureInfo.InvariantCulture)) |
233 | l = enumCompileType.lsl; | 244 | l = enumCompileType.lsl; |
234 | 245 | ||
246 | |||
235 | if (!AllowedCompilers.ContainsKey(l.ToString())) | 247 | if (!AllowedCompilers.ContainsKey(l.ToString())) |
236 | { | 248 | { |
237 | // Not allowed to compile to this language! | 249 | // Not allowed to compile to this language! |
238 | string errtext = String.Empty; | 250 | string errtext = String.Empty; |
239 | errtext += "The compiler for language \"" + l.ToString() + "\" is not in list of allowed compilers. Script will not be executed!"; | 251 | errtext += "The compiler for language \"" + l.ToString() + "\" is not in list of allowed compilers. Script will not be executed!"; |
240 | throw new Exception(errtext); | 252 | //throw new Exception(errtext); |
241 | } | 253 | } |
242 | 254 | ||
243 | string compileScript; | 255 | string compileScript = Script; |
244 | 256 | ||
245 | if (l == enumCompileType.lsl) | 257 | if (l == enumCompileType.lsl) |
246 | { | 258 | { |
@@ -257,7 +269,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
257 | String.Empty + "namespace SecondLife { " + | 269 | String.Empty + "namespace SecondLife { " + |
258 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { " + | 270 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { " + |
259 | @"public Script() { } " + | 271 | @"public Script() { } " + |
260 | Script + | 272 | compileScript + |
261 | "} }\r\n"; | 273 | "} }\r\n"; |
262 | break; | 274 | break; |
263 | case enumCompileType.vb: | 275 | case enumCompileType.vb: |
@@ -266,7 +278,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
266 | String.Empty + "NameSpace SecondLife { " + | 278 | String.Empty + "NameSpace SecondLife { " + |
267 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " + | 279 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " + |
268 | @"Public Sub New(): End Sub: " + | 280 | @"Public Sub New(): End Sub: " + |
269 | Script + | 281 | compileScript + |
270 | ":End Class :End Namespace\r\n"; | 282 | ":End Class :End Namespace\r\n"; |
271 | break; | 283 | break; |
272 | } | 284 | } |