! ---------------------------------------------
! This file is part of an effort to replace most uses of preprocessor CPP keys by fortran variables,
! to improve readability, compilation coverage, and linting.
! CPP keys used here should ONLY be used here (unless specified explicitely),
! and imported through USE ..., ONLY: ... elsewhere
! CPP keys supported (key -> fortran variables associated):
!      NC_DOUBLE      -> nf90_format
!      CPP_PHYS       -> CPPKEY_PHYS
!      INCA           -> CPPKEY_INCA   ! -> also in lmdz_inca_wrappers.F90
!      CPP_StratAer   -> CPPKEY_STRATAER
!      CPP_DUST       -> CPPKEY_DUST
!      CPP_INLANDSIS  -> CPPKEY_INLANDSIS
!      OUTPUT_PHYS_SCM-> CPPKEY_OUTPUTPHYSSCM
! ---------------------------------------------

MODULE lmdz_cppkeys_wrapper
  USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: REAL64, REAL32
  USE netcdf, ONLY: nf90_float, nf90_double
  IMPLICIT NONE; PRIVATE
  PUBLIC nf90_format, CPPKEY_PHYS, CPPKEY_INCA, CPPKEY_STRATAER, CPPKEY_DUST, &
      CPPKEY_DEBUGIO, CPPKEY_INLANDSIS

#ifdef NC_DOUBLE
  INTEGER, PARAMETER :: nf90_format = nf90_double
#else
  INTEGER, PARAMETER :: nf90_format = nf90_float
#endif

#ifdef CPP_PHYS
  LOGICAL, PARAMETER :: CPPKEY_PHYS = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_PHYS = .FALSE.
#endif

#ifdef INCA
  LOGICAL, PARAMETER :: CPPKEY_INCA = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_INCA = .FALSE.
#endif

#ifdef CPP_StratAer
  LOGICAL, PARAMETER :: CPPKEY_STRATAER = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_STRATAER = .FALSE.
#endif

#ifdef CPP_DUST
  LOGICAL, PARAMETER :: CPPKEY_DUST = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_DUST = .FALSE.
#endif

#ifdef DEBUG_IO
  LOGICAL, PARAMETER :: CPPKEY_DEBUGIO = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_DEBUGIO = .FALSE.
#endif

#ifdef CPP_INLANDSIS
  LOGICAL, PARAMETER :: CPPKEY_INLANDSIS = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_INLANDSIS = .FALSE.
#endif

#ifdef OUTPUT_PHYS_SCM
  LOGICAL, PARAMETER :: CPPKEY_OUTPUTPHYSSCM = .TRUE.
#else
  LOGICAL, PARAMETER :: CPPKEY_OUTPUTPHYSSCM = .FALSE.
#endif

END MODULE lmdz_cppkeys_wrapper