|
Teuchos - Trilinos Tools Package
Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Teuchos: Common Tools Package 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 00042 #ifndef _TEUCHOS_F77_WRAPPERS_H_ 00043 #define _TEUCHOS_F77_WRAPPERS_H_ 00044 00049 #include "Teuchos_ConfigDefs.hpp" 00050 00051 /* Define fcd (Fortran Teuchos_fcd descriptor) for non-standard situations */ 00052 00053 #if defined(CRAY_T3X) 00054 00055 # include <fortran.h> 00056 # define F77_CALL_PREFIX 00057 # define FORTRAN_CHAR_1_ARG(ARG_NAME) fcd* ARG_NAME 00058 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const fcd& ARG_NAME 00059 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME 00060 00061 #elif defined(INTEL_CXML) 00062 00063 # define F77_CALL_PREFIX __stdcall 00064 # define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME, unsigned int 00065 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME, unsigned int 00066 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME, 1 00067 00068 #elif defined(INTEL_MKL) 00069 00070 # define F77_CALL_PREFIX 00071 # define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME 00072 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME 00073 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME, 1 00074 00075 #else 00076 00077 # define F77_CALL_PREFIX 00078 # define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME 00079 # define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME 00080 # define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME 00081 00082 #endif 00083 00084 /* RAB: 20030924: ToDo: Find a way to see if const is supported or not by C or 00085 just decide that this will only be for C++ code and be done with it. */ 00086 00087 /* External macros */ 00088 00089 #define FORTRAN_NAME_UL(UNAME,LNAME) F77_FUNC(LNAME,UNAME) 00090 00091 #define FORTRAN_FUNC_DECL_UL(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE F77_CALL_PREFIX FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME) 00092 00093 #define FORTRAN_FUNC_CALL_UL(UFUNC_NAME,LFUNC_NAME) FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME) 00094 00095 #define FORTRAN_FUNC_PTR_DECL_UL(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE (F77_CALL_PREFIX *FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME)) 00096 00097 #define FORTRAN_COMMMON_BLOCK_NAME_UL(UNAME,LNAME) FORTRAN_NAME_UL(UNAME,LNAME)\ 00098 00099 #define FORTRAN_NAME_UL_(UNAME,LNAME) F77_FUNC_(LNAME,UNAME) 00100 00101 #define FORTRAN_FUNC_DECL_UL_(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE F77_CALL_PREFIX FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME) 00102 00103 #define FORTRAN_FUNC_CALL_UL_(UFUNC_NAME,LFUNC_NAME) FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME) 00104 00105 #define FORTRAN_FUNC_PTR_DECL_UL_(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE (F77_CALL_PREFIX *FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME)) 00106 00107 #define FORTRAN_COMMMON_BLOCK_NAME_UL_(UNAME,LNAME) FORTRAN_NAME_UL_(UNAME,LNAME)\ 00108 00109 #ifdef __cplusplus 00110 00111 // These are the platform dependent C++ equivalents of fortran types 00112 // RAB: 2003/11/20: ToDo: Move this into Teuchos namespace at some point 00113 namespace FortranTypes { 00114 00115 typedef int f_int; // INTEGER 00116 typedef float f_real; // REAL 00117 typedef double f_dbl_prec; // DOUBLE PRECISION 00118 typedef int f_logical; // LOGICAL 00119 typedef char f_char; // CHARACTER*1 00120 typedef unsigned int f_char_len; // length argument for a CHARACTER*(*) 00121 //typedef std::complex<f_real> f_complex; // COMPLEX 00122 //typedef std::complex<f_dbl_prec> f_complex_16; // COMPLEX*16 00123 00124 enum { F_TRUE = true, F_FALSE = false }; // Let compiler figure this out! 00125 00126 #endif /* __cplusplus */ 00127 00128 } // namespace FortranTypes 00129 00130 #endif // _TEUCHOS_F77_WRAPPERS_H_
1.7.6.1