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
This commit is contained in:
Charles Krinke
2008-08-13 14:13:49 +00:00
parent e46248ab17
commit 323ada012d
23 changed files with 2060 additions and 584 deletions

View File

@@ -132,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
/// <summary>
/// Return an array of the elements in list or null if it is not
/// a proper list. If list is Atom.NIL, return an array of zero elements.
/// If the list or one of the tails of the list is Variable, raise an instantiation_error.
/// This does not call YP.getValue on each element.
/// </summary>
/// <param name="list"></param>
@@ -143,10 +144,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
return new object[0];
List<object> result = new List<object>();
for (object element = list;
element is Functor2 && ((Functor2)element)._name == Atom.DOT;
element = YP.getValue(((Functor2)element)._arg2))
object element = list;
while (true) {
if (element == Atom.NIL)
break;
if (element is Variable)
throw new PrologException(Atom.a("instantiation_error"),
"List tail is an unbound variable");
if (!(element is Functor2 && ((Functor2)element)._name == Atom.DOT))
// Not a proper list.
return null;
result.Add(((Functor2)element)._arg1);
element = YP.getValue(((Functor2)element)._arg2);
}
if (result.Count <= 0)
return null;