diff options
author | Charles Krinke | 2008-08-13 14:13:49 +0000 |
---|---|---|
committer | Charles Krinke | 2008-08-13 14:13:49 +0000 |
commit | 323ada012d3bed0c6f7a6d5d0ee14b409b7457c7 (patch) | |
tree | d5a2e30707baba7804aefb341774d6d51ca7b439 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs | |
parent | Thank you, tyre, for a patch that fixes a null reference in LSL (diff) | |
download | opensim-SC-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.zip opensim-SC-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.tar.gz opensim-SC-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.tar.bz2 opensim-SC-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.tar.xz |
Mantis#1931. Thank you kindly, Kinoc for a patch that:
* Yield Prolog 1.0.1 Released : it passes all but 9 of the
421 tests in the ISO Prolog test suite (97.8%) .
* support dynamic predicates and rules.
* support 'import' to use external static functions
improves connection to C# functions
* Matches Yield Prolog r831
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs index f0669f6..c00a556 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs | |||
@@ -132,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
132 | /// <summary> | 132 | /// <summary> |
133 | /// Return an array of the elements in list or null if it is not | 133 | /// Return an array of the elements in list or null if it is not |
134 | /// a proper list. If list is Atom.NIL, return an array of zero elements. | 134 | /// a proper list. If list is Atom.NIL, return an array of zero elements. |
135 | /// If the list or one of the tails of the list is Variable, raise an instantiation_error. | ||
135 | /// This does not call YP.getValue on each element. | 136 | /// This does not call YP.getValue on each element. |
136 | /// </summary> | 137 | /// </summary> |
137 | /// <param name="list"></param> | 138 | /// <param name="list"></param> |
@@ -143,10 +144,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
143 | return new object[0]; | 144 | return new object[0]; |
144 | 145 | ||
145 | List<object> result = new List<object>(); | 146 | List<object> result = new List<object>(); |
146 | for (object element = list; | 147 | object element = list; |
147 | element is Functor2 && ((Functor2)element)._name == Atom.DOT; | 148 | while (true) { |
148 | element = YP.getValue(((Functor2)element)._arg2)) | 149 | if (element == Atom.NIL) |
150 | break; | ||
151 | if (element is Variable) | ||
152 | throw new PrologException(Atom.a("instantiation_error"), | ||
153 | "List tail is an unbound variable"); | ||
154 | if (!(element is Functor2 && ((Functor2)element)._name == Atom.DOT)) | ||
155 | // Not a proper list. | ||
156 | return null; | ||
149 | result.Add(((Functor2)element)._arg1); | 157 | result.Add(((Functor2)element)._arg1); |
158 | element = YP.getValue(((Functor2)element)._arg2); | ||
159 | } | ||
150 | 160 | ||
151 | if (result.Count <= 0) | 161 | if (result.Count <= 0) |
152 | return null; | 162 | return null; |