[top] [up] [next]

Microsoft Visual C++ Interface


The Trinc-Prolog DLL can be used by applications developed with Microsoft Visual C++ (version 5 and higher). The files dll\visualc\dll\tp_vc.h and dll\visualc\dll\tp_vc.cpp contain the class CPrologEngine. With this class Trinc-Prolog engines inside the DLL can be created, deleted and controlled.

With the CPrologEngine class it is not necessary to initialize or exit the DLL, these tasks are automatically done by the instances of the class. The declaration of the class is:

CPrologEngine
    CPrologEngine( void )
func Constructor.
pre TRUE
post The DLL will be loaded if the first instance of the class is created.
~CPrologEngine
func Virtual destructor.
pre TRUE
post The instance was deleted, if the last instance is deleted the DLL will be unloaded.
static int Version( void )
func Return the version of the Trinc-Prolog DLL interface.
pre TRUE
post A version number was returned.
int Prove( Goal:string )
func Prove the goal.
pre A goal to prove must have been supplied.
post If the goal was proven successfully and a solution was found was TP_SOLUTION returned, if the goal failed then was TP_FAIL returned, else one of the following error codes: "TPERROR_INCORRECT_GOAL", "TPERROR_UNKNOWN_ENGINE" or "TPERROR_PROVE" was returned.
int Continue( void )
func Find the next solution.
pre A solution must have been found by a previous call to the method Prove.
post If the goal was proven successfully and a solution was found was TP_SOLUTION returned, if the goal failed then was TP_NO returned, else one of the following error codes: "TPERROR_INCORRECT_GOAL", "TPERROR_UNKNOWN_ENGINE" or "TPERROR_PROVE" was returned.
int NumVars(void )
func Return the number of variables in the last solution.
pre A solution was found.
post The number of variables was returned.
const char* VarName( int Index )
func Return the name of a specific variable from the last solution.
pre A solution was found AND "Index" >= 0 AND "Index" < "NumVars".
post The name of the variable was returned.
const char *VarValue( int Index )
func Return the value of a specific variable from the last solution.
pre A solution was found AND "Index" >= 0 AND "Index" < "NumVars".
post A string representation of the value was returned.
int VarType( int Index )
func Return the type of the value of a specific variable from the last solution.
pre A solution was found AND "Index" >= 0 AND "Index" < "NumVars".
post One of the following values will be returned:
    TPTYPE_UNKNOWN
    TPTYPE_EMPTYLIST
    TPTYPE_LIST
    TPTYPE_EMPTY
    TPTYPE_INTEGER
    TPTYPE_FLOAT
    TPTYPE_STRUCTURE
    TPTYPE_ATOM

The methods "VarName" and "VarValue" return a pointer to an internal buffer of the DLL. To store the name or value of a variable create a copy of the returned string.

[top] [up] [next]

 

info@trinc-prolog.com