EnglishFrenchSpanish

Ad


OnWorks favicon

fortc - Online in the Cloud

Run fortc in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command fortc that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


fortc - Unidata utility to generate fortran-compatible C code

SYNOPSIS


fortc [-L LibDir] [-O OpSys] file

DESCRIPTION


fortc Reads C code from `file', transforms it into FORTRAN compatible code, and then
writes the result to standard output. The transformation is operating-system dependent
because there are no standards in this matter.

The target operating-system can be specified in several ways. If the `-O' option is
given, then the operating-system specified by its argument is used; otherwise, if the
environmental variable `OS' exists, then the operating-system specified by it's value is
used; otherwise, the default operating-system -- determined at installation time -- is
used.

Global names that are not function definitions but that are to be accessible from both C
and FORTRAN should be enclosed by the `FC_NAME()' macro:

extern int FC_NAME(foo)(void); /* FORTRAN function */

extern struct {
float f;
int i;
} FC_NAME(comblk); /* FORTRAN common block */

cfoo()
{
return FC_NAME(foo)(); /* call FORTRAN function */
}

C functions which are to be called from FORTRAN are written as follows:

int
/*FORTRAN*/
foo(
character pathname, /* file name of new file */
real amount, /* amount to frobdicate by */
doubleprecision dbl, /* amount to tizzle by */
void function errf, /* error routine */
integer rcode /* returned error code */)
{
...

or, equivalently,

int
/*FORTRAN*/
foo(char* pathname, float* amount, double* dbl,
void (*errf)(), int* rcode)
{
...

The points to note in writing FORTRAN-compatible functions are:

1. Functions to be transformed are marked by a proceeding `/*FORTRAN*/' comment, which
must appear on the line prior to the function name. Any return-type declarations must
proceed the comment.

2. The formal parameters must be declared within function parentheses and be separated by
commas.

3. The formal parameters are restricted to the following types:

character or char*
For Fortran character-variables.

doubleprecision or double*"
For double-precision floating-point values.

real or float*
For single-precision floating-point values.

integer or int*
For integer values.

type function name or type (*name)()
For functions returning type `type'.

4. There must be nothing important after the opening brace, `{', and on the same line.

The functions should be written using variables with the same names as the formal
parameters, and with the same semantics. In the case of formal parameters of type
`character' (i.e. Fortran character-variables), a variable with the same name will exist
and will be of type `char*'. In addition, for each character-variable argument, a local
variable of integral type will be created and its value will be the size of the associated
character-variable. The name of this variable will be the name of the associated
character variable with "_len" appended (e.g. "pathname_len"). These length variables may
be used in the function just like any other variable.

For example, under SunOS the previous function would become (if it is contained in the
file `foo.src'):

#line 1 "foo.src"
unsigned int
#line 2 "foo.src"
foo_(pathname, amount, errf, rcode, pathname_len)
char *pathname;
int pathname_len;
float *amount;
void (*errf)();
int *rcode;
{
#line 9 "foo.src"

Note that 1) preprocessor line directives have been added; 2) the function name has been
suffixed with an underscore; and 3) a formal parameter, `pathname_len', has been created.

Under UNICOS, the same file would become

#include <fortran.h>
#line 1 "foo.src"
unsigned int
#line 2 "foo.src"
FOO(pathnamed, amount, errf, rcode)
_fcd pathnamed;
float *amount;
void (*errf)();
int *rcode;
{
char *pathname = _fcdtocp (pathnamed);
unsigned pathname_len = _fcdlen (pathnamed);
#line 9 "foo.src"

Note, in particular, the additional `#include <fortran.h>' and the creation and
initialization of the local variables `pathname' and `pathname_len'.

This utility is implemented as a script and uses the system-supplied utilities sed(1) and
m4(1).

OPTIONS


-L LibDir"
Defines the directory containing the `fortc' library files. The default is
determined at installation time.

-O OpSys
Defines the operating-system as OpSys. Known values include `aix', `convexos',
`domainos', `hpux', `irix', `msoft', `next-absoft', `newsos', `sunos', `ultrix',
`unicos', and `vms'. To allow for greater flexibility, the known values may have
any suffix (e.g. `sunos_4.1').

ENVIRONMENT


OS Defines the operating system if the `-O' option is not specified. Known values
are the same as the -O option.

Use fortc online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    AstrOrzPlayer
    AstrOrzPlayer
    AstrOrz Player is a free media player
    software, part based on WMP and VLC. The
    player is in a minimalist style, with
    more than ten theme colors, and can also
    b...
    Download AstrOrzPlayer
  • 2
    movistartv
    movistartv
    Kodi Movistar+ TV es un ADDON para XBMC/
    Kodi que permite disponer de un
    decodificador de los servicios IPTV de
    Movistar integrado en uno de los
    mediacenters ma...
    Download movistartv
  • 3
    Code::Blocks
    Code::Blocks
    Code::Blocks is a free, open-source,
    cross-platform C, C++ and Fortran IDE
    built to meet the most demanding needs
    of its users. It is designed to be very
    extens...
    Download Code::Blocks
  • 4
    Amidst
    Amidst
    Amidst or Advanced Minecraft Interface
    and Data/Structure Tracking is a tool to
    display an overview of a Minecraft
    world, without actually creating it. It
    can ...
    Download Amidst
  • 5
    MSYS2
    MSYS2
    MSYS2 is a collection of tools and
    libraries providing you with an
    easy-to-use environment for building,
    installing and running native Windows
    software. It con...
    Download MSYS2
  • 6
    libjpeg-turbo
    libjpeg-turbo
    libjpeg-turbo is a JPEG image codec
    that uses SIMD instructions (MMX, SSE2,
    NEON, AltiVec) to accelerate baseline
    JPEG compression and decompression on
    x86, x8...
    Download libjpeg-turbo
  • More »

Linux commands

  • 1
    abi-tracker
    abi-tracker
    abi-tracker - visualize ABI changes
    timeline of a C/C++ software library.
    DESCRIPTION: NAME: ABI Tracker
    (abi-tracker) Visualize ABI changes
    timeline of a C/C+...
    Run abi-tracker
  • 2
    abicheck
    abicheck
    abicheck - check application binaries
    for calls to private or evolving symbols
    in libraries and for static linking of
    some system libraries. ...
    Run abicheck
  • 3
    couriermlm
    couriermlm
    couriermlm - The Courier mailing list
    manager ...
    Run couriermlm
  • 4
    couriertcpd
    couriertcpd
    couriertcpd - the Courier mail server
    TCP server daemon ...
    Run couriertcpd
  • 5
    gbklatex
    gbklatex
    bg5latex - Use LaTeX directly on a Big5
    encodedtex file bg5pdflatex - Use
    pdfLaTeX directly on a Big5 encodedtex
    file bg5+latex - Use LaTeX directly on a
    Big5+...
    Run gbklatex
  • 6
    gbkpdflatex
    gbkpdflatex
    bg5latex - Use LaTeX directly on a Big5
    encodedtex file bg5pdflatex - Use
    pdfLaTeX directly on a Big5 encodedtex
    file bg5+latex - Use LaTeX directly on a
    Big5+...
    Run gbkpdflatex
  • More »

Ad