Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Описание языка ПРОЛОГ.DOC
Скачиваний:
21
Добавлен:
12.03.2015
Размер:
159.23 Кб
Скачать

Запрос Пролога

Запросы это функции, которые фактически вызывают предикаты в Прологе logicbase/program. Первый параметр, термин, всегда объединяется с результатом запроса. Функция Redo вводит backtracking, который повторно объединяет термин со следующим результатом.

ClearCall только полезен, если вы запускаете восстановленную петлю и не заканчиваете ее. Это очищает стек.

Function ExecLS (TermPtr As Long) as Boolean

Function ExecStrLS (TermPtr As Long, ByVal StrPtr) as Boolean

Function CallLS (TermPtr As Long) as Boolean

Function CallStrLS (TermPtr As Long, ByVal StrPtr As String) as Boolean

Function RedoLS () as Boolean

Sub ClearCallLS ()

Function GetCurrentEngineLS () as Long

Sub SetCurrentEngineLS (NewEngID as Long)

Эти функции основаны на функциях API lsExec, lsExecStr, lsCall, lsCallStr, lsRedo, и lsClearCall.

Динамическая база данных

Эти функции заставят облегчить работу с динамической базы данных Пролога.

Sub AssertaLS (ByVal Term As Long)

Sub AssertzLS (ByVal Term As Long)

Function RetractLS (ByVal Term As Long) as Boolean

Sub AssertaStrLS (ByVal StrPtr As String)

Sub AssertzStrLS (ByVal StrPtr As String)

Function RetractStrLS (ByVal StrPtr As String) as Boolean

Эти функции основаны на функциях API lsAsserta, lsAssertaStr, lsAssertz, lsAssertzStr, и lsRetract.

Преобразования сроки

Эти функции преобразовывают строки к терминам и терминам к строкам.

Sub TermToStrLS (ByVal Term As Long, StrPtr As String, ByVal StrLen As Integer)

Sub TermToStrQLS (ByVal Term As Long, StrPtr As String, ByVal StrLen As Integer)

Sub StrToTermLS (TermPtr As Long, ByVal StrPtr As String)

Эти функции основаны на функциях API lsTermToStr, lsTermToStrQ, и lsStrToTerm.

Создание / получение Типов Пролога

Эти функции отображают типы Пролога к и типов VB. Тип - определенные функции Get - VB дополнения.

Sub MakeAtomLS (TermPtr As Long, ByVal StrPtr As String)

Sub MakeStrLS (TermPtr As Long, ByVal StrPtr As String)

Sub MakeIntLS (TermPtr As Long, ByVal IntVal As Integer)

Sub MakeLongLS (TermPtr As Long, ByVal IntVal As Integer)

Sub MakeFloatLS (TermPtr As Long, ByVal FloatVal As Double)

Sub MakeAddrLS (TermPtr As Long, Ptr As Variant)

Function GetTermTypeLS (ByVal Term As Long) as Integer

Sub GetTermLS (ByVal Term As Long, ByVal BType As Integer, Ptr As Variant)

Function GetStrTermLS (ByVal Term As Long) As String

Function GetIntTermLS (ByVal Term As Long) As Integer

Function GetLongTermLS (ByVal Term As Long) As Long

Function GetFloatTermLS (ByVal Term As Long) As Double

Эти функции основаны на функциях API lsMakeAtom, lsMakeStr, lsMakeInt, lsMakeFloat, lsMakeAddr, lsGetTermType, и lsGetTerm.

Структуры управления

В этом Прологе управляющая структура функции позволяют вам создавать и удалять термины которые являются основной структурой. Это особенность полезна для получения различных параметров в запросе. В типовом примере, имеется запрос 'родной брат (Мэри, X)'. Функция GetStrArgLS может использоваться, чтобы получить второй параметр этой структуры, после того, как CallStrLS связал переменную.

Sub GetFALS (ByVal Term As Long, StrPtr As String, IntPtr As Integer)

Function GetFunctorLS (ByVal Term As Long) As String

Function GetArityLS (ByVal Term As Long) As Integer

Sub MakeFALS (Term As Long, ByVal Functor As String, ByVal Arity As Integer)

Function UnifyArgLS (TermPtr As Long, ByVal ArgNum As Integer, ByVal PType As Integer, ByVal Ptr As Variant) As Boolean

Function UnifyStrArgLS (TermPtr As Long, ByVal ArgNum As Integer, ByVal StrPtr As String) As Boolean

Function UnifyAtomArgLS (TermPtr As Long, ByVal ArgNum As Integer, ByVal StrPtr As String) As Boolean

Function UnifyIntArgLS (TermPtr As Long, ByVal ArgNum As Integer, ByVal IntVal As Integer) As Boolean

Function UnifyLongArgLS (TermPtr As Long, ByVal ArgNum As Integer, ByVal LongVal As Long) As Boolean

Function UnifyFloatArgLS (TermPtr As Long, ByVal ArgNum As Integer, ByVal FloatVal As Double) As Boolean

Sub GetArgLS (ByVal Term As Long, ByVal ArgNum As Integer, ByVal BType As Integer, Ptr As Variant)

Function GetStrArgLS (ByVal Term As Long, ByVal ArgNum As Integer) As String

Function GetIntArgLS (ByVal Term As Long, ByVal ArgNum As Integer) As Integer

Function GetLongArgLS (ByVal Term As Long, ByVal ArgNum As Integer) As Long

Function GetFloatArgLS (ByVal Term As Long, ByVal ArgNum As Integer) As Double

Function GetArgTypeLS (ByVal Term As Long, ByVal ArgNum As Integer) As Integer

Function StrArgLenLS (ByVal Term As Long, ByVal ArgNum As Integer) As Integer

Function UnifyLS (ByVal Term1 As Long, ByVal Term2 As Long) as Integer

Эти функции основаны на функциях API lsGetFA, lsMakeFA, lsUnifyArg, lsGetArg, lsGetArgType, lsStrArgLen, и lsUnify.