Difference between revisions of "Visual Prolog 8 Upgrade Notes"

From wiki.visual-prolog.com

(event0-7)
m (excessive space)
Line 26: Line 26:
== Manual updates ==
== Manual updates ==


=== event0 - event 7 ===
=== event0 - event7 ===


The most severe change is that the <vp>Source</vp> parameter has been removed from all the polymorphic classes/interfaces <vp>event0</vp> - <vp>event7</vp>.  And that the corresponding listeners does not have a <vp>Source</vp> argument any more.
The most severe change is that the <vp>Source</vp> parameter has been removed from all the polymorphic classes/interfaces <vp>event0</vp> - <vp>event7</vp>.  And that the corresponding listeners does not have a <vp>Source</vp> argument any more.

Revision as of 16:17, 7 August 2017

This document describes how to upgrade Visual Prolog 7.5 projects to Visual Prolog 8, for older projects you should also read Visual Prolog 7.5 Upgrade Notes.

If you have problems with upgrading your projects and need additional information, you are welcome to ask questions in Visual Prolog Discussion Forum.

By default, the installation of Visual Prolog 8 will not replace any previously installed versions. It is possible to work with several versions on a single computer.

  • The Commercial Edition will by default be installed in C:\Program Files (x86)\Visual Prolog 8 or C:\Program Files\Visual Prolog 8.
  • The Personal Edition will by default be installed to C:\Program Files (x86)\Visual Prolog 8PE or C:\Program Files\Visual Prolog 8PE.

Visual Prolog 8 projects are backward-compatible with Visual Prolog 7.5 projects. If you are going to use different versions of Visual Prolog installed at one computer, avoid opening projects by double-clicking on vipprj files.

Notice it is highly advisable to have a backup of a project before updating.

After loading the project you should rebuild the entire project with the help of the Build -> Rebuild All command and answer Yes All or to all to the messages suggesting adding or removing packages and include statements. You may have to build again several times to complete the build process.

Notice that you should simply delete include directives to PFC files which cannot be found: proper include directives will (normally) be inserted automatically.

Many projects will only require:

  • Accept to remove all unexisting packages
  • Accept to add required packages
  • Delete all include directives for files that does not exist
  • Accept to add include directives

It is reccomended that you continue the process above untill process stabilizes, before you start performing any manual updates.

Manual updates

event0 - event7

The most severe change is that the Source parameter has been removed from all the polymorphic classes/interfaces event0 - event7. And that the corresponding listeners does not have a Source argument any more.

Example

So a property like this:

facts
    changed : event0{vipProject} := event0::new(This).

must be changed like this

facts
    changed : event0 := event0::new().

It is more difficult to change the listeners.

Example

Code like this:

P:changed:addListener(listView_changedItem),

May give an error like this:

The flow pattern '()' does not exist for 'listView_changedItem/1'

This is because listView_changedItem/1 is a listener that expects a source argument (P):

predicates
    listView_changedItem : (vipProject Project).

In many cases the source argument is not used anyway:

clauses
    listView_changedItem(_Project) :-
        ...

In which case the predicate should simply "loose" the source arguments:

predicates
    listView_changedItem : ().
clauses
    listView_changedItem() :-
        ...

However if the source argument is actually used:

predicates
    listView_changedItem : (vipProject).
clauses
    listView_changedItem(P) :-
        listViewControl_ctl:setItem(vipProjectToListViewItem(P)).

Then it can obviously not just be deleted. Instead it may be possible to capture the "Source" in an anonymous predicate where the listener is added. Here the original code looked like this:

P:changed:addListener(listView_changedItem),

and it is P which is the source of the changed event, so we can change the code like this:

P:changed:addListener({ :- listView_changedItem(P) }),

The anonymous predicate { :- listView_changedItem(P) } captures the source P and transfers it to listView_changedItem

See also