Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog
DelegateParameter3 Delegate
SwiPlCs interfaceSbsSW.SwiPlCs.CallbackDelegateParameter3

Provide a predefined Delegate to register a C# method to be called from SWI-Prolog

Declaration Syntax
C#Visual BasicVisual C++F#
public delegate bool DelegateParameter3(
	PlTerm term1,
	PlTerm term2,
	PlTerm term3
)
Public Delegate Function DelegateParameter3 ( 
	term1 As PlTerm,
	term2 As PlTerm,
	term3 As PlTerm
) As Boolean
public delegate bool DelegateParameter3(
	PlTerm term1, 
	PlTerm term2, 
	PlTerm term3
)
type DelegateParameter3 = 
    delegate of 
        term1 : PlTerm * 
        term2 : PlTerm * 
        term3 : PlTerm -> bool
Parameters
term1 (PlTerm)
term2 (PlTerm)
term3 (PlTerm)
Return Value
Boolean
true for succeeding otherwise false for fail
Examples

This example is for DelegateParameter2 and shows how o call a C# method with two parameter.

For other samples see the source file CallbackForeigenPredicate.cs in the TestSwiPl VS2008 test project.

 Copy imageCopy
public void t_in_out()
{
    Delegate replaceDelegate = new DelegateParameter2(atom_replace);
    PlEngine.RegisterForeign(replaceDelegate);
    for (int i = 1; i < 10; i++)
    {
        PlTermV arg = new PlTermV(new PlTerm("test_f"), PlTerm.PlVar());
        PlQuery.PlCall("atom_replace", arg);
        Assert.AreEqual("test_xx_f", arg[1].ToString(), "atom_replace failed!");
    }
}
public static bool atom_replace(PlTerm atom_in, PlTerm atom_out)
{
    return atom_out.Unify(atom_in.ToString().Replace("_", "_xx_"));
}
See Also

Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60601.0 (1.1.60601.0)