aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs35
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs63
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs6
12 files changed, 165 insertions, 45 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fea3fc2..70a88fb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2776,7 +2776,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2776 2776
2777 m_host.AddScriptLPS(1); 2777 m_host.AddScriptLPS(1);
2778 2778
2779 uint partLocalID; 2779 // uint partLocalID;
2780 LLUUID partItemID; 2780 LLUUID partItemID;
2781 2781
2782 switch ((int)linknum) 2782 switch ((int)linknum)
@@ -2790,7 +2790,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2790 { 2790 {
2791 if (item.Type == 10) 2791 if (item.Type == 10)
2792 { 2792 {
2793 partLocalID = part.LocalId; 2793 // partLocalID = part.LocalId;
2794 partItemID = item.ItemID; 2794 partItemID = item.ItemID;
2795 2795
2796 object[] resobj = new object[] 2796 object[] resobj = new object[]
@@ -2815,7 +2815,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2815 { 2815 {
2816 if (item.Type == 10) 2816 if (item.Type == 10)
2817 { 2817 {
2818 partLocalID = partInst.LocalId; 2818 // partLocalID = partInst.LocalId;
2819 partItemID = item.ItemID; 2819 partItemID = item.ItemID;
2820 Object[] resobj = new object[] 2820 Object[] resobj = new object[]
2821 { 2821 {
@@ -2843,7 +2843,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2843 { 2843 {
2844 if (item.Type == 10) 2844 if (item.Type == 10)
2845 { 2845 {
2846 partLocalID = partInst.LocalId; 2846 // partLocalID = partInst.LocalId;
2847 partItemID = item.ItemID; 2847 partItemID = item.ItemID;
2848 Object[] resobj = new object[] 2848 Object[] resobj = new object[]
2849 { 2849 {
@@ -2873,7 +2873,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2873 { 2873 {
2874 if (item.Type == 10) 2874 if (item.Type == 10)
2875 { 2875 {
2876 partLocalID = partInst.LocalId; 2876 // partLocalID = partInst.LocalId;
2877 partItemID = item.ItemID; 2877 partItemID = item.ItemID;
2878 Object[] resobj = new object[] 2878 Object[] resobj = new object[]
2879 { 2879 {
@@ -2924,7 +2924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2924 { 2924 {
2925 if (item.Type == 10) 2925 if (item.Type == 10)
2926 { 2926 {
2927 partLocalID = partInst.LocalId; 2927 // partLocalID = partInst.LocalId;
2928 partItemID = item.ItemID; 2928 partItemID = item.ItemID;
2929 Object[] resObjDef = new object[] 2929 Object[] resObjDef = new object[]
2930 { 2930 {
@@ -3049,7 +3049,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3049 3049
3050 } 3050 }
3051 3051
3052 double angle = 2 * Math.Acos(rot.s); 3052 // double angle = 2 * Math.Acos(rot.s);
3053 double s = Math.Sqrt(1 - rot.s * rot.s); 3053 double s = Math.Sqrt(1 - rot.s * rot.s);
3054 if (s < 0.001) 3054 if (s < 0.001)
3055 { 3055 {
@@ -6592,7 +6592,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6592 6592
6593 while (count < len) 6593 while (count < len)
6594 { 6594 {
6595 int l = input[idx].Length; 6595 // int l = input[idx].Length;
6596 string ln = input[idx]; 6596 string ln = input[idx];
6597 6597
6598 int need = len-count-1; 6598 int need = len-count-1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
index 70c1b5a..c52adb1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
@@ -127,19 +127,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
127 // No unbound free variables, so we only filled one bag. If empty, bagof fails. 127 // No unbound free variables, so we only filled one bag. If empty, bagof fails.
128 if (_findallBagArray.Count > 0) 128 if (_findallBagArray.Count > 0)
129 { 129 {
130 // disable warning on l1, don't see how we can
131 // code this differently
132 #pragma warning disable 0168
130 foreach (bool l1 in bagArrayVariable.unify(_findallBagArray)) 133 foreach (bool l1 in bagArrayVariable.unify(_findallBagArray))
131 yield return false; 134 yield return false;
135 #pragma warning restore 0168
132 } 136 }
133 } 137 }
134 else 138 else
135 { 139 {
136 foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables) 140 foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables)
137 { 141 {
142 // disable warning on l1 and l2, don't see how we can
143 // code this differently
144 #pragma warning disable 0168
138 foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key)) 145 foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key))
139 { 146 {
140 foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value)) 147 foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value))
141 yield return false; 148 yield return false;
142 } 149 }
150 #pragma warning restore 0168
143 // Debug: Should we free memory of the answers already returned? 151 // Debug: Should we free memory of the answers already returned?
144 } 152 }
145 } 153 }
@@ -153,11 +161,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
153 public IEnumerable<bool> result(object Bag) 161 public IEnumerable<bool> result(object Bag)
154 { 162 {
155 Variable bagArrayVariable = new Variable(); 163 Variable bagArrayVariable = new Variable();
164 // disable warning on l1, don't see how we can
165 // code this differently
166 #pragma warning disable 0168
156 foreach (bool l1 in resultArray(bagArrayVariable)) 167 foreach (bool l1 in resultArray(bagArrayVariable))
157 { 168 {
158 foreach (bool l2 in YP.unify(Bag, ListPair.make((List<object>)bagArrayVariable.getValue()))) 169 foreach (bool l2 in YP.unify(Bag, ListPair.make((List<object>)bagArrayVariable.getValue())))
159 yield return false; 170 yield return false;
160 } 171 }
172 #pragma warning restore 0168
161 } 173 }
162 174
163 /// <summary> 175 /// <summary>
@@ -169,6 +181,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
169 public IEnumerable<bool> resultSet(object Bag) 181 public IEnumerable<bool> resultSet(object Bag)
170 { 182 {
171 Variable bagArrayVariable = new Variable(); 183 Variable bagArrayVariable = new Variable();
184 // disable warning on l1, don't see how we can
185 // code this differently
186 #pragma warning disable 0168
172 foreach (bool l1 in resultArray(bagArrayVariable)) 187 foreach (bool l1 in resultArray(bagArrayVariable))
173 { 188 {
174 List<object> bagArray = (List<object>)bagArrayVariable.getValue(); 189 List<object> bagArray = (List<object>)bagArrayVariable.getValue();
@@ -176,14 +191,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
176 foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray))) 191 foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray)))
177 yield return false; 192 yield return false;
178 } 193 }
194 #pragma warning restore 0168
179 } 195 }
180 196
181 public static IEnumerable<bool> bagofArray 197 public static IEnumerable<bool> bagofArray
182 (object Template, object Goal, IEnumerable<bool> goalIterator, Variable bagArrayVariable) 198 (object Template, object Goal, IEnumerable<bool> goalIterator, Variable bagArrayVariable)
183 { 199 {
184 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); 200 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
201 // disable warning on l1, don't see how we can
202 // code this differently
203 #pragma warning disable 0168
185 foreach (bool l1 in goalIterator) 204 foreach (bool l1 in goalIterator)
186 bagOfAnswers.add(); 205 bagOfAnswers.add();
206 #pragma warning restore 0168
187 return bagOfAnswers.resultArray(bagArrayVariable); 207 return bagOfAnswers.resultArray(bagArrayVariable);
188 } 208 }
189 209
@@ -191,8 +211,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
191 (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag) 211 (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
192 { 212 {
193 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); 213 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
214 // disable warning on l1, don't see how we can
215 // code this differently
216 #pragma warning disable 0168
194 foreach (bool l1 in goalIterator) 217 foreach (bool l1 in goalIterator)
195 bagOfAnswers.add(); 218 bagOfAnswers.add();
219 #pragma warning restore 0168
196 return bagOfAnswers.result(Bag); 220 return bagOfAnswers.result(Bag);
197 } 221 }
198 222
@@ -200,8 +224,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
200 (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag) 224 (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
201 { 225 {
202 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); 226 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
227 // disable warning on l1, don't see how we can
228 // code this differently
229 #pragma warning disable 0168
203 foreach (bool l1 in goalIterator) 230 foreach (bool l1 in goalIterator)
204 bagOfAnswers.add(); 231 bagOfAnswers.add();
232 #pragma warning restore 0168
205 return bagOfAnswers.resultSet(Bag); 233 return bagOfAnswers.resultSet(Bag);
206 } 234 }
207 235
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
index 28709e1..fbb173e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
@@ -81,8 +81,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
81 public static IEnumerable<bool> findall(object Template, IEnumerable<bool> goal, object Bag) 81 public static IEnumerable<bool> findall(object Template, IEnumerable<bool> goal, object Bag)
82 { 82 {
83 FindallAnswers findallAnswers = new FindallAnswers(Template); 83 FindallAnswers findallAnswers = new FindallAnswers(Template);
84 // disable warning on l1, don't see how we can
85 // code this differently
86 #pragma warning disable 0168
84 foreach (bool l1 in goal) 87 foreach (bool l1 in goal)
85 findallAnswers.add(); 88 findallAnswers.add();
89 #pragma warning restore 0168
86 return findallAnswers.result(Bag); 90 return findallAnswers.result(Bag);
87 } 91 }
88 92
@@ -95,8 +99,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
95 public static List<object> findallArray(object Template, IEnumerable<bool> goal) 99 public static List<object> findallArray(object Template, IEnumerable<bool> goal)
96 { 100 {
97 FindallAnswers findallAnswers = new FindallAnswers(Template); 101 FindallAnswers findallAnswers = new FindallAnswers(Template);
102 // disable warning on l1, don't see how we can
103 // code this differently
104 #pragma warning disable 0168
98 foreach (bool l1 in goal) 105 foreach (bool l1 in goal)
99 findallAnswers.add(); 106 findallAnswers.add();
107 #pragma warning restore 0168
100 return findallAnswers.resultArray(); 108 return findallAnswers.resultArray();
101 } 109 }
102 } 110 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
index 3c0c1c4..69fbeee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
@@ -57,14 +57,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
57 Functor1 argFunctor = (Functor1)arg; 57 Functor1 argFunctor = (Functor1)arg;
58 if (_name.Equals(argFunctor._name)) 58 if (_name.Equals(argFunctor._name))
59 { 59 {
60 // disable warning on l1, don't see how we can
61 // code this differently
62 #pragma warning disable 0168
60 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) 63 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
61 yield return false; 64 yield return false;
65 #pragma warning restore 0168
62 } 66 }
63 } 67 }
64 else if (arg is Variable) 68 else if (arg is Variable)
65 { 69 {
70 // disable warning on l1, don't see how we can
71 // code this differently
72 #pragma warning disable 0168
66 foreach (bool l1 in ((Variable)arg).unify(this)) 73 foreach (bool l1 in ((Variable)arg).unify(this))
67 yield return false; 74 yield return false;
75 #pragma warning restore 0168
76
68 } 77 }
69 } 78 }
70 79
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
index 596b763..7e4f27d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
@@ -59,17 +59,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
59 Functor2 argFunctor = (Functor2)arg; 59 Functor2 argFunctor = (Functor2)arg;
60 if (_name.Equals(argFunctor._name)) 60 if (_name.Equals(argFunctor._name))
61 { 61 {
62 // disable warning on l1, don't see how we can
63 // code this differently
64 #pragma warning disable 0168
62 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) 65 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
63 { 66 {
64 foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2)) 67 foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
65 yield return false; 68 yield return false;
66 } 69 }
70 #pragma warning restore 0168
67 } 71 }
68 } 72 }
69 else if (arg is Variable) 73 else if (arg is Variable)
70 { 74 {
75 // disable warning on l1, don't see how we can
76 // code this differently
77 #pragma warning disable 0168
71 foreach (bool l1 in ((Variable)arg).unify(this)) 78 foreach (bool l1 in ((Variable)arg).unify(this))
72 yield return false; 79 yield return false;
80 #pragma warning restore 0168
73 } 81 }
74 } 82 }
75 83
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
index 041cceb..6ef8327 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
@@ -61,6 +61,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
61 Functor3 argFunctor = (Functor3)arg; 61 Functor3 argFunctor = (Functor3)arg;
62 if (_name.Equals(argFunctor._name)) 62 if (_name.Equals(argFunctor._name))
63 { 63 {
64 // disable warning on l1, l2, l3 don't see how we can
65 // code this differently
66 #pragma warning disable 0168
64 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) 67 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
65 { 68 {
66 foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2)) 69 foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
@@ -69,12 +72,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
69 yield return false; 72 yield return false;
70 } 73 }
71 } 74 }
75 #pragma warning restore 0168
72 } 76 }
73 } 77 }
74 else if (arg is Variable) 78 else if (arg is Variable)
75 { 79 {
80 // disable warning on l1, don't see how we can
81 // code this differently
82 #pragma warning disable 0168
76 foreach (bool l1 in ((Variable)arg).unify(this)) 83 foreach (bool l1 in ((Variable)arg).unify(this))
77 yield return false; 84 yield return false;
85 #pragma warning restore 0168
78 } 86 }
79 } 87 }
80 88
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
index 105b556..e9dd8f1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
@@ -44,6 +44,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
44 yield return false; 44 yield return false;
45 } 45 }
46 46
47 // disable warning about unused variables: the following code
48 // is infested with it.
49 #pragma warning disable 0168, 0219
50
47 // Debug: Hand-modify this central predicate to do tail recursion. 51 // Debug: Hand-modify this central predicate to do tail recursion.
48 public static IEnumerable<bool> read_tokens(object arg1, object arg2, object arg3) 52 public static IEnumerable<bool> read_tokens(object arg1, object arg2, object arg3)
49 { 53 {
@@ -188,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
188 // Compiler output follows. 192 // Compiler output follows.
189 193
190 class YPInnerClass { } 194 class YPInnerClass { }
191 static Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; } 195 // static Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }
192 196
193 public static IEnumerable<bool> parseInput(object TermList) 197 public static IEnumerable<bool> parseInput(object TermList)
194 { 198 {
@@ -224,10 +228,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
224 if (YP.termEqual(Term, Atom.a(@"end_of_file"))) 228 if (YP.termEqual(Term, Atom.a(@"end_of_file")))
225 { 229 {
226 yield break; 230 yield break;
227 goto cutIf1; 231 // unreachable code:
232 // goto cutIf1;
228 } 233 }
229 yield return false; 234 yield return false;
230 cutIf1: 235 // cutIf1:
231 { } 236 { }
232 } 237 }
233 } 238 }
@@ -4452,6 +4457,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
4452 { } 4457 { }
4453 } 4458 }
4454 } 4459 }
4455 4460 #pragma warning restore 0168
4456 } 4461 }
4457} 4462}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
index 2b5b0f1..8e2aa7e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
@@ -92,8 +92,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
92 } 92 }
93 else 93 else
94 { 94 {
95 // disable warning on l1, don't see how we can
96 // code this differently
97 #pragma warning disable 0168
95 foreach (bool l1 in YP.unify(this, arg)) 98 foreach (bool l1 in YP.unify(this, arg))
96 yield return false; 99 yield return false;
100 #pragma warning restore 0168
97 } 101 }
98 } 102 }
99 103
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
index 74704aa..f0e8147 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
@@ -572,6 +572,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
572 572
573 Variable Name = new Variable(); 573 Variable Name = new Variable();
574 Variable ArgList = new Variable(); 574 Variable ArgList = new Variable();
575 // disable warning on l1, don't see how we can
576 // code this differently
577 #pragma warning disable 0168
575 foreach (bool l1 in new ListPair(Name, ArgList).unify(List)) 578 foreach (bool l1 in new ListPair(Name, ArgList).unify(List))
576 { 579 {
577 object[] args = ListPair.toArray(ArgList); 580 object[] args = ListPair.toArray(ArgList);
@@ -585,6 +588,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
585 588
586 return YP.unify(Term, Functor.make((Atom)YP.getValue(Name), args)); 589 return YP.unify(Term, Functor.make((Atom)YP.getValue(Name), args));
587 } 590 }
591 #pragma warning restore 0168
588 592
589 return YP.fail(); 593 return YP.fail();
590 } 594 }
@@ -597,11 +601,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
597 601
598 if (!(Term is Variable)) 602 if (!(Term is Variable))
599 { 603 {
604 // disable warning on l1, don't see how we can
605 // code this differently
606 #pragma warning disable 0168
600 foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term))) 607 foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term)))
601 { 608 {
602 foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length)) 609 foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length))
603 yield return false; 610 yield return false;
604 } 611 }
612 #pragma warning restore 0168
605 } 613 }
606 else 614 else
607 throw new NotImplementedException("Debug: must finish functor/3"); 615 throw new NotImplementedException("Debug: must finish functor/3");
@@ -621,8 +629,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
621 if (argNumberInt >= 1 && argNumberInt <= termArgs.Length) 629 if (argNumberInt >= 1 && argNumberInt <= termArgs.Length)
622 { 630 {
623 // The first ArgNumber is at 1, not 0. 631 // The first ArgNumber is at 1, not 0.
632 // disable warning on l1, don't see how we can
633 // code this differently
634 #pragma warning disable 0168
624 foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1])) 635 foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1]))
625 yield return false; 636 yield return false;
637 #pragma warning restore 0168
626 } 638 }
627 } 639 }
628 } 640 }
@@ -814,8 +826,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
814 object[] args = new object[] { Priority, Specifier, Operator }; 826 object[] args = new object[] { Priority, Specifier, Operator };
815 foreach (object[] answer in _operatorTable) 827 foreach (object[] answer in _operatorTable)
816 { 828 {
829 // disable warning on l1, don't see how we can
830 // code this differently
831 #pragma warning disable 0168
817 foreach (bool l1 in YP.unifyArrays(args, answer)) 832 foreach (bool l1 in YP.unifyArrays(args, answer))
818 yield return false; 833 yield return false;
834 #pragma warning restore 0168
819 } 835 }
820 } 836 }
821 837
@@ -847,12 +863,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
847 int afterInt = atomAtom._name.Length - (beforeInt + lengthInt); 863 int afterInt = atomAtom._name.Length - (beforeInt + lengthInt);
848 if (afterInt >= 0) 864 if (afterInt >= 0)
849 { 865 {
866 // disable warning on l1, don't see how we can
867 // code this differently
868 #pragma warning disable 0168
850 foreach (bool l1 in YP.unify(After, afterInt)) 869 foreach (bool l1 in YP.unify(After, afterInt))
851 { 870 {
852 foreach (bool l2 in YP.unify 871 foreach (bool l2 in YP.unify
853 (Sub_atom, Atom.a(atomAtom._name.Substring(beforeInt, lengthInt)))) 872 (Sub_atom, Atom.a(atomAtom._name.Substring(beforeInt, lengthInt))))
854 yield return false; 873 yield return false;
855 } 874 }
875 #pragma warning restore 0168
856 } 876 }
857 } 877 }
858 878
@@ -1201,9 +1221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
1201 if (arity == 2 && (name == Atom.a(",") || name == Atom.a(";") || name == Atom.DOT)) 1221 if (arity == 2 && (name == Atom.a(",") || name == Atom.a(";") || name == Atom.DOT))
1202 return false; 1222 return false;
1203 // Use the same mapping to static predicates in YP as the compiler. 1223 // Use the same mapping to static predicates in YP as the compiler.
1224 // disable warning on l1, don't see how we can
1225 // code this differently
1226 #pragma warning disable 0168
1204 foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable())) 1227 foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable()))
1205 return false; 1228 return false;
1206 // Debug: Do we need to check if name._module is null? 1229 // Debug: Do we need to check if name._module is null?
1230 #pragma warning restore 0168
1207 return true; 1231 return true;
1208 } 1232 }
1209 1233
@@ -1342,9 +1366,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
1342 1366
1343 foreach (NameArity key in _predicatesStore.Keys) 1367 foreach (NameArity key in _predicatesStore.Keys)
1344 { 1368 {
1369 // disable warning on l1, don't see how we can
1370 // code this differently
1371 #pragma warning disable 0168
1345 foreach (bool l1 in YP.unify 1372 foreach (bool l1 in YP.unify
1346 (new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity)) 1373 (new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity))
1347 yield return false; 1374 yield return false;
1375 #pragma warning restore 0168
1348 } 1376 }
1349 } 1377 }
1350 1378
@@ -1414,7 +1442,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
1414 /// <returns></returns> 1442 /// <returns></returns>
1415 public static void script_event(object script_event, object script_params) 1443 public static void script_event(object script_event, object script_params)
1416 { 1444 {
1417 string function = ((Atom)YP.getValue(script_event))._name; 1445 // string function = ((Atom)YP.getValue(script_event))._name;
1418 object[] array = ListPair.toArray(script_params); 1446 object[] array = ListPair.toArray(script_params);
1419 if (array == null) 1447 if (array == null)
1420 return; // YP.fail(); 1448 return; // YP.fail();
@@ -1600,11 +1628,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
1600 if (_exception != null) 1628 if (_exception != null)
1601 { 1629 {
1602 bool didUnify = false; 1630 bool didUnify = false;
1631 // disable warning on l1, don't see how we can
1632 // code this differently
1633 #pragma warning disable 0168
1603 foreach (bool l1 in YP.unify(_exception._term, Catcher)) 1634 foreach (bool l1 in YP.unify(_exception._term, Catcher))
1604 { 1635 {
1605 didUnify = true; 1636 didUnify = true;
1606 yield return false; 1637 yield return false;
1607 } 1638 }
1639 #pragma warning restore 0168
1640
1608 if (!didUnify) 1641 if (!didUnify)
1609 throw _exception; 1642 throw _exception;
1610 } 1643 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
index c2040c9..d6115ce 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
@@ -209,14 +209,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
209 object[] functorArgs = YP.getFunctorArgs(Term); 209 object[] functorArgs = YP.getFunctorArgs(Term);
210 210
211 Variable pred = new Variable(); 211 Variable pred = new Variable();
212 // disable warning on l1, don't see how we can
213 // code this differently
214 #pragma warning disable 0168
212 foreach (bool l1 in ((CompilerState)State)._pred.match 215 foreach (bool l1 in ((CompilerState)State)._pred.match
213 (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") })) 216 (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") }))
214 { 217 {
215 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue()))) 218 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue())))
216 { 219 {
217 return true; 220 return true;
218 } 221 }
219 } 222 }
223 #pragma warning restore 0168
220 224
221 return false; 225 return false;
222 } 226 }
@@ -228,14 +232,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
228 object[] functorArgs = YP.getFunctorArgs(Term); 232 object[] functorArgs = YP.getFunctorArgs(Term);
229 233
230 Variable pred = new Variable(); 234 Variable pred = new Variable();
235 // disable warning on l1, don't see how we can
236 // code this differently
237 #pragma warning disable 0168
231 foreach (bool l1 in ((CompilerState)State)._pred.match 238 foreach (bool l1 in ((CompilerState)State)._pred.match
232 (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") })) 239 (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") }))
233 { 240 {
234 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue()))) 241 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue())))
235 { 242 {
236 return true; 243 return true;
237 } 244 }
238 } 245 }
246 #pragma warning restore 0168
239 247
240 return false; 248 return false;
241 } 249 }
@@ -275,6 +283,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
275 } 283 }
276 } 284 }
277 285
286 // disable warning unused variables, the following code is
287 // infested with it.
288 #pragma warning disable 0168, 0219
289
278 /// <summary> 290 /// <summary>
279 /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction 291 /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction
280 /// to return an anonymous YP.IClause for the Head and Body of a rule clause. 292 /// to return an anonymous YP.IClause for the Head and Body of a rule clause.
@@ -3939,12 +3951,12 @@ namespace Temporary {
3939 YP.nl(); 3951 YP.nl();
3940 convertStatementListCSharp(RestStatements, Level); 3952 convertStatementListCSharp(RestStatements, Level);
3941 return; 3953 return;
3942 goto cutIf1; 3954 // goto cutIf1;
3943 } 3955 }
3944 convertStatementListCSharp(RestStatements, Level); 3956 convertStatementListCSharp(RestStatements, Level);
3945 return; 3957 return;
3946 cutIf1: 3958 // cutIf1:
3947 { } 3959 // { }
3948 } 3960 }
3949 } 3961 }
3950 { 3962 {
@@ -4111,12 +4123,12 @@ namespace Temporary {
4111 YP.write(Atom.a(@", ")); 4123 YP.write(Atom.a(@", "));
4112 convertArgListCSharp(Tail); 4124 convertArgListCSharp(Tail);
4113 return; 4125 return;
4114 goto cutIf1; 4126 // goto cutIf1;
4115 } 4127 }
4116 convertArgListCSharp(Tail); 4128 convertArgListCSharp(Tail);
4117 return; 4129 return;
4118 cutIf1: 4130 // cutIf1:
4119 { } 4131 // { }
4120 } 4132 }
4121 } 4133 }
4122 } 4134 }
@@ -4266,13 +4278,13 @@ namespace Temporary {
4266 YP.put_code(Code); 4278 YP.put_code(Code);
4267 convertStringCodesCSharp(RestCodes); 4279 convertStringCodesCSharp(RestCodes);
4268 return; 4280 return;
4269 goto cutIf1; 4281 // goto cutIf1;
4270 } 4282 }
4271 YP.put_code(Code); 4283 YP.put_code(Code);
4272 convertStringCodesCSharp(RestCodes); 4284 convertStringCodesCSharp(RestCodes);
4273 return; 4285 return;
4274 cutIf1: 4286 // cutIf1:
4275 { } 4287 // { }
4276 } 4288 }
4277 } 4289 }
4278 } 4290 }
@@ -4623,12 +4635,12 @@ namespace Temporary {
4623 YP.write(Atom.a(@", ")); 4635 YP.write(Atom.a(@", "));
4624 convertArgListJavascript(Tail); 4636 convertArgListJavascript(Tail);
4625 return; 4637 return;
4626 goto cutIf1; 4638 // goto cutIf1;
4627 } 4639 }
4628 convertArgListJavascript(Tail); 4640 convertArgListJavascript(Tail);
4629 return; 4641 return;
4630 cutIf1: 4642 // cutIf1:
4631 { } 4643 // { }
4632 } 4644 }
4633 } 4645 }
4634 } 4646 }
@@ -4777,7 +4789,7 @@ namespace Temporary {
4777 YP.put_code(Code); 4789 YP.put_code(Code);
4778 convertStringCodesJavascript(RestCodes); 4790 convertStringCodesJavascript(RestCodes);
4779 return; 4791 return;
4780 goto cutIf1; 4792 // goto cutIf1;
4781 } 4793 }
4782 if (YP.termEqual(Code, 92)) 4794 if (YP.termEqual(Code, 92))
4783 { 4795 {
@@ -4785,13 +4797,13 @@ namespace Temporary {
4785 YP.put_code(Code); 4797 YP.put_code(Code);
4786 convertStringCodesJavascript(RestCodes); 4798 convertStringCodesJavascript(RestCodes);
4787 return; 4799 return;
4788 goto cutIf1; 4800 // goto cutIf1;
4789 } 4801 }
4790 YP.put_code(Code); 4802 YP.put_code(Code);
4791 convertStringCodesJavascript(RestCodes); 4803 convertStringCodesJavascript(RestCodes);
4792 return; 4804 return;
4793 cutIf1: 4805 // cutIf1:
4794 { } 4806 // { }
4795 } 4807 }
4796 } 4808 }
4797 } 4809 }
@@ -5420,12 +5432,12 @@ namespace Temporary {
5420 YP.write(Atom.a(@", ")); 5432 YP.write(Atom.a(@", "));
5421 convertArgListPython(Tail); 5433 convertArgListPython(Tail);
5422 return; 5434 return;
5423 goto cutIf1; 5435 // goto cutIf1;
5424 } 5436 }
5425 convertArgListPython(Tail); 5437 convertArgListPython(Tail);
5426 return; 5438 return;
5427 cutIf1: 5439 // cutIf1:
5428 { } 5440 // { }
5429 } 5441 }
5430 } 5442 }
5431 } 5443 }
@@ -5573,7 +5585,7 @@ namespace Temporary {
5573 YP.put_code(Code); 5585 YP.put_code(Code);
5574 convertStringCodesPython(RestCodes); 5586 convertStringCodesPython(RestCodes);
5575 return; 5587 return;
5576 goto cutIf1; 5588 // goto cutIf1;
5577 } 5589 }
5578 if (YP.termEqual(Code, 92)) 5590 if (YP.termEqual(Code, 92))
5579 { 5591 {
@@ -5581,13 +5593,13 @@ namespace Temporary {
5581 YP.put_code(Code); 5593 YP.put_code(Code);
5582 convertStringCodesPython(RestCodes); 5594 convertStringCodesPython(RestCodes);
5583 return; 5595 return;
5584 goto cutIf1; 5596 // goto cutIf1;
5585 } 5597 }
5586 YP.put_code(Code); 5598 YP.put_code(Code);
5587 convertStringCodesPython(RestCodes); 5599 convertStringCodesPython(RestCodes);
5588 return; 5600 return;
5589 cutIf1: 5601 // cutIf1:
5590 { } 5602 // { }
5591 } 5603 }
5592 } 5604 }
5593 } 5605 }
@@ -5646,6 +5658,7 @@ namespace Temporary {
5646 } 5658 }
5647 } 5659 }
5648 } 5660 }
5661 #pragma warning restore 0168
5649 5662
5650 } 5663 }
5651} 5664}
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 841ed26..d54d2f5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -40,8 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
40{ 40{
41 public class Compiler 41 public class Compiler
42 { 42 {
43 private static readonly log4net.ILog m_log 43 // private static readonly log4net.ILog m_log
44 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 44 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 // * Uses "LSL2Converter" to convert LSL to C# if necessary. 46 // * Uses "LSL2Converter" to convert LSL to C# if necessary.
47 // * Compiles C#-code into an assembly 47 // * Compiles C#-code into an assembly
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
79 private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp 79 private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp
80 private static YP2CSConverter YP_Converter = new YP2CSConverter(); 80 private static YP2CSConverter YP_Converter = new YP2CSConverter();
81 81
82 private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files 82 // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
83 private static UInt64 scriptCompileCounter = 0; // And a counter 83 private static UInt64 scriptCompileCounter = 0; // And a counter
84 84
85 public IScriptEngine m_scriptEngine; 85 public IScriptEngine m_scriptEngine;
@@ -273,7 +273,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
273 { 273 {
274 Directory.CreateDirectory(ScriptEnginesPath); 274 Directory.CreateDirectory(ScriptEnginesPath);
275 } 275 }
276 catch (Exception ex) 276 catch (Exception)
277 { 277 {
278 } 278 }
279 } 279 }
@@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
285 { 285 {
286 Directory.CreateDirectory(ScriptEnginesPath); 286 Directory.CreateDirectory(ScriptEnginesPath);
287 } 287 }
288 catch (Exception ex) 288 catch (Exception)
289 { 289 {
290 } 290 }
291 } 291 }
@@ -486,7 +486,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
486// } 486// }
487 487
488 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 488 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
489 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); 489 // string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
490 //Console.WriteLine("Assembly location: " + rootPath); 490 //Console.WriteLine("Assembly location: " + rootPath);
491 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); 491 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
492 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); 492 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
index 54b4861..69f9fdc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
@@ -69,11 +69,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
69 YP.tell(myCS_SW); 69 YP.tell(myCS_SW);
70 70
71 //Console.WriteLine("Mycode\n ===================================\n" + myCode+"\n"); 71 //Console.WriteLine("Mycode\n ===================================\n" + myCode+"\n");
72 // disable warning on l1, don't see how we can
73 // code this differently
74 #pragma warning disable 0168
72 foreach (bool l1 in Parser.parseInput(TermList)) 75 foreach (bool l1 in Parser.parseInput(TermList))
73 { 76 {
74 foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode)) 77 foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode))
75 { 78 {
76 ListPair VFC = new ListPair(FunctionCode, new Variable()); 79 // ListPair VFC = new ListPair(FunctionCode, new Variable());
77 //Console.WriteLine("-------------------------") 80 //Console.WriteLine("-------------------------")
78 //Console.WriteLine(FunctionCode.ToString()) 81 //Console.WriteLine(FunctionCode.ToString())
79 //Console.WriteLine("-------------------------") 82 //Console.WriteLine("-------------------------")
@@ -81,6 +84,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
81 //YPCompiler.convertStringCodesCSharp(VFC); 84 //YPCompiler.convertStringCodesCSharp(VFC);
82 } 85 }
83 } 86 }
87 #pragma warning restore 0168
84 YP.seen(); 88 YP.seen();
85 myCS_SW.Close(); 89 myCS_SW.Close();
86 YP.told(); 90 YP.told();