1 // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 2 // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 3 // All Rights reserved. See files LICENSE and NOTICE for details. 4 // 5 // This file is part of CEED, a collection of benchmarks, miniapps, software 6 // libraries and APIs for efficient high-order finite element and spectral 7 // element discretizations for exascale applications. For more information and 8 // source code availability see http://github.com/ceed. 9 // 10 // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11 // a collaborative effort of two U.S. Department of Energy organizations (Office 12 // of Science and the National Nuclear Security Administration) responsible for 13 // the planning and preparation of a capable exascale ecosystem, including 14 // software, applications, hardware, advanced system engineering and early 15 // testbed platforms, in support of the nation's exascale computing imperative. 16 17 #ifndef _ceed_fortran_name_h 18 #define _ceed_fortran_name_h 19 20 /* establishes some macros to establish 21 * the FORTRAN naming convention 22 default gs_setup, etc. 23 -DUPCASE GS_SETUP, etc. 24 -DUNDERSCORE gs_setup_, etc. 25 * a prefix for all external (non-FORTRAN) function names 26 for example, -DPREFIX=jl_ transforms fail -> jl_fail 27 * a prefix for all external FORTRAN function names 28 for example, -DFPREFIX=jlf_ transforms gs_setup_ -> jlf_gs_setup_ 29 */ 30 31 /* the following macro functions like a##b, 32 but will expand a and/or b if they are themselves macros */ 33 #define TOKEN_PASTE_(a,b) a##b 34 #define TOKEN_PASTE(a,b) TOKEN_PASTE_(a,b) 35 36 #ifdef PREFIX 37 # define PREFIXED_NAME(x) TOKEN_PASTE(PREFIX,x) 38 #else 39 # define PREFIXED_NAME(x) x 40 #endif 41 42 #ifdef FPREFIX 43 # define FPREFIXED_NAME(x) TOKEN_PASTE(FPREFIX,x) 44 #else 45 # define FPREFIXED_NAME(x) x 46 #endif 47 48 #if defined(UPCASE) 49 # define FORTRAN_NAME(low,up) FPREFIXED_NAME(up) 50 # define FORTRAN_UNPREFIXED(low,up) up 51 #elif defined(UNDERSCORE) 52 # define FORTRAN_NAME(low,up) FPREFIXED_NAME(TOKEN_PASTE(low,_)) 53 # define FORTRAN_UNPREFIXED(low,up) TOKEN_PASTE(low,_) 54 #else 55 # define FORTRAN_NAME(low,up) FPREFIXED_NAME(low) 56 # define FORTRAN_UNPREFIXED(low,up) low 57 #endif 58 59 #endif 60