26 #if ! defined (octave_f77_fcn_h)
27 #define octave_f77_fcn_h 1
29 #include "octave-config.h"
34 #if defined (__cplusplus)
45 #define F77_XFCN(f, F, args) \
48 #if ! defined (F77_FCN)
49 # define F77_FCN(f, F) F77_FUNC (f, F)
107 #if defined (F77_USES_CRAY_CALLING_CONVENTION)
115 #define F77_CHAR_ARG(x) octave_make_cray_ftn_ch_dsc (x, strlen (x))
116 #define F77_CONST_CHAR_ARG(x) \
117 octave_make_cray_const_ftn_ch_dsc (x, strlen (x))
118 #define F77_CHAR_ARG2(x, l) octave_make_cray_ftn_ch_dsc (x, l)
119 #define F77_CONST_CHAR_ARG2(x, l) octave_make_cray_const_ftn_ch_dsc (x, l)
120 #define F77_CXX_STRING_ARG(x) \
121 octave_make_cray_const_ftn_ch_dsc (x.c_str (), x.length ())
122 #define F77_CHAR_ARG_LEN(l)
123 #define F77_CHAR_ARG_LEN_TYPE
124 #define F77_CHAR_ARG_LEN_DECL
125 #define F77_CHAR_ARG_DECL octave_cray_ftn_ch_dsc
126 #define F77_CONST_CHAR_ARG_DECL octave_cray_ftn_ch_dsc
130 #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
131 #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
132 #define F77_CHAR_ARG_LEN_DEF(len)
133 #define F77_CHAR_ARG_USE(s) s.ptr
134 #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len >> 3)
136 #define F77_RET_T int
143 #define F77_RETURN(retval) return retval;
144 #if defined (HAVE_OCTAVE_NORETURN_ATTR)
145 # define F77_NORETURN(retval)
147 # define F77_NORETURN(retval) return retval;
155 const char *const_ptr;
163 } octave_cray_descriptor;
165 typedef void *octave_cray_ftn_ch_dsc;
167 #if defined (__cplusplus)
168 # define OCTAVE_F77_FCN_INLINE inline
170 # define OCTAVE_F77_FCN_INLINE
173 static OCTAVE_F77_FCN_INLINE octave_cray_ftn_ch_dsc
174 octave_make_cray_ftn_ch_dsc (
char *ptr_arg,
unsigned long len_arg)
176 octave_cray_descriptor desc;
178 desc.mask.len = len_arg << 3;
179 return *((octave_cray_ftn_ch_dsc *) &desc);
182 static OCTAVE_F77_FCN_INLINE octave_cray_ftn_ch_dsc
183 octave_make_cray_const_ftn_ch_dsc (
const char *ptr_arg,
unsigned long len_arg)
185 octave_cray_descriptor desc;
186 desc.const_ptr = ptr_arg;
187 desc.mask.len = len_arg << 3;
188 return *((octave_cray_ftn_ch_dsc *) &desc);
191 #undef OCTAVE_F77_FCN_INLINE
193 #elif defined (F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION)
199 #define F77_CHAR_ARG(x) x, strlen (x)
200 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
201 #define F77_CHAR_ARG2(x, l) x, l
202 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
203 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ())
204 #define F77_CHAR_ARG_LEN(l)
205 #define F77_CHAR_ARG_LEN_TYPE int
206 #define F77_CHAR_ARG_LEN_DECL
207 #define F77_CHAR_ARG_DECL char *, F77_CHAR_ARG_LEN_TYPE
208 #define F77_CONST_CHAR_ARG_DECL const char *, F77_CHAR_ARG_LEN_TYPE
210 #define F77_CHAR_ARG_DEF(s, len) char *s, F77_CHAR_ARG_LEN_TYPE len
211 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, F77_CHAR_ARG_LEN_TYPE len
212 #define F77_CHAR_ARG_LEN_DEF(len)
213 #define F77_CHAR_ARG_USE(s) s
214 #define F77_CHAR_ARG_LEN_USE(s, len) len
216 #define F77_RET_T void
218 #define F77_RETURN(retval) return;
219 #define F77_NORETURN(retval)
221 #elif defined (F77_USES_GFORTRAN_CALLING_CONVENTION)
233 #define F77_CHAR_ARG(x) x
234 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
235 #define F77_CHAR_ARG2(x, l) x
236 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
237 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ())
238 #define F77_CHAR_ARG_LEN(l) , l
239 #if defined (__GNUC__) && __GNUC__ >= 8
240 # define F77_CHAR_ARG_LEN_TYPE size_t
242 # define F77_CHAR_ARG_LEN_TYPE int
244 #define F77_CHAR_ARG_LEN_DECL , F77_CHAR_ARG_LEN_TYPE
245 #define F77_CHAR_ARG_DECL char *
246 #define F77_CONST_CHAR_ARG_DECL const char *
248 #define F77_CHAR_ARG_DEF(s, len) char *s
249 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s
250 #define F77_CHAR_ARG_LEN_DEF(len) , F77_CHAR_ARG_LEN_TYPE len
251 #define F77_CHAR_ARG_USE(s) s
252 #define F77_CHAR_ARG_LEN_USE(s, len) len
254 #define F77_RET_T void
256 #define F77_RETURN(retval) return;
257 #if defined (HAVE_OCTAVE_NORETURN_ATTR)
258 # define F77_NORETURN(retval)
260 # define F77_NORETURN(retval) return retval;
263 #elif defined (F77_USES_F2C_CALLING_CONVENTION)
270 #define F77_CHAR_ARG(x) x
271 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
272 #define F77_CHAR_ARG2(x, l) x
273 #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
274 #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ())
275 #define F77_CHAR_ARG_LEN(l) , l
276 #define F77_CHAR_ARG_LEN_TYPE long
277 #define F77_CHAR_ARG_LEN_DECL , F77_CHAR_ARG_LEN_TYPE
278 #define F77_CHAR_ARG_DECL char *
279 #define F77_CONST_CHAR_ARG_DECL const char *
281 #define F77_CHAR_ARG_DEF(s, len) char *s
282 #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s
283 #define F77_CHAR_ARG_LEN_DEF(len) , F77_CHAR_ARG_LEN_TYPE len
284 #define F77_CHAR_ARG_USE(s) s
285 #define F77_CHAR_ARG_LEN_USE(s, len) len
287 #define F77_RET_T int
289 #define F77_RETURN(retval) return retval;
290 #if defined (HAVE_OCTAVE_NORETURN_ATTR)
291 # define F77_NORETURN(retval)
293 # define F77_NORETURN(retval) return retval;
298 #error "unknown C++ to Fortran calling convention"
310 #define F77_CMPLX_ARG(x) \
311 reinterpret_cast<float _Complex *> (x)
313 #define F77_CONST_CMPLX_ARG(x) \
314 reinterpret_cast<const float _Complex *> (x)
316 #define F77_DBLE_CMPLX_ARG(x) \
317 reinterpret_cast<double _Complex *> (x)
319 #define F77_CONST_DBLE_CMPLX_ARG(x) \
320 reinterpret_cast<const double _Complex *> (x)
327 #define F77_CSTRING(s, len, cs) \
328 OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \
329 memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \
330 cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0'
337 #if defined (__cplusplus)
346 (*current_liboctave_error_handler)
347 (
"integer dimension or index out of range for Fortran INTEGER type");
352 OCTAVE_END_NAMESPACE(
octave)
356 #if defined (__cplusplus)
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_f77_int_type F77_LOGICAL
double _Complex F77_DBLE_CMPLX
octave_f77_int_type F77_INT
OCTAVE_NORETURN F77_RET_T F77_FUNC(xstopx, XSTOPX)(F77_CONST_CHAR_ARG_DECL F77_CHAR_ARG_LEN_DECL)
F77_RET_T F77_CONST_CHAR_ARG_DECL
F77_RET_T const F77_INT F77_INT const F77_DBLE F77_DBLE const F77_INT F77_DBLE const F77_INT F77_INT F77_INT F77_DBLE F77_DBLE const F77_INT F77_INT &F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL
F77_RET_T(F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const F77_INT &, const F77_INT &, const F77_INT &, F77_INT &, F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_DBLE *, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_INT *, F77_INT &F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL)
F77_RET_T const F77_DBLE * x