1*04822c1eSjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 2*04822c1eSjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 3*04822c1eSjeremylt // All Rights reserved. See files LICENSE and NOTICE for details. 4*04822c1eSjeremylt // 5*04822c1eSjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software 6*04822c1eSjeremylt // libraries and APIs for efficient high-order finite element and spectral 7*04822c1eSjeremylt // element discretizations for exascale applications. For more information and 8*04822c1eSjeremylt // source code availability see http://github.com/ceed. 9*04822c1eSjeremylt // 10*04822c1eSjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11*04822c1eSjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office 12*04822c1eSjeremylt // of Science and the National Nuclear Security Administration) responsible for 13*04822c1eSjeremylt // the planning and preparation of a capable exascale ecosystem, including 14*04822c1eSjeremylt // software, applications, hardware, advanced system engineering and early 15*04822c1eSjeremylt // testbed platforms, in support of the nation's exascale computing imperative. 16*04822c1eSjeremylt 17734e90feSThilina Rathnayake #ifndef _ceed_fortran_name_h 18734e90feSThilina Rathnayake #define _ceed_fortran_name_h 19734e90feSThilina Rathnayake 20734e90feSThilina Rathnayake /* establishes some macros to establish 21734e90feSThilina Rathnayake * the FORTRAN naming convention 22734e90feSThilina Rathnayake default gs_setup, etc. 23734e90feSThilina Rathnayake -DUPCASE GS_SETUP, etc. 24734e90feSThilina Rathnayake -DUNDERSCORE gs_setup_, etc. 25734e90feSThilina Rathnayake * a prefix for all external (non-FORTRAN) function names 26734e90feSThilina Rathnayake for example, -DPREFIX=jl_ transforms fail -> jl_fail 27734e90feSThilina Rathnayake * a prefix for all external FORTRAN function names 28734e90feSThilina Rathnayake for example, -DFPREFIX=jlf_ transforms gs_setup_ -> jlf_gs_setup_ 29734e90feSThilina Rathnayake */ 30734e90feSThilina Rathnayake 31734e90feSThilina Rathnayake /* the following macro functions like a##b, 32734e90feSThilina Rathnayake but will expand a and/or b if they are themselves macros */ 33734e90feSThilina Rathnayake #define TOKEN_PASTE_(a,b) a##b 34734e90feSThilina Rathnayake #define TOKEN_PASTE(a,b) TOKEN_PASTE_(a,b) 35734e90feSThilina Rathnayake 36734e90feSThilina Rathnayake #ifdef PREFIX 37734e90feSThilina Rathnayake # define PREFIXED_NAME(x) TOKEN_PASTE(PREFIX,x) 38734e90feSThilina Rathnayake #else 39734e90feSThilina Rathnayake # define PREFIXED_NAME(x) x 40734e90feSThilina Rathnayake #endif 41734e90feSThilina Rathnayake 42734e90feSThilina Rathnayake #ifdef FPREFIX 43734e90feSThilina Rathnayake # define FPREFIXED_NAME(x) TOKEN_PASTE(FPREFIX,x) 44734e90feSThilina Rathnayake #else 45734e90feSThilina Rathnayake # define FPREFIXED_NAME(x) x 46734e90feSThilina Rathnayake #endif 47734e90feSThilina Rathnayake 48734e90feSThilina Rathnayake #if defined(UPCASE) 49734e90feSThilina Rathnayake # define FORTRAN_NAME(low,up) FPREFIXED_NAME(up) 50734e90feSThilina Rathnayake # define FORTRAN_UNPREFIXED(low,up) up 51734e90feSThilina Rathnayake #elif defined(UNDERSCORE) 52734e90feSThilina Rathnayake # define FORTRAN_NAME(low,up) FPREFIXED_NAME(TOKEN_PASTE(low,_)) 53734e90feSThilina Rathnayake # define FORTRAN_UNPREFIXED(low,up) TOKEN_PASTE(low,_) 54734e90feSThilina Rathnayake #else 55734e90feSThilina Rathnayake # define FORTRAN_NAME(low,up) FPREFIXED_NAME(low) 56734e90feSThilina Rathnayake # define FORTRAN_UNPREFIXED(low,up) low 57734e90feSThilina Rathnayake #endif 58734e90feSThilina Rathnayake 59734e90feSThilina Rathnayake #endif 60