diff options
author | Diva Canto | 2012-03-15 16:03:33 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-15 16:03:33 -0700 |
commit | 0548eeb571cc503384724688f8b11143efb9b620 (patch) | |
tree | 25efe4b40a3bcde2f67023174c583e2187df424a /OpenSim/Region/ScriptEngine/Shared/CodeTools | |
parent | More on SLURLs and V3. This is hacky, but it works. Basically, we have to red... (diff) | |
parent | Protect the scriptmodulecomms interface. (diff) | |
download | opensim-SC_OLD-0548eeb571cc503384724688f8b11143efb9b620.zip opensim-SC_OLD-0548eeb571cc503384724688f8b11143efb9b620.tar.gz opensim-SC_OLD-0548eeb571cc503384724688f8b11143efb9b620.tar.bz2 opensim-SC_OLD-0548eeb571cc503384724688f8b11143efb9b620.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 31 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 5 |
2 files changed, 33 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 65d3b9b..b24f016 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -32,6 +32,8 @@ using System.Reflection; | |||
32 | using log4net; | 32 | using log4net; |
33 | using Tools; | 33 | using Tools; |
34 | 34 | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | |||
35 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | 37 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools |
36 | { | 38 | { |
37 | public class CSCodeGenerator : ICodeConverter | 39 | public class CSCodeGenerator : ICodeConverter |
@@ -45,12 +47,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
45 | private int m_CSharpLine; // the current line of generated C# code | 47 | private int m_CSharpLine; // the current line of generated C# code |
46 | private int m_CSharpCol; // the current column of generated C# code | 48 | private int m_CSharpCol; // the current column of generated C# code |
47 | private List<string> m_warnings = new List<string>(); | 49 | private List<string> m_warnings = new List<string>(); |
50 | private IScriptModuleComms m_comms = null; | ||
48 | 51 | ||
49 | /// <summary> | 52 | /// <summary> |
50 | /// Creates an 'empty' CSCodeGenerator instance. | 53 | /// Creates an 'empty' CSCodeGenerator instance. |
51 | /// </summary> | 54 | /// </summary> |
52 | public CSCodeGenerator() | 55 | public CSCodeGenerator() |
53 | { | 56 | { |
57 | m_comms = null; | ||
58 | ResetCounters(); | ||
59 | } | ||
60 | |||
61 | public CSCodeGenerator(IScriptModuleComms comms) | ||
62 | { | ||
63 | m_comms = comms; | ||
54 | ResetCounters(); | 64 | ResetCounters(); |
55 | } | 65 | } |
56 | 66 | ||
@@ -866,8 +876,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
866 | { | 876 | { |
867 | string retstr = String.Empty; | 877 | string retstr = String.Empty; |
868 | 878 | ||
869 | retstr += Generate(String.Format("{0}(", CheckName(fc.Id)), fc); | 879 | string modinvoke = null; |
870 | 880 | if (m_comms != null) | |
881 | modinvoke = m_comms.LookupModInvocation(fc.Id); | ||
882 | |||
883 | if (modinvoke != null) | ||
884 | { | ||
885 | if (fc.kids[0] is ArgumentList) | ||
886 | { | ||
887 | if ((fc.kids[0] as ArgumentList).kids.Count == 0) | ||
888 | retstr += Generate(String.Format("{0}(\"{1}\"",modinvoke,fc.Id), fc); | ||
889 | else | ||
890 | retstr += Generate(String.Format("{0}(\"{1}\",",modinvoke,fc.Id), fc); | ||
891 | } | ||
892 | } | ||
893 | else | ||
894 | { | ||
895 | retstr += Generate(String.Format("{0}(", CheckName(fc.Id)), fc); | ||
896 | } | ||
897 | |||
871 | foreach (SYMBOL kid in fc.kids) | 898 | foreach (SYMBOL kid in fc.kids) |
872 | retstr += GenerateNode(kid); | 899 | retstr += GenerateNode(kid); |
873 | 900 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index c10143b..8f2ec49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -35,6 +35,7 @@ using Microsoft.CSharp; | |||
35 | //using Microsoft.JScript; | 35 | //using Microsoft.JScript; |
36 | using Microsoft.VisualBasic; | 36 | using Microsoft.VisualBasic; |
37 | using log4net; | 37 | using log4net; |
38 | |||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.ScriptEngine.Interfaces; | 40 | using OpenSim.Region.ScriptEngine.Interfaces; |
40 | using OpenMetaverse; | 41 | using OpenMetaverse; |
@@ -293,6 +294,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
293 | { | 294 | { |
294 | // m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script); | 295 | // m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script); |
295 | 296 | ||
297 | IScriptModuleComms comms = m_scriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); | ||
298 | |||
296 | linemap = null; | 299 | linemap = null; |
297 | m_warnings.Clear(); | 300 | m_warnings.Clear(); |
298 | 301 | ||
@@ -382,7 +385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
382 | if (language == enumCompileType.lsl) | 385 | if (language == enumCompileType.lsl) |
383 | { | 386 | { |
384 | // Its LSL, convert it to C# | 387 | // Its LSL, convert it to C# |
385 | LSL_Converter = (ICodeConverter)new CSCodeGenerator(); | 388 | LSL_Converter = (ICodeConverter)new CSCodeGenerator(comms); |
386 | compileScript = LSL_Converter.Convert(Script); | 389 | compileScript = LSL_Converter.Convert(Script); |
387 | 390 | ||
388 | // copy converter warnings into our warnings. | 391 | // copy converter warnings into our warnings. |