1. Convert program from version 3.1 to version 4.x
- Posted by cp Apr 07, 2014
- 1309 views
I would like to "bite the bullet" and convert a version 3.1 program to version 4.x including translating and compiling. Is there any documentation or best practice on how to go about this?
-casey
2. Re: Convert program from version 3.1 to version 4.x
- Posted by ryanj Apr 07, 2014
- 1276 views
I would like to "bite the bullet" and convert a version 3.1 program to version 4.x including translating and compiling. Is there any documentation or best practice on how to go about this?
-casey
I would start with converting all your include statements to include std/whatever.e, so that you can use the new standard libray. You may have to add a few includes, because there are so many routines that they have been split into quite a few more files than the old includes. Do a search/replace for any routines that may be slightly different in the new standard library. (Try running the program to see which routines aren't declared or have an error.) You will probably have to look at the manual for each one that gives you a problem.
You may find that the standard library can do things they you probably had to write your own libraries to do in eu3.1, so you may end up leaving some things (if it isn't broke, don't fix it.) But, after you get it running, you may want to replace all global declarations with export or public and gradually convert things to the newer way of doing things, which may actually streamline your code a bit.
3. Re: Convert program from version 3.1 to version 4.x
- Posted by ChrisB (moderator) Apr 08, 2014
- 1266 views
Hi
In my experience, changing a 20K odd line program from 3.1 to 4.x was surprisingly easy. Thanks toi the developers, all the keywords remain, with lots added on.
the global keyword still works as expected.
You may get some conflicts when you run the program - eg if you use loop in your program you need to change it to n_loop (or whatever)
Changing the includes is optional, and you can add in and use the 4.1 std/ includes as you wish - use of namespaces here helps with confusions. I mix and match with only the occasional, easily resolved, namespace issue.
You need to remember to include includes in each include that you use (that sounds hideous, but where you used to use one master file that pointed to all your includes, all your sub includes must now explicitly include the files you want to use)
You will enjoy forward referencing within your program, but I actually use it less than I thought - somehow upward referencing leads to easier to trace and more logical code layout.
You will find the program starts slower, but once you bind it this disappears.
On the occasional time I have compiled a program, I have not had any issues.
I find eu.cfg a godsend.
Note, what I have said is not best practice, but it means you have a working program in virtually no time at all, and can then go on to write in a 4.x fashion from then on.
Chris
4. Re: Convert program from version 3.1 to version 4.x
- Posted by jimcbrown (admin) Apr 08, 2014
- 1268 views
You may get some conflicts when you run the program - eg if you use loop in your program you need to change it to n_loop (or whatever)
There's a program in demo/preproc called make40.ex that is suppose to deal with these automatically for you (though it may not have a completely up to date list of keywords). The idea is that you run make40.ex on 3.1 code and out comes something that'll just run on 4.0 with no additional editing. (Of course, one might want to edit further to remove use of 'global', switch to the new stdlib, etc, which make40.ex won't do.)
5. Re: Convert program from version 3.1 to version 4.x
- Posted by cp Apr 15, 2014
- 1219 views
I would like to "bite the bullet" and convert a version 3.1 program to version 4.x including translating and compiling. Is there any documentation or best practice on how to go about this?
-casey
I would start with converting all your include statements to include std/whatever.e, so that you can use the new standard libray. You may have to add a few includes, because there are so many routines that they have been split into quite a few more files than the old includes. Do a search/replace for any routines that may be slightly different in the new standard library. (Try running the program to see which routines aren't declared or have an error.) You will probably have to look at the manual for each one that gives you a problem.
You may find that the standard library can do things they you probably had to write your own libraries to do in eu3.1, so you may end up leaving some things (if it isn't broke, don't fix it.) But, after you get it running, you may want to replace all global declarations with export or public and gradually convert things to the newer way of doing things, which may actually streamline your code a bit.
After a couple of days of making changes I have converted the code to 4.05. I was able to translate and compile with watcom and it runs fine on win2008R2 server. Thank you to the Euphoria team and to those who helped by posting comments.