Class PzlPort
Copyright (C) Prolog Development Center SPb.
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
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
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 callRegistryFileStatus=pzl::getComponentRegisterFileName()
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"
"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(),
...