Programmazione in linguaggi misti - Fortran e C
Una guida sulla programmazione in linguaggi misti utilizzando i linguaggi Fortran e C
SOMMARIO
- Abstract
How to read this document
Cookbook
Calling C from
FORTRAN
Calling FORTRAN from C
Building the Program
Representation
of Data
Numeric Types
Characters
Logical Types
Pointer Types
Arrays
Same Language - Different Compiler
Communication Between
Routines
Arguments
Function Values
Global Data
More on Calling C
from FORTRAN
General Description
Declaration of a Function
Declaration of Arguments
Arguments - and Pointers to Them
Type
Specifiers
Logical Values
External Names
Common Blocks
Converting Between FORTRAN and C Strings
The CNF Functions
Handling
Byte Strings (HDS Locators)
Using Dynamic FORTRAN Character Strings
Pointers
Pointer Registration and Conversion
Allocating Exportable
Dynamic Memory
Accessing Dynamic Memory from C and FORTRAN
Registering
Your Own Pointers
More on Calling FORTRAN from C
More on Arrays
CHARACTER and LOGICAL Arrays
Arrays of pointer to char
POINTER
Arrays
The IMPORT and EXPORT Macros
Subroutines and Functions as
Arguments
Other Approaches to Mixed Language Programming
Compiling and
Linking
Implementation Specific Details
Sun
General
Data Types
External Names
Arguments
Function Values
Global Data
DEC
Unix
General
LOGICAL Values
POINTERS on Alphas
VAX/VMS
General
Data Types
Arguments
Function Values
Global Data
Other Operating Systems
Rationale for Mixed Language Programming
Alphabetical List of F77 Macros
Classified List of F77 Macros
Declaration of a C Function
Arguments of a C Function
Generate
Pointers to Arguments
Data Type Macros
Logical Value Macros
External
Name Macro
Common Block Macros
Declaring Variables for Passing to a
FORTRAN Routine
Importing and Exporting Arguments
Passing Arguments to a
FORTRAN Routine
Full Description of F77 Macros
Generic Descriptions
DECLARE_type - Declare a FORTRAN variable
DECLARE_type_ARRAY - Declare a
FORTRAN array
DECLARE_type_ARRAY_DYN - Declare a dynamic type array
F77_ASSOC_type_ARRAY - Associate a FORTRAN array with a C array.
F77_CREATE_type_ARRAY - Create an array of type.
F77_EXPORT_type -
Export a C variable to a FORTRAN variable.
F77_EXPORT_type_ARRAY - Export an
array of type from C to FORTRAN
F77_FREE_type - Free a dynamic variable of
type
F77_IMPORT_type - Import a FORTRAN variable to a C variable.
F77_IMPORT_type_ARRAY - Import an array of type from FORTRAN to C
F77_type_FUNCTION - Declare a FORTRAN function
GENPTR_type - Generate a
pointer to an argument
GENPTR_type_ARRAY - Generate a pointer to an array
argument
GENPTR_type_FUNCTION - Generate a pointer to a FUNCTION argument
type - Declare a type argument
type_ARG - Pass a type argument to a
FORTRAN routine
type_ARRAY - Declare a array argument
type_ARRAY_ARG -
Pass an array argument to a FORTRAN routine
type_FUNCTION - Declare a
FUNCTION argument
type_FUNCTION_ARG - Pass a FUNCTION argument to a FORTRAN
routine
Specific Descriptions
CHARACTER - Declare a CHARACTER argument
CHARACTER_ARG - Pass a CHARACTER argument to a FORTRAN routine
CHARACTER_ARRAY - Declare a CHARACTER array argument
CHARACTER_ARRAY_ARG
- Pass a CHARACTER array argument to a FORTRAN routine
CHARACTER_RETURN_ARG
- Pass argument(s) that will be the return value of a FORTRAN CHARACTER FUNCTION
CHARACTER_RETURN_VALUE - Declare argument(s) that will be the return value
of a FORTRAN CHARACTER FUNCTION
DECLARE_CHARACTER - Declare a CHARACTER
variable
DECLARE_CHARACTER_ARRAY - Declare a CHARACTER array
DECLARE_CHARACTER_DYN - Declare a CHARACTER variable
F77_BLANK_COMMON -
Refer to blank common
F77_BYTE_TYPE - Define the type BYTE
F77_CALL -
Call a FORTRAN routine from C
F77_CHARACTER_ARG_TYPE - Define the type of a
FORTRAN CHARACTER argument
F77_CHARACTER_ARRAY_ARG_TYPE - Define the type of
a FORTRAN CHARACTER array argument
F77_CHARACTER_TYPE - Define the type
CHARACTER
F77_CREATE_CHARACTER - Create a FORTRAN CHARACTER variable
F77_CREATE_CHARACTER_ARRAY - Create a FORTRAN CHARACTER array
F77_CREATE_CHARACTER_ARRAY_M - Create a FORTRAN CHARACTER array (n-D)
F77_CREATE_LOGICAL_ARRAY_M - Create a FORTRAN LOGICAL array (n-D)
F77_DOUBLE_TYPE - Define the type DOUBLE PRECISION
F77_EXPORT_CHARACTER
- Export a C variable to a FORTRAN variable.
F77_EXPORT_CHARACTER_ARRAY -
Export a CHARACTER array from C to FORTRAN
F77_EXPORT_CHARACTER_ARRAY_P -
Export an array of pointers to char from C to a FORTRAN CHARACTER array.
F77_EXTERNAL_NAME - The external name of a function
F77_FALSE - The
logical value FALSE
F77_IMPORT_CHARACTER - Import a FORTRAN variable to a C
variable.
F77_IMPORT_CHARACTER_ARRAY - Import a CHARACTER array from FORTRAN
to C.
F77_IMPORT_CHARACTER_ARRAY_P - Import a FORTRAN CHARACTER array to a C
array of pointers to char.
F77_INTEGER_TYPE - Define the type INTEGER
F77_ISFALSE - Is this the FORTRAN logical value false?
F77_ISTRUE - Is
this the FORTRAN logical value true?
F77_LOGICAL_TYPE - Define the type
LOGICAL
F77_NAMED_COMMON - Refer to a named common block
F77_POINTER_TYPE - Define the type POINTER
F77_REAL_TYPE - Define the
type REAL
F77_SUBROUTINE - Declare a SUBROUTINE
F77_TRUE - The logical
value TRUE
F77_UBYTE_TYPE - Define the type UBYTE
F77_UWORD_TYPE -
Define the type UWORD
F77_WORD_TYPE - Define the type WORD
GENPTR_CHARACTER - Generate a pointer to a CHARACTER argument
GENPTR_CHARACTER_ARRAY - Generate a pointer to a CHARACTER array argument
GENPTR_SUBROUTINE - Generate a pointer to a SUBROUTINE argument.
SUBROUTINE - Declare a SUBROUTINE argument.
SUBROUTINE_ARG - Pass a
SUBROUTINE argument to a FORTRAN routine.
TRAIL - Declare hidden trailing
arguments
TRAIL_ARG - Pass the length of a CHARACTER argument to a FORTRAN
routine
Classified List of CNF Functions
Import a FORTRAN String to C
Export a C String to FORTRAN
String Lengths
Miscellaneous String
Handling
LOGICAL Array Handling
Memory and Pointer Handling
CNF C
Routine Descriptions
cnfCalloc - Allocate space that may be accessed from C
and FORTRAN
cnfCopyf - Copy one FORTRAN string to another FORTRAN string
cnfCptr - Convert a FORTRAN pointer to a C pointer
cnfCreat - Create a
temporary C string and return a pointer to it
cnfCref - Create a temporary
FORTRAN CHARACTER string and return a pointer to it.
cnfCrefa - Create a
temporary FORTRAN CHARACTER array and return a pointer to it.
cnfCreib -
Create a temporary C string and import a FORTRAN string into it including
trailing blanks
cnfCreim - Create a temporary C string and import a FORTRAN
string into it discarding trailing blanks
cnfCrela - Create a temporary
FORTRAN LOGICAL array and return a pointer to it.
cnfExpch - Export a C
array of char to a FORTRAN string.
cnfExpla - Export a C int array to a
FORTRAN LOGICAL array
cnfExpn - Export a C string to a FORTRAN string,
copying a given maximum number of characters
cnfExprt - Export a C string to
a FORTRAN string
cnfExprta - Export a C string array to a FORTRAN CHARACTER
array
cnfExprtap - Export a C array of pointers to char, to a FORTRAN
CHARACTER array
cnfFptr - Convert a C pointer to a FORTRAN pointer
cnfFree - Free allocated space
cnfFreef - Free a FORTRAN string
cnfImpb - Import a FORTRAN string into a C string, retaining trailing blanks
cnfImpbn - Import no more than max characters from a FORTRAN string into a C
string, retaining trailing blanks
cnfImpch - Import a FORTRAN string into a
C array of char.
cnfImpla - Import a FORTRAN LOGICAL array into a C int
array
cnfImpn - Import no more than max characters from a FORTRAN string
into a C string
cnfImprt - Import a FORTRAN string into a C string
cnfImprta - Import a FORTRAN CHARACTER array into a C string array.
cnfImprtap - Import a FORTRAN CHARACTER array into a C array of pointers to
char.
cnfLenc - Find the length of a C string
cnfLenf - Find the length
of a FORTRAN string
cnfMalloc - Allocate space that may be accessed from C
and FORTRAN
cnfRegp - Register a pointer for use from both C and FORTRAN
cnfUregp - Unregister a pointer previously registered using cnfRegp
CNF
FORTRAN Function Description
CNF_PVAL - Expand a FORTRAN pointer to its full
value
References
Bibliography
About this document ...
PER CONSULTARE IL MANUALE CLICCARE SUL LINK SEGUENTE:
Programmazione
in linguaggi misti - Fortran e C