Class PzlPort: различия между версиями

Материал из wikiru.visual-prolog.com

м (Новая: {{copyright}} =Назначение= Класс pzlPort является ядром системы VpPuzzle и предназначен для обеспечения работы с pzl...)
 
 
(не показано 6 промежуточных версий этого же участника)
Строка 1: Строка 1:
{{copyright}}
{{copyright}}
=Назначение=


Класс pzlPort является ядром системы VpPuzzle и предназначен для обеспечения работы с pzl-компонентами. Этот класс обязательно должен включаться в проект главного приложения, генерирующего исполняемый (.EXE) файл.
'''package PzlPort'''


Обращения к предикатам этого класса возможны только из классов главного исполняемого приложения. Компоненты, помещенные в DLL-контейнеры, не могут обращаться к предикатам этого класса.
The class pzlPort is the core of the VpPuzzle system and supports the use of pzl-components. This class must be included to the project, which generates the main executable applicaion(.EXE).


=Список предикатов класса=
The calls of the predicates of the class PzlPort are possible only from the classes of the main executable applicaion project. Components placed to the dll-containers can not make a calls of the predicats of the class PzlPort.
 
=Predicate summary=
{|cellspacing="0" border="1" style="float:center;background:#F9F9F9;color:black;"
{|cellspacing="0" border="1" style="float:center;background:#F9F9F9;color:black;"
|-
|-
|[[#core::classInfo/0|classInfo]].
|[[#core::classInfo/0|classInfo]].
Получение информации о классе
get the information regarding the class
|-
|-
|[[#pzlPort::init/0|init:()]].
|[[#pzlPort::init/0|init:()]].
Инициализация системы VpPuZzle
Initialization of the VpPuZzle system
|-
|-
|[[#pzlPort::setComponentRegisterFileName/1|setComponentRegisterFileName:(string ComponentRegisterFileName)]].
|[[#pzlPort::setComponentRegisterFileName/1|setComponentRegisterFileName:(string ComponentRegisterFileName)]].
Установка имени файла-реестра компонент
Set the name of the component registry file
|-
|-
|[[#pzlPort::isInitialized/0|isInitialized:()  determ]].
|[[#pzlPort::isInitialized/0|isInitialized:()  determ]].
Проверка инициализации системы VpPuZzle
Checking of the initialization status of the VpPuZzle system
|}
|}


=Используемые дополнительные ресурсы=
=Additionally used resources=
Обязательно:
The mandatory use:
*использование библиотеки pzlPort_XX.lib, где XX - квалификатор лицензии. Библиотека фактически содержит имплементацию класса pzlPort и включает имплементацию свойств pzl-Контейнера главного исполняемого приложения.
*the pzlPort_XX.lib library must be used, where  XX - license qualifier. The library in fact contains the implementation of the class PzlPort and also the library includes the implementation of the handling of the pzl-container of the main executable application.
*наличие пакета pzlConfig, который участвует в процессе инициализации.
*the package pzlConfig must be used. The package PzlConfig participates in the initialization procedure.


=Описание предикатов класса=
=Predicate details=
==core::classInfo/0==
==core::classInfo/0==
{{predicate
|decl=
<vip>classInfo:().</vip>
<vip>classInfo:().</vip>
Получение информации о классе.
|short=
 
get the information regarding the class
'''Описание'''
|full=
 
The predicate is the tipical predicate, which is generated when any class generated automatically by the IDE of the Visual Prolog System
Является типичным предикатом, который автоматически генерируется при генерации текста любого класса средствами IDE системы VIP. Описание и порядок использования предиката - см. руководства VIP.
}}
 
==pzlPort::init/0==
==pzlPort::init/0==
{{predicate
|decl=
<vip>init:().</vip>
<vip>init:().</vip>
Инициализация системы VpPuzzle.
|short=
 
Initialization of the VpPuZzle system
'''Описание'''
|full=
 
The predicate must be the first predicate, which is used while the accessing to the Pzl-system. It must be called only once. After initialization the calls to other classes of the Pzl system become possible.  
Этот предикат всегда должен быть первым предикатом, к которому производится обращение. После инициализации возможны обращения к другим классам pzl-системы.
 
Инициализация pzl-системы может быть выполнена как немедленно после старта приложения, так и в любой другой момент, когда возникает необходимость в начале ее использования.
Деинициализация системы невозможна.
 
Повторная инициализация игнорируется.
 
'''Исключения'''
 
Предикат при исполнении не генерирует исключения. Повторная инициализация игнорируется.


'''Пример'''
The initialization of the pzl-system may be performed immidiately after the main applicaion start. It also may be performed at any moment when the pzl-system is expected to be used.
The deinitialization of the pzl-system is impossible.


The repetitions of the initialization are ignored.
|example=
<vip>
<vip>
clauses
clauses
Строка 62: Строка 59:
     ...
     ...
</vip>
</vip>
 
}}
==pzlPort::setComponentRegisterFileName/1==
==pzlPort::setComponentRegisterFileName/1==
{{predicate
|decl=
<vip>setComponentRegisterFileName:(string ComponentRegisterFileName).</vip>
<vip>setComponentRegisterFileName:(string ComponentRegisterFileName).</vip>
Установка имени файла-реестра компонент.
|short=
 
Set the name of the component registry file
Файл ComponentRegisterFileName является одним из хринилищ информации о pzl-компонентах на данном компьютере. Другим хранилищем является реестр Windows. При поиске информации о месте расположения компоненты, файл регистрации используется первым. Если файла нет или компонента в нем не зарегистрирована, то поиск продолжается в системном реестре Windows.
|full=
 
The file ComponentRegisterFileName is one of the places, where the information regarding the pzl-components at the given computer is stored. The other place of store is the Windows registry. When the siarching process runs the component registry file is used first. If the file dosn't exist or the component is not registered there, then the search process continued in the Windows registry.
Информация в файле-реестре компонент хранится в формате термов, принятом в системе Visual Prolog (save-consult). Прежде чем компонента может быть использована на данном компьютере, она должна быть на нем зарегистрирована. Приложение, которое использует pzl-технологию, может либо не использовать файл-реестр компонент либо может назначить использование этого файла путем установки его имени с помощью предиката setComponentRegisterFileName/1.
 
'''Описание'''
 
Параметр ''ComponentRegisterFileName'' должен быть либо полным именем файла, либо относительным именем относительно места расположения главного исполняемого приложения.
Имя расширения файла pzl-системой не регламентируется. Рекомендуемое имя расширения - '''.PZR'''.


Установка имени файла после старта приложения может быть осуществлена только один раз.  
The information in the component registry file is stored in the Visual Prolog term format (save-consult data format). Before the component may be used at the given computer, it must be registered at this computer. The applicaion, which uses the pzl-technology may avoid the use of the component registry file or the applicaion may assign the use of the file by using the predicate setComponentRegisterFileName/1.  
При повторном назначении файла-реестра существование предыдущего назначения не проверяется.


Загрузка данных о регистрации компонент производится только один раз при первом обращении к какой-либо pzl-компоненте. Соответственно, добавление информации о регистрации в этот же файл или изменение этой информации после того, как приложение обратилось к этому файлу, не могут повлиять на уже работающее приложение.
The parameter ''ComponentRegisterFileName'' must be the full path to the file, or it may be relative to the directory, where the main applicaion is placed.
The file extension is not strongly defined in the pzl-system. The recommended file extension is  - '''.PZR'''.


Корректность содержимого файла ''ComponentRegisterFileName'' при выполнении предиката '''''setComponentRegisterFileName''''' не проверяется. Но файл должен существовать.
The component registration file of the applicaion may be assigned only once. While the repetitive assignement the existence of the previous assignment is not checked.


Получение имени файла-реестра, установленного в pzl-системе возможно с помощью обращения
The component registration data is load only once while the first access to an any pzl-component. Thus the second (and further) file assignment is not make influence on the component registration.
<vip>RegistryFileStatus=pzl::getComponentRegisterFileName().</vip> При этом возвращается не непосредственно имя файла, а терм, определяющий состояние назначения файла-реестра, в том числе и имя файла, если было проведено назначение.


'''Исключения'''
The content validation of the file  ''ComponentRegisterFileName'' while the predicate '''''setComponentRegisterFileName''''' performing is not used. But the file must exist.


При отсутствии файла с именем, установленным параметром ''ComponentRegisterFileName'', генерируется исключение с текстом
It is possible to get the name of the component registration file, assigned at the pzl-system by the use of the predicate call <vip>RegistryFileStatus=pzl::getComponentRegisterFileName()</vip> The predicate pzl::getComponentRegisterFileName() returns the term, which reflects the status of the assignment of the file. If the file name has been assigned successfully, then the name will be returned as the parameter of the term.
|except=
If there is no file with the given name ''ComponentRegisterFileName'', then the exception is genereated with the text
<vip>"The file <ComponentRegisterFileName> can not be found"</vip>
<vip>"The file <ComponentRegisterFileName> can not be found"</vip>
 
While checking the file existence the system exception are possible and they are stored with the message <vip>"System Error while checking the file <ComponentRegisterFileName> existence"</vip>
При проверке существования файла возможны системные исключения, связанные с особенностями файловой системы операционной системы с сообщением
The error code will be stored also.
<vip>"System Error while checking the file <ComponentRegisterFileName> existence"</vip> и сохранением кода ошибки.
|example=
 
'''Пример'''
<vip>
<vip>
class predicates
class predicates
Строка 108: Строка 100:
     runStudioStarter(TaskWindow,InitialComponent).
     runStudioStarter(TaskWindow,InitialComponent).
</vip>
</vip>
}}


==pzlPort::isInitialized/0==
==pzlPort::isInitialized/0==
{{predicate
|decl=
<vip>isInitialized:()  determ.</vip>
<vip>isInitialized:()  determ.</vip>
Проверка инициализации системы VpPuZzle
|short=
 
Checking of the initialization status of the VpPuZzle system
'''Описание'''
|full=
 
Makes it possible to check whether the initialization of the pzl-system was performed. If the result of the check is positive, then predicate succeeds.
Позволяет выяснить, была ли выполнена инициализация pzl-системы, то есть доступна ли она для использования. Положительный исход проверки дает положительный ответ на этот вопрос. Соответственно, отрицательный - отрицательный.
|example=
 
'''Исключения'''
 
Исключения невозможны.
 
'''Пример'''
<vip>
<vip>
clauses
clauses
Строка 132: Строка 121:
     ...
     ...
</vip>
</vip>
 
}}
 
=References=
=Ссылки=
[[Category:VpPuZzleEn]]
[[Категория:VpPuZzle]]

Текущая версия на 10:01, 30 января 2008

Автор: Виктор Юхтенко

package PzlPort

The class pzlPort is the core of the VpPuzzle system and supports the use of pzl-components. This class must be included to the project, which generates the main executable applicaion(.EXE).

The calls of the predicates of the class PzlPort are possible only from the classes of the main executable applicaion project. Components placed to the dll-containers can not make a calls of the predicats of the class PzlPort.

Predicate summary

classInfo.

get the information regarding the class

init:().

Initialization of the VpPuZzle system

setComponentRegisterFileName:(string ComponentRegisterFileName).

Set the name of the component registry file

isInitialized:() determ.

Checking of the initialization status of the VpPuZzle system

Additionally used resources

The mandatory use:

  • the pzlPort_XX.lib library must be used, where XX - license qualifier. The library in fact contains the implementation of the class PzlPort and also the library includes the implementation of the handling of the pzl-container of the main executable application.
  • the package pzlConfig must be used. The package PzlConfig participates in the initialization procedure.

Predicate details

core::classInfo/0

classInfo:().

get the information regarding the class

Description

The predicate is the tipical predicate, which is generated when any class generated automatically by the IDE of the Visual Prolog System

Exceptions

No

Example

No

pzlPort::init/0

init:().

Initialization of the VpPuZzle system

Description

The predicate must be the first predicate, which is used while the accessing to the Pzl-system. It must be called only once. After initialization the calls to other classes of the Pzl system become possible.

The initialization of the pzl-system may be performed immidiately after the main applicaion start. It also may be performed at any moment when the pzl-system is expected to be used. The deinitialization of the pzl-system is impossible.

The repetitions of the initialization are ignored.

Exceptions

No

Example

clauses
  run():-
    pzlPort::init(),
    TaskWindow = taskWindow::new(),
    ...

pzlPort::setComponentRegisterFileName/1

setComponentRegisterFileName:(string ComponentRegisterFileName).

Set the name of the component registry file

Description

The file ComponentRegisterFileName is one of the places, where the information regarding the pzl-components at the given computer is stored. The other place of store is the Windows registry. When the siarching process runs the component registry file is used first. If the file dosn't exist or the component is not registered there, then the search process continued in the Windows registry.

The information in the component registry file is stored in the Visual Prolog term format (save-consult data format). Before the component may be used at the given computer, it must be registered at this computer. The applicaion, which uses the pzl-technology may avoid the use of the component registry file or the applicaion may assign the use of the file by using the predicate setComponentRegisterFileName/1.

The parameter ComponentRegisterFileName must be the full path to the file, or it may be relative to the directory, where the main applicaion is placed. The file extension is not strongly defined in the pzl-system. The recommended file extension is - .PZR.

The component registration file of the applicaion may be assigned only once. While the repetitive assignement the existence of the previous assignment is not checked.

The component registration data is load only once while the first access to an any pzl-component. Thus the second (and further) file assignment is not make influence on the component registration.

The content validation of the file ComponentRegisterFileName while the predicate setComponentRegisterFileName performing is not used. But the file must exist.

It is possible to get the name of the component registration file, assigned at the pzl-system by the use of the predicate call

RegistryFileStatus=pzl::getComponentRegisterFileName()

The predicate pzl::getComponentRegisterFileName() returns the term, which reflects the status of the assignment of the file. If the file name has been assigned successfully, then the name will be returned as the parameter of the term.

Exceptions

If there is no file with the given name ComponentRegisterFileName, then the exception is genereated with the text

"The file <ComponentRegisterFileName> can not be found"

While checking the file existence the system exception are possible and they are stored with the message

"System Error while checking the file <ComponentRegisterFileName> existence"

The error code will be stored also.

Example

class predicates
  runProfile:(window TaskWindow,string RegistryFileName,string InitialComponent).
clauses
  runProfile(_TaskWindow,RegistryFileName,_InitialComponent):-
    not(RegistryFileName=""),
    trap(pzlPort::setComponentRegisterFileName(RegistryFileName),_Err,fail()),
    fail.
  runProfile(TaskWindow,RegistryFileName,InitialComponent):-
    RegistryFileStatus=pzl::getComponentRegisterFileName(),
    notifyUser(TaskWindow,RegistryFileStatus,RegistryFileName),
    runStudioStarter(TaskWindow,InitialComponent).

pzlPort::isInitialized/0

isInitialized:()  determ.

Checking of the initialization status of the VpPuZzle system

Description

Makes it possible to check whether the initialization of the pzl-system was performed. If the result of the check is positive, then predicate succeeds.

Exceptions

No

Example

clauses
  run():-
    not(isInitialazed()),
    pzlPort::init(),
    fail.
  run():-
    TaskWindow = taskWindow::new(),
    ...

References