ratfor(1)

πŸ“¦
version 1.07 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ ratfor ✨

okay bestie, pull up a chair πŸ’– this is the page for ratfor, and she lives in section 1 of the General Commands Manual. quick vibe check: ratfor is a ratfor preprocessor for fortran77. yes it's a preprocessor for a preprocessor-adjacent situation, no we are not going to think about that too hard, just go with it 🌸


🌈 SYNOPSIS 🌈

ratfor [-l n] [-C] [-o output] [-s type] input

πŸŽ€ PARAMETERS πŸŽ€

  • -l n β€” you, the user, set the starting label to n. you're in charge, slay πŸ’…
  • -o output β€” name your output file. and if you don't? it goes to stdout, periodt.
  • -C β€” keep comments in! lowkey useful for compiler directives, highkey iconic ✨
  • -s type β€” say what element type the array used for strings should be. default is integer, because of course it is πŸ¦‹

πŸ’œ DESCRIPTION πŸ’œ

Ratfor has the following syntax:

prog:   stat
        prog stat

stat:   if (...) stat
        if (...) stat else stat
        while (...) stat
        repeat stat
        repeat stat until (...)
        for (...;...;...) stat
        do ... stat
        switch (intexpr) { case val[,val]: stmt ... default: stmt }
        break n
        next n
        return (...)
        digits stat
        { prog }  or  [ prog ]  or  $( prog $)
        anything unrecognizable

where stat is any Fortran or Ratfor statement, and intexpr is an expression that resolves into an integer value. not me being picky about types, it's just what she needs πŸ”₯

A statement is terminated by an end-of-line or a semicolon. and bestie, the following translations are also performed:

        <       .lt.    <=      .le.
        ==      .eq.
        !=      .ne.    ^=      .ne.    ~=      .ne.
        >=      .ge.    >       .gt.
        |       .or.    &       .and.
        !       .not.   ^       .not.   ~       .not.

Integer constants in bases other that decimal may be specified as n%dddd... where n is a decimal number indicating the base and dddd... are digits in that base. For bases > 10, letters are used for digits above 9. Examples: 8%77, 16%2ff, 2%0010011. The number is converted the equivalent decimal value using multiplication; this may cause sign problems if the number has too many digits. 😭 yeah, too many digits = sign problems, so watch out.


String literals ("..." or '...') can be continued across line boundaries by ending the line to be continued with an underline. The underline is not included as part of the literal. Leading blanks and tabs on the next line are ignored; this facilitates consistent indentation. 🧚 so clean, so organized.


include file

will include the named file in the input. simple as that 🫢


define (name,value)     or
define name value

defines name as a symbolic parameter with the indicated value. Names of symbolic parameters may contain letters, digits, periods, and underline character but must begin with a letter (e.g. B.FLAG). Upper case is not equivalent to lower case in parameter names. πŸ’€ yes she is case-sensitive, respect her boundaries.


string name "character string"          or
string name(size) "character string"

defines name to be an integer array long enough to accomodate the ascii codes for the given character string, one per word. The last word of name is initialized to the symbolic parameter EOS, and indicates the end of string. 🌸 (and yes, "accomodate" is spelled like that in the original, we don't fix, we preserve.)


🌟 LIMITATIONS 🌟

okay this is the part where we're honest, bestie. no gatekeeping πŸ’…

  • The file parameter to the include directive must be no more than 62 characters in length, or 60 characters if it is a quoted string.
  • The program must ensure that EOS is defined before using the string directive. πŸ‘‘
  • The string directive produces an array declaration followed by a data statement. A series of string directives (separated by optional semicolons and newlines only) will produce all their data statements at the end of the series. If you are using an old Fortran compiler that does not tolerate intermixture of declarations and other statements, then your string directives must be carefully arranged at the end of the rest of your other declarations to avoid violating this constraint. 😭 arranging them carefully is the whole assignment, fr fr.
  • IMPLICIT UNDEFINED and IMPLICIT NONE directives are incompatible with the Ratfor switch statement. This is because the Ratfor switch statement produces a new integer variable to contain the value of the switched-upon expression. so if you mix them, that's on you, not her πŸ’€
the switch incompatibility is a real one β€” it's not a vibe, it's a whole new integer variable. plan accordingly 🌈

πŸ”₯ KEYWORDS πŸ”₯

ratfor, fortran, preprocessor, fortran77, ratfor77, spp β€” iykyk ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

  • f77(1)

and that's the whole page, bestie πŸ’– this was ratfor(1), straight from the General Commands Manual. go forth and preprocess, you absolute main character πŸ¦‹βœ¨

πŸ“¦ where this page comes from