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

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

м
 
(не показано 5 промежуточных версий этого же участника)
Строка 1: Строка 1:
{{copyright}}
{{copyright}}
'''package PzlPort'''
'''package PzlPort'''


Строка 66: Строка 67:
Set the name of the component registry file
Set the name of the component registry file
|full=
|full=
The file ComponentRegisterFileName is one of the places, where the information regarding the pzl-components at the given computer is stored. Другим хранилищем является реестр Windows. При поиске информации о месте расположения компоненты, файл регистрации используется первым. Если файла нет или компонента в нем не зарегистрирована, то поиск продолжается в системном реестре Windows.
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.  
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.  


Параметр ''ComponentRegisterFileName'' должен быть либо полным именем файла, либо относительным именем относительно места расположения главного исполняемого приложения.
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.
Имя расширения файла pzl-системой не регламентируется. Рекомендуемое имя расширения - '''.PZR'''.
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.
При повторном назначении файла-реестра существование предыдущего назначения не проверяется.


Загрузка данных о регистрации компонент производится только один раз при первом обращении к какой-либо 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.


Корректность содержимого файла ''ComponentRegisterFileName'' при выполнении предиката '''''setComponentRegisterFileName''''' не проверяется. Но файл должен существовать.
The content validation of the file  ''ComponentRegisterFileName'' while the predicate '''''setComponentRegisterFileName''''' performing is not used. But the file must exist.


Получение имени файла-реестра, установленного в pzl-системе возможно с помощью обращения
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.
<vip>RegistryFileStatus=pzl::getComponentRegisterFileName().</vip> При этом возвращается не непосредственно имя файла, а терм, определяющий состояние назначения файла-реестра, в том числе и имя файла, если было проведено назначение.
|except=
|except=
При отсутствии файла с именем, установленным параметром ''ComponentRegisterFileName'', генерируется исключение с текстом
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=
|example=
<vip>
<vip>
Строка 103: Строка 101:
</vip>
</vip>
}}
}}
==pzlPort::isInitialized/0==
==pzlPort::isInitialized/0==
{{predicate
{{predicate
Строка 110: Строка 109:
Checking of the initialization status of the VpPuZzle system
Checking of the initialization status of the VpPuZzle system
|full=
|full=
Позволяет выяснить, была ли выполнена инициализация pzl-системы, то есть доступна ли она для использования. Положительный исход проверки дает положительный ответ на этот вопрос. Соответственно, отрицательный - отрицательный.
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.
|example=
|example=
<vip>
<vip>
Строка 124: Строка 123:
}}
}}
=References=
=References=
[[Category:VpPuZzle]]
[[Category:VpPuZzleEn]]

Текущая версия на 09: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