Adding the PzlPort to the application

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

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

Elementary PzlStudio has no feature to create new executable applications projects, which contain the pzl-system embedded. But Elementary PzlStudio gives the possibility to include the pzl-system into any application project created before.

Invoking the operation

The form to perform the operation may be invoked via menu Tools/Add/Port to Executable. AddPzlPort.png

The Option list includes:

The editing of the option is performed in the right side of the table. The Editing supposed to be done by the explicit editing or it may be done by the pressing the button on the right side of the active field. Double clicking makes the same as pressing the button.

The operation is performed by clicking the button 'Add.

The button may be inactive if there is not enough data entered.

After the operation completion you may add pzl-system to any other application.

The button Close closes the form.

Performing the operation

If the operation complete, then the report will be sent to the Message Window. You will see there also the report regarding the changes, which has been made on the project.

PzlPortAddedSuccessfullyReport.png

If Pzl-System was included to the application before, then the dialog message will appear and you may cancel the operation performing.

AddPortReplacementWarning.png

You may continue the performing the operation if you are making some updates like changing the license level.

The resulting report will be seen in the Message Window.

PzlPortReplacedSuccessfullyReport.png

Coming back to the IDE, you may compile and build the project of the executable application.

The example of the project window in the IDE after the building the project may be seen below.

PzlSystemAddedToMainApplicaion.png

As the result of the execution of the operation by the Elementary PzlStudio the new part of the project tree appeared in the project together with the new files included.

The source code of the main applicaion’s file is also updated and the pzlPort initialization has been added (pzlPort::init())

clauses
  run():-
    pzlPort::init(), %<--- Added 
    TaskWindow = taskWindow::new(),
    TaskWindow:show().

Now you can add the assignment of the component registration file (if needed) using the IDE:

clauses
  run():-
    pzlPort::init(),
    pzlPort::setComponentRegisterFileName("ComponentRegistry.pzr"),
    TaskWindow = taskWindow::new(),
    TaskWindow:show().

The Target Project

The target Project is the executable application project, which needs to be updated to add the pzl-system. The target project must be chosen as the Project file of the Visual Prolog programming system with the file extension .prj6.

So you must set the name of the Project file of the executable application.

When you open the form first, the field is empty and you may not edit the field. Pressing the button at the right side will invoke the file dialog to choose the application project file

The project may be any kind of – with the user interface VPI or GUI, with no user interface, the console application or it is the Web cgi application or Web IsApi DLL.

The project must exist before you try to add the pzl-system to it.

If you create the completely new project from the scratch, then you must first create the project using the IDE, set there all needed options and then build it and save it (Ctrl-S).

If your project exists, then it is ready to include the pzl-system to that project.

There is no need to close the project in the IDE before you are going to add the pzl-system to it – it is enough to save it (Ctrl-S).

The version of the Visual Prolog programming system, which was used to create the project, must be compatible with the version of the Elementary PzlStudio. The list of compatible versions of the Visual Prolog system must be shown in the dialog About of the Elementary PzlStudio.

The License Level

The Pzl-system uses the licensing principle.

There are license levels predefined:

  • Public
  • Commercial
  • Exclusive
  • SuperExclusive

The license level is defined:

  • for the main application – by the library pzlPort_X.lib
  • for the pzl-container – by the library pzlContainer_X.lib

Here X is the license level identifier.

The only pzl-container may have the license level Public. The main application may not have the license level Public.

The correspondence of the license level and the library’s identifier is shown below:

  • Commercial - pzlPort_C.lib
  • Exclusive - pzlPort_EX.lib (X – the personal identifier)
  • SuperExclusive pzlPort_SE.lib

So when you include the pzl-system to the main application, you must set the license level of the application. Choosing the license level defines exactly the name of the pzl-library, which will be included to the project. If you choose the license level Exclusive, then there may be many libraries of the license level Exclusive, so you must decide which variant of the library you wish to set for the application.

PzlStudio proposes the license level Commercial by default. This corresponds to the library PzlPort_C.lib.

When you choose the license level, then the Elemantary PzlStudio automatically assigns the name of the library to the property Container Library. This property is not editable. If the choice is Exclusive license level, then the dialog to choose the filename of the library appears and you see all available libraries. You must choose one of libraries of the Exclusive level. If the choice is wrong, then the error message appears

PzlPortLicenseLevelErrorDlg.png

The Library of the Pzl-system

This field is not editable. It shows the name of the library pzlPort_X.lib, which corresponds to the appropriate license level of the main application.

Pzl-container Version

The pzl-container version is the string value, which has the meaning for the developer only. The Elementary PzlStudio only places the value of the property as the value of the constant pzlContainerVersion_C in the file PzlConfig.i, when it will be created.

interface iPzlConfig
constants
    pzlContainerVersion_C="1.0;001".
 
 % Container Configuration
constants
 
end interface iPzlConfig

Attributes related to the basic options

The last three positions in the form

  • Company
  • Author
  • Copyright

are taken from the Basic Options and they may be redefined here if there is need. If you modify these properties in the current form, they will not be changed in the Basic Options.

References