Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_F77_wrappers.h
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef _TEUCHOS_F77_WRAPPERS_H_
11 #define _TEUCHOS_F77_WRAPPERS_H_
12 
17 #include "Teuchos_ConfigDefs.hpp"
18 
19 /* Define fcd (Fortran Teuchos_fcd descriptor) for non-standard situations */
20 
21 #if defined(CRAY_T3X)
22 
23 # include <fortran.h>
24 # define F77_CALL_PREFIX
25 # define FORTRAN_CHAR_1_ARG(ARG_NAME) fcd* ARG_NAME
26 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const fcd& ARG_NAME
27 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME
28 
29 #elif defined(INTEL_CXML)
30 
31 # define F77_CALL_PREFIX __stdcall
32 # define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME, unsigned int
33 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME, unsigned int
34 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME, 1
35 
36 #elif defined(INTEL_MKL)
37 
38 # define F77_CALL_PREFIX
39 # define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME
40 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME
41 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME, 1
42 
43 #else
44 
45 # define F77_CALL_PREFIX
46 # define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME
47 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME
48 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME
49 
50 #endif
51 
52 /* RAB: 20030924: ToDo: Find a way to see if const is supported or not by C or
53  just decide that this will only be for C++ code and be done with it. */
54 
55 /* External macros */
56 
57 #define FORTRAN_NAME_UL(UNAME,LNAME) F77_FUNC(LNAME,UNAME)
58 
59 #define FORTRAN_FUNC_DECL_UL(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE F77_CALL_PREFIX FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME)
60 
61 #define FORTRAN_FUNC_CALL_UL(UFUNC_NAME,LFUNC_NAME) FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME)
62 
63 #define FORTRAN_FUNC_PTR_DECL_UL(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE (F77_CALL_PREFIX *FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME))
64 
65 #define FORTRAN_COMMMON_BLOCK_NAME_UL(UNAME,LNAME) FORTRAN_NAME_UL(UNAME,LNAME)\
66 
67 #define FORTRAN_NAME_UL_(UNAME,LNAME) F77_FUNC_(LNAME,UNAME)
68 
69 #define FORTRAN_FUNC_DECL_UL_(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE F77_CALL_PREFIX FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME)
70 
71 #define FORTRAN_FUNC_CALL_UL_(UFUNC_NAME,LFUNC_NAME) FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME)
72 
73 #define FORTRAN_FUNC_PTR_DECL_UL_(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE (F77_CALL_PREFIX *FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME))
74 
75 #define FORTRAN_COMMMON_BLOCK_NAME_UL_(UNAME,LNAME) FORTRAN_NAME_UL_(UNAME,LNAME)\
76 
77 #ifdef __cplusplus
78 
79 // These are the platform dependent C++ equivalents of fortran types
80 // RAB: 2003/11/20: ToDo: Move this into Teuchos namespace at some point
81 namespace FortranTypes {
82 
83 typedef int f_int; // INTEGER
84 typedef float f_real; // REAL
85 typedef double f_dbl_prec; // DOUBLE PRECISION
86 typedef int f_logical; // LOGICAL
87 typedef char f_char; // CHARACTER*1
88 typedef unsigned int f_char_len; // length argument for a CHARACTER*(*)
89 //typedef std::complex<f_real> f_complex; // COMPLEX
90 //typedef std::complex<f_dbl_prec> f_complex_16; // COMPLEX*16
91 
92 enum { F_TRUE = true, F_FALSE = false }; // Let compiler figure this out!
93 
94 #endif /* __cplusplus */
95 
96 } // namespace FortranTypes
97 
98 #endif // _TEUCHOS_F77_WRAPPERS_H_
Teuchos header file which uses auto-configuration information to include necessary C++ headers...