ratfor(1)
β¨ 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 ton. 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 isinteger, 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
includedirective must be no more than 62 characters in length, or 60 characters if it is a quoted string. - The program must ensure that
EOSis defined before using thestringdirective. π - The
stringdirective produces an array declaration followed by a data statement. A series ofstringdirectives (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 yourstringdirectives 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 UNDEFINEDandIMPLICIT NONEdirectives are incompatible with the Ratforswitchstatement. This is because the Ratforswitchstatement 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
- debian trixie: ratfor 1.07-1 Β· LicenseRef-public-domain
- ubuntu questing: ratfor 1.07-1
- ubuntu resolute: ratfor 1.07-1build1 Β· LicenseRef-public-domain
- ubuntu stonking: ratfor 1.07-1build1 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms