Teuchos_F77_wrappers.h

Go to the documentation of this file.
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 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef _TEUCHOS_F77_WRAPPERS_H_
00030 #define _TEUCHOS_F77_WRAPPERS_H_
00031 
00036 #include "Teuchos_ConfigDefs.hpp"
00037 
00038 /* Define fcd (Fortran Teuchos_fcd descriptor) for non-standard situations */
00039 
00040 #if defined(CRAY_T3X)
00041 
00042 #  include <fortran.h>
00043 #  define F77_CALL_PREFIX
00044 #  define FORTRAN_CHAR_1_ARG(ARG_NAME) fcd* ARG_NAME
00045 #  define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const fcd& ARG_NAME
00046 #  define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME
00047 
00048 #elif defined(INTEL_CXML)
00049 
00050 #  define F77_CALL_PREFIX __stdcall 
00051 #  define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME, unsigned int
00052 #  define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME, unsigned int
00053 #  define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME, 1
00054 
00055 #elif defined(INTEL_MKL)
00056 
00057 #  define F77_CALL_PREFIX
00058 #  define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME
00059 #  define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME
00060 #  define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME, 1
00061 
00062 #else
00063 
00064 #  define F77_CALL_PREFIX
00065 #  define FORTRAN_CHAR_1_ARG(ARG_NAME) char* ARG_NAME
00066 #  define FORTRAN_CONST_CHAR_1_ARG(ARG_NAME) const char& ARG_NAME
00067 #  define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME) ARG_NAME
00068 
00069 #endif
00070 
00071 /* RAB: 20030924: ToDo: Find a way to see if const is supported or not by C or
00072    just decide that this will only be for C++ code and be done with it. */
00073 
00074 /* External macros */
00075 
00076 #define FORTRAN_NAME_UL(UNAME,LNAME) F77_FUNC(LNAME,UNAME)
00077 
00078 #define FORTRAN_FUNC_DECL_UL(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE F77_CALL_PREFIX FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME)
00079 
00080 #define FORTRAN_FUNC_CALL_UL(UFUNC_NAME,LFUNC_NAME) FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME)
00081 
00082 #define FORTRAN_FUNC_PTR_DECL_UL(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE (F77_CALL_PREFIX *FORTRAN_NAME_UL(UFUNC_NAME,LFUNC_NAME))
00083 
00084 #define FORTRAN_COMMMON_BLOCK_NAME_UL(UNAME,LNAME)  FORTRAN_NAME_UL(UNAME,LNAME)\
00085 
00086 #define FORTRAN_NAME_UL_(UNAME,LNAME) F77_FUNC_(LNAME,UNAME)
00087 
00088 #define FORTRAN_FUNC_DECL_UL_(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE F77_CALL_PREFIX FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME)
00089 
00090 #define FORTRAN_FUNC_CALL_UL_(UFUNC_NAME,LFUNC_NAME) FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME)
00091 
00092 #define FORTRAN_FUNC_PTR_DECL_UL_(TYPE,UFUNC_NAME,LFUNC_NAME) TYPE (F77_CALL_PREFIX *FORTRAN_NAME_UL_(UFUNC_NAME,LFUNC_NAME))
00093 
00094 #define FORTRAN_COMMMON_BLOCK_NAME_UL_(UNAME,LNAME)  FORTRAN_NAME_UL_(UNAME,LNAME)\
00095 
00096 #ifdef __cplusplus
00097 
00098 // These are the platform dependent C++ equivalents of fortran types
00099 // RAB: 2003/11/20: ToDo: Move this into Teuchos namespace at some point
00100 namespace FortranTypes {
00101 
00102 typedef int             f_int;          // INTEGER
00103 typedef float           f_real;         // REAL
00104 typedef double            f_dbl_prec;       // DOUBLE PRECISION
00105 typedef int             f_logical;        // LOGICAL
00106 typedef char            f_char;         // CHARACTER*1
00107 typedef unsigned int        f_char_len;       // length argument for a CHARACTER*(*)
00108 //typedef std::complex<f_real>    f_complex;        // COMPLEX
00109 //typedef std::complex<f_dbl_prec>  f_complex_16;     // COMPLEX*16
00110 
00111 enum {  F_TRUE = true, F_FALSE = false }; // Let compiler figure this out!
00112 
00113 #endif /* __cplusplus */
00114 
00115 } // namespace FortranTypes
00116 
00117 #endif // _TEUCHOS_F77_WRAPPERS_H_

Generated on Thu Sep 18 12:30:29 2008 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1