MRedies / f2f_mirror

A mirror of Colby Lemon FORTRAN 2 Fortran perl script. Sadly his bitbucket disappeared. If you have a newer version, please create a pull request.
GNU General Public License v2.0
4 stars 0 forks source link

Double precision functions not handled correctly #2

Open w6ws opened 1 week ago

w6ws commented 1 week ago

Double precision functions get an incorrect "::" added to the function declaration, and "END PROGRAM" instead of "END FUNCTION" at the end:

  double precision function dpfunc (x)
  real x
  dpfunc = x
  end

Gets translated to:

double precision :: function dpfunc (x)
real :: x
dpfunc = x
END PROGRAM

With the following mod, it produces correct code:

415a416,420

        } else {
            if (s/^double precision (function [\w_\d]*)/double precision $1/i) {
                $subname = $1;
                last cblock;
            }

Produces:

double precision function dpfunc (x)
real :: x
dpfunc = x
end function dpfunc

(I've found several other bugs in f2f.pl as well. Details, and perhaps fixes, will be added as separate issues.)

MRedies commented 1 week ago

It’s just a mirror so it’s not really maintained, but if you make a PR I can approve

w6ws commented 1 week ago

Ok - I can't do the PR today. Hopefully in the next few days.