Coder Social home page Coder Social logo

ylikx / fortran-legacy-tools Goto Github PK

View Code? Open in Web Editor NEW
43.0 7.0 7.0 49 KB

Three tools to deal with Fortran code: fixed to free source form converter, upper- to lowercase converter, formatter for variable declarations

License: GNU General Public License v3.0

Python 100.00%
fortran python legacy converter fortran77 punchcard fortran90 developer-tools auto-formatter portability

fortran-legacy-tools's People

Contributors

jacobwilliams avatar ylikx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fortran-legacy-tools's Issues

flowercase bug

flowercase.py is not properly handling cases like this:

PROGRAM TEST

     CHARACTER MTXTAA(3) * (186)
!
      DATA MTXTAA/'DIVAA$BAt: TN=$F, KSTEP=$I, with H=$F$EA previously r&
     &eported error was fatal.$EPrint points not properly ordered: TSPEC&
     &($I)=$F$EAn error tolerance of 0 requires setting special flags. $&
     & ','$BStep size reduced too fast, doing a restart.  $BH is so smal&
     &l that TN + H = TN.  $BError tolerance too small.  $BStep size at$&
     & end of start < HMIN=$F, $BError estimates require a steps','ize <&
     & HMIN=$F, $B(Estimated Error) / (Requested Error) for equation $I$&
     & is $F.  $BTolerance $I is F($I) = $F.$BTolerance $I is F($I) * F(&
     &$I) = $F * $F = $F.$B  Replacing F($I) with $F.$E'/
!

END PROGRAM TEST

The result is:

program test

     character mtxtaa(3) * (186)
!
      data mtxtaa/'DIVAA$BAt: TN=$F, KSTEP=$I, with H=$F$EA previously r&
     &eported error was fatal.$EPrint points not properly ordered: tspec&
     &($i)=$f$EAn error tolerance of 0 requires setting special flags. $&
     & ','$BStep size reduced too fast, doing a restart.  $bh is so smal&
     &l that tn + h = tn.  $BError tolerance too small.  $BStep size at$&
     & end of start < hmin=$f, $BError estimates require a steps','ize <&
     & hmin=$f, $b(Estimated Error) / (Requested Error) for equation $i$&
     & is $f.  $BTolerance $i is f($i) = $f.$BTolerance $i is f($i) * f(&
     &$i) = $f * $f = $f.$b  Replacing f($i) with $f.$e'/
!

end program 

Notice that it's changing the case of variables inside these continued strings as though they were code.

Bad free from generated if variable names are split in different lines in the fixed form version

Consider the following code, where the name of variable IJKLMN is split in the write statement:

      PROGRAM example
         IMPLICIT NONE
         INTEGER :: IJKLMN
         IJKLMN = 9
         WRITE(*,*) 'This is a very long line',IJKL
     &         MN
      END PROGRAM example

Splitting the name of the variables in different lines seems to be valid fixed-form Fortran. After processing the file with fixed2free2.py, the new free-form file is:

PROGRAM example
   IMPLICIT NONE
   INTEGER :: IJKLMN
   IJKLMN = 9
   WRITE(*,*) 'This is a very long line',IJKL &
         MN
END PROGRAM example

This causes compilation errors since variables IJKL and MN are not declared. Free-form Fortran does not seem to accept splitting the name of the variables in different lines. In the case that IMPLICIT NONE is omitted, the compiler is expecting a "," or an operator between IJKL and MN.

It also happens with labels. For example spliting the go to 100:

      IF (very long stuff) GO TO 10
     & 0

And also happens for things like:

      IF (very long stuff) THE
     & N

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.