diff options
Diffstat (limited to 'OpenSim/Tools/Compiler')
-rw-r--r-- | OpenSim/Tools/Compiler/Program.cs | 51 | ||||
-rw-r--r-- | OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs | 4 |
2 files changed, 36 insertions, 19 deletions
diff --git a/OpenSim/Tools/Compiler/Program.cs b/OpenSim/Tools/Compiler/Program.cs index 6c59c31..b010eaf 100644 --- a/OpenSim/Tools/Compiler/Program.cs +++ b/OpenSim/Tools/Compiler/Program.cs | |||
@@ -255,12 +255,13 @@ namespace OpenSim.Tools.LSL.Compiler | |||
255 | return FindErrorPosition(line, col, null); | 255 | return FindErrorPosition(line, col, null); |
256 | } | 256 | } |
257 | 257 | ||
258 | private class kvpSorter : IComparer<KeyValuePair<int,int>> | 258 | private class kvpSorter : IComparer<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>> |
259 | { | 259 | { |
260 | public int Compare(KeyValuePair<int,int> a, | 260 | public int Compare(KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> a, |
261 | KeyValuePair<int,int> b) | 261 | KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> b) |
262 | { | 262 | { |
263 | return a.Key.CompareTo(b.Key); | 263 | int kc = a.Key.Key.CompareTo(b.Key.Key); |
264 | return (kc != 0) ? kc : a.Key.Value.CompareTo(b.Key.Value); | ||
264 | } | 265 | } |
265 | } | 266 | } |
266 | 267 | ||
@@ -277,30 +278,46 @@ namespace OpenSim.Tools.LSL.Compiler | |||
277 | out ret)) | 278 | out ret)) |
278 | return ret; | 279 | return ret; |
279 | 280 | ||
280 | List<KeyValuePair<int,int>> sorted = | 281 | var sorted = new List<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>(positionMap); |
281 | new List<KeyValuePair<int,int>>(positionMap.Keys); | ||
282 | 282 | ||
283 | sorted.Sort(new kvpSorter()); | 283 | sorted.Sort(new kvpSorter()); |
284 | 284 | ||
285 | int l = 1; | 285 | int l = 1; |
286 | int c = 1; | 286 | int c = 1; |
287 | int pl = 1; | ||
287 | 288 | ||
288 | foreach (KeyValuePair<int, int> cspos in sorted) | 289 | foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> posmap in sorted) |
289 | { | 290 | { |
290 | if (cspos.Key >= line) | 291 | //m_log.DebugFormat("[Compiler]: Scanning line map {0},{1} --> {2},{3}", posmap.Key.Key, posmap.Key.Value, posmap.Value.Key, posmap.Value.Value); |
292 | int nl = posmap.Value.Key + line - posmap.Key.Key; // New, translated LSL line and column. | ||
293 | int nc = posmap.Value.Value + col - posmap.Key.Value; | ||
294 | // Keep going until we find the first point passed line,col. | ||
295 | if (posmap.Key.Key > line) | ||
291 | { | 296 | { |
292 | if (cspos.Key > line) | 297 | //m_log.DebugFormat("[Compiler]: Line is larger than requested {0},{1}, returning {2},{3}", line, col, l, c); |
293 | return new KeyValuePair<int, int>(l, c); | 298 | if (pl < line) |
294 | if (cspos.Value > col) | 299 | { |
295 | return new KeyValuePair<int, int>(l, c); | 300 | //m_log.DebugFormat("[Compiler]: Previous line ({0}) is less than requested line ({1}), setting column to 1.", pl, line); |
296 | c = cspos.Value; | 301 | c = 1; |
297 | if (c == 0) | 302 | } |
298 | c++; | 303 | break; |
299 | } | 304 | } |
300 | else | 305 | if (posmap.Key.Key == line && posmap.Key.Value > col) |
301 | { | 306 | { |
302 | l = cspos.Key; | 307 | // Never move l,c backwards. |
308 | if (nl > l || (nl == l && nc > c)) | ||
309 | { | ||
310 | //m_log.DebugFormat("[Compiler]: Using offset relative to this: {0} + {1} - {2}, {3} + {4} - {5} = {6}, {7}", | ||
311 | // posmap.Value.Key, line, posmap.Key.Key, posmap.Value.Value, col, posmap.Key.Value, nl, nc); | ||
312 | l = nl; | ||
313 | c = nc; | ||
314 | } | ||
315 | //m_log.DebugFormat("[Compiler]: Column is larger than requested {0},{1}, returning {2},{3}", line, col, l, c); | ||
316 | break; | ||
303 | } | 317 | } |
318 | pl = posmap.Key.Key; | ||
319 | l = posmap.Value.Key; | ||
320 | c = posmap.Value.Value; | ||
304 | } | 321 | } |
305 | return new KeyValuePair<int, int>(l, c); | 322 | return new KeyValuePair<int, int>(l, c); |
306 | } | 323 | } |
diff --git a/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs b/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs index e1a1fda..d7f8870 100644 --- a/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs +++ b/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.5.*")] | 32 | [assembly: AssemblyVersion("0.8.3.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | |