diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 8b88588..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 | ||
@@ -118,7 +128,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
118 | emessage = emessage.Substring(slinfo.Length+2); | 128 | emessage = emessage.Substring(slinfo.Length+2); |
119 | 129 | ||
120 | message = String.Format("({0},{1}) {2}", | 130 | message = String.Format("({0},{1}) {2}", |
121 | e.slInfo.lineNumber - 2, | 131 | e.slInfo.lineNumber - 1, |
122 | e.slInfo.charPosition - 1, emessage); | 132 | e.slInfo.charPosition - 1, emessage); |
123 | 133 | ||
124 | throw new Exception(message); | 134 | throw new Exception(message); |
@@ -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 | ||