View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Wed Aug 09, 2006 2:28 pm Post subject: Problems with long lines of code |
|
|
I am trying to take an old fortran code and re-compile it. This older version would allow a very long line of code (for example a procedure that passes about 10 variables) to extend to the next line by placing an asterick in the first space of the following line. The Plato3 compiler doesn't recognize this and will only allow about 60 characters per line. I looked for a way to duplicate the * in the help section but couldn't find it. Can someone help???
Ed Wilcox |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7942 Location: Salford, UK
|
Posted: Thu Aug 10, 2006 12:21 am Post subject: Problems with long lines of code |
|
|
Ed
Standard Fortran 77 and fixed format Standard Fortran 90/95 allows you to continue with a * (or any other character except a zero) but you must place it in column 6 not column 1.
The alternative is to change to free format Fortran 90/95 which allows longer lines.
Details can be found in any standard Fortran text book. |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Thu Aug 10, 2006 5:54 am Post subject: Problems with long lines of code |
|
|
I am already programing in the free text mode. If I put all of the parameters into the procedure call then the line has almost 200 characters in it (about 15 variables). I believe the compilier is truncating the end of the line (because a max length) because I keep getting a compile error 58 - Unpaired right brackets. To remove some of the parameters (i.e. make the line shorter) I would have to make several variables global, which would alter the program considerably, which I would prefer not to do.
Ed Wilcox |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7942 Location: Salford, UK
|
Posted: Thu Aug 10, 2006 9:45 am Post subject: Problems with long lines of code |
|
|
Ed
The free format continuation character is an ampersand (&) and this is the last character of the line to be continued. It is also optionally the first non-blank character of the continued line. The maximum line length is 132 characters and you can have 39 continuation lines giving you 40*132 characters per statement.
Plato does not impose a limit on the line length although with .for files the characters go green after column 72. When you compile a file, FTN95 should complain if you go beyond the permitted line length.
FTN95 has a command line switch /WIDE_SOURCE that over-rides the Fortran Standard and removes the limit on the line length. In a Plato project you can set this switch from the Project Properties dialog under Compiler Options->Source->Allow wide source. |
|
Back to top |
|
|
|