From 323ada012d3bed0c6f7a6d5d0ee14b409b7457c7 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Wed, 13 Aug 2008 14:13:49 +0000
Subject: 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
---
.../DotNetEngine/Compiler/YieldProlog/Variable.cs | 24 +++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs')
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs
index 281fb42..a9bd563 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs
@@ -43,6 +43,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
bool ground();
}
+ ///
+ /// A Variable is passed to a function so that it can be unified with
+ /// value or another Variable. See getValue and unify for details.
+ ///
public class Variable : IUnifiable
{
// Use _isBound separate from _value so that it can be bound to any value,
@@ -50,6 +54,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
private bool _isBound = false;
private object _value;
+ ///
+ /// If this Variable is unbound, then just return this Variable.
+ /// Otherwise, if this has been bound to a value with unify, return the value.
+ /// If the bound value is another Variable, this follows the "variable chain"
+ /// to the end and returns the final value, or the final Variable if it is unbound.
+ /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
+ ///
+ ///
public object getValue()
{
if (!_isBound)
@@ -68,6 +80,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
return result;
}
+ ///
+ /// If this Variable is bound, then just call YP.unify to unify this with arg.
+ /// (Note that if arg is an unbound Variable, then YP.unify will bind it to
+ /// this Variable's value.)
+ /// Otherwise, bind this Variable to YP.getValue(arg) and yield once. After the
+ /// yield, return this Variable to the unbound state.
+ /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
+ ///
+ ///
+ ///
public IEnumerable unify(object arg)
{
if (!_isBound)
@@ -105,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
{
object value = getValue();
if (value == this)
- return "Variable";
+ return "_Variable";
else
return getValue().ToString();
}
--
cgit v1.1