Fortran: Reformatting

This commit is contained in:
Shahram Najm 2024-01-11 13:40:07 +00:00
parent 6f4a3f625a
commit 5e6313407f
1 changed files with 215 additions and 138 deletions

View File

@ -845,7 +845,8 @@ static int clear_bufr_keys_iterator(int keys_iterator_id)
/*****************************************************************************/
#if 0
int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbytes) {
int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbytes)
{
grib_context* c;
int err=0;
FILE* f=get_file(*fid);
@ -861,7 +862,8 @@ int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbyt
#endif
/*****************************************************************************/
int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes) {
int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes)
{
grib_context* c;
int err=0;
FILE* f=get_file(*fid);
@ -876,7 +878,8 @@ int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes) {
}
/*****************************************************************************/
int grib_f_write_file_(int* fid, void* buffer, size_t* nbytes) {
int grib_f_write_file_(int* fid, void* buffer, size_t* nbytes)
{
grib_context* c;
FILE* f=get_file(*fid);
@ -895,7 +898,8 @@ int grib_f_write_file_(int* fid, void* buffer, size_t* nbytes) {
}
/*****************************************************************************/
int grib_f_read_file_(int* fid, void* buffer, size_t* nbytes) {
int grib_f_read_file_(int* fid, void* buffer, size_t* nbytes)
{
grib_context* c;
FILE* f=get_file(*fid);
@ -914,7 +918,8 @@ int grib_f_read_file_(int* fid, void* buffer, size_t* nbytes) {
}
/*****************************************************************************/
int grib_f_open_file_(int* fid, char* name , char* op, int lname, int lop) {
int grib_f_open_file_(int* fid, char* name , char* op, int lname, int lop)
{
FILE* f = NULL;
int ioerr=0;
char oper[1024]; /* GRIB-576: open mode */
@ -961,7 +966,8 @@ int grib_f_open_file_(int* fid, char* name , char* op, int lname, int lop) {
}
/*****************************************************************************/
int grib_f_close_file_(int* fid){
int grib_f_close_file_(int* fid)
{
return clear_file(*fid);
}
@ -990,12 +996,14 @@ void grib_f_write_on_fail_(int* gid) {
grib_f_write_on_fail(gid);
}
/*****************************************************************************/
int grib_f_multi_support_on_(){
int grib_f_multi_support_on_()
{
grib_multi_support_on(0);
return GRIB_SUCCESS;
}
int grib_f_multi_support_off_(){
int grib_f_multi_support_off_()
{
grib_multi_support_off(0);
return GRIB_SUCCESS;
}
@ -1128,7 +1136,8 @@ int grib_f_iterator_delete_(int* iterid) {
#endif /*FORTRAN_GEOITERATOR_SUPPORT*/
/*****************************************************************************/
static int _grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len) {
static int _grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len)
{
int err=0;
char buf[1024];
grib_handle* h;
@ -1146,7 +1155,8 @@ static int _grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int
*iterid=-1;
return err;
}
int grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len) {
int grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len)
{
int ret=0;
GRIB_MUTEX_INIT_ONCE(&once,&init)
GRIB_MUTEX_LOCK(&keys_iterator_mutex)
@ -1156,7 +1166,8 @@ int grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len) {
}
/*****************************************************************************/
int grib_f_keys_iterator_next_(int* iterid) {
int grib_f_keys_iterator_next_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
@ -1164,60 +1175,70 @@ int grib_f_keys_iterator_next_(int* iterid) {
}
/*****************************************************************************/
int grib_f_keys_iterator_delete_(int* iterid) {
int grib_f_keys_iterator_delete_(int* iterid)
{
return clear_keys_iterator(*iterid);
}
/*****************************************************************************/
int grib_f_gribex_mode_on_() {
int grib_f_gribex_mode_on_()
{
grib_gribex_mode_on(0);
return GRIB_SUCCESS;
}
int grib_f_gribex_mode_off_() {
int grib_f_gribex_mode_off_()
{
grib_gribex_mode_off(0);
return GRIB_SUCCESS;
}
/*****************************************************************************/
int grib_f_skip_computed_(int* iterid) {
int grib_f_skip_computed_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
return grib_keys_iterator_set_flags(iter,GRIB_KEYS_ITERATOR_SKIP_COMPUTED);
}
int grib_f_skip_coded_(int* iterid) {
int grib_f_skip_coded_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
return grib_keys_iterator_set_flags(iter,GRIB_KEYS_ITERATOR_SKIP_CODED);
}
int grib_f_skip_edition_specific_(int* iterid) {
int grib_f_skip_edition_specific_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
return grib_keys_iterator_set_flags(iter,GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC);
}
int grib_f_skip_duplicates_(int* iterid) {
int grib_f_skip_duplicates_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
return grib_keys_iterator_set_flags(iter,GRIB_KEYS_ITERATOR_SKIP_DUPLICATES);
}
int grib_f_skip_read_only_(int* iterid) {
int grib_f_skip_read_only_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
return grib_keys_iterator_set_flags(iter,GRIB_KEYS_ITERATOR_SKIP_READ_ONLY);
}
int grib_f_skip_function_(int* iterid) {
int grib_f_skip_function_(int* iterid)
{
grib_keys_iterator* iter=get_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
return grib_keys_iterator_set_flags(iter,GRIB_KEYS_ITERATOR_SKIP_FUNCTION);
}
/*****************************************************************************/
int grib_f_keys_iterator_get_name_(int* iterid,char* name,int len) {
int grib_f_keys_iterator_get_name_(int* iterid,char* name,int len)
{
size_t input_len = len;
size_t lsize = len;
char buf[1024]={0,};
@ -1240,7 +1261,8 @@ int grib_f_keys_iterator_get_name_(int* iterid,char* name,int len) {
}
/*****************************************************************************/
int grib_f_keys_iterator_rewind_(int* kiter) {
int grib_f_keys_iterator_rewind_(int* kiter)
{
grib_keys_iterator* i=get_keys_iterator(*kiter);
if (!i) return GRIB_INVALID_KEYS_ITERATOR;
@ -1249,7 +1271,8 @@ int grib_f_keys_iterator_rewind_(int* kiter) {
/* BUFR keys iterator */
/*****************************************************************************/
static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) {
static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid)
{
int err=0;
grib_handle* h;
bufr_keys_iterator* iter;
@ -1267,7 +1290,8 @@ static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) {
*iterid=-1;
return err;
}
int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) {
int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid)
{
int ret=0;
GRIB_MUTEX_INIT_ONCE(&once,&init)
GRIB_MUTEX_LOCK(&keys_iterator_mutex)
@ -1276,7 +1300,8 @@ int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) {
return ret;
}
/*****************************************************************************/
int codes_f_bufr_keys_iterator_next_(int* iterid) {
int codes_f_bufr_keys_iterator_next_(int* iterid)
{
bufr_keys_iterator* iter=get_bufr_keys_iterator(*iterid);
if (!iter) return GRIB_INVALID_KEYS_ITERATOR;
@ -1284,7 +1309,8 @@ int codes_f_bufr_keys_iterator_next_(int* iterid) {
}
/*****************************************************************************/
int codes_f_bufr_keys_iterator_get_name_(int* iterid, char* name, int len) {
int codes_f_bufr_keys_iterator_get_name_(int* iterid, char* name, int len)
{
size_t input_len = len;
size_t lsize = len;
char buf[1024] = {0,};
@ -1306,7 +1332,8 @@ int codes_f_bufr_keys_iterator_get_name_(int* iterid, char* name, int len) {
return 0;
}
/*****************************************************************************/
int codes_f_bufr_keys_iterator_rewind_(int* kiter) {
int codes_f_bufr_keys_iterator_rewind_(int* kiter)
{
bufr_keys_iterator* i=get_bufr_keys_iterator(*kiter);
if (!i) return GRIB_INVALID_KEYS_ITERATOR;
@ -1314,12 +1341,14 @@ int codes_f_bufr_keys_iterator_rewind_(int* kiter) {
}
/*****************************************************************************/
int codes_f_bufr_keys_iterator_delete_(int* iterid) {
int codes_f_bufr_keys_iterator_delete_(int* iterid)
{
return clear_bufr_keys_iterator(*iterid);
}
/*****************************************************************************/
int grib_f_new_from_message_(int* gid, void* buffer, size_t* bufsize) {
int grib_f_new_from_message_(int* gid, void* buffer, size_t* bufsize)
{
grib_handle *h = NULL;
h = grib_handle_new_from_message_copy(0, buffer, *bufsize);
if (h){
@ -1331,12 +1360,14 @@ int grib_f_new_from_message_(int* gid, void* buffer, size_t* bufsize) {
}
/* See SUP-3893: Need to provide an 'int' version */
int grib_f_new_from_message_int_(int* gid, int* buffer , size_t* bufsize) {
int grib_f_new_from_message_int_(int* gid, int* buffer , size_t* bufsize)
{
/* Call the version with void pointer */
return grib_f_new_from_message_(gid, (void*)buffer, bufsize);
}
/*****************************************************************************/
int grib_f_new_from_message_copy_(int* gid, void* buffer, size_t* bufsize){
int grib_f_new_from_message_copy_(int* gid, void* buffer, size_t* bufsize)
{
grib_handle *h = NULL;
h = grib_handle_new_from_message_copy(0, buffer, *bufsize);
if(h){
@ -1348,7 +1379,8 @@ int grib_f_new_from_message_copy_(int* gid, void* buffer, size_t* bufsize){
}
/*****************************************************************************/
int grib_f_new_from_samples_(int* gid, char* name, int lname){
int grib_f_new_from_samples_(int* gid, char* name, int lname)
{
char fname[1024];
grib_handle *h = grib_handle_new_from_samples(NULL,cast_char(fname,name,lname));
/* grib_context_set_debug(h->context,1);*/
@ -1362,7 +1394,8 @@ int grib_f_new_from_samples_(int* gid, char* name, int lname){
}
/*****************************************************************************/
int codes_bufr_f_new_from_samples_(int* gid, char* name, int lname){
int codes_bufr_f_new_from_samples_(int* gid, char* name, int lname)
{
char fname[1024];
grib_handle* h = codes_bufr_handle_new_from_samples(NULL,cast_char(fname,name,lname));
/* grib_context_set_debug(h->context,1);*/
@ -1376,7 +1409,8 @@ int codes_bufr_f_new_from_samples_(int* gid, char* name, int lname){
}
/*****************************************************************************/
int grib_f_clone_(int* gidsrc,int* giddest){
int grib_f_clone_(int* gidsrc,int* giddest)
{
grib_handle *src = get_handle(*gidsrc);
grib_handle *dest = NULL;
@ -1409,7 +1443,8 @@ 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);
@ -1425,7 +1460,8 @@ int grib_f_util_sections_copy_(int* gidfrom,int* gidto,int* what,int *gidout){
}
/*****************************************************************************/
int grib_f_copy_namespace_(int* gidsrc,char* name,int* giddest,int len){
int grib_f_copy_namespace_(int* gidsrc,char* name,int* giddest,int len)
{
char buf[1024]={0,};
grib_handle *src = get_handle(*gidsrc);
grib_handle *dest = get_handle(*giddest);
@ -1437,7 +1473,8 @@ int grib_f_copy_namespace_(int* gidsrc,char* name,int* giddest,int len){
}
/*****************************************************************************/
int any_f_scan_file_(int* fid, int* n) {
int any_f_scan_file_(int* fid, int* n)
{
int err = 0;
off_t offset=0;
void *data = NULL;
@ -1508,7 +1545,8 @@ int any_f_new_from_scanned_file_(int* fid, int* msgid, int* gid)
}
/*****************************************************************************/
int any_f_load_all_from_file_(int* fid, int* n) {
int any_f_load_all_from_file_(int* fid, int* n)
{
int err = 0;
off_t offset=0;
void* data = NULL;
@ -1563,7 +1601,8 @@ int any_f_new_from_loaded_(int* msgid, int* gid)
}
/*****************************************************************************/
int codes_f_clear_loaded_from_file_(void) {
int codes_f_clear_loaded_from_file_(void)
{
grib_context* c = grib_context_get_default();
/* grib_oarray_delete_content(c,binary_messages); */
grib_oarray_delete(c, binary_messages);
@ -1571,7 +1610,8 @@ int codes_f_clear_loaded_from_file_(void) {
}
/*****************************************************************************/
int grib_f_count_in_file_(int* fid,int* n) {
int grib_f_count_in_file_(int* fid,int* n)
{
int err = 0;
FILE* f = get_file(*fid);
if (f) err = grib_count_in_file(0, f, n);
@ -1579,7 +1619,8 @@ int grib_f_count_in_file_(int* fid,int* n) {
}
/*****************************************************************************/
int any_f_new_from_file_(int* fid, int* gid) {
int any_f_new_from_file_(int* fid, int* gid)
{
int err = 0;
FILE* f = get_file(*fid);
grib_handle* h = NULL;
@ -1600,7 +1641,8 @@ int any_f_new_from_file_(int* fid, int* gid) {
}
/*****************************************************************************/
int bufr_f_new_from_file_(int* fid, int* gid){
int bufr_f_new_from_file_(int* fid, int* gid)
{
int err = 0;
FILE* f = get_file(*fid);
@ -1617,12 +1659,13 @@ int bufr_f_new_from_file_(int* fid, int* gid){
}
}
*gid=-1;
*gid = -1;
return GRIB_INVALID_FILE;
}
/*****************************************************************************/
int grib_f_new_from_file_(int* fid, int* gid){
int grib_f_new_from_file_(int* fid, int* gid)
{
int err = 0;
FILE* f = get_file(*fid);
@ -1644,7 +1687,8 @@ int grib_f_new_from_file_(int* fid, int* gid){
}
/*****************************************************************************/
int grib_f_headers_only_new_from_file_(int* fid, int* gid){
int grib_f_headers_only_new_from_file_(int* fid, int* gid)
{
int err = 0;
FILE* f = get_file(*fid);
grib_handle *h = NULL;
@ -1666,7 +1710,8 @@ int grib_f_headers_only_new_from_file_(int* fid, int* gid){
}
/*****************************************************************************/
int grib_f_new_from_index_(int* iid, int* gid) {
int grib_f_new_from_index_(int* iid, int* gid)
{
int err = 0;
grib_index* i = get_index(*iid);
grib_handle *h = NULL;
@ -1687,7 +1732,8 @@ int grib_f_new_from_index_(int* iid, int* gid) {
}
/*****************************************************************************/
int grib_f_index_new_from_file_(char* file, char* keys, int* gid, int lfile, int lkeys) {
int grib_f_index_new_from_file_(char* file, char* keys, int* gid, int lfile, int lkeys)
{
int err = 0;
char fname[1024] = {0,};
char knames[1024] = {0,};
@ -1710,7 +1756,8 @@ int grib_f_index_new_from_file_(char* file, char* keys, int* gid, int lfile, int
}
/*****************************************************************************/
int grib_f_index_add_file_(int* iid, char* file, int lfile) {
int grib_f_index_add_file_(int* iid, char* file, int lfile)
{
grib_index *i = get_index(*iid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1724,7 +1771,8 @@ int grib_f_index_add_file_(int* iid, char* file, int lfile) {
}
/*****************************************************************************/
int grib_f_index_read_(char* file, int* gid, int lfile) {
int grib_f_index_read_(char* file, int* gid, int lfile)
{
int err = 0;
char fname[1024]={0,};
@ -1746,7 +1794,8 @@ int grib_f_index_read_(char* file, int* gid, int lfile) {
}
/*****************************************************************************/
int grib_f_index_write_(int* gid, char* file, int lfile) {
int grib_f_index_write_(int* gid, char* file, int lfile)
{
grib_index *i = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1760,7 +1809,8 @@ int grib_f_index_write_(int* gid, char* file, int lfile) {
}
/*****************************************************************************/
int grib_f_index_release_(int* hid){
int grib_f_index_release_(int* hid)
{
return clear_index(*hid);
}
@ -1768,7 +1818,8 @@ int grib_f_index_release_(int* hid){
return clear_multi_handle(*hid);
} */
int grib_f_release_(int* hid){
int grib_f_release_(int* hid)
{
return clear_handle(*hid);
}
@ -1794,9 +1845,9 @@ static void do_the_dump(grib_handle* h)
grib_dump_content(h,stdout, "wmo", dump_flags, NULL);
}
}
int grib_f_dump_(int* gid){
int grib_f_dump_(int* gid)
{
grib_handle *h = get_handle(*gid);
if(!h)
return GRIB_INVALID_GRIB;
else
@ -1807,7 +1858,8 @@ int grib_f_dump_(int* gid){
/*****************************************************************************/
#ifdef USE_GRIB_PRINT
int grib_f_print_(int* gid, char* key, int len){
int grib_f_print_(int* gid, char* key, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
grib_dumper* d = NULL;
@ -1824,7 +1876,8 @@ int grib_f_print_(int* gid, char* key, int len){
}
#endif
/*****************************************************************************/
int grib_f_get_error_string_(int* err, char* buf, int len) {
int grib_f_get_error_string_(int* err, char* buf, int len)
{
const char* err_msg = grib_get_error_message(*err);
const size_t erlen = strlen(err_msg);
if( len < erlen) return GRIB_ARRAY_TOO_SMALL;
@ -1833,7 +1886,8 @@ int grib_f_get_error_string_(int* err, char* buf, int len) {
}
/*****************************************************************************/
int grib_f_get_api_version_(int* apiVersion,int len) {
int grib_f_get_api_version_(int* apiVersion,int len)
{
*apiVersion = grib_get_api_version();
return GRIB_SUCCESS;
}
@ -1856,7 +1910,8 @@ int grib_f_get_size_int_(int* gid, char* key, int* val, int len)
}
}
int grib_f_get_size_long_(int* gid, char* key, long* val, int len){
int grib_f_get_size_long_(int* gid, char* key, long* val, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1872,7 +1927,8 @@ int grib_f_get_size_long_(int* gid, char* key, long* val, int len){
}
/*****************************************************************************/
int grib_f_index_get_size_int_(int* gid, char* key, int* val, int len){
int grib_f_index_get_size_int_(int* gid, char* key, int* val, int len)
{
grib_index *h = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1887,7 +1943,8 @@ int grib_f_index_get_size_int_(int* gid, char* key, int* val, int len){
}
}
int grib_f_index_get_size_long_(int* gid, char* key, long* val, int len){
int grib_f_index_get_size_long_(int* gid, char* key, long* val, int len)
{
grib_index *h = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1903,7 +1960,8 @@ int grib_f_index_get_size_long_(int* gid, char* key, long* val, int len){
}
/*****************************************************************************/
int grib_f_get_int_(int* gid, char* key, int* val, int len){
int grib_f_get_int_(int* gid, char* key, int* val, int len)
{
grib_handle *h = get_handle(*gid);
long long_val;
int err = GRIB_SUCCESS;
@ -1915,7 +1973,8 @@ int grib_f_get_int_(int* gid, char* key, int* val, int len){
return err;
}
int grib_f_get_long_(int* gid, char* key, long* val, int len){
int grib_f_get_long_(int* gid, char* key, long* val, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1926,7 +1985,8 @@ int grib_f_get_long_(int* gid, char* key, long* val, int len){
}
/*****************************************************************************/
int grib_f_get_native_type_(int* gid, char* key, int* val, int len){
int grib_f_get_native_type_(int* gid, char* key, int* val, int len)
{
grib_handle *h = get_handle(*gid);
int type_val = 0;
int err = GRIB_SUCCESS;
@ -1939,8 +1999,8 @@ int grib_f_get_native_type_(int* gid, char* key, int* val, int len){
}
/*****************************************************************************/
int grib_f_get_int_array_(int* gid, char* key, int *val, int* size, int len){
int grib_f_get_int_array_(int* gid, char* key, int *val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
long* long_val = NULL;
int err = GRIB_SUCCESS;
@ -1970,8 +2030,8 @@ int grib_f_get_int_array_(int* gid, char* key, int *val, int* size, int len){
return err;
}
/*****************************************************************************/
int grib_f_get_long_array_(int* gid, char* key, long *val, int* size, int len){
int grib_f_get_long_array_(int* gid, char* key, long *val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -1986,8 +2046,8 @@ int grib_f_get_long_array_(int* gid, char* key, long *val, int* size, int len){
}
/*****************************************************************************/
int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv){
int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2002,8 +2062,8 @@ int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, i
}
/*****************************************************************************/
int grib_f_index_get_string_(int* gid, char* key, char* val, int *eachsize,int* size, int len){
int grib_f_index_get_string_(int* gid, char* key, char* val, int *eachsize,int* size, int len)
{
grib_index *h = get_index(*gid);
int err = GRIB_SUCCESS;
int i;
@ -2043,8 +2103,8 @@ int grib_f_index_get_string_(int* gid, char* key, char* val, int *eachsize,int*
}
/*****************************************************************************/
int grib_f_index_get_long_(int* gid, char* key, long *val, int* size, int len){
int grib_f_index_get_long_(int* gid, char* key, long *val, int* size, int len)
{
grib_index *h = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2057,14 +2117,13 @@ int grib_f_index_get_long_(int* gid, char* key, long *val, int* size, int len){
}
/*****************************************************************************/
int grib_f_index_get_int_(int* gid, char* key, int *val, int* size, int len){
int grib_f_index_get_int_(int* gid, char* key, int *val, int* size, int len)
{
grib_index *h = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
size_t lsize = *size;
size_t lsize = *size, i = 0;
long* lval=0;
int i;
if(!h) return GRIB_INVALID_GRIB;
@ -2080,8 +2139,8 @@ int grib_f_index_get_int_(int* gid, char* key, int *val, int* size, int len){
}
/*****************************************************************************/
int grib_f_index_get_real8_(int* gid, char* key, double *val, int* size, int len){
int grib_f_index_get_real8_(int* gid, char* key, double *val, int* size, int len)
{
grib_index *h = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2094,7 +2153,8 @@ int grib_f_index_get_real8_(int* gid, char* key, double *val, int* size, int len
}
/*****************************************************************************/
int grib_f_set_int_array_(int* gid, char* key, int* val, int* size, int len){
int grib_f_set_int_array_(int* gid, char* key, int* val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2125,7 +2185,8 @@ int grib_f_set_int_array_(int* gid, char* key, int* val, int* size, int len){
}
/*****************************************************************************/
int grib_f_set_long_array_(int* gid, char* key, long* val, int* size, int len){
int grib_f_set_long_array_(int* gid, char* key, long* val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
size_t lsize = *size;
@ -2136,7 +2197,8 @@ int grib_f_set_long_array_(int* gid, char* key, long* val, int* size, int len){
}
/*****************************************************************************/
int grib_f_set_byte_array_(int* gid, char* key, unsigned char* val, int* size, int len, int lenv){
int grib_f_set_byte_array_(int* gid, char* key, unsigned char* val, int* size, int len, int lenv)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2151,7 +2213,8 @@ int grib_f_set_byte_array_(int* gid, char* key, unsigned char* val, int* size, i
}
/*****************************************************************************/
int grib_f_set_int_(int* gid, char* key, int* val, int len){
int grib_f_set_int_(int* gid, char* key, int* val, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
long long_val = *val;
@ -2159,7 +2222,8 @@ int grib_f_set_int_(int* gid, char* key, int* val, int len){
return grib_set_long(h, cast_char(buf,key,len), long_val);
}
int grib_f_set_long_(int* gid, char* key, long* val, int len){
int grib_f_set_long_(int* gid, char* key, long* val, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
if(!h) return GRIB_INVALID_GRIB;
@ -2167,7 +2231,8 @@ int grib_f_set_long_(int* gid, char* key, long* val, int len){
}
/*****************************************************************************/
int grib_f_set_missing_(int* gid, char* key,int len){
int grib_f_set_missing_(int* gid, char* key,int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
@ -2176,7 +2241,8 @@ int grib_f_set_missing_(int* gid, char* key,int len){
return grib_set_missing(h, cast_char(buf,key,len));
}
int grib_f_is_missing_(int* gid, char* key,int* isMissing,int len){
int grib_f_is_missing_(int* gid, char* key,int* isMissing,int len)
{
int err=0;
grib_handle *h = get_handle(*gid);
char buf[1024];
@ -2187,7 +2253,8 @@ int grib_f_is_missing_(int* gid, char* key,int* isMissing,int len){
}
/*****************************************************************************/
int grib_f_is_defined_(int* gid, char* key,int* isDefined,int len){
int grib_f_is_defined_(int* gid, char* key,int* isDefined,int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
if(!h) return GRIB_INVALID_GRIB;
@ -2197,8 +2264,8 @@ int grib_f_is_defined_(int* gid, char* key,int* isDefined,int len){
}
/*****************************************************************************/
int grib_f_set_real4_(int* gid, char* key, float* val, int len){
int grib_f_set_real4_(int* gid, char* key, float* val, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
double val8 = *val;
@ -2207,8 +2274,8 @@ int grib_f_set_real4_(int* gid, char* key, float* val, int len){
return grib_set_double(h, cast_char(buf,key,len), val8);
}
int grib_f_get_real4_element_(int* gid, char* key, int* index,float* val, int len){
int grib_f_get_real4_element_(int* gid, char* key, int* index,float* val, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2221,8 +2288,8 @@ int grib_f_get_real4_element_(int* gid, char* key, int* index,float* val, int le
return err;
}
int grib_f_get_real4_elements_(int* gid, char* key,int* index, float *val,int* size, int len){
int grib_f_get_real4_elements_(int* gid, char* key,int* index, float *val,int* size, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2249,8 +2316,8 @@ int grib_f_get_real4_elements_(int* gid, char* key,int* index, float *val,int* s
return err;
}
int grib_f_get_real4_(int* gid, char* key, float* val, int len){
int grib_f_get_real4_(int* gid, char* key, float* val, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2400,21 +2467,21 @@ int grib_f_index_select_string_(int* gid, char* key, char* val, int len, int val
int grib_f_index_select_int_(int* gid, char* key, int* val, int len)
{
grib_index *h = get_index(*gid);
long lval=*val;
char buf[1024];
long lval = *val;
char buf[1024] = {0,};
if(!h) return GRIB_INVALID_GRIB;
return grib_index_select_long(h, cast_char(buf,key,len), lval);
if (!h) return GRIB_INVALID_GRIB;
return grib_index_select_long(h, cast_char(buf, key, len), lval);
}
/*****************************************************************************/
int grib_f_index_select_long_(int* gid, char* key, long* val, int len)
{
grib_index *h = get_index(*gid);
char buf[1024];
char buf[1024] = {0,};
if(!h) return GRIB_INVALID_GRIB;
return grib_index_select_long(h, cast_char(buf,key,len), *val);
if (!h) return GRIB_INVALID_GRIB;
return grib_index_select_long(h, cast_char(buf, key, len), *val);
}
/*****************************************************************************/
@ -2438,8 +2505,8 @@ int grib_f_get_real8_(int* gid, char* key, double* val, int len)
}
/*****************************************************************************/
int grib_f_get_real8_element_(int* gid, char* key,int* index, double* val, int len){
int grib_f_get_real8_element_(int* gid, char* key,int* index, double* val, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
@ -2449,8 +2516,8 @@ int grib_f_get_real8_element_(int* gid, char* key,int* index, double* val, int l
}
/*****************************************************************************/
int grib_f_get_real8_elements_(int* gid, char* key,int* index, double* val, int *size, int len){
int grib_f_get_real8_elements_(int* gid, char* key,int* index, double* val, int *size, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
@ -2489,10 +2556,9 @@ int grib_f_find_nearest_single_(int* gid,int* is_lsm,
double* inlats,double* inlons,
double* outlats,double* outlons,
double* values,double* distances,
int* indexes) {
int* indexes)
{
grib_handle *h = get_handle(*gid);
if(!h) return GRIB_INVALID_GRIB;
return grib_nearest_find_multiple(h,*is_lsm,
@ -2505,10 +2571,9 @@ int grib_f_find_nearest_multiple_(int* gid,int* is_lsm,
double* inlats,double* inlons,
double* outlats,double* outlons,
double* values,double* distances,
int* indexes, int* npoints) {
int* indexes, int* npoints)
{
grib_handle *h = get_handle(*gid);
if(!h) return GRIB_INVALID_GRIB;
return grib_nearest_find_multiple(h,*is_lsm,
@ -2517,8 +2582,8 @@ int grib_f_find_nearest_multiple_(int* gid,int* is_lsm,
}
/*****************************************************************************/
int grib_f_get_real8_array_(int* gid, char* key, double*val, int* size, int len){
int grib_f_get_real8_array_(int* gid, char* key, double*val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2534,8 +2599,8 @@ int grib_f_get_real8_array_(int* gid, char* key, double*val, int* size, int len)
}
/*****************************************************************************/
int grib_f_set_force_real8_array_(int* gid, char* key, double*val, int* size, int len){
int grib_f_set_force_real8_array_(int* gid, char* key, double*val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
size_t lsize = *size;
@ -2546,8 +2611,8 @@ int grib_f_set_force_real8_array_(int* gid, char* key, double*val, int* size, in
}
/*****************************************************************************/
int grib_f_set_real8_array_(int* gid, char* key, double*val, int* size, int len){
int grib_f_set_real8_array_(int* gid, char* key, double*val, int* size, int len)
{
grib_handle *h = get_handle(*gid);
char buf[1024];
size_t lsize = *size;
@ -2636,8 +2701,8 @@ int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen
}
/*****************************************************************************/
int grib_f_get_string_(int* gid, char* key, char* val,int len, int len2){
int grib_f_get_string_(int* gid, char* key, char* val,int len, int len2)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
@ -2664,8 +2729,8 @@ static int is_all_spaces(const char *s)
}
/*****************************************************************************/
int grib_f_set_string_(int* gid, char* key, char* val, int len, int len2){
int grib_f_set_string_(int* gid, char* key, char* val, int len, int len2)
{
grib_handle *h = get_handle(*gid);
char* val_str = NULL;
@ -2686,8 +2751,8 @@ int grib_f_set_string_(int* gid, char* key, char* val, int len, int len2){
}
/*****************************************************************************/
int grib_f_get_data_real4_(int* gid,float* lats, float* lons,float* values,size_t* size) {
int grib_f_get_data_real4_(int* gid,float* lats, float* lons,float* values,size_t* size)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
double *lat8=NULL,*lon8=NULL,*val8 = NULL;
@ -2717,14 +2782,15 @@ int grib_f_get_data_real4_(int* gid,float* lats, float* lons,float* values,size_
return err;
}
int grib_f_get_data_real8_(int* gid,double* lats, double* lons,double* values,size_t* size) {
int grib_f_get_data_real8_(int* gid,double* lats, double* lons,double* values,size_t* size)
{
grib_handle *h = get_handle(*gid);
return grib_get_data(h,lats,lons,values);
}
/*****************************************************************************/
int grib_f_get_message_size_(int* gid, size_t *len){
int grib_f_get_message_size_(int* gid, size_t *len)
{
grib_handle *h = get_handle(*gid);
if(!h) return GRIB_INVALID_GRIB;
*len = h->buffer->ulength;
@ -2732,7 +2798,8 @@ int grib_f_get_message_size_(int* gid, size_t *len){
}
/*****************************************************************************/
int grib_f_copy_message_(int* gid, void* mess, size_t* len){
int grib_f_copy_message_(int* gid, void* mess, size_t* len)
{
grib_handle *h = get_handle(*gid);
if(!h)
return GRIB_INVALID_GRIB;
@ -2749,7 +2816,8 @@ int grib_f_copy_message_(int* gid, void* mess, size_t* len){
}
/*****************************************************************************/
void grib_f_check_(int* err,char* call,char* str,int lencall,int lenstr){
void grib_f_check_(int* err,char* call,char* str,int lencall,int lenstr)
{
char bufstr[1024]={0,};
char bufcall[1024]={0,};
grib_context* c=grib_context_get_default();
@ -2764,7 +2832,8 @@ void grib_f_check_(int* err,char* call,char* str,int lencall,int lenstr){
}
/*****************************************************************************/
int grib_f_write_(int* gid, int* fid) {
int grib_f_write_(int* gid, int* fid)
{
grib_handle *h = get_handle(*gid);
FILE* f = get_file(*fid);
const void* mess = NULL;
@ -2783,7 +2852,8 @@ int grib_f_write_(int* gid, int* fid) {
}
/*****************************************************************************/
int grib_f_multi_write_(int* gid, int* fid) {
int grib_f_multi_write_(int* gid, int* fid)
{
grib_multi_handle *h = get_multi_handle(*gid);
FILE* f = get_file(*fid);
@ -2793,7 +2863,8 @@ int grib_f_multi_write_(int* gid, int* fid) {
return grib_multi_handle_write(h,f);
}
int grib_f_multi_append_(int* ingid, int* sec,int* mgid) {
int grib_f_multi_append_(int* ingid, int* sec,int* mgid)
{
grib_handle *h = get_handle(*ingid);
grib_multi_handle *mh = get_multi_handle(*mgid);
@ -2808,18 +2879,21 @@ int grib_f_multi_append_(int* ingid, int* sec,int* mgid) {
}
/*****************************************************************************/
int codes_f_bufr_multi_element_constant_arrays_on_() {
int codes_f_bufr_multi_element_constant_arrays_on_()
{
codes_bufr_multi_element_constant_arrays_on(NULL);
return GRIB_SUCCESS;
}
int codes_f_bufr_multi_element_constant_arrays_off_() {
int codes_f_bufr_multi_element_constant_arrays_off_()
{
codes_bufr_multi_element_constant_arrays_off(NULL);
return GRIB_SUCCESS;
}
/*****************************************************************************/
int grib_f_set_definitions_path_(char* path, int len){
int grib_f_set_definitions_path_(char* path, int len)
{
grib_context* c = grib_context_get_default();
char buf[1024];
grib_context_set_definitions_path(c, cast_char(buf,path,len));
@ -2827,7 +2901,8 @@ int grib_f_set_definitions_path_(char* path, int len){
}
/*****************************************************************************/
int grib_f_set_samples_path_(char* path, int len){
int grib_f_set_samples_path_(char* path, int len)
{
grib_context* c = grib_context_get_default();
char buf[1024];
grib_context_set_samples_path(c, cast_char(buf,path,len));
@ -2835,11 +2910,13 @@ int grib_f_set_samples_path_(char* path, int len){
}
/*****************************************************************************/
int grib_f_julian_to_datetime_(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second) {
int grib_f_julian_to_datetime_(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second)
{
return grib_julian_to_datetime(*jd,year,month,day,hour,minute,second);
}
/*****************************************************************************/
int grib_f_datetime_to_julian_(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd) {
int grib_f_datetime_to_julian_(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd)
{
return grib_datetime_to_julian(*year,*month,*day,*hour,*minute,*second,jd);
}