Skip to content

Commit

Permalink
Clean-up portable ABI support implementation for
Browse files Browse the repository at this point in the history
  • Loading branch information
theurich committed May 30, 2024
1 parent fe6c53c commit ae1ac79
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Infrastructure/Util/include/ESMCI_Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const char *ESMC_LogicalString(ESMC_Logical tf);

extern "C" {
void FTN_X(esmf_pointertoint)(int *n, short *s, ESMC_POINTER *len);
void FTN_X(esmf_pointerdifference)(long *n, short *s1, short *s2, int *len);
void FTN_X(esmf_pointerdifference)(size_t *n, short *s1, short *s2, int *len);
void FTN_X(c_esmc_getcwd)(char *pathname, int *rc, ESMCI_FortranStrLenArg pathname_l);
void FTN_X(c_esmc_makedirectory)(const char *pathname, int *mode, ESMC_Logical *relaxedFlag,
int *rc, ESMCI_FortranStrLenArg pathname_l);
Expand Down
9 changes: 2 additions & 7 deletions src/Infrastructure/Util/include/ESMC_Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define ESMC_UTIL_H

#include "ESMC_Conf.h"
#include <stddef.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -40,13 +41,7 @@ extern "C" {
typedef char ESMC_I1;
typedef double ESMC_R8;
typedef float ESMC_R4;
#if (ESMC_POINTER_SIZE == 4)
// 32-bit machine
typedef unsigned long ESMC_POINTER;
#else
// 64-bit machine
typedef unsigned long long ESMC_POINTER;
#endif
typedef size_t ESMC_POINTER;

enum ESMC_CoordSys_Flag {ESMC_COORDSYS_INVALID=-2,
ESMC_COORDSYS_UNINIT,
Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure/Util/src/ESMCI_Util.C
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ extern "C" {
// 2 ^ 32 apart so the result fits in to a standard integer return val.
//
// !ARGUMENTS:
long *n, // in - number of expected bytes in a pointer
size_t *n, // in - number of expected bytes in a pointer
short *s1, // in - F90 pointer of some kind
short *s2, // in - F90 pointer of some kind
int *len) { // out - that same value cast to an int
Expand Down
13 changes: 7 additions & 6 deletions src/Infrastructure/Util/src/ESMF_FortranWordsize.cppF90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module ESMF_FortranWordsizeMod
! !USES:
use iso_c_binding

use ESMF_UtilTypesMod
use ESMF_UtilTypesMod
use ESMF_LogErrMod

implicit none
Expand Down Expand Up @@ -71,12 +71,13 @@ module ESMF_FortranWordsizeMod
^ifndef ESMF_NO_F2018ASSUMEDTYPE

interface

subroutine esmf_pointerdifference(n, s1, s2, len)
integer*8 :: n
type(*) :: s1
type(*) :: s2
integer :: len
use iso_c_binding
integer(C_SIZE_T) :: n
type(*) :: s1
type(*) :: s2
integer :: len
end subroutine

!EOPI
Expand Down
8 changes: 0 additions & 8 deletions src/Infrastructure/Util/src/ESMF_UtilTypes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,7 @@ module ESMF_UtilTypesMod
sequence
#endif
!private
#if 1
integer(C_SIZE_T) :: ptr
#else
#if (ESMC_POINTER_SIZE == 4)
integer(selected_int_kind( 9)) :: ptr
#else
integer(selected_int_kind(18)) :: ptr
#endif
#endif
end type

type(ESMF_Pointer), parameter :: ESMF_NULL_POINTER = ESMF_Pointer(0), &
Expand Down

0 comments on commit ae1ac79

Please sign in to comment.