#include "ccp4_types.h"
Go to the source code of this file.
Defines | |
#define | _LVTOB(l) ((long) ((l) == 0 ? 0 : 1)) |
#define | _BTOLV(l) ((int) ((l) == 0 ? 0 : 1)) |
#define | FTN_STR(s) s |
#define | FTN_LEN(s) s##_len |
#define | char_struct(s) |
#define | fill_char_struct(s, str) |
#define | init_char_struct(s, str, size) |
#define | FORTRAN_SUBR(NAME, name, p_sun, p_stardent, p_mvs) void name##_ p_sun |
#define | FORTRAN_CALL(NAME, name, p_sun, p_stardent, p_mvs) name##_ p_sun |
#define | FORTRAN_FUN(val, NAME, name, p_sun, p_stardent, p_mvs) val name##_ p_sun |
Typedefs | |
typedef pstr | fpstr |
typedef unsigned int | ftn_logical |
Functions | |
char * | ccp4_FtoCString (fpstr str1, int str1_len) |
void | ccp4_CtoFString (fpstr str1, int str1_len, const char *cstring) |
Macro FORTRAN_SUBR(NAME,name,p_send,p_sstruct,p_sflw) makes function header statements that allow for linking with programs written in FORTRAN.
NAME | name of the FORTRAN subroutine in capital letters | |
name | name of the FORTRAN subroutine in small letters | |
p_send | parameter list (in brackets) with string lengths attached to the end of it (see below) | |
p_sstruct | parameter list (in brackets) with strings passed as complex parameters, or structures | |
p_sflw | parameter list (in brackets) with string lengths following immediately the string parameters (see below) |
CALL_LIKE_STARDENT : 'fpstr' is identical to 'PSStrPar' CALL_LIKE_VMS : 'fpstr' is identical to 'dsc$descriptor_s *'
Example:
FORTRAN statement
subroutine SomeSub ( k,s1,a,s2,m ) integer k,m real a character*(*) s1,s2
is translated to
FORTRAN_SUBR ( SOMESUB, somesub, ( int * k, fpstr s1, float * a, fpstr s2, int * m, int s1_len, int s2_len ), ( int * k, fpstr s1, float * a, fpstr s2, int * m ), ( int * k, fpstr s1, int s1_len, float * a, fpstr s2, int s2_len, int * m ) )
The macro should replace ordinary function header statements to assure compatibility with FORTRAN links. In header files, do not forget to add semicolon:
FORTRAN_SUBR ( .... );
while in source files use simply
FORTRAN_SUBR ( .... ) { <source body, operators> }
#define char_struct | ( | s | ) |
Value:
pstr s; \
int s##_len;
#define fill_char_struct | ( | s, | |||
str | ) |
Value:
s = str; \ s##_len = strlen(str);
#define FORTRAN_CALL | ( | NAME, | |||
name, | |||||
p_sun, | |||||
p_stardent, | |||||
p_mvs | ) | name##_ p_sun |
Macro to call a Fortran subroutine from a C function.
NAME | Subroutine name in upper case | |
name | Subroutine name in lower case | |
p_sun | Argument list in Sun style | |
p_stardent | Argument list in Stardent style | |
p_mvs | Argument list in MVS style |
#define FORTRAN_FUN | ( | val, | |||
NAME, | |||||
name, | |||||
p_sun, | |||||
p_stardent, | |||||
p_mvs | ) | val name##_ p_sun |
Macro to define a function such that it is callable as a Fortran function.
val | Data type of return value. | |
NAME | Function name in upper case | |
name | Function name in lower case | |
p_sun | Argument list in Sun style | |
p_stardent | Argument list in Stardent style | |
p_mvs | Argument list in MVS style |
#define FORTRAN_SUBR | ( | NAME, | |||
name, | |||||
p_sun, | |||||
p_stardent, | |||||
p_mvs | ) | void name##_ p_sun |
Macro to define a function such that it is callable as a Fortran subroutine.
NAME | Subroutine name in upper case | |
name | Subroutine name in lower case | |
p_sun | Argument list in Sun style | |
p_stardent | Argument list in Stardent style | |
p_mvs | Argument list in MVS style |
#define init_char_struct | ( | s, | |||
str, | |||||
size | ) |
Value:
s = str; \ s##_len = size;