Move from old versions to this one

This is a help tool which is provided for people who have programs which work with an old version of Strawberry Prolog but do not work with this one due to some small changes which we made in the built-in predicates.

All such changes are described here. In order to correct your program start from the last version with which your program is working and make all changes to the current version.

From version 6.0 to version 6.1

In get and put replace the last argument with something like int32 or float64.

From version 2.92 to version 3.0

Some replacements:
Replace <>= with has_to.
Replace close_window with close.

Some changes:
Change window(Handle, Parent, Win_func(_), Title, X, Y, Width, Height)
with window( handle(Handle), parent(Parent), class(Win_func), title(Title), pos(X,Y), size(Width,Height)).

Change edit(Handle, Parent, Edit_func(_), Text, X, Y, Width, Height)
with edit( handle(Handle), parent(Parent), class(Edit_func), text(Text), pos(X,Y), size(Width,Height)).

Change button(Handle, Parent, Button_func(_), Text, X, Y, Width, Height)
with button( handle(Handle), parent(Parent), class(Button_func), text(Text), pos(X,Y), size(Width,Height)).

Change static(Handle, Parent, Static_func(_), Text, X, Y, Width, Height)
with static( handle(Handle), parent(Parent), class(Static_func), text(Text), pos(X,Y), size(Width,Height)).

Change for(I, A, B, Step) with for(I, A, B, step(Step)).
Change text_out(X, Y, Text) with text_out(Text, pos(X, Y)).
Change brush( Color, Type) with brush( Color, shape(Type)).
Change window_brush(Window, Color, Type) with window_brush(Window, Color, shape(Type)).
Change chronometer(T) with T is 1000*chronometer() (now "chronometer" returns seconds instead of milliseconds).

Other changes:
Now the predicate paint_rect is replaced with two predicates which are get_paint_rect and is_rect_in_paint.
Now the predicate position is replaced with two predicates which are pos and set_pos.
Now the predicate size is replaced with two predicates which are size and set_size.

If you use pos as a predicate then you have to change it because now it is a built-in predicate.

From version 2.9 to version 2.91

Changes with operators.
If you use operator as a term in the previous versions you should put it in brackets but in version 2.91 this will give you a syntax error. You should put the operator in apostrophes instead of brackets. For example, the expression X is (+) now will give a syntax error. You can write the same expression in this way: X is '+'.

Another change with the operators is that now you cannot put them in apostrophes. This means that a '+' b will give a syntax error. You should write this as a + b or as '+'(a,b). As you can see now if you want to use the prefix notation you should put the operator in apostrophes because +(a,b) is a syntax error (i.e. it is the same as + (a,b) or the space between the operator and the bracket is not important anymore).

Changes with priorities.
Now the priority of the bitwise predicates is a little bit higher. So if you use /\ or \/ or xor and if you rely too much on the priority maybe you will need to add brackets. If you have the expression X+Y\/Z then you have to change it to (X+Y)\/Z. Also X\/Y/\Z has to be changed to (X\/Y)/\Z.

Also the operators which are connected with an integer division now have a little bit lower priority. These operators are //, rem, mod, >> and <<. If you use these operators with * and / maybe you will need to put more brackets. If you have the expression X//Y*Z you have to change it to (X//Y)*Z. Also X mod Y/Z has to be changed to (X mod Y)/Z.

Look in the ADD file or in the Help/Operators to see these actual priorities.

Other changes:
The built-in predicates ++ and -- are removed. Replace ++(X) with X := X+1 and --(X) with X := X-1.

From version 2.6 to version 2.9

The message key_down has now only two arguments (the first two). Delete the third argument which was Flags. If you need the information which was carried by the argument Flags take it by the predicate message_flags.

Now, after the processing of any message, the stack is released in the same way as if the code ended with: !, fail. So, if you were using fail to clean the stack at the end of message processing, now you do not need to do this.

From version 2.3 to version 2.5

The predicates get_clipboard_data  and set_clipboard_data have one extra argument. To make your old program working change:
get_clipboard_data() with get_clipboard_data(0)
set_clipboard_data(Text) with set_clipboard_data(Text, 0)

From version 1.6 to version 1.7

The key word built_in is changed. If you have it in your program you should to replace it with ***.

From version 1.2 to version 1.21

In this version the predicate for is changed. If you have for(I,A,B) in the old version it would make a loop for I from A up to B but without B. In this version the loop will be from A  to B (included).

The easiest way to correct this in your old programs is to replace for(I,A,B) with for(I, A, B- 1) everywhere. Note that in this version you can write expressions in the place of A and B. Analogically  if you have for(I,A,B,Step) then replace it with for(I,A,B- 1,Step) if the Step is positive and with for(I,A,B+1,Step) if the Step is negative.

Other change is in the predicates size and position. Now they have one more argument which shows which is the window that is all about. The easiest way to correct your old programs is to replace everywhere size(X,Y) with size(_,X,Y) and analogically for the position.

If you use brush(R,G,B) where R, G, B mean reed, green and blue then you have to replace it with brush(rgb(R,G,B)).

Predicate count_list is changed with function and its name is list_length

From version 1.02 to version 1.2

Many predicates now are functions and you have to change their syntax. For example is you have in your program print(S, T), then you should to replace it with S is print(T). The full list of predicates which became functions follows:


In version 1.2 the way in which you can define functions is changed. For example, if you wish to define function add(X,Y) and to use it like Result is add(2,2) to obtain 4 then the old definition style is:
add(Result, X, Y) :- Result is X + Y.

and the new style is:
Result is add(X,Y) :- Result is X + Y.

From version 1.0 (beta release) to version 1.0 (beta release2)

predicate / is changed with //.
predicate get_time is changed with chronometer
The argument of wait now is in seconds, not in centiseconds. Correct it by changing Time with Time/100.
The predicates get, put, get_text and set_text changed the places of their first two arguments.

The predicates bitmap and icon lost their last two arguments.

From version 0.7 to version 1.0 (beta release)

The predicates: pen, brush, window_brush, color_text, color_text_back, select_color are changed. The change is that instead of three arguments for the color now they have only one argument. Correct them by changing of Red, Green, Blue with rgb( Red, Green, Blue).