From fd0f41ef648a5aedb7b1486819cb74135291cc16 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sun, 21 Jan 2024 14:34:54 +0000 Subject: [PATCH] Fortran: grib_sections_copy --- examples/F90/CMakeLists.txt | 1 + fortran/grib_api_externals.h | 1 - fortran/grib_fortran.c | 19 ++++++++++--------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/F90/CMakeLists.txt b/examples/F90/CMakeLists.txt index 88b77e9fa..e4104bd83 100644 --- a/examples/F90/CMakeLists.txt +++ b/examples/F90/CMakeLists.txt @@ -25,6 +25,7 @@ if( HAVE_BUILD_TOOLS ) codes_scan_file codes_load_file grib_copy_message + grib_sections_copy bufr_copy_message grib_get_keys grib_get_data diff --git a/fortran/grib_api_externals.h b/fortran/grib_api_externals.h index 85a442c96..f789fb92e 100644 --- a/fortran/grib_api_externals.h +++ b/fortran/grib_api_externals.h @@ -21,7 +21,6 @@ integer, external :: grib_f_keys_iterator_get_name, & grib_f_keys_iterator_rewind integer, external :: grib_f_new_from_message, & grib_f_new_from_message_int, & - grib_f_new_from_message_copy, & grib_f_new_from_samples, & codes_bufr_f_new_from_samples, & grib_f_read_any_from_file, & diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index be814a1bd..e1835ae47 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -1366,6 +1366,7 @@ int grib_f_new_from_message_int_(int* gid, int* buffer , size_t* bufsize) return grib_f_new_from_message_(gid, (void*)buffer, bufsize); } /*****************************************************************************/ +#if 0 int grib_f_new_from_message_copy_(int* gid, void* buffer, size_t* bufsize) { grib_handle *h = NULL; @@ -1377,7 +1378,7 @@ int grib_f_new_from_message_copy_(int* gid, void* buffer, size_t* bufsize) *gid = -1; return GRIB_INTERNAL_ERROR; } - +#endif /*****************************************************************************/ int grib_f_new_from_samples_(int* gid, char* name, int lname) { @@ -1443,16 +1444,16 @@ int grib_f_copy_key_(int* gidsrc, char* key, int* giddest, int len) } /*****************************************************************************/ -int grib_f_util_sections_copy_(int* gidfrom,int* gidto,int* what,int *gidout) +int grib_f_util_sections_copy_(int* gidfrom, int* gidto, int* what, int* gidout) { - int err=0; - grib_handle *hfrom = get_handle(*gidfrom); - grib_handle *hto = get_handle(*gidto); - grib_handle *out =0; + int err = 0; + grib_handle* hfrom = get_handle(*gidfrom); + grib_handle* hto = get_handle(*gidto); + grib_handle* out = 0; - if(hfrom && hto) out=grib_util_sections_copy(hfrom,hto,*what,&err); - if(out){ - push_handle(out,gidout); + if (hfrom && hto) out = grib_util_sections_copy(hfrom, hto, *what, &err); + if (out) { + push_handle(out, gidout); return GRIB_SUCCESS; }