26
26
@brief Header file for Fortran APIs
27
27
@author Eugene Krissinel
32
#ifndef __CCP4_FORTRAN
33
#define __CCP4_FORTRAN
35
#include "ccp4_types.h"
37
/* stardent is now obsolete, but we retain this category in case it is useful later */
38
#ifdef CALL_LIKE_STARDENT
39
/* SStrParam is used in Ardent-like machines' fortran calls */
40
/* for passing a string parameter */
41
DefineStructure(SStrPar)
49
#define _LVTOB(l) ((long) ((l) == 0 ? 0 : 1))
50
#define _BTOLV(l) ((int) ((l) == 0 ? 0 : 1))
51
#if defined (__OSF1__) || defined (__osf__)
53
#define _BTOLV(l) ((int) ((l) == 0 ? 0 : -1))
29
57
Macro FORTRAN_SUBR(NAME,name,p_send,p_sstruct,p_sflw)
30
58
makes function header statements that allow for linking with
31
59
programs written in FORTRAN.
58
86
complex parameter, 'fpstr' is identical to the
59
87
pointer on the corresponding structure:
62
90
'fpstr' is identical to 'PSStrPar'
64
92
'fpstr' is identical to 'dsc$descriptor_s *'
119
147
fpstr s2, int s2_len, int * m ) )
122
The macro should replace ordinary function header
150
The macro should replace ordinary function header
123
151
statements to assure compatibility with FORTRAN links.
124
152
In header files, do not forget to add semicolon:
148
#ifndef __CCP4_FORTRAN
149
#define __CCP4_FORTRAN
151
#include "ccp4_types.h"
153
/* stardent is now obsolete, but we retain this category in case it is useful later */
154
#ifdef CALL_LIKE_STARDENT
155
/* SStrParam is used in Ardent-like machines' fortran calls */
156
/* for passing a string parameter */
157
DefineStructure(SStrPar)
165
#define _LVTOB(l) ((long) ((l) == 0 ? 0 : 1))
166
#define _BTOLV(l) ((int) ((l) == 0 ? 0 : 1))
167
#if defined (__OSF1__) || defined (__osf__)
169
#define _BTOLV(l) ((int) ((l) == 0 ? 0 : -1))
174
176
#if defined(CALL_LIKE_SUN)
176
178
typedef pstr fpstr;
178
# define FTN_STR(s) s
179
# define FTN_LEN(s) s##_len
181
#define FTN_LEN(s) s##_len
181
# define char_struct(s) \
183
#define char_struct(s) \
184
# define fill_char_struct(s,str) \
186
#define fill_char_struct(s,str) \
186
188
s##_len = strlen(str);
187
# define init_char_struct(s,str,size) \
189
#define init_char_struct(s,str,size) \
191
# define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
193
#define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
192
194
void name##_ p_sun
193
# define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
195
#define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
195
# define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
197
#define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
196
198
val name##_ p_sun
197
199
#elif defined(CALL_LIKE_HPUX)
272
274
#elif defined(CALL_LIKE_MVS)
276
#if (CALL_LIKE_MVS == 2)
281
#define FTN_LEN(s) s##_len
283
#define char_struct(s) \
286
#define fill_char_struct(s,str) \
288
s##_len = strlen(str);
289
#define init_char_struct(s,str,size) \
293
#define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
295
#define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
297
#define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
274
302
typedef pstr fpstr;
276
304
# define FTN_STR(s) s