00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00016 #ifndef __CCP4_FORTRAN
00017 #define __CCP4_FORTRAN
00018
00019 #include "ccp4_types.h"
00020 static char rcsidhh[] = "$Id$";
00021
00022
00023 #ifdef CALL_LIKE_STARDENT
00024
00025
00026 DefineStructure(SStrPar)
00027 struct SStrPar {
00028 pstr S;
00029 int len;
00030 int id;
00031 };
00032 #endif
00033
00034 #define _LVTOB(l) ((long) ((l) == 0 ? 0 : 1))
00035 #define _BTOLV(l) ((int) ((l) == 0 ? 0 : 1))
00036 #if defined (__OSF1__) || defined (__osf__)
00037 #undef _BTOLV
00038 #define _BTOLV(l) ((int) ((l) == 0 ? 0 : -1))
00039 #endif
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 #if defined(CALL_LIKE_SUN)
00159
00160 typedef pstr fpstr;
00161
00162 #define FTN_STR(s) s
00163 #define FTN_LEN(s) s##_len
00164
00165 #define char_struct(s) \
00166 pstr s; \
00167 int s##_len;
00168 #define fill_char_struct(s,str) \
00169 s = str; \
00170 s##_len = strlen(str);
00171 #define init_char_struct(s,str,size) \
00172 s = str; \
00173 s##_len = size;
00174
00175 #define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
00176 void name##_ p_sun
00177 #define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
00178 name##_ p_sun
00179 #define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
00180 val name##_ p_sun
00181 #elif defined(CALL_LIKE_HPUX)
00182
00183 typedef pstr fpstr;
00184
00185 # define FTN_STR(s) s
00186 # define FTN_LEN(s) s##_len
00187
00188 # define char_struct(s) \
00189 pstr s; \
00190 int s##_len;
00191 # define fill_char_struct(s,str) \
00192 s = str; \
00193 s##_len = strlen(str);
00194 # define init_char_struct(s,str,size) \
00195 s = str; \
00196 s##_len = size;
00197
00198 # define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
00199 void name p_sun
00200 # define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
00201 name p_sun
00202 # define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
00203 val name p_sun
00204 #elif defined(CALL_LIKE_STARDENT)
00205
00206 typedef PStrPar fpstr;
00207
00208 # define FTN_STR(s) s->Str_pointer
00209 # define FTN_LEN(s) s->Str_length
00210
00211 # define char_struct(s) \
00212 SStrPar s;
00213 # define fill_char_struct(s,str) \
00214 s.S = str; \
00215 s.len = strlen(FName); \
00216 s.id = 0;
00217 # define init_char_struct(s,str,size) \
00218 s.S = str; \
00219 s.len = size; \
00220 s.id = 0;
00221
00222 # define FORTRAN_SUBR(NAME,name,p_send,p_sstruct,p_sflw) \
00223 void NAME p_stardent
00224 # define FORTRAN_CALL(NAME,name,p_send,p_sstruct,p_sflw) \
00225 NAME p_stardent
00226 # define FORTRAN_FUN(val,NAME,name,p_send,p_sstruct,p_sflw) \
00227 val NAME p_stardent
00228
00229 #elif defined(CALL_LIKE_VMS)
00230
00231 typedef dsc$descriptor_s * fpstr;
00232
00233 # define FTN_STR(s) s->dsc$a_pointer;
00234 # define FTN_LEN(s) s->dsc$w_length;
00235
00236 # define char_struct(s) \
00237 dsc$descriptor_s s;
00238 # define fill_char_struct(s,str) \
00239 s.dsc$a_pointer = str; \
00240 s.dsc$w_length = strlen(str); \
00241 s.dsc$b_dtype = DSC$K_DTYPE_T; \
00242 s.dsc$b_class = DSC$K_CLASS_S;
00243 # define init_char_struct(s,str,size) \
00244 s.dsc$a_pointer = str; \
00245 s.dsc$w_length = size; \
00246 s.dsc$b_dtype = DSC$K_DTYPE_T; \
00247 s.dsc$b_class = DSC$K_CLASS_S;
00248
00249 # define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
00250 void NAME p_stardent
00251 # define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
00252 NAME p_stardent
00253 # define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
00254 val NAME p_stardent
00255
00256 #elif defined(CALL_LIKE_MVS)
00257
00258 #if (CALL_LIKE_MVS == 2)
00259
00260 typedef pstr fpstr;
00261
00262 #define FTN_STR(s) s
00263 #define FTN_LEN(s) s##_len
00264
00265 #define char_struct(s) \
00266 pstr s; \
00267 int s##_len;
00268 #define fill_char_struct(s,str) \
00269 s = str; \
00270 s##_len = strlen(str);
00271 #define init_char_struct(s,str,size) \
00272 s = str; \
00273 s##_len = size;
00274
00275 #define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
00276 void NAME p_sun
00277 #define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
00278 NAME p_sun
00279 #define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
00280 val NAME p_sun
00281
00282 #else
00283
00284 typedef pstr fpstr;
00285
00286 # define FTN_STR(s) s
00287 # define FTN_LEN(s) s##_len
00288
00289 # define char_struct(s) \
00290 pstr s; \
00291 int s##_len;
00292 # define fill_char_struct(s,str) \
00293 s = str; \
00294 s##_len = strlen(str);
00295 # define init_char_struct(s,str,size) \
00296 s = str; \
00297 s##_len = size;
00298
00299 # define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
00300 void __stdcall NAME p_mvs
00301 # define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
00302 NAME p_mvs
00303 # define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
00304 val __stdcall NAME p_mvs
00305
00306 # endif
00307
00308 #else
00309
00310 # error Unknown machine!!!
00311
00312 typedef pstr fpstr;
00313
00314 # define FTN_STR(s) s
00315 # define FTN_LEN(s) s##_len
00316
00317 # define char_struct(s) \
00318 pstr s; \
00319 int s##_len;
00320 # define fill_char_struct(s,str) \
00321 s = str; \
00322 s##_len = strlen(str);
00323 # define init_char_struct(s,str,size) \
00324 s = str; \
00325 s##_len = size;
00326
00335 # define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
00336 void name##_ p_sun
00337
00345 # define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
00346 name##_ p_sun
00347
00357 # define FORTRAN_FUN(val,NAME,name,p_sun,p_stardent,p_mvs) \
00358 val name##_ p_sun
00359
00360 #endif
00361
00362
00363 typedef unsigned int ftn_logical;
00364 #if defined (KNOWN_MACHINE)
00365 # define FORTRAN_LOGICAL_TRUE 1
00366 # define FORTRAN_LOGICAL_FALSE 0
00367 #endif
00368 #if defined (__OSF1__) || defined (__osf__)
00369 # undef FORTRAN_LOGICAL_TRUE
00370 # define FORTRAN_LOGICAL_TRUE -1
00371 #endif
00372
00373 char *ccp4_FtoCString(fpstr str1, int str1_len);
00374 void ccp4_CtoFString(fpstr str1, int str1_len, const char *cstring);
00375
00376 #endif