KTH framework for Nek5000 toolboxes; testing version  0.0.1
name.h
Go to the documentation of this file.
1 #ifndef NAME_H
2 #define NAME_H
3 
4 /* establishes some macros to establish
5  * the FORTRAN naming convention
6  default gs_setup, etc.
7  -DUPCASE GS_SETUP, etc.
8  -DUNDERSCORE gs_setup_, etc.
9  * a prefix for all external (non-FORTRAN) function names
10  for example, -DPREFIX=jl_ transforms fail -> jl_fail
11  * a prefix for all external FORTRAN function names
12  for example, -DFPREFIX=jlf_ transforms gs_setup_ -> jlf_gs_setup_
13 */
14 
15 /* the following macro functions like a##b,
16  but will expand a and/or b if they are themselves macros */
17 #define TOKEN_PASTE_(a,b) a##b
18 #define TOKEN_PASTE(a,b) TOKEN_PASTE_(a,b)
19 
20 #ifdef PREFIX
21 # define PREFIXED_NAME(x) TOKEN_PASTE(PREFIX,x)
22 #else
23 # define PREFIXED_NAME(x) x
24 #endif
25 
26 #ifdef FPREFIX
27 # define FPREFIXED_NAME(x) TOKEN_PASTE(FPREFIX,x)
28 #else
29 # define FPREFIXED_NAME(x) x
30 #endif
31 
32 #if defined(UPCASE)
33 # define FORTRAN_NAME(low,up) FPREFIXED_NAME(up)
34 # define FORTRAN_UNPREFIXED(low,up) up
35 #elif defined(UNDERSCORE)
36 # define FORTRAN_NAME(low,up) FPREFIXED_NAME(TOKEN_PASTE(low,_))
37 # define FORTRAN_UNPREFIXED(low,up) TOKEN_PASTE(low,_)
38 #else
39 # define FORTRAN_NAME(low,up) FPREFIXED_NAME(low)
40 # define FORTRAN_UNPREFIXED(low,up) low
41 #endif
42 
43 #endif
44