Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ f2c(1) — CLIX 3.1r7.6.22

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acc(1)

af77(1)

ld(1)

sed(1)



  f2c(1)                              CLIX                              f2c(1)



  NAME

    f2c - Converts FORTRAN 77 source code to C or C++ source code

  SYNOPSIS

    f2c [flag] file ...

  FLAGS

    -C         Compiles code to check that subscripts are within declared
               array bounds.

    -I2        Renders INTEGER and LOGICAL as short integers, and INTEGER*4 as
               long integer.  Assumes the default libf2c.a; allows only
               INTEGER*4 (and no LOGICAL) variables in INQUIREs.  The flag -I4
               confirms the default rendering of INTEGER as long integer.

    -onetrip   Compiles DO loops that are performed at least once if reached.
               (FORTRAN 77 DO loops are not performed at all if the upper
               limit is smaller than the lower limit.)

    -U         Honors the case of variable and external names.  FORTRAN
               keywords must be in lower case.

    -u         Makes the default type of a variable undefined rather than
               using the default FORTRAN rules.

    -w         Suppresses all warning messages.  If the flag is -w66, only
               FORTRAN 66 compatibility warnings are suppressed.

    -A         Produces ANSI C.  The default is old-style C.

    -a         Makes local variables automatic rather than static unless they
               appear in a DATA, EQUIVALENCE, NAMELIST, or SAVE statement.

    -C++       Creates C++ code.

    -c         Includes original FORTRAN source as comments.

    -E         Declares uninitialized COMMON blocks to be Extern (overridably
               defined in f2c.h as extern).

    -ec        Places uninitialized COMMON blocks in separate files:  COMMON
               /ABC/ appears in file abc_com.c.  The flag -e1c bundles the
               separate files into the output file, with comments that give an
               unbundling sed script.

    -ext       Prints warnings about FORTRAN 77 extensions.

    -g         Includes original FORTRAN line numbers in #line lines.



  2/94 - Intergraph Corporation                                              1






  f2c(1)                              CLIX                              f2c(1)



    -h         Tries to align character strings on word (or, if the flag is -
               hd, on double-word) boundaries.

    -i2        Is similar to -I2, but assumes a modified libfc2.a (compiled
               with -Df2c_i2), so INTEGER and LOGICAL variables may be
               assigned by INQUIRE and array lengths are stored in short
               integers.

    -kr        Uses temporary values to enforce FORTRAN expression evaluation
               where K&R (first edition) parenthesization rules allow
               rearrangement.  If the flag is -krd, uses double precision
               temporaries even for single-precision operands.

    -P         Writes a file.P of ANSI (or C++) prototypes for procedures
               defined in each input file.f or file.F.  When reading FORTRAN
               from stdin, writes prototypes at the beginning of stdout.
               Implies the -A flag unless the -C++ flag is present.  The -Ps
               flag implies the -P flag, and gives an exit value of 4 if
               rerunning f2c may change prototypes or declarations.

    -p         Supplies preprocessor definitions to make common-block members
               look like local variables.

    -R         Does not promote REAL functions and operations to DOUBLE
               PRECISION.  The -!R flag confirms the default, which imitates
               the af77 command.

    -r         Casts values of REAL functions (including intrinsics) to REAL.

    -r8        Promotes REAL functions DOUBLE PRECISION, COMPLEX to DOUBLE
               COMPLEX.

    -T dir     Puts temporary files in directory dir.

    -w8        Suppresses warnings when COMMON or EQUIVALENCE forces odd-word
               alignment of doubles.

    -W n       Assumes n characters per word when initializing numeric
               variables with character data.  The default is 4.

    -z         Does not implicitly recognize DOUBLE COMPLEX.

    -!bs       Does not recognize backslash escape sequences (\", \', \0, \\,
               \b, \f, \n, \r, \t, \v) in character strings.

    -!c        Inhibits C output, but produces the -P flag output.

    -!I        Rejects include statements.

    -!it       Does not infer types of untyped EXTERNAL procedures from use as
               parameters to previously defined or prototyped procedures.



  2                                              Intergraph Corporation - 2/94






  f2c(1)                              CLIX                              f2c(1)



    -!P        Does not attempt to infer ANSI or C++ prototypes from usage.

  DESCRIPTION

    The fc2 command converts FORTRAN 77 source code in the specified files to
    C or C++ source files.  The command converts source code in the specified
    files with names ending in .f or .F to C (or C++) source files in the
    current directory, with .c substituted for the final .f or .F.  If no
    FORTRAN files are named, f2c reads FORTRAN from stdin and writes C on
    stdout.  File names that end with .p or .P are taken to be prototype
    files, as produced by the -P flag, and are read first.

    The resulting C invokes the support routines provided in the f2c support
    library.  Object code may be loaded by af77, ld, or acc.  When using ld or
    acc, the flags -lf2c -lm must be used.

  EXAMPLES

    1.  The following example converts the contents of the Fortran module
        example.f to a C module.  The resulting C module will be named
        example.c.

        f2c example.f


    2.  The following example converts all files with a .f extension in the
        current directory, generating corresponding .c files which contain
        ANSI C code.

        f2c -A *.f


  FILES

    file.[fF]                Input file.

    *.c                      Output file.

    /usr/include/f2c/f2c.h   Header file.

    /usr/lib/libf2c.a        Intrinsic function and FORTRAN I/O library.

    /lib/libc.a              C library.

  CAUTIONS

    Floating-point constant expressions are simplified in the floating-point
    arithmetic of the machine running f2c, so they are typically accurate to
    (at most) 16 or 17 decimal places.

    Untypable EXTERNAL functions are declared as int.



  2/94 - Intergraph Corporation                                              3






  f2c(1)                              CLIX                              f2c(1)



  DIAGNOSTICS

    The diagnostics produced by f2c are intended to be self-explanatory.

  EXIT VALUES

    The f2c command exits with a value of 0 if successful.  If the command is
    run with the -Ps flag, it exits with a value of 4 if the prototypes would
    be modified.  Other values represent various errors.

  RELATED INFORMATION

    Commands:  acc(1), af77(1), ld(1), sed(1)

    S. I. Feldman and P. J. Weinberger, "A Portable Fortran 77 Compiler," UNIX
    Time Sharing System Programmer's Manual, Tenth Edition, Volume 2, AT&T
    Bell Laboratories, 1990.





































  4                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026