diff --git a/src/eccodes.h b/src/eccodes.h index 713259169..44d299744 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -27,168 +27,168 @@ extern "C" { #define CODES_VERSION ECCODES_VERSION /* sections */ -#define CODES_SECTION_PRODUCT GRIB_SECTION_PRODUCT -#define CODES_SECTION_GRID GRIB_SECTION_GRID -#define CODES_SECTION_LOCAL GRIB_SECTION_LOCAL -#define CODES_SECTION_DATA GRIB_SECTION_DATA -#define CODES_SECTION_BITMAP GRIB_SECTION_BITMAP +#define CODES_SECTION_PRODUCT GRIB_SECTION_PRODUCT +#define CODES_SECTION_GRID GRIB_SECTION_GRID +#define CODES_SECTION_LOCAL GRIB_SECTION_LOCAL +#define CODES_SECTION_DATA GRIB_SECTION_DATA +#define CODES_SECTION_BITMAP GRIB_SECTION_BITMAP /* LOG MODES Log mode for information for processing information */ -#define CODES_LOG_INFO GRIB_LOG_INFO -#define CODES_LOG_WARNING GRIB_LOG_WARNING -#define CODES_LOG_ERROR GRIB_LOG_ERROR -#define CODES_LOG_FATAL GRIB_LOG_FATAL -#define CODES_LOG_DEBUG GRIB_LOG_DEBUG +#define CODES_LOG_INFO GRIB_LOG_INFO +#define CODES_LOG_WARNING GRIB_LOG_WARNING +#define CODES_LOG_ERROR GRIB_LOG_ERROR +#define CODES_LOG_FATAL GRIB_LOG_FATAL +#define CODES_LOG_DEBUG GRIB_LOG_DEBUG /* Types */ -#define CODES_TYPE_UNDEFINED GRIB_TYPE_UNDEFINED -#define CODES_TYPE_LONG GRIB_TYPE_LONG -#define CODES_TYPE_DOUBLE GRIB_TYPE_DOUBLE -#define CODES_TYPE_STRING GRIB_TYPE_STRING -#define CODES_TYPE_BYTES GRIB_TYPE_BYTES -#define CODES_TYPE_SECTION GRIB_TYPE_SECTION -#define CODES_TYPE_LABEL GRIB_TYPE_LABEL -#define CODES_TYPE_MISSING GRIB_TYPE_MISSING +#define CODES_TYPE_UNDEFINED GRIB_TYPE_UNDEFINED +#define CODES_TYPE_LONG GRIB_TYPE_LONG +#define CODES_TYPE_DOUBLE GRIB_TYPE_DOUBLE +#define CODES_TYPE_STRING GRIB_TYPE_STRING +#define CODES_TYPE_BYTES GRIB_TYPE_BYTES +#define CODES_TYPE_SECTION GRIB_TYPE_SECTION +#define CODES_TYPE_LABEL GRIB_TYPE_LABEL +#define CODES_TYPE_MISSING GRIB_TYPE_MISSING /* Missing values */ -#define CODES_MISSING_LONG GRIB_MISSING_LONG +#define CODES_MISSING_LONG GRIB_MISSING_LONG #define CODES_MISSING_DOUBLE GRIB_MISSING_DOUBLE /*set spec flags*/ #define CODES_UTIL_SET_SPEC_FLAGS_ONLY_PACKING GRIB_UTIL_SET_SPEC_FLAGS_ONLY_PACKING /* Dump option flags*/ -#define CODES_DUMP_FLAG_READ_ONLY GRIB_DUMP_FLAG_READ_ONLY -#define CODES_DUMP_FLAG_DUMP_OK GRIB_DUMP_FLAG_DUMP_OK -#define CODES_DUMP_FLAG_VALUES GRIB_DUMP_FLAG_VALUES -#define CODES_DUMP_FLAG_CODED GRIB_DUMP_FLAG_CODED -#define CODES_DUMP_FLAG_OCTECT GRIB_DUMP_FLAG_OCTECT -#define CODES_DUMP_FLAG_ALIASES GRIB_DUMP_FLAG_ALIASES -#define CODES_DUMP_FLAG_TYPE GRIB_DUMP_FLAG_TYPE -#define CODES_DUMP_FLAG_HEXADECIMAL GRIB_DUMP_FLAG_HEXADECIMAL -#define CODES_DUMP_FLAG_NO_DATA GRIB_DUMP_FLAG_NO_DATA -#define CODES_DUMP_FLAG_ALL_DATA GRIB_DUMP_FLAG_ALL_DATA -#define CODES_DUMP_FLAG_ALL_ATTRIBUTES GRIB_DUMP_FLAG_ALL_ATTRIBUTES +#define CODES_DUMP_FLAG_READ_ONLY GRIB_DUMP_FLAG_READ_ONLY +#define CODES_DUMP_FLAG_DUMP_OK GRIB_DUMP_FLAG_DUMP_OK +#define CODES_DUMP_FLAG_VALUES GRIB_DUMP_FLAG_VALUES +#define CODES_DUMP_FLAG_CODED GRIB_DUMP_FLAG_CODED +#define CODES_DUMP_FLAG_OCTECT GRIB_DUMP_FLAG_OCTECT +#define CODES_DUMP_FLAG_ALIASES GRIB_DUMP_FLAG_ALIASES +#define CODES_DUMP_FLAG_TYPE GRIB_DUMP_FLAG_TYPE +#define CODES_DUMP_FLAG_HEXADECIMAL GRIB_DUMP_FLAG_HEXADECIMAL +#define CODES_DUMP_FLAG_NO_DATA GRIB_DUMP_FLAG_NO_DATA +#define CODES_DUMP_FLAG_ALL_DATA GRIB_DUMP_FLAG_ALL_DATA +#define CODES_DUMP_FLAG_ALL_ATTRIBUTES GRIB_DUMP_FLAG_ALL_ATTRIBUTES /* codes_nearest flags */ -#define CODES_NEAREST_SAME_GRID GRIB_NEAREST_SAME_GRID -#define CODES_NEAREST_SAME_DATA GRIB_NEAREST_SAME_DATA -#define CODES_NEAREST_SAME_POINT GRIB_NEAREST_SAME_POINT +#define CODES_NEAREST_SAME_GRID GRIB_NEAREST_SAME_GRID +#define CODES_NEAREST_SAME_DATA GRIB_NEAREST_SAME_DATA +#define CODES_NEAREST_SAME_POINT GRIB_NEAREST_SAME_POINT /*! Iteration is carried out on all the keys available in the message \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_ALL_KEYS GRIB_KEYS_ITERATOR_ALL_KEYS +#define CODES_KEYS_ITERATOR_ALL_KEYS GRIB_KEYS_ITERATOR_ALL_KEYS /*! read only keys are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_READ_ONLY GRIB_KEYS_ITERATOR_SKIP_READ_ONLY +#define CODES_KEYS_ITERATOR_SKIP_READ_ONLY GRIB_KEYS_ITERATOR_SKIP_READ_ONLY /*! optional keys are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_OPTIONAL GRIB_KEYS_ITERATOR_SKIP_OPTIONAL +#define CODES_KEYS_ITERATOR_SKIP_OPTIONAL GRIB_KEYS_ITERATOR_SKIP_OPTIONAL /*! edition specific keys are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC +#define CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC /*! coded keys are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_CODED GRIB_KEYS_ITERATOR_SKIP_CODED +#define CODES_KEYS_ITERATOR_SKIP_CODED GRIB_KEYS_ITERATOR_SKIP_CODED /*! computed keys are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_COMPUTED GRIB_KEYS_ITERATOR_SKIP_COMPUTED +#define CODES_KEYS_ITERATOR_SKIP_COMPUTED GRIB_KEYS_ITERATOR_SKIP_COMPUTED /*! duplicates of a key are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_DUPLICATES GRIB_KEYS_ITERATOR_SKIP_DUPLICATES +#define CODES_KEYS_ITERATOR_SKIP_DUPLICATES GRIB_KEYS_ITERATOR_SKIP_DUPLICATES /*! function keys are skipped by keys iterator. \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_SKIP_FUNCTION GRIB_KEYS_ITERATOR_SKIP_FUNCTION +#define CODES_KEYS_ITERATOR_SKIP_FUNCTION GRIB_KEYS_ITERATOR_SKIP_FUNCTION /*! only keys present in the dump \ingroup keys_iterator \see codes_keys_iterator_new */ -#define CODES_KEYS_ITERATOR_DUMP_ONLY GRIB_KEYS_ITERATOR_DUMP_ONLY +#define CODES_KEYS_ITERATOR_DUMP_ONLY GRIB_KEYS_ITERATOR_DUMP_ONLY -typedef struct grib_values codes_values; -typedef struct grib_key_value_list codes_key_value_list; +typedef struct grib_values codes_values; +typedef struct grib_key_value_list codes_key_value_list; /*! Codes handle, structure giving access to parsed values by keys \ingroup codes_handle \struct codes_handle */ -typedef struct grib_handle codes_handle; +typedef struct grib_handle codes_handle; /*! GRIB multi field handle, structure used to build multi fields messages. \ingroup codes_handle \struct codes_multi_handle */ -typedef struct grib_multi_handle codes_multi_handle; +typedef struct grib_multi_handle codes_multi_handle; /*! Codes context, structure containing the memory methods, the parsers and the formats. \ingroup codes_context \struct codes_context */ -typedef struct grib_context codes_context; +typedef struct grib_context codes_context; /*! GRIB geoiterator, structure supporting a geographic iteration of values in a GRIB message. \ingroup iterators \struct codes_iterator */ -typedef struct grib_iterator codes_iterator; +typedef struct grib_iterator codes_iterator; /*! Codes nearest, structure used to find the nearest points of a latitude longitude point in a GRIB message. \ingroup iterators \struct codes_nearest */ -typedef struct grib_nearest codes_nearest; -typedef struct grib_box codes_box; -typedef struct grib_points codes_points; +typedef struct grib_nearest codes_nearest; +typedef struct grib_box codes_box; +typedef struct grib_points codes_points; /*! Codes keys iterator. Iterator over keys. \ingroup keys_iterator \struct codes_keys_iterator */ -typedef struct grib_keys_iterator codes_keys_iterator; -typedef struct bufr_keys_iterator codes_bufr_keys_iterator; +typedef struct grib_keys_iterator codes_keys_iterator; +typedef struct bufr_keys_iterator codes_bufr_keys_iterator; -typedef struct grib_fieldset codes_fieldset; -typedef struct grib_order_by codes_order_by; -typedef struct grib_where codes_where; -typedef struct grib_sarray codes_sarray; -typedef struct grib_oarray codes_oarray; -typedef struct grib_darray codes_darray; -typedef struct grib_iarray codes_iarray; -typedef struct grib_vdarray codes_vdarray; -typedef struct grib_vsarray codes_vsarray; -typedef struct grib_viarray codes_viarray; -typedef struct grib_string_list codes_string_list; +typedef struct grib_fieldset codes_fieldset; +typedef struct grib_order_by codes_order_by; +typedef struct grib_where codes_where; +typedef struct grib_sarray codes_sarray; +typedef struct grib_oarray codes_oarray; +typedef struct grib_darray codes_darray; +typedef struct grib_iarray codes_iarray; +typedef struct grib_vdarray codes_vdarray; +typedef struct grib_vsarray codes_vsarray; +typedef struct grib_viarray codes_viarray; +typedef struct grib_string_list codes_string_list; typedef struct grib_util_packing_spec codes_util_packing_spec; -typedef struct grib_util_grid_spec codes_util_grid_spec; +typedef struct grib_util_grid_spec codes_util_grid_spec; -codes_fieldset *codes_fieldset_new_from_files(codes_context *c, char *filenames[], int nfiles, char **keys, int nkeys, const char *where_string, const char *order_by_string, int *err); +codes_fieldset* codes_fieldset_new_from_files(codes_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err); void codes_fieldset_delete(codes_fieldset* set); void codes_fieldset_rewind(codes_fieldset* set); -int codes_fieldset_apply_order_by(codes_fieldset* set, const char* order_by_string); +int codes_fieldset_apply_order_by(codes_fieldset* set, const char* order_by_string); codes_handle* codes_fieldset_next_handle(codes_fieldset* set, int* err); -int codes_fieldset_count(codes_fieldset *set); -int codes_values_check(codes_handle* h, codes_values* values, int count); +int codes_fieldset_count(codes_fieldset* set); +int codes_values_check(codes_handle* h, codes_values* values, int count); /*! \defgroup codes_index The indexing feature The codes_index is the structure giving indexed access to messages in a file. @@ -199,7 +199,7 @@ The codes_index is the structure giving indexed access to messages in a file. * \ingroup codes_index * \struct codes_index */ -typedef struct grib_index codes_index; +typedef struct grib_index codes_index; /** * Create a new index form a file. The file is indexed with the keys in argument. @@ -214,7 +214,7 @@ typedef struct grib_index codes_index; * @param err : 0 if OK, integer value on error * @return the newly created index */ -codes_index* codes_index_new_from_file(codes_context* c, char* filename, const char* keys, int *err); +codes_index* codes_index_new_from_file(codes_context* c, char* filename, const char* keys, int* err); /** * Create a new index based on a set of keys. @@ -228,7 +228,7 @@ codes_index* codes_index_new_from_file(codes_context* c, char* filename, const c * @param err : 0 if OK, integer value on error * @return the newly created index */ -codes_index* codes_index_new(codes_context* c, const char* keys, int *err); +codes_index* codes_index_new(codes_context* c, const char* keys, int* err); /** * Indexes the file given in argument in the index given in argument. @@ -237,9 +237,9 @@ codes_index* codes_index_new(codes_context* c, const char* keys, int *err); * @param filename : name of the file of messages to be indexed * @return 0 if OK, integer value on error */ -int codes_index_add_file(codes_index* index, const char *filename); -int codes_index_write(codes_index* index, const char *filename); -codes_index* codes_index_read(codes_context* c, const char* filename, int *err); +int codes_index_add_file(codes_index* index, const char* filename); +int codes_index_write(codes_index* index, const char* filename); +codes_index* codes_index_read(codes_context* c, const char* filename, int* err); /** * Get the number of distinct values of the key in argument contained in the index. The key must belong to the index. @@ -262,7 +262,7 @@ int codes_index_get_size(const codes_index* index, const char* key, size_t* size * @param size : size of the values array * @return 0 if OK, integer value on error */ -int codes_index_get_long(const codes_index* index, const char* key, long* values, size_t *size); +int codes_index_get_long(const codes_index* index, const char* key, long* values, size_t* size); /** * Get the distinct values of the key in argument contained in the index. The key must belong to the index. This function is used when the type of the key was explicitly defined as double or when the native type of the key is double. @@ -274,7 +274,7 @@ int codes_index_get_long(const codes_index* index, const char* key, long* values * @param size : size of the values array * @return 0 if OK, integer value on error */ -int codes_index_get_double(const codes_index* index, const char* key, double* values, size_t *size); +int codes_index_get_double(const codes_index* index, const char* key, double* values, size_t* size); /** * Get the distinct values of the key in argument contained in the index. The key must belong to the index. This function is used when the type of the key was explicitly defined as string or when the native type of the key is string. @@ -286,7 +286,7 @@ int codes_index_get_double(const codes_index* index, const char* key, double* va * @param size : size of the values array * @return 0 if OK, integer value on error */ -int codes_index_get_string(const codes_index* index, const char* key, char** values, size_t *size); +int codes_index_get_string(const codes_index* index, const char* key, char** values, size_t* size); /** @@ -331,7 +331,7 @@ int codes_index_select_string(codes_index* index, const char* key, char* value); * @param err : 0 if OK, integer value on error. CODES_END_OF_INDEX when no more handles are contained in the index. * @return grib handle. */ -codes_handle* codes_handle_new_from_index(codes_index* index, int *err); +codes_handle* codes_handle_new_from_index(codes_index* index, int* err); /** * Delete the index. @@ -417,7 +417,7 @@ codes_handle* codes_bufr_handle_new_from_file(codes_context* c, FILE* f, int* er */ int codes_write_message(const codes_handle* h, const char* file, const char* mode); -codes_handle* codes_grib_util_sections_copy(codes_handle* hfrom, codes_handle* hto, int what, int *err); +codes_handle* codes_grib_util_sections_copy(codes_handle* hfrom, codes_handle* hto, int what, int* err); codes_string_list* codes_grib_util_get_param_id(const char* mars_param); codes_string_list* codes_grib_util_get_mars_param(const char* param_id); @@ -444,7 +444,7 @@ codes_handle* codes_handle_new_from_message(codes_context* c, const void* data, * @return the new handle, NULL if the message is invalid or a problem is encountered */ codes_handle* codes_grib_handle_new_from_multi_message(codes_context* c, void** data, - size_t *data_len, int* error); + size_t* data_len, int* error); /** * Create a handle from a user message. The message is copied and will be freed with the handle @@ -552,7 +552,7 @@ int codes_grib_multi_handle_write(codes_multi_handle* mh, FILE* f); * @param message_length : On exit, the message size in number of bytes * @return 0 if OK, integer value on error */ -int codes_get_message(const codes_handle* h, const void** message, size_t *message_length); +int codes_get_message(const codes_handle* h, const void** message, size_t* message_length); /** @@ -564,7 +564,7 @@ int codes_get_message(const codes_handle* h, const void** message, size_t *messa * On exit, the actual message length in number of bytes * @return 0 if OK, integer value on error */ -int codes_get_message_copy(const codes_handle* h, void* message, size_t *message_length); +int codes_get_message_copy(const codes_handle* h, void* message, size_t* message_length); /*! @} */ /*! \defgroup iterators Iterating on latitude/longitude/values */ @@ -591,7 +591,7 @@ codes_iterator* codes_grib_iterator_new(const codes_handle* h, unsigned long fla * @param values : returned array of data values * @return 0 if OK, integer value on error */ -int codes_grib_get_data(const codes_handle *h, double *lats, double *lons, double *values); +int codes_grib_get_data(const codes_handle* h, double* lats, double* lons, double* values); /** * Get the next value from a geoiterator. @@ -602,7 +602,7 @@ int codes_grib_get_data(const codes_handle *h, double *lats, double *lons, doubl * @param value : on output value of the point * @return positive value if successful, 0 if no more data are available */ -int codes_grib_iterator_next(codes_iterator *i, double* lat, double* lon, double* value); +int codes_grib_iterator_next(codes_iterator* i, double* lat, double* lon, double* value); /** * Get the previous value from a geoiterator. @@ -613,7 +613,7 @@ int codes_grib_iterator_next(codes_iterator *i, double* lat, double* lon, double * @param value : on output value of the point* * @return positive value if successful, 0 if no more data are available */ -int codes_grib_iterator_previous(codes_iterator *i, double* lat, double* lon, double* value); +int codes_grib_iterator_previous(codes_iterator* i, double* lat, double* lon, double* value); /** * Test procedure for values in a geoiterator. @@ -621,7 +621,7 @@ int codes_grib_iterator_previous(codes_iterator *i, double* lat, double* lon, do * @param i : the geoiterator * @return boolean, 1 if the iterator still nave next values, 0 otherwise */ -int codes_grib_iterator_has_next(codes_iterator *i); +int codes_grib_iterator_has_next(codes_iterator* i); /** * Test procedure for values in a geoiterator. @@ -629,7 +629,7 @@ int codes_grib_iterator_has_next(codes_iterator *i); * @param i : the geoiterator * @return 0 if OK, integer value on error */ -int codes_grib_iterator_reset(codes_iterator *i); +int codes_grib_iterator_reset(codes_iterator* i); /** * Frees the geoiterator from memory. @@ -637,7 +637,7 @@ int codes_grib_iterator_reset(codes_iterator *i); * @param i : the geoiterator * @return 0 if OK, integer value on error */ -int codes_grib_iterator_delete(codes_iterator *i); +int codes_grib_iterator_delete(codes_iterator* i); /*! * \brief Create a new nearest neighbour object from a handle, using current geometry. @@ -669,9 +669,9 @@ codes_nearest* codes_grib_nearest_new(const codes_handle* h, int* error); * @param len : size of the arrays * @return 0 if OK, integer value on error */ -int codes_grib_nearest_find(codes_nearest *nearest, const codes_handle* h, double inlat, double inlon, - unsigned long flags, double* outlats, double* outlons, - double* values, double* distances, int* indexes, size_t *len); +int codes_grib_nearest_find(codes_nearest* nearest, const codes_handle* h, double inlat, double inlon, + unsigned long flags, double* outlats, double* outlons, + double* values, double* distances, int* indexes, size_t* len); /** * Frees an nearest from memory @@ -679,7 +679,7 @@ int codes_grib_nearest_find(codes_nearest *nearest, const codes_handle* h, doubl * @param nearest : the nearest * @return 0 if OK, integer value on error */ -int codes_grib_nearest_delete(codes_nearest *nearest); +int codes_grib_nearest_delete(codes_nearest* nearest); /** * Find the nearest point of a set of points whose latitudes and longitudes @@ -706,9 +706,9 @@ int codes_grib_nearest_delete(codes_nearest *nearest); * @return 0 if OK, integer value on error */ int codes_grib_nearest_find_multiple(const codes_handle* h, int is_lsm, - const double* inlats, const double* inlons, long npoints, - double* outlats, double* outlons, - double* values, double* distances, int* indexes); + const double* inlats, const double* inlons, long npoints, + double* outlats, double* outlons, + double* values, double* distances, int* indexes); /* @} */ @@ -733,7 +733,7 @@ int codes_get_offset(const codes_handle* h, const char* key, size_t* offset); * @param size : the address of a size_t where the size will be set * @return 0 if OK, integer value on error */ -int codes_get_size(const codes_handle* h, const char* key, size_t *size); +int codes_get_size(const codes_handle* h, const char* key, size_t* size); /** * Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned @@ -743,7 +743,7 @@ int codes_get_size(const codes_handle* h, const char* key, size_t *size); * @param length : the address of a size_t where the length will be set * @return 0 if OK, integer value on error */ -int codes_get_length(const codes_handle* h, const char* key, size_t *length); +int codes_get_length(const codes_handle* h, const char* key, size_t* length); /** * Get a long value from a key, if several keys of the same name are present, the last one is returned @@ -800,7 +800,7 @@ int codes_get_double_elements(const codes_handle* h, const char* key, int* i, lo * @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output * @return 0 if OK, integer value on error */ -int codes_get_string(const codes_handle* h, const char* key, char* mesg, size_t *length); +int codes_get_string(const codes_handle* h, const char* key, char* mesg, size_t* length); /** * Get string array values from a key. If several keys of the same name are present, the last one is returned @@ -812,7 +812,7 @@ int codes_get_string(const codes_handle* h, const char* key, char* mesg, size_t * @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output * @return 0 if OK, integer value on error */ -int codes_get_string_array(const codes_handle* h, const char* key, char** vals, size_t *length); +int codes_get_string_array(const codes_handle* h, const char* key, char** vals, size_t* length); /** * Get raw bytes values from a key. If several keys of the same name are present, the last one is returned @@ -824,7 +824,7 @@ int codes_get_string_array(const codes_handle* h, const char* key, char** vals, * @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output * @return 0 if OK, integer value on error */ -int codes_get_bytes(const codes_handle* h, const char* key, unsigned char* bytes, size_t *length); +int codes_get_bytes(const codes_handle* h, const char* key, unsigned char* bytes, size_t* length); /** * Get double array values from a key. If several keys of the same name are present, the last one is returned @@ -836,7 +836,7 @@ int codes_get_bytes(const codes_handle* h, const char* key, unsigned char* bytes * @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output * @return 0 if OK, integer value on error */ -int codes_get_double_array(const codes_handle* h, const char* key, double* vals, size_t *length); +int codes_get_double_array(const codes_handle* h, const char* key, double* vals, size_t* length); /** * Get long array values from a key. If several keys of the same name are present, the last one is returned @@ -848,7 +848,7 @@ int codes_get_double_array(const codes_handle* h, const char* key, double* vals, * @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output * @return 0 if OK, integer value on error */ -int codes_get_long_array(const codes_handle* h, const char* key, long* vals, size_t *length); +int codes_get_long_array(const codes_handle* h, const char* key, long* vals, size_t* length); /* setting data */ @@ -895,7 +895,7 @@ int codes_set_double(codes_handle* h, const char* key, double val); * @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output * @return 0 if OK, integer value on error */ -int codes_set_string(codes_handle* h, const char* key , const char* mesg, size_t *length); +int codes_set_string(codes_handle* h, const char* key, const char* mesg, size_t* length); /** * Set a bytes array from a key. If several keys of the same name are present, the last one is set @@ -907,7 +907,7 @@ int codes_set_string(codes_handle* h, const char* key , const char* mesg, size_ * @param length : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output * @return 0 if OK, integer value on error */ -int codes_set_bytes(codes_handle* h, const char* key, const unsigned char* bytes, size_t *length); +int codes_set_bytes(codes_handle* h, const char* key, const unsigned char* bytes, size_t* length); /** * Set a double array from a key. If several keys of the same name are present, the last one is set @@ -950,7 +950,7 @@ int codes_set_long_array(codes_handle* h, const char* key, const long* vals, siz * @param length : a size_t that contains the length of the array on input * @return 0 if OK, integer value on error */ -int codes_set_string_array(codes_handle *h, const char *key, const char **vals, size_t length); +int codes_set_string_array(codes_handle* h, const char* key, const char** vals, size_t length); /*! @} */ @@ -1088,8 +1088,8 @@ void codes_grib_multi_support_off(codes_context* c); */ void codes_grib_multi_support_reset_file(codes_context* c, FILE* f); -char* codes_samples_path(const codes_context *c); -char* codes_definition_path(const codes_context *c); +char* codes_samples_path(const codes_context* c); +char* codes_definition_path(const codes_context* c); /*! @} */ /** @@ -1140,7 +1140,7 @@ codes_keys_iterator* codes_keys_iterator_new(codes_handle* h, unsigned long filt * structure as the aim is to copy what is possible to be copied. * This will allow the user to add something to a message by creating a new message with additions or changes to the * unexpandedDescriptors and copying what is possible to copy from the original message. */ -char **codes_bufr_copy_data_return_copied_keys(codes_handle *hin, codes_handle *hout, size_t *nkeys, int *err); +char** codes_bufr_copy_data_return_copied_keys(codes_handle* hin, codes_handle* hout, size_t* nkeys, int* err); int codes_bufr_copy_data(codes_handle* hin, codes_handle* hout); @@ -1148,14 +1148,14 @@ int codes_bufr_copy_data(codes_handle* hin, codes_handle* hout); * @param kiter : valid codes_keys_iterator * @return 1 if next iterator exists, 0 if no more elements to iterate on */ -int codes_keys_iterator_next(codes_keys_iterator *kiter); +int codes_keys_iterator_next(codes_keys_iterator* kiter); /*! get the key name from the keys iterator * @param kiter : valid codes_keys_iterator * @return key name */ -const char* codes_keys_iterator_get_name(const codes_keys_iterator *kiter); +const char* codes_keys_iterator_get_name(const codes_keys_iterator* kiter); /*! Delete the keys iterator. * @param kiter : valid codes_keys_iterator @@ -1170,11 +1170,11 @@ int codes_keys_iterator_delete(codes_keys_iterator* kiter); int codes_keys_iterator_rewind(codes_keys_iterator* kiter); -int codes_keys_iterator_set_flags(codes_keys_iterator *kiter, unsigned long flags); -int codes_keys_iterator_get_long(const codes_keys_iterator *kiter, long *v, size_t *len); -int codes_keys_iterator_get_double(const codes_keys_iterator *kiter, double *v, size_t *len); -int codes_keys_iterator_get_string(const codes_keys_iterator *kiter, char *v, size_t *len); -int codes_keys_iterator_get_bytes(const codes_keys_iterator *kiter, unsigned char *v, size_t *len); +int codes_keys_iterator_set_flags(codes_keys_iterator* kiter, unsigned long flags); +int codes_keys_iterator_get_long(const codes_keys_iterator* kiter, long* v, size_t* len); +int codes_keys_iterator_get_double(const codes_keys_iterator* kiter, double* v, size_t* len); +int codes_keys_iterator_get_string(const codes_keys_iterator* kiter, char* v, size_t* len); +int codes_keys_iterator_get_bytes(const codes_keys_iterator* kiter, unsigned char* v, size_t* len); /* @} */ @@ -1192,7 +1192,7 @@ const char* codes_get_type_name(int type); int codes_get_native_type(const codes_handle* h, const char* name, int* type); void codes_check(const char* call, const char* file, int line, int e, const char* msg); -#define CODES_CHECK(a, msg) GRIB_CHECK(a, msg) +#define CODES_CHECK(a, msg) GRIB_CHECK(a, msg) #define CODES_CHECK_NOLINE(a, msg) GRIB_CHECK_NOLINE(a, msg) @@ -1205,13 +1205,13 @@ int codes_set_missing(codes_handle* h, const char* key); /* The truncation is the Gaussian number (or order) */ int codes_get_gaussian_latitudes(long truncation, double* latitudes); -int codes_julian_to_datetime(double jd, long *year, long *month, long *day, long *hour, long *minute, long *second); -int codes_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double *jd); +int codes_julian_to_datetime(double jd, long* year, long* month, long* day, long* hour, long* minute, long* second); +int codes_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double* jd); long codes_julian_to_date(long jdate); long codes_date_to_julian(long ddate); void codes_get_reduced_row(long pl, double lon_first, double lon_last, long* npoints, long* ilon_first, long* ilon_last); -void codes_get_reduced_row_p(long pl, double lon_first, double lon_last, long *npoints, double *olon_first, double *olon_last); +void codes_get_reduced_row_p(long pl, double lon_first, double lon_last, long* npoints, double* olon_first, double* olon_last); /* read products */ @@ -1222,45 +1222,45 @@ int codes_check_message_header(const void* bytes, size_t length, ProductKind pro int codes_check_message_footer(const void* bytes, size_t length, ProductKind product); codes_box* codes_box_new(codes_handle* h, int* error); -codes_points* codes_box_get_points(codes_box *box, double north, double west, double south, double east, int *err); +codes_points* codes_box_get_points(codes_box* box, double north, double west, double south, double east, int* err); int codes_points_get_values(codes_handle* h, codes_points* points, double* val); /* --------------------------------------- */ -#define CODES_UTIL_GRID_SPEC_REGULAR_LL GRIB_UTIL_GRID_SPEC_REGULAR_LL -#define CODES_UTIL_GRID_SPEC_ROTATED_LL GRIB_UTIL_GRID_SPEC_ROTATED_LL -#define CODES_UTIL_GRID_SPEC_REGULAR_GG GRIB_UTIL_GRID_SPEC_REGULAR_GG -#define CODES_UTIL_GRID_SPEC_ROTATED_GG GRIB_UTIL_GRID_SPEC_ROTATED_GG -#define CODES_UTIL_GRID_SPEC_REDUCED_GG GRIB_UTIL_GRID_SPEC_REDUCED_GG -#define CODES_UTIL_GRID_SPEC_SH GRIB_UTIL_GRID_SPEC_SH -#define CODES_UTIL_GRID_SPEC_REDUCED_LL GRIB_UTIL_GRID_SPEC_REDUCED_LL -#define CODES_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC -#define CODES_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA -#define CODES_UTIL_GRID_SPEC_LAMBERT_CONFORMAL GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL -#define CODES_UTIL_GRID_SPEC_UNSTRUCTURED GRIB_UTIL_GRID_SPEC_UNSTRUCTURED +#define CODES_UTIL_GRID_SPEC_REGULAR_LL GRIB_UTIL_GRID_SPEC_REGULAR_LL +#define CODES_UTIL_GRID_SPEC_ROTATED_LL GRIB_UTIL_GRID_SPEC_ROTATED_LL +#define CODES_UTIL_GRID_SPEC_REGULAR_GG GRIB_UTIL_GRID_SPEC_REGULAR_GG +#define CODES_UTIL_GRID_SPEC_ROTATED_GG GRIB_UTIL_GRID_SPEC_ROTATED_GG +#define CODES_UTIL_GRID_SPEC_REDUCED_GG GRIB_UTIL_GRID_SPEC_REDUCED_GG +#define CODES_UTIL_GRID_SPEC_SH GRIB_UTIL_GRID_SPEC_SH +#define CODES_UTIL_GRID_SPEC_REDUCED_LL GRIB_UTIL_GRID_SPEC_REDUCED_LL +#define CODES_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC +#define CODES_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA +#define CODES_UTIL_GRID_SPEC_LAMBERT_CONFORMAL GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL +#define CODES_UTIL_GRID_SPEC_UNSTRUCTURED GRIB_UTIL_GRID_SPEC_UNSTRUCTURED -#define CODES_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX -#define CODES_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE -#define CODES_UTIL_PACKING_TYPE_JPEG GRIB_UTIL_PACKING_TYPE_JPEG -#define CODES_UTIL_PACKING_TYPE_GRID_COMPLEX GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX -#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE -#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX -#define CODES_UTIL_PACKING_TYPE_GRID_SECOND_ORDER GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER -#define CODES_UTIL_PACKING_SAME_AS_INPUT GRIB_UTIL_PACKING_SAME_AS_INPUT -#define CODES_UTIL_PACKING_USE_PROVIDED GRIB_UTIL_PACKING_USE_PROVIDED -#define CODES_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT -#define CODES_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES +#define CODES_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX +#define CODES_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE +#define CODES_UTIL_PACKING_TYPE_JPEG GRIB_UTIL_PACKING_TYPE_JPEG +#define CODES_UTIL_PACKING_TYPE_GRID_COMPLEX GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX +#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE +#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX +#define CODES_UTIL_PACKING_TYPE_GRID_SECOND_ORDER GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER +#define CODES_UTIL_PACKING_SAME_AS_INPUT GRIB_UTIL_PACKING_SAME_AS_INPUT +#define CODES_UTIL_PACKING_USE_PROVIDED GRIB_UTIL_PACKING_USE_PROVIDED +#define CODES_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT +#define CODES_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES #define CODES_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT -#define CODES_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR +#define CODES_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR -codes_handle *codes_grib_util_set_spec(codes_handle *h, - const codes_util_grid_spec *grid_spec, - const codes_util_packing_spec *packing_spec, /* NULL for defaults (same as input) */ - int flags, - const double *data_values, - size_t data_values_count, - int *err); +codes_handle* codes_grib_util_set_spec(codes_handle* h, + const codes_util_grid_spec* grid_spec, + const codes_util_packing_spec* packing_spec, /* NULL for defaults (same as input) */ + int flags, + const double* data_values, + size_t data_values_count, + int* err); /* EXPERIMENTAL FEATURE * Build an array of headers from input BUFR file. @@ -1271,7 +1271,7 @@ codes_handle *codes_grib_util_set_spec(codes_handle *h, * returns 0 if OK, integer value on error. */ int codes_bufr_extract_headers_malloc(codes_context* c, const char* filename, codes_bufr_header** result, int* num_messages, int strict_mode); -int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char *val, size_t *len); +int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* val, size_t* len); /* --------------------------------------- */ #ifdef __cplusplus @@ -1286,140 +1286,140 @@ Error codes returned by the eccodes functions. */ /*! @{*/ /** No error */ -#define CODES_SUCCESS GRIB_SUCCESS +#define CODES_SUCCESS GRIB_SUCCESS /** End of resource reached */ -#define CODES_END_OF_FILE GRIB_END_OF_FILE +#define CODES_END_OF_FILE GRIB_END_OF_FILE /** Internal error */ -#define CODES_INTERNAL_ERROR GRIB_INTERNAL_ERROR +#define CODES_INTERNAL_ERROR GRIB_INTERNAL_ERROR /** Passed buffer is too small */ -#define CODES_BUFFER_TOO_SMALL GRIB_BUFFER_TOO_SMALL +#define CODES_BUFFER_TOO_SMALL GRIB_BUFFER_TOO_SMALL /** Function not yet implemented */ -#define CODES_NOT_IMPLEMENTED GRIB_NOT_IMPLEMENTED +#define CODES_NOT_IMPLEMENTED GRIB_NOT_IMPLEMENTED /** Missing 7777 at end of message */ -#define CODES_7777_NOT_FOUND GRIB_7777_NOT_FOUND +#define CODES_7777_NOT_FOUND GRIB_7777_NOT_FOUND /** Passed array is too small */ -#define CODES_ARRAY_TOO_SMALL GRIB_ARRAY_TOO_SMALL +#define CODES_ARRAY_TOO_SMALL GRIB_ARRAY_TOO_SMALL /** File not found */ -#define CODES_FILE_NOT_FOUND GRIB_FILE_NOT_FOUND +#define CODES_FILE_NOT_FOUND GRIB_FILE_NOT_FOUND /** Code not found in code table */ -#define CODES_CODE_NOT_FOUND_IN_TABLE GRIB_CODE_NOT_FOUND_IN_TABLE +#define CODES_CODE_NOT_FOUND_IN_TABLE GRIB_CODE_NOT_FOUND_IN_TABLE /** Array size mismatch */ -#define CODES_WRONG_ARRAY_SIZE GRIB_WRONG_ARRAY_SIZE +#define CODES_WRONG_ARRAY_SIZE GRIB_WRONG_ARRAY_SIZE /** Key/value not found */ -#define CODES_NOT_FOUND GRIB_NOT_FOUND +#define CODES_NOT_FOUND GRIB_NOT_FOUND /** Input output problem */ -#define CODES_IO_PROBLEM GRIB_IO_PROBLEM +#define CODES_IO_PROBLEM GRIB_IO_PROBLEM /** Message invalid */ -#define CODES_INVALID_MESSAGE GRIB_INVALID_MESSAGE +#define CODES_INVALID_MESSAGE GRIB_INVALID_MESSAGE /** Decoding invalid */ -#define CODES_DECODING_ERROR GRIB_DECODING_ERROR +#define CODES_DECODING_ERROR GRIB_DECODING_ERROR /** Encoding invalid */ -#define CODES_ENCODING_ERROR GRIB_ENCODING_ERROR +#define CODES_ENCODING_ERROR GRIB_ENCODING_ERROR /** Code cannot unpack because of string too small */ -#define CODES_NO_MORE_IN_SET GRIB_NO_MORE_IN_SET +#define CODES_NO_MORE_IN_SET GRIB_NO_MORE_IN_SET /** Problem with calculation of geographic attributes */ -#define CODES_GEOCALCULUS_PROBLEM GRIB_GEOCALCULUS_PROBLEM +#define CODES_GEOCALCULUS_PROBLEM GRIB_GEOCALCULUS_PROBLEM /** Memory allocation error */ -#define CODES_OUT_OF_MEMORY GRIB_OUT_OF_MEMORY +#define CODES_OUT_OF_MEMORY GRIB_OUT_OF_MEMORY /** Value is read only */ -#define CODES_READ_ONLY GRIB_READ_ONLY +#define CODES_READ_ONLY GRIB_READ_ONLY /** Invalid argument */ -#define CODES_INVALID_ARGUMENT GRIB_INVALID_ARGUMENT +#define CODES_INVALID_ARGUMENT GRIB_INVALID_ARGUMENT /** Null handle */ -#define CODES_NULL_HANDLE GRIB_NULL_HANDLE +#define CODES_NULL_HANDLE GRIB_NULL_HANDLE /** Invalid section number */ -#define CODES_INVALID_SECTION_NUMBER GRIB_INVALID_SECTION_NUMBER +#define CODES_INVALID_SECTION_NUMBER GRIB_INVALID_SECTION_NUMBER /** Value cannot be missing */ -#define CODES_VALUE_CANNOT_BE_MISSING GRIB_VALUE_CANNOT_BE_MISSING +#define CODES_VALUE_CANNOT_BE_MISSING GRIB_VALUE_CANNOT_BE_MISSING /** Wrong message length */ -#define CODES_WRONG_LENGTH GRIB_WRONG_LENGTH +#define CODES_WRONG_LENGTH GRIB_WRONG_LENGTH /** Invalid key type */ -#define CODES_INVALID_TYPE GRIB_INVALID_TYPE +#define CODES_INVALID_TYPE GRIB_INVALID_TYPE /** Unable to set step */ -#define CODES_WRONG_STEP GRIB_WRONG_STEP +#define CODES_WRONG_STEP GRIB_WRONG_STEP /** Wrong units for step (step must be integer) */ -#define CODES_WRONG_STEP_UNIT GRIB_WRONG_STEP_UNIT +#define CODES_WRONG_STEP_UNIT GRIB_WRONG_STEP_UNIT /** Invalid file id */ -#define CODES_INVALID_FILE GRIB_INVALID_FILE +#define CODES_INVALID_FILE GRIB_INVALID_FILE /** Invalid grib id */ -#define CODES_INVALID_GRIB GRIB_INVALID_GRIB +#define CODES_INVALID_GRIB GRIB_INVALID_GRIB /** Invalid index id */ -#define CODES_INVALID_INDEX GRIB_INVALID_INDEX +#define CODES_INVALID_INDEX GRIB_INVALID_INDEX /** Invalid iterator id */ -#define CODES_INVALID_ITERATOR GRIB_INVALID_ITERATOR +#define CODES_INVALID_ITERATOR GRIB_INVALID_ITERATOR /** Invalid keys iterator id */ -#define CODES_INVALID_KEYS_ITERATOR GRIB_INVALID_KEYS_ITERATOR +#define CODES_INVALID_KEYS_ITERATOR GRIB_INVALID_KEYS_ITERATOR /** Invalid nearest id */ -#define CODES_INVALID_NEAREST GRIB_INVALID_NEAREST +#define CODES_INVALID_NEAREST GRIB_INVALID_NEAREST /** Invalid order by */ -#define CODES_INVALID_ORDERBY GRIB_INVALID_ORDERBY +#define CODES_INVALID_ORDERBY GRIB_INVALID_ORDERBY /** Missing a key from the fieldset */ -#define CODES_MISSING_KEY GRIB_MISSING_KEY +#define CODES_MISSING_KEY GRIB_MISSING_KEY /** The point is out of the grid area */ -#define CODES_OUT_OF_AREA GRIB_OUT_OF_AREA +#define CODES_OUT_OF_AREA GRIB_OUT_OF_AREA /** Concept no match */ -#define CODES_CONCEPT_NO_MATCH GRIB_CONCEPT_NO_MATCH +#define CODES_CONCEPT_NO_MATCH GRIB_CONCEPT_NO_MATCH /** Hash array no match */ -#define CODES_HASH_ARRAY_NO_MATCH GRIB_HASH_ARRAY_NO_MATCH +#define CODES_HASH_ARRAY_NO_MATCH GRIB_HASH_ARRAY_NO_MATCH /** Definitions files not found */ -#define CODES_NO_DEFINITIONS GRIB_NO_DEFINITIONS +#define CODES_NO_DEFINITIONS GRIB_NO_DEFINITIONS /** Wrong type while packing */ -#define CODES_WRONG_TYPE GRIB_WRONG_TYPE +#define CODES_WRONG_TYPE GRIB_WRONG_TYPE /** End of resource */ -#define CODES_END GRIB_END +#define CODES_END GRIB_END /** Unable to code a field without values */ -#define CODES_NO_VALUES GRIB_NO_VALUES +#define CODES_NO_VALUES GRIB_NO_VALUES /** Grid description is wrong or inconsistent */ -#define CODES_WRONG_GRID GRIB_WRONG_GRID +#define CODES_WRONG_GRID GRIB_WRONG_GRID /** End of index reached */ -#define CODES_END_OF_INDEX GRIB_END_OF_INDEX +#define CODES_END_OF_INDEX GRIB_END_OF_INDEX /** Null index */ -#define CODES_NULL_INDEX GRIB_NULL_INDEX +#define CODES_NULL_INDEX GRIB_NULL_INDEX /** End of resource reached when reading message */ -#define CODES_PREMATURE_END_OF_FILE GRIB_PREMATURE_END_OF_FILE +#define CODES_PREMATURE_END_OF_FILE GRIB_PREMATURE_END_OF_FILE /** An internal array is too small */ -#define CODES_INTERNAL_ARRAY_TOO_SMALL GRIB_INTERNAL_ARRAY_TOO_SMALL +#define CODES_INTERNAL_ARRAY_TOO_SMALL GRIB_INTERNAL_ARRAY_TOO_SMALL /** Message is too large for the current architecture */ -#define CODES_MESSAGE_TOO_LARGE GRIB_MESSAGE_TOO_LARGE +#define CODES_MESSAGE_TOO_LARGE GRIB_MESSAGE_TOO_LARGE /** Constant field */ -#define CODES_CONSTANT_FIELD GRIB_CONSTANT_FIELD +#define CODES_CONSTANT_FIELD GRIB_CONSTANT_FIELD /** Switch unable to find a matching case */ -#define CODES_SWITCH_NO_MATCH GRIB_SWITCH_NO_MATCH +#define CODES_SWITCH_NO_MATCH GRIB_SWITCH_NO_MATCH /** Underflow */ -#define CODES_UNDERFLOW GRIB_UNDERFLOW +#define CODES_UNDERFLOW GRIB_UNDERFLOW /** Message malformed */ -#define CODES_MESSAGE_MALFORMED GRIB_MESSAGE_MALFORMED +#define CODES_MESSAGE_MALFORMED GRIB_MESSAGE_MALFORMED /** Index is corrupted */ -#define CODES_CORRUPTED_INDEX GRIB_CORRUPTED_INDEX +#define CODES_CORRUPTED_INDEX GRIB_CORRUPTED_INDEX /** Invalid number of bits per value */ -#define CODES_INVALID_BPV GRIB_INVALID_BPV +#define CODES_INVALID_BPV GRIB_INVALID_BPV /** Edition of two messages is different */ -#define CODES_DIFFERENT_EDITION GRIB_DIFFERENT_EDITION +#define CODES_DIFFERENT_EDITION GRIB_DIFFERENT_EDITION /** Value is different */ -#define CODES_VALUE_DIFFERENT GRIB_VALUE_DIFFERENT +#define CODES_VALUE_DIFFERENT GRIB_VALUE_DIFFERENT /** Invalid key value */ -#define CODES_INVALID_KEY_VALUE GRIB_INVALID_KEY_VALUE +#define CODES_INVALID_KEY_VALUE GRIB_INVALID_KEY_VALUE /** String is smaller than requested */ -#define CODES_STRING_TOO_SMALL GRIB_STRING_TOO_SMALL +#define CODES_STRING_TOO_SMALL GRIB_STRING_TOO_SMALL /** Wrong type conversion */ -#define CODES_WRONG_CONVERSION GRIB_WRONG_CONVERSION +#define CODES_WRONG_CONVERSION GRIB_WRONG_CONVERSION /** Missing BUFR table entry for descriptor */ -#define CODES_MISSING_BUFR_ENTRY GRIB_MISSING_BUFR_ENTRY +#define CODES_MISSING_BUFR_ENTRY GRIB_MISSING_BUFR_ENTRY /** Null pointer */ -#define CODES_NULL_POINTER GRIB_NULL_POINTER +#define CODES_NULL_POINTER GRIB_NULL_POINTER /** Attribute is already present, cannot add */ -#define CODES_ATTRIBUTE_CLASH GRIB_ATTRIBUTE_CLASH +#define CODES_ATTRIBUTE_CLASH GRIB_ATTRIBUTE_CLASH /** Too many attributes. Increase MAX_ACCESSOR_ATTRIBUTES */ -#define CODES_TOO_MANY_ATTRIBUTES GRIB_TOO_MANY_ATTRIBUTES +#define CODES_TOO_MANY_ATTRIBUTES GRIB_TOO_MANY_ATTRIBUTES /** Attribute not found. */ -#define CODES_ATTRIBUTE_NOT_FOUND GRIB_ATTRIBUTE_NOT_FOUND +#define CODES_ATTRIBUTE_NOT_FOUND GRIB_ATTRIBUTE_NOT_FOUND /** Edition not supported. */ -#define CODES_UNSUPPORTED_EDITION GRIB_UNSUPPORTED_EDITION +#define CODES_UNSUPPORTED_EDITION GRIB_UNSUPPORTED_EDITION /** Value out of coding range */ -#define CODES_OUT_OF_RANGE GRIB_OUT_OF_RANGE +#define CODES_OUT_OF_RANGE GRIB_OUT_OF_RANGE /** Size of bitmap is incorrect */ -#define CODES_WRONG_BITMAP_SIZE GRIB_WRONG_BITMAP_SIZE +#define CODES_WRONG_BITMAP_SIZE GRIB_WRONG_BITMAP_SIZE /** Functionality not enabled */ -#define CODES_FUNCTIONALITY_NOT_ENABLED GRIB_FUNCTIONALITY_NOT_ENABLED +#define CODES_FUNCTIONALITY_NOT_ENABLED GRIB_FUNCTIONALITY_NOT_ENABLED /*! @}*/ #endif diff --git a/src/eccodes_windef.h b/src/eccodes_windef.h index 46c8ee97a..61bb43f57 100644 --- a/src/eccodes_windef.h +++ b/src/eccodes_windef.h @@ -13,10 +13,10 @@ /* Microsoft Windows Visual Studio support */ #if defined(_WIN32) && defined(_MSC_VER) - #define ECCODES_ON_WINDOWS - #ifndef YY_NO_UNISTD_H - #define YY_NO_UNISTD_H - #endif +#define ECCODES_ON_WINDOWS +#ifndef YY_NO_UNISTD_H +#define YY_NO_UNISTD_H +#endif #endif #endif diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c index 0046e3f9b..740863489 100644 --- a/src/grib_accessor_class_bufr_data_array.c +++ b/src/grib_accessor_class_bufr_data_array.c @@ -1416,7 +1416,7 @@ static int encode_new_replication(grib_context* c, grib_accessor_bufr_data_array if (self->compressedData) { grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + 6); grib_encode_unsigned_longb(buff->data, 0, pos, 6); - }; + } return err; } diff --git a/src/grib_api.h b/src/grib_api.h index 523ce189e..228e3f3dd 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -28,13 +28,21 @@ #endif #include -#if defined( __GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) #define ECCODES_DEPRECATED __attribute__((deprecated)) #else #define ECCODES_DEPRECATED #endif -typedef enum ProductKind {PRODUCT_ANY, PRODUCT_GRIB, PRODUCT_BUFR, PRODUCT_METAR, PRODUCT_GTS, PRODUCT_TAF} ProductKind; +typedef enum ProductKind +{ + PRODUCT_ANY, + PRODUCT_GRIB, + PRODUCT_BUFR, + PRODUCT_METAR, + PRODUCT_GTS, + PRODUCT_TAF +} ProductKind; #include "eccodes_version.h" @@ -43,26 +51,26 @@ extern "C" { #endif /* sections */ -#define GRIB_SECTION_PRODUCT (1<<0) -#define GRIB_SECTION_GRID (1<<1) -#define GRIB_SECTION_LOCAL (1<<2) -#define GRIB_SECTION_DATA (1<<3) -#define GRIB_SECTION_BITMAP (1<<4) +#define GRIB_SECTION_PRODUCT (1 << 0) +#define GRIB_SECTION_GRID (1 << 1) +#define GRIB_SECTION_LOCAL (1 << 2) +#define GRIB_SECTION_DATA (1 << 3) +#define GRIB_SECTION_BITMAP (1 << 4) /* LOG MODES Log mode for information for processing information */ /* Log mode for info */ -#define GRIB_LOG_INFO 0 +#define GRIB_LOG_INFO 0 /* Log mode for warnings */ -#define GRIB_LOG_WARNING 1 +#define GRIB_LOG_WARNING 1 /* Log mode for errors */ -#define GRIB_LOG_ERROR 2 +#define GRIB_LOG_ERROR 2 /* Log mode for fatal errors */ -#define GRIB_LOG_FATAL 3 +#define GRIB_LOG_FATAL 3 /* Log mode for debug */ -#define GRIB_LOG_DEBUG 4 +#define GRIB_LOG_DEBUG 4 /* Types */ /* undefined */ @@ -89,126 +97,127 @@ Log mode for information for processing information #define GRIB_MISSING_DOUBLE -1e+100 /*set spec flags*/ -#define GRIB_UTIL_SET_SPEC_FLAGS_ONLY_PACKING (1<<0) +#define GRIB_UTIL_SET_SPEC_FLAGS_ONLY_PACKING (1 << 0) /* Dump option flags*/ -#define GRIB_DUMP_FLAG_READ_ONLY (1<<0) -#define GRIB_DUMP_FLAG_DUMP_OK (1<<1) -#define GRIB_DUMP_FLAG_VALUES (1<<2) -#define GRIB_DUMP_FLAG_CODED (1<<3) -#define GRIB_DUMP_FLAG_OCTECT (1<<4) -#define GRIB_DUMP_FLAG_ALIASES (1<<5) -#define GRIB_DUMP_FLAG_TYPE (1<<6) -#define GRIB_DUMP_FLAG_HEXADECIMAL (1<<7) -#define GRIB_DUMP_FLAG_NO_DATA (1<<8) -#define GRIB_DUMP_FLAG_ALL_DATA (1<<9) -#define GRIB_DUMP_FLAG_ALL_ATTRIBUTES (1<<10) +#define GRIB_DUMP_FLAG_READ_ONLY (1 << 0) +#define GRIB_DUMP_FLAG_DUMP_OK (1 << 1) +#define GRIB_DUMP_FLAG_VALUES (1 << 2) +#define GRIB_DUMP_FLAG_CODED (1 << 3) +#define GRIB_DUMP_FLAG_OCTECT (1 << 4) +#define GRIB_DUMP_FLAG_ALIASES (1 << 5) +#define GRIB_DUMP_FLAG_TYPE (1 << 6) +#define GRIB_DUMP_FLAG_HEXADECIMAL (1 << 7) +#define GRIB_DUMP_FLAG_NO_DATA (1 << 8) +#define GRIB_DUMP_FLAG_ALL_DATA (1 << 9) +#define GRIB_DUMP_FLAG_ALL_ATTRIBUTES (1 << 10) /* grib_nearest flags */ -#define GRIB_NEAREST_SAME_GRID (1<<0) -#define GRIB_NEAREST_SAME_DATA (1<<1) -#define GRIB_NEAREST_SAME_POINT (1<<2) +#define GRIB_NEAREST_SAME_GRID (1 << 0) +#define GRIB_NEAREST_SAME_DATA (1 << 1) +#define GRIB_NEAREST_SAME_POINT (1 << 2) /*! Iteration is carried out on all the keys available in the message \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_ALL_KEYS 0 +#define GRIB_KEYS_ITERATOR_ALL_KEYS 0 /*! read only keys are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_READ_ONLY (1<<0) +#define GRIB_KEYS_ITERATOR_SKIP_READ_ONLY (1 << 0) /*! optional keys are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_OPTIONAL (1<<1) +#define GRIB_KEYS_ITERATOR_SKIP_OPTIONAL (1 << 1) /*! edition specific keys are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC (1<<2) +#define GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC (1 << 2) /*! coded keys are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_CODED (1<<3) +#define GRIB_KEYS_ITERATOR_SKIP_CODED (1 << 3) /*! computed keys are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_COMPUTED (1<<4) +#define GRIB_KEYS_ITERATOR_SKIP_COMPUTED (1 << 4) /*! duplicates of a key are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_DUPLICATES (1<<5) +#define GRIB_KEYS_ITERATOR_SKIP_DUPLICATES (1 << 5) /*! function keys are skipped by keys iterator. \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_SKIP_FUNCTION (1<<6) +#define GRIB_KEYS_ITERATOR_SKIP_FUNCTION (1 << 6) /*! only keys present in the dump \ingroup keys_iterator \see grib_keys_iterator_new */ -#define GRIB_KEYS_ITERATOR_DUMP_ONLY (1<<7) +#define GRIB_KEYS_ITERATOR_DUMP_ONLY (1 << 7) typedef struct grib_key_value_list grib_key_value_list; typedef struct grib_values grib_values; -struct grib_values { - const char* name; - int type; - long long_value; - double double_value; - const char* string_value; - int error; - int has_value; - int equal; - grib_values* next; -} ; +struct grib_values +{ + const char* name; + int type; + long long_value; + double double_value; + const char* string_value; + int error; + int has_value; + int equal; + grib_values* next; +}; /*! Grib handle, structure giving access to parsed message values by keys \ingroup grib_handle */ -typedef struct grib_handle grib_handle; +typedef struct grib_handle grib_handle; /*! Grib multi field handle, structure used to build multi field GRIB messages. \ingroup grib_handle */ -typedef struct grib_multi_handle grib_multi_handle; +typedef struct grib_multi_handle grib_multi_handle; /*! Grib context, structure containing the memory methods, the parsers and the formats. \ingroup grib_context */ -typedef struct grib_context grib_context; +typedef struct grib_context grib_context; /*! Grib geoiterator, structure supporting a geographic iteration of values on a GRIB message. \ingroup grib_iterator */ -typedef struct grib_iterator grib_iterator; +typedef struct grib_iterator grib_iterator; /*! Grib nearest, structure used to find the nearest points of a latitude longitude point. \ingroup grib_iterator */ -typedef struct grib_nearest grib_nearest; +typedef struct grib_nearest grib_nearest; /*! Grib box, structure used to crop a box given north/west/south/east boundaries. \ingroup grib_box */ -typedef struct grib_box grib_box; -typedef struct grib_points grib_points; +typedef struct grib_box grib_box; +typedef struct grib_points grib_points; /*! Grib keys iterator. Iterator over keys. \ingroup keys_iterator */ -typedef struct grib_keys_iterator grib_keys_iterator; -typedef struct bufr_keys_iterator bufr_keys_iterator; +typedef struct grib_keys_iterator grib_keys_iterator; +typedef struct bufr_keys_iterator bufr_keys_iterator; typedef struct grib_fieldset grib_fieldset; @@ -226,12 +235,12 @@ typedef struct bufr_descriptor bufr_descriptor; typedef struct bufr_descriptors_array bufr_descriptors_array; typedef struct bufr_descriptors_map_list bufr_descriptors_map_list; -grib_fieldset *grib_fieldset_new_from_files(grib_context *c, char *filenames[], int nfiles, char **keys, int nkeys, const char *where_string, const char *order_by_string, int *err); +grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err); void grib_fieldset_delete(grib_fieldset* set); void grib_fieldset_rewind(grib_fieldset* set); -int grib_fieldset_apply_order_by(grib_fieldset* set,const char* order_by_string); -grib_handle* grib_fieldset_next_handle(grib_fieldset* set,int* err); -int grib_fieldset_count(grib_fieldset *set); +int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string); +grib_handle* grib_fieldset_next_handle(grib_fieldset* set, int* err); +int grib_fieldset_count(grib_fieldset* set); int grib_values_check(grib_handle* h, grib_values* values, int count); /*! \defgroup grib_index The grib_index @@ -257,7 +266,7 @@ typedef struct grib_index grib_index; * @return the newly created index */ grib_index* grib_index_new_from_file(grib_context* c, - char* filename,const char* keys,int *err); + char* filename, const char* keys, int* err); /** * Create a new index based on a set of keys. * @@ -270,7 +279,7 @@ grib_index* grib_index_new_from_file(grib_context* c, * @param err : 0 if OK, integer value on error * @return the newly created index */ -grib_index* grib_index_new(grib_context* c, const char* keys,int *err); +grib_index* grib_index_new(grib_context* c, const char* keys, int* err); /** * Indexes the file given in argument in the index given in argument. @@ -279,9 +288,9 @@ grib_index* grib_index_new(grib_context* c, const char* keys,int *err); * @param filename : name of the file of messages to be indexed * @return 0 if OK, integer value on error */ -int grib_index_add_file(grib_index *index, const char *filename); -int grib_index_write(grib_index *index, const char *filename); -grib_index* grib_index_read(grib_context* c,const char* filename,int *err); +int grib_index_add_file(grib_index* index, const char* filename); +int grib_index_write(grib_index* index, const char* filename); +grib_index* grib_index_read(grib_context* c, const char* filename, int* err); /** * Get the number of distinct values of the key in argument contained in the index. The key must belong to the index. @@ -292,7 +301,7 @@ grib_index* grib_index_read(grib_context* c,const char* filename,int *err); * @param size : number of distinct values of the key in the index * @return 0 if OK, integer value on error */ -int grib_index_get_size(const grib_index* index,const char* key,size_t* size); +int grib_index_get_size(const grib_index* index, const char* key, size_t* size); /** * Get the distinct values of the key in argument contained in the index. The key must belong to the index. This function is used when the type of the key was explicitly defined as long or when the native type of the key is long. @@ -304,8 +313,8 @@ int grib_index_get_size(const grib_index* index,const char* key,size_t* size); * @param size : size of the values array * @return 0 if OK, integer value on error */ -int grib_index_get_long(const grib_index* index,const char* key, - long* values,size_t *size); +int grib_index_get_long(const grib_index* index, const char* key, + long* values, size_t* size); /** * Get the distinct values of the key in argument contained in the index. The key must belong to the index. This function is used when the type of the key was explicitly defined as double or when the native type of the key is double. @@ -317,8 +326,8 @@ int grib_index_get_long(const grib_index* index,const char* key, * @param size : size of the values array * @return 0 if OK, integer value on error */ -int grib_index_get_double(const grib_index* index,const char* key, - double* values,size_t *size); +int grib_index_get_double(const grib_index* index, const char* key, + double* values, size_t* size); /** * Get the distinct values of the key in argument contained in the index. The key must belong to the index. This function is used when the type of the key was explicitly defined as string or when the native type of the key is string. @@ -330,8 +339,8 @@ int grib_index_get_double(const grib_index* index,const char* key, * @param size : size of the values array * @return 0 if OK, integer value on error */ -int grib_index_get_string(const grib_index* index,const char* key, - char** values,size_t *size); +int grib_index_get_string(const grib_index* index, const char* key, + char** values, size_t* size); /** @@ -343,7 +352,7 @@ int grib_index_get_string(const grib_index* index,const char* key, * @param value : value of the key to select * @return 0 if OK, integer value on error */ -int grib_index_select_long(grib_index* index,const char* key,long value); +int grib_index_select_long(grib_index* index, const char* key, long value); /** * Select the message subset with key==value. The value is a double. The key must have been created with double type or have double as native type if the type was not explicitly defined in the index creation. @@ -354,7 +363,7 @@ int grib_index_select_long(grib_index* index,const char* key,long value); * @param value : value of the key to select * @return 0 if OK, integer value on error */ -int grib_index_select_double(grib_index* index,const char* key,double value); +int grib_index_select_double(grib_index* index, const char* key, double value); /** * Select the message subset with key==value. The value is a string. The key must have been created with string type or have string as native type if the type was not explicitly defined in the index creation. @@ -365,7 +374,7 @@ int grib_index_select_double(grib_index* index,const char* key,double value); * @param value : value of the key to select * @return 0 if OK, integer value on error */ -int grib_index_select_string(grib_index* index,const char* key,char* value); +int grib_index_select_string(grib_index* index, const char* key, char* value); /** * Create a new handle from an index after having selected the key values. @@ -376,7 +385,7 @@ int grib_index_select_string(grib_index* index,const char* key,char* value); * @param err : 0 if OK, integer value on error. GRIB_END_OF_INDEX when no more handles are contained in the index. * @return grib handle. */ -grib_handle* grib_handle_new_from_index(grib_index* index,int *err); +grib_handle* grib_handle_new_from_index(grib_index* index, int* err); /** * Delete the index. @@ -399,7 +408,7 @@ The grib_handle is the structure giving access to parsed grib values by keys. * @param n : the number of messages in the file * @return 0 if OK, integer value on error */ -int grib_count_in_file(grib_context* c, FILE* f,int* n); +int grib_count_in_file(grib_context* c, FILE* f, int* n); /** * Counts the messages contained in a file. @@ -433,16 +442,17 @@ grib_handle* grib_handle_new_from_file(grib_context* c, FILE* f, int* error); * @param mode : mode * @return 0 if OK, integer value on error */ -int grib_write_message(const grib_handle* h,const char* file,const char* mode); +int grib_write_message(const grib_handle* h, const char* file, const char* mode); typedef struct grib_string_list grib_string_list; -struct grib_string_list { - char* value; - int count; - grib_string_list* next; +struct grib_string_list +{ + char* value; + int count; + grib_string_list* next; }; -grib_handle* grib_util_sections_copy(grib_handle* hfrom,grib_handle* hto,int what,int *err); +grib_handle* grib_util_sections_copy(grib_handle* hfrom, grib_handle* hto, int what, int* err); grib_string_list* grib_util_get_param_id(const char* mars_param); grib_string_list* grib_util_get_mars_param(const char* param_id); @@ -469,8 +479,8 @@ grib_handle* grib_handle_new_from_message(grib_context* c, const void* data, siz * @param error : error code * @return the new handle, NULL if the message is invalid or a problem is encountered */ -grib_handle* grib_handle_new_from_multi_message(grib_context* c,void** data, - size_t *data_len,int* error); +grib_handle* grib_handle_new_from_multi_message(grib_context* c, void** data, + size_t* data_len, int* error); /** * Create a handle from a user message. The message is copied and will be freed with the handle @@ -491,8 +501,7 @@ grib_handle* grib_handle_new_from_message_copy(grib_context* c, const void* data * @param sample_name : the name of the sample file (without the .tmpl extension) * @return the new handle, NULL if the resource is invalid or a problem is encountered */ -grib_handle* grib_handle_new_from_samples (grib_context* c, const char* sample_name); - +grib_handle* grib_handle_new_from_samples(grib_context* c, const char* sample_name); /** @@ -502,7 +511,7 @@ grib_handle* grib_handle_new_from_samples (grib_context* c, const char* sample_n * @param h : The handle to be cloned * @return the new handle, NULL if the message is invalid or a problem is encountered */ -grib_handle* grib_handle_clone(const grib_handle* h) ; +grib_handle* grib_handle_clone(const grib_handle* h); /** * Frees a handle, also frees the message if it is not a user message @@ -519,7 +528,7 @@ int grib_handle_delete(grib_handle* h); * * @param c : the context from which the handle will be created (NULL for default context) */ -grib_multi_handle* grib_multi_handle_new (grib_context* c); +grib_multi_handle* grib_multi_handle_new(grib_context* c); /** * Append the sections starting with start_section of the message pointed by h at @@ -532,7 +541,7 @@ grib_multi_handle* grib_multi_handle_new (grib_context* c); * @param mh : The multi field handle on which the sections are appended. * @return 0 if OK, integer value on error */ -int grib_multi_handle_append(grib_handle* h,int start_section,grib_multi_handle* mh); +int grib_multi_handle_append(grib_handle* h, int start_section, grib_multi_handle* mh); /** * Delete multi field handle. @@ -551,7 +560,7 @@ int grib_multi_handle_delete(grib_multi_handle* mh); * @param f : File on which the file handle is written. * @return 0 if OK, integer value on error */ -int grib_multi_handle_write(grib_multi_handle* mh,FILE* f); +int grib_multi_handle_write(grib_multi_handle* mh, FILE* f); /*! @} */ @@ -565,7 +574,7 @@ int grib_multi_handle_write(grib_multi_handle* mh,FILE* f); * @param message_length : On exit, the message size in number of bytes * @return 0 if OK, integer value on error */ -int grib_get_message(const grib_handle* h ,const void** message, size_t *message_length); +int grib_get_message(const grib_handle* h, const void** message, size_t* message_length); /** @@ -577,7 +586,7 @@ int grib_get_message(const grib_handle* h ,const void** message, size_t *message * On exit, the actual message length in number of bytes * @return 0 if OK, integer value on error */ -int grib_get_message_copy(const grib_handle* h, void* message,size_t *message_length); +int grib_get_message_copy(const grib_handle* h, void* message, size_t* message_length); /*! @} */ /*! \defgroup iterators Iterating on latitude/longitude/values */ @@ -604,7 +613,7 @@ grib_iterator* grib_iterator_new(const grib_handle* h, unsigned long flags, int* * @param values : returned array of data values * @return 0 if OK, integer value on error */ -int grib_get_data(const grib_handle *h, double *lats, double *lons, double *values); +int grib_get_data(const grib_handle* h, double* lats, double* lons, double* values); /** * Get the next value from a geoiterator. @@ -615,7 +624,7 @@ int grib_get_data(const grib_handle *h, double *lats, double *lons, double *valu * @param value : on output value of the point * @return positive value if successful, 0 if no more data are available */ -int grib_iterator_next(grib_iterator *i, double* lat,double* lon,double* value); +int grib_iterator_next(grib_iterator* i, double* lat, double* lon, double* value); /** * Get the previous value from a geoiterator. @@ -626,7 +635,7 @@ int grib_iterator_next(grib_iterator *i, double* lat,double* lon,double* value); * @param value : on output value of the point* * @return positive value if successful, 0 if no more data are available */ -int grib_iterator_previous(grib_iterator *i, double* lat,double* lon,double* value); +int grib_iterator_previous(grib_iterator* i, double* lat, double* lon, double* value); /** * Test procedure for values in a geoiterator. @@ -634,7 +643,7 @@ int grib_iterator_previous(grib_iterator *i, double* lat,double* lon,double* val * @param i : the geoiterator * @return boolean, 1 if the geoiterator still nave next values, 0 otherwise */ -int grib_iterator_has_next(grib_iterator *i); +int grib_iterator_has_next(grib_iterator* i); /** * Test procedure for values in a geoiterator. @@ -642,7 +651,7 @@ int grib_iterator_has_next(grib_iterator *i); * @param i : the geoiterator * @return 0 if OK, integer value on error */ -int grib_iterator_reset(grib_iterator *i); +int grib_iterator_reset(grib_iterator* i); /** * Frees a geoiterator from memory @@ -650,7 +659,7 @@ int grib_iterator_reset(grib_iterator *i); * @param i : the geoiterator * @return 0 if OK, integer value on error */ -int grib_iterator_delete(grib_iterator *i); +int grib_iterator_delete(grib_iterator* i); /*! * \brief Create a new nearest neighbour object from a handle, using current geometry. @@ -692,7 +701,7 @@ int grib_nearest_find(grib_nearest* nearest, const grib_handle* h, double inlat, * @param nearest : the nearest * @return 0 if OK, integer value on error */ -int grib_nearest_delete(grib_nearest *nearest); +int grib_nearest_delete(grib_nearest* nearest); /** * Find the nearest point of a set of points whose latitudes and longitudes @@ -719,9 +728,9 @@ int grib_nearest_delete(grib_nearest *nearest); * @return 0 if OK, integer value on error */ int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, - const double* inlats, const double* inlons, long npoints, - double* outlats, double* outlons, - double* values, double* distances, int* indexes); + const double* inlats, const double* inlons, long npoints, + double* outlats, double* outlons, + double* values, double* distances, int* indexes); /* @} */ @@ -746,7 +755,7 @@ int grib_get_offset(const grib_handle* h, const char* key, size_t* offset); * @param size : the address of a size_t where the size will be set * @return 0 if OK, integer value on error */ -int grib_get_size(const grib_handle* h, const char* key,size_t *size); +int grib_get_size(const grib_handle* h, const char* key, size_t* size); /** * Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned @@ -756,7 +765,7 @@ int grib_get_size(const grib_handle* h, const char* key,size_t *size); * @param length : the address of a size_t where the length will be set * @return 0 if OK, integer value on error */ -int grib_get_length(const grib_handle* h, const char* key,size_t *length); +int grib_get_length(const grib_handle* h, const char* key, size_t* length); /** * Get a long value from a key, if several keys of the same name are present, the last one is returned @@ -813,7 +822,7 @@ int grib_get_double_elements(const grib_handle* h, const char* key, int* i, long * @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output * @return 0 if OK, integer value on error */ -int grib_get_string(const grib_handle* h, const char* key, char* mesg, size_t *length); +int grib_get_string(const grib_handle* h, const char* key, char* mesg, size_t* length); /** * Get string array values from a key. If several keys of the same name are present, the last one is returned @@ -825,7 +834,7 @@ int grib_get_string(const grib_handle* h, const char* key, char* mesg, size_t *l * @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output * @return 0 if OK, integer value on error */ -int grib_get_string_array(const grib_handle* h, const char* key, char** vals, size_t *length); +int grib_get_string_array(const grib_handle* h, const char* key, char** vals, size_t* length); /** * Get raw bytes values from a key. If several keys of the same name are present, the last one is returned @@ -837,7 +846,7 @@ int grib_get_string_array(const grib_handle* h, const char* key, char** vals, si * @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output * @return 0 if OK, integer value on error */ -int grib_get_bytes(const grib_handle* h, const char* key, unsigned char* bytes, size_t *length); +int grib_get_bytes(const grib_handle* h, const char* key, unsigned char* bytes, size_t* length); /** * Get double array values from a key. If several keys of the same name are present, the last one is returned * @see grib_set_double_array @@ -848,7 +857,7 @@ int grib_get_bytes(const grib_handle* h, const char* key, unsigned char* bytes, * @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output * @return 0 if OK, integer value on error */ -int grib_get_double_array(const grib_handle* h, const char* key, double* vals, size_t *length); +int grib_get_double_array(const grib_handle* h, const char* key, double* vals, size_t* length); /** * Get long array values from a key. If several keys of the same name are present, the last one is returned @@ -860,7 +869,7 @@ int grib_get_double_array(const grib_handle* h, const char* key, double* vals, s * @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output * @return 0 if OK, integer value on error */ -int grib_get_long_array(const grib_handle* h, const char* key, long* vals, size_t *length); +int grib_get_long_array(const grib_handle* h, const char* key, long* vals, size_t* length); /* setting data */ @@ -907,7 +916,7 @@ int grib_set_double(grib_handle* h, const char* key, double val); * @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output * @return 0 if OK, integer value on error */ -int grib_set_string(grib_handle* h, const char* key, const char* mesg, size_t *length); +int grib_set_string(grib_handle* h, const char* key, const char* mesg, size_t* length); /** * Set a bytes array from a key. If several keys of the same name are present, the last one is set @@ -919,7 +928,7 @@ int grib_set_string(grib_handle* h, const char* key, const char* mesg, size_t *l * @param length : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output * @return 0 if OK, integer value on error */ -int grib_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes, size_t *length); +int grib_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes, size_t* length); /** * Set a double array from a key. If several keys of the same name are present, the last one is set @@ -931,7 +940,7 @@ int grib_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes, * @param length : a size_t that contains the length of the byte array on input * @return 0 if OK, integer value on error */ -int grib_set_double_array(grib_handle* h, const char* key , const double* vals , size_t length); +int grib_set_double_array(grib_handle* h, const char* key, const double* vals, size_t length); /** * Same as grib_set_double_array but allows setting of READ-ONLY keys like codedValues. @@ -950,7 +959,7 @@ int grib_set_force_double_array(grib_handle* h, const char* key, const double* v * @param length : a size_t that contains the length of the long array on input * @return 0 if OK, integer value on error */ -int grib_set_long_array(grib_handle* h, const char* key , const long* vals, size_t length); +int grib_set_long_array(grib_handle* h, const char* key, const long* vals, size_t length); /** * Set a string array from a key. If several keys of the same name are present, the last one is set @@ -962,7 +971,7 @@ int grib_set_long_array(grib_handle* h, const char* key , const long* vals, siz * @param length : a size_t that contains the length of the array on input * @return 0 if OK, integer value on error */ -int grib_set_string_array(grib_handle* h, const char *key, const char **vals, size_t length); +int grib_set_string_array(grib_handle* h, const char* key, const char** vals, size_t length); /*! @} */ @@ -975,7 +984,7 @@ int grib_set_string_array(grib_handle* h, const char *key, const char **vals, si * @param option_flags : all the GRIB_DUMP_FLAG_x flags can be used * @param arg : used to provide a format to output data (experimental) */ -void grib_dump_content(const grib_handle* h,FILE* out,const char* mode, unsigned long option_flags,void* arg); +void grib_dump_content(const grib_handle* h, FILE* out, const char* mode, unsigned long option_flags, void* arg); /** * Print all keys from the parsed definition files available in a context @@ -983,7 +992,7 @@ void grib_dump_content(const grib_handle* h,FILE* out,const char* mode, unsigned * @param f : the File used to print the keys on * @param c : the context that contains the cached definition files to be printed */ -void grib_dump_action_tree(grib_context* c, FILE* f) ; +void grib_dump_action_tree(grib_context* c, FILE* f); /*! \defgroup context The context object The context is a long life configuration object of the grib_api. @@ -998,7 +1007,7 @@ void grib_dump_action_tree(grib_context* c, FILE* f) ; * @param data : pointer to the data to be freed * must match @see grib_malloc_proc */ -typedef void (*grib_free_proc)(const grib_context* c, void* data); +typedef void (*grib_free_proc)(const grib_context* c, void* data); /** * Grib malloc procedure, format of a procedure referenced in the context that is used to allocate memory @@ -1025,7 +1034,7 @@ typedef void* (*grib_realloc_proc)(const grib_context* c, void* data, size_t len * @param level : the log level, as defined in log modes * @param mesg : the message to be logged */ -typedef void (*grib_log_proc)(const grib_context* c, int level, const char* mesg); +typedef void (*grib_log_proc)(const grib_context* c, int level, const char* mesg); /** * Grib print proc, format of a procedure referenced in the context that is used to print external messages @@ -1034,7 +1043,7 @@ typedef void (*grib_log_proc)(const grib_context* c, int level, const char* mes * @param descriptor : the structure to be printed on, must match the implementation * @param mesg : the message to be printed */ -typedef void (*grib_print_proc)(const grib_context* c, void* descriptor, const char* mesg); +typedef void (*grib_print_proc)(const grib_context* c, void* descriptor, const char* mesg); /** @@ -1046,7 +1055,7 @@ typedef void (*grib_print_proc)(const grib_context* c, void* descriptor, const * @param stream : the stream * @return size read */ -typedef size_t (*grib_data_read_proc)(const grib_context* c,void *ptr, size_t size, void *stream); +typedef size_t (*grib_data_read_proc)(const grib_context* c, void* ptr, size_t size, void* stream); /** * Grib data read write, format of a procedure referenced in the context that is used to write to a stream from a resource @@ -1057,7 +1066,7 @@ typedef size_t (*grib_data_read_proc)(const grib_context* c,void *ptr, size_t si * @param stream : the stream * @return size written */ -typedef size_t (*grib_data_write_proc)(const grib_context* c,const void *ptr, size_t size, void *stream); +typedef size_t (*grib_data_write_proc)(const grib_context* c, const void* ptr, size_t size, void* stream); /** * Grib data tell, format of a procedure referenced in the context that is used to tell the current position in a stream @@ -1066,7 +1075,7 @@ typedef size_t (*grib_data_write_proc)(const grib_context* c,const void *ptr, si * @param stream : the stream * @return the position in the stream */ -typedef off_t (*grib_data_tell_proc) (const grib_context* c, void *stream); +typedef off_t (*grib_data_tell_proc)(const grib_context* c, void* stream); /** * Grib data seek, format of a procedure referenced in the context that is used to seek the current position in a stream @@ -1079,7 +1088,7 @@ typedef off_t (*grib_data_tell_proc) (const grib_context* c, void *stream); * @param stream : the stream * @return 0 if OK, integer value on error */ -typedef off_t (*grib_data_seek_proc)(const grib_context* c, off_t offset, int whence, void *stream); +typedef off_t (*grib_data_seek_proc)(const grib_context* c, off_t offset, int whence, void* stream); /** * Grib data eof, format of a procedure referenced in the context that is used to test end of file @@ -1088,7 +1097,7 @@ typedef off_t (*grib_data_seek_proc)(const grib_context* c, off_t offset, int w * @param stream : the stream * @return the position in the stream */ -typedef int (*grib_data_eof_proc) (const grib_context* c, void *stream); +typedef int (*grib_data_eof_proc)(const grib_context* c, void* stream); /** * Get the static default context @@ -1110,7 +1119,7 @@ void grib_context_delete(grib_context* c); * * @param c : the context */ -void grib_gts_header_on(grib_context* c) ; +void grib_gts_header_on(grib_context* c); /** * Set the GTS header mode off. @@ -1167,8 +1176,8 @@ void grib_context_set_samples_path(grib_context* c, const char* path); * @param gribfree : the memory freeing procedure to be set @see grib_free_proc */ void grib_context_set_memory_proc(grib_context* c, grib_malloc_proc griballoc, - grib_free_proc gribfree, - grib_realloc_proc gribrealloc); + grib_free_proc gribfree, + grib_realloc_proc gribrealloc); /** * Sets memory procedures of the context for persistent data @@ -1177,8 +1186,8 @@ void grib_context_set_memory_proc(grib_context* c, grib_malloc_proc griballoc, * @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc * @param gribfree : the memory freeing procedure to be set @see grib_free_proc */ -void grib_context_set_persistent_memory_proc(grib_context* c, grib_malloc_proc griballoc, - grib_free_proc gribfree); +void grib_context_set_persistent_memory_proc(grib_context* c, grib_malloc_proc griballoc, + grib_free_proc gribfree); /** * Sets memory procedures of the context for large buffers @@ -1229,8 +1238,8 @@ void grib_multi_support_off(grib_context* c); */ void grib_multi_support_reset_file(grib_context* c, FILE* f); -char* grib_samples_path(const grib_context *c); -char* grib_definition_path(const grib_context *c); +char* grib_samples_path(const grib_context* c); +char* grib_definition_path(const grib_context* c); /*! @} */ /** @@ -1273,7 +1282,7 @@ attributes or by the namespace they belong to. * @return keys iterator ready to iterate through keys according to filter_flags * and namespace */ -grib_keys_iterator* grib_keys_iterator_new(grib_handle* h,unsigned long filter_flags, const char* name_space); +grib_keys_iterator* grib_keys_iterator_new(grib_handle* h, unsigned long filter_flags, const char* name_space); bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h, unsigned long filter_flags); bufr_keys_iterator* codes_bufr_data_section_keys_iterator_new(grib_handle* h); @@ -1288,7 +1297,7 @@ int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter); * @param kiter : valid grib_keys_iterator * @return key name */ -const char* grib_keys_iterator_get_name(const grib_keys_iterator *kiter); +const char* grib_keys_iterator_get_name(const grib_keys_iterator* kiter); char* codes_bufr_keys_iterator_get_name(const bufr_keys_iterator* kiter); /*! Delete the iterator. @@ -1305,13 +1314,13 @@ int codes_bufr_keys_iterator_delete(bufr_keys_iterator* kiter); int grib_keys_iterator_rewind(grib_keys_iterator* kiter); int codes_bufr_keys_iterator_rewind(bufr_keys_iterator* kiter); -int grib_keys_iterator_set_flags(grib_keys_iterator *kiter,unsigned long flags); +int grib_keys_iterator_set_flags(grib_keys_iterator* kiter, unsigned long flags); -int grib_keys_iterator_get_long(const grib_keys_iterator *kiter, long *v, size_t *len); -int grib_keys_iterator_get_double(const grib_keys_iterator *kiter, double *v, size_t *len); -int grib_keys_iterator_get_string(const grib_keys_iterator *kiter, char *v, size_t *len); -int grib_keys_iterator_get_bytes(const grib_keys_iterator *kiter, unsigned char *v, size_t *len); -int codes_copy_key(grib_handle* h1,grib_handle* h2,const char* key,int type); +int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len); +int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len); +int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len); +int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len); +int codes_copy_key(grib_handle* h1, grib_handle* h2, const char* key, int type); /* @} */ @@ -1326,49 +1335,50 @@ void grib_update_sections_lengths(grib_handle* h); const char* grib_get_error_message(int code); const char* grib_get_type_name(int type); -int grib_get_native_type(const grib_handle* h, const char* name,int* type); +int grib_get_native_type(const grib_handle* h, const char* name, int* type); -void grib_check(const char* call,const char* file,int line,int e,const char* msg); -#define GRIB_CHECK(a,msg) grib_check(#a,__FILE__,__LINE__,a,msg) -#define GRIB_CHECK_NOLINE(a,msg) grib_check(#a,0,0,a,msg) +void grib_check(const char* call, const char* file, int line, int e, const char* msg); +#define GRIB_CHECK(a, msg) grib_check(#a, __FILE__, __LINE__, a, msg) +#define GRIB_CHECK_NOLINE(a, msg) grib_check(#a, 0, 0, a, msg) -int grib_set_values(grib_handle* h,grib_values* grib_values , size_t arg_count); +int grib_set_values(grib_handle* h, grib_values* grib_values, size_t arg_count); grib_handle* grib_handle_new_from_partial_message_copy(grib_context* c, const void* data, size_t size); grib_handle* grib_handle_new_from_partial_message(grib_context* c, const void* data, size_t buflen); int grib_is_missing(const grib_handle* h, const char* key, int* err); int grib_is_defined(const grib_handle* h, const char* key); int grib_set_missing(grib_handle* h, const char* key); /* The truncation is the Gaussian number (or order) */ -int grib_get_gaussian_latitudes(long truncation,double* latitudes); +int grib_get_gaussian_latitudes(long truncation, double* latitudes); -int grib_julian_to_datetime(double jd, long *year, long *month, long *day, long *hour, long *minute, long *second); -int grib_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double *jd); +int grib_julian_to_datetime(double jd, long* year, long* month, long* day, long* hour, long* minute, long* second); +int grib_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double* jd); long grib_julian_to_date(long jdate); long grib_date_to_julian(long ddate); -void grib_get_reduced_row(long pl,double lon_first,double lon_last,long* npoints,long* ilon_first, long* ilon_last); -void grib_get_reduced_row_p(long pl, double lon_first, double lon_last, long *npoints, double *olon_first, double *olon_last); +void grib_get_reduced_row(long pl, double lon_first, double lon_last, long* npoints, long* ilon_first, long* ilon_last); +void grib_get_reduced_row_p(long pl, double lon_first, double lon_last, long* npoints, double* olon_first, double* olon_last); /* read products */ -int wmo_read_any_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_grib_from_file(FILE* f,void* buffer,size_t* len); -int wmo_read_bufr_from_file(FILE* f,void* buffer,size_t* len); -int wmo_read_gts_from_file(FILE* f,void* buffer,size_t* len); -int wmo_read_any_from_stream(void *stream_data, long (*stream_proc )(void *, void *buffer, long len ), void *buffer, size_t *len); +int wmo_read_any_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_grib_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_bufr_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_any_from_stream(void* stream_data, long (*stream_proc)(void*, void* buffer, long len), void* buffer, size_t* len); /* These functions allocate memory for the result so the user is responsible for freeing it */ -void* wmo_read_any_from_stream_malloc(void* stream_data,long (*stream_proc)(void*,void* buffer,long len) ,size_t *size, int* err); -void *wmo_read_any_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); -void *wmo_read_gts_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); -void *wmo_read_bufr_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); -void *wmo_read_grib_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err); +void* wmo_read_any_from_stream_malloc(void* stream_data, long (*stream_proc)(void*, void* buffer, long len), size_t* size, int* err); +void* wmo_read_any_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_gts_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_bufr_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_grib_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); -int grib_read_any_from_file(grib_context *ctx, FILE *f, void *buffer, size_t *len); -int grib_get_message_offset(const grib_handle* h,off_t* offset); -int grib_get_message_size(const grib_handle* h,size_t* size); +int grib_read_any_from_file(grib_context* ctx, FILE* f, void* buffer, size_t* len); +int grib_get_message_offset(const grib_handle* h, off_t* offset); +int grib_get_message_size(const grib_handle* h, size_t* size); -struct grib_points { +struct grib_points +{ grib_context* context; double* latitudes; double* longitudes; @@ -1380,8 +1390,8 @@ struct grib_points { size_t size; }; -grib_box* grib_box_new(grib_handle* h,int* error); -grib_points* grib_box_get_points(grib_box *box,double north, double west,double south,double east, int *err); +grib_box* grib_box_new(grib_handle* h, int* error); +grib_points* grib_box_get_points(grib_box* box, double north, double west, double south, double east, int* err); int grib_points_get_values(grib_handle* h, grib_points* points, double* val); @@ -1393,70 +1403,70 @@ int grib_points_get_values(grib_handle* h, grib_points* points, double* val); #define GRIB_UTIL_GRID_SPEC_ROTATED_GG 4 #define GRIB_UTIL_GRID_SPEC_REDUCED_GG 5 -#define GRIB_UTIL_GRID_SPEC_SH 6 +#define GRIB_UTIL_GRID_SPEC_SH 6 #define GRIB_UTIL_GRID_SPEC_REDUCED_LL 7 -#define GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC 8 -#define GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG 9 +#define GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC 8 +#define GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG 9 #define GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA 10 -#define GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL 11 -#define GRIB_UTIL_GRID_SPEC_UNSTRUCTURED 12 +#define GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL 11 +#define GRIB_UTIL_GRID_SPEC_UNSTRUCTURED 12 -typedef struct grib_util_grid_spec { +typedef struct grib_util_grid_spec +{ + int grid_type; - int grid_type; + /* Grid */ + long Ni; + long Nj; - /* Grid */ - long Ni; - long Nj; + double iDirectionIncrementInDegrees; + double jDirectionIncrementInDegrees; - double iDirectionIncrementInDegrees; - double jDirectionIncrementInDegrees; + double longitudeOfFirstGridPointInDegrees; + double longitudeOfLastGridPointInDegrees; - double longitudeOfFirstGridPointInDegrees; - double longitudeOfLastGridPointInDegrees; + double latitudeOfFirstGridPointInDegrees; + double latitudeOfLastGridPointInDegrees; - double latitudeOfFirstGridPointInDegrees; - double latitudeOfLastGridPointInDegrees; + /* Rotation */ + long uvRelativeToGrid; + double latitudeOfSouthernPoleInDegrees; + double longitudeOfSouthernPoleInDegrees; - /* Rotation */ - long uvRelativeToGrid; - double latitudeOfSouthernPoleInDegrees; - double longitudeOfSouthernPoleInDegrees; + /* Scanning mode */ + long iScansNegatively; + long jScansPositively; - /* Scanning mode */ - long iScansNegatively; - long jScansPositively; + /* Gaussian number */ + long N; - /* Gaussian number */ - long N; + /* bitmap */ + long bitmapPresent; + double missingValue; - /* bitmap */ - long bitmapPresent; - double missingValue; + /* pl list for reduced */ + const long* pl; + long pl_size; - /* pl list for reduced */ - const long *pl; - long pl_size; + /* Spherical harmonics */ + long truncation; - /* Spherical harmonics */ - long truncation; - - /* polar stereographic */ - double orientationOfTheGridInDegrees; - long DyInMetres; - long DxInMetres; + /* polar stereographic */ + double orientationOfTheGridInDegrees; + long DyInMetres; + long DxInMetres; } grib_util_grid_spec; -typedef struct grib_util_grid_spec2 { - +typedef struct grib_util_grid_spec2 +{ int grid_type; const char* grid_name; /* e.g. N320 */ /* Grid */ - long Ni; - long Nj; + long Ni; + long Nj; double iDirectionIncrementInDegrees; double jDirectionIncrementInDegrees; @@ -1485,7 +1495,7 @@ typedef struct grib_util_grid_spec2 { double missingValue; /* pl list for reduced */ - const long *pl; + const long* pl; long pl_size; /* Spherical harmonics */ @@ -1498,72 +1508,73 @@ typedef struct grib_util_grid_spec2 { } grib_util_grid_spec2; -#define GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT 0 -#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX 1 -#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE 2 -#define GRIB_UTIL_PACKING_TYPE_JPEG 3 -#define GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX 4 -#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE 5 -#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX 6 -#define GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER 7 -#define GRIB_UTIL_PACKING_TYPE_CCSDS 8 +#define GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT 0 +#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX 1 +#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE 2 +#define GRIB_UTIL_PACKING_TYPE_JPEG 3 +#define GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX 4 +#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE 5 +#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX 6 +#define GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER 7 +#define GRIB_UTIL_PACKING_TYPE_CCSDS 8 -#define GRIB_UTIL_PACKING_SAME_AS_INPUT 0 -#define GRIB_UTIL_PACKING_USE_PROVIDED 1 +#define GRIB_UTIL_PACKING_SAME_AS_INPUT 0 +#define GRIB_UTIL_PACKING_USE_PROVIDED 1 -#define GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT 0 -#define GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES 1 +#define GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT 0 +#define GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES 1 #define GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT 2 -#define GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR 3 +#define GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR 3 -typedef struct grib_util_packing_spec { +typedef struct grib_util_packing_spec +{ + /* Packing options */ + long packing_type; + long packing; + long boustrophedonic; - /* Packing options */ - long packing_type; - long packing; - long boustrophedonic; + long editionNumber; /* =0 for default value */ - long editionNumber; /* =0 for default value */ + /* Accuracy */ + long accuracy; + long bitsPerValue; + long decimalScaleFactor; - /* Accuracy */ - long accuracy; - long bitsPerValue; - long decimalScaleFactor; + long computeLaplacianOperator; + int truncateLaplacian; + double laplacianOperator; - long computeLaplacianOperator; - int truncateLaplacian; - double laplacianOperator; + /* local definition */ + long deleteLocalDefinition; /* default(=0) local definition is taken from the input field */ - /* local definition */ - long deleteLocalDefinition; /* default(=0) local definition is taken from the input field */ - - /* Extra values when packing */ - grib_values extra_settings[80]; - long extra_settings_count; + /* Extra values when packing */ + grib_values extra_settings[80]; + long extra_settings_count; } grib_util_packing_spec; -grib_handle *grib_util_set_spec(grib_handle *h, - const grib_util_grid_spec *grid_spec, - const grib_util_packing_spec *packing_spec, /* NULL for defaults (same as input) */ - int flags, - const double *data_values, - size_t data_values_count, - int *err); +grib_handle* grib_util_set_spec(grib_handle* h, + const grib_util_grid_spec* grid_spec, + const grib_util_packing_spec* packing_spec, /* NULL for defaults (same as input) */ + int flags, + const double* data_values, + size_t data_values_count, + int* err); -grib_handle *grib_util_set_spec2(grib_handle *h, - const grib_util_grid_spec2 *grid_spec, - const grib_util_packing_spec *packing_spec, /* NULL for defaults (same as input) */ - int flags, - const double *data_values, - size_t data_values_count, - int *err); +grib_handle* grib_util_set_spec2(grib_handle* h, + const grib_util_grid_spec2* grid_spec, + const grib_util_packing_spec* packing_spec, /* NULL for defaults (same as input) */ + int flags, + const double* data_values, + size_t data_values_count, + int* err); -int parse_keyval_string(const char *grib_tool, char *arg, int values_required, int default_type, grib_values values[], int *count); -grib_handle *grib_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); +int parse_keyval_string(const char* grib_tool, char* arg, int values_required, int default_type, grib_values values[], int* count); +grib_handle* grib_new_from_file(grib_context* c, FILE* f, int headers_only, int* error); /* EXPERIMENTAL */ -typedef struct codes_bufr_header { +typedef struct codes_bufr_header +{ unsigned long message_offset; unsigned long message_size; @@ -1616,18 +1627,18 @@ typedef struct codes_bufr_header { long rectimeMinute; long rectimeSecond; - long isSatellite; + long isSatellite; double localLongitude1; double localLatitude1; double localLongitude2; double localLatitude2; double localLatitude; double localLongitude; - long localNumberOfObservations; - long satelliteID; - long qualityControl; - long newSubtype; - long daLoop; + long localNumberOfObservations; + long satelliteID; + long qualityControl; + long newSubtype; + long daLoop; /* Section 3 keys */ unsigned long numberOfSubsets; @@ -1653,140 +1664,140 @@ Error codes returned by the grib_api functions. */ /*! @{*/ /** No error */ -#define GRIB_SUCCESS 0 +#define GRIB_SUCCESS 0 /** End of resource reached */ -#define GRIB_END_OF_FILE -1 +#define GRIB_END_OF_FILE -1 /** Internal error */ -#define GRIB_INTERNAL_ERROR -2 +#define GRIB_INTERNAL_ERROR -2 /** Passed buffer is too small */ -#define GRIB_BUFFER_TOO_SMALL -3 +#define GRIB_BUFFER_TOO_SMALL -3 /** Function not yet implemented */ -#define GRIB_NOT_IMPLEMENTED -4 +#define GRIB_NOT_IMPLEMENTED -4 /** Missing 7777 at end of message */ -#define GRIB_7777_NOT_FOUND -5 +#define GRIB_7777_NOT_FOUND -5 /** Passed array is too small */ -#define GRIB_ARRAY_TOO_SMALL -6 +#define GRIB_ARRAY_TOO_SMALL -6 /** File not found */ -#define GRIB_FILE_NOT_FOUND -7 +#define GRIB_FILE_NOT_FOUND -7 /** Code not found in code table */ -#define GRIB_CODE_NOT_FOUND_IN_TABLE -8 +#define GRIB_CODE_NOT_FOUND_IN_TABLE -8 /** Array size mismatch */ -#define GRIB_WRONG_ARRAY_SIZE -9 +#define GRIB_WRONG_ARRAY_SIZE -9 /** Key/value not found */ -#define GRIB_NOT_FOUND -10 +#define GRIB_NOT_FOUND -10 /** Input output problem */ -#define GRIB_IO_PROBLEM -11 +#define GRIB_IO_PROBLEM -11 /** Message invalid */ -#define GRIB_INVALID_MESSAGE -12 +#define GRIB_INVALID_MESSAGE -12 /** Decoding invalid */ -#define GRIB_DECODING_ERROR -13 +#define GRIB_DECODING_ERROR -13 /** Encoding invalid */ -#define GRIB_ENCODING_ERROR -14 +#define GRIB_ENCODING_ERROR -14 /** Code cannot unpack because of string too small */ -#define GRIB_NO_MORE_IN_SET -15 +#define GRIB_NO_MORE_IN_SET -15 /** Problem with calculation of geographic attributes */ -#define GRIB_GEOCALCULUS_PROBLEM -16 +#define GRIB_GEOCALCULUS_PROBLEM -16 /** Memory allocation error */ -#define GRIB_OUT_OF_MEMORY -17 +#define GRIB_OUT_OF_MEMORY -17 /** Value is read only */ -#define GRIB_READ_ONLY -18 +#define GRIB_READ_ONLY -18 /** Invalid argument */ -#define GRIB_INVALID_ARGUMENT -19 +#define GRIB_INVALID_ARGUMENT -19 /** Null handle */ -#define GRIB_NULL_HANDLE -20 +#define GRIB_NULL_HANDLE -20 /** Invalid section number */ -#define GRIB_INVALID_SECTION_NUMBER -21 +#define GRIB_INVALID_SECTION_NUMBER -21 /** Value cannot be missing */ -#define GRIB_VALUE_CANNOT_BE_MISSING -22 +#define GRIB_VALUE_CANNOT_BE_MISSING -22 /** Wrong message length */ -#define GRIB_WRONG_LENGTH -23 +#define GRIB_WRONG_LENGTH -23 /** Invalid key type */ -#define GRIB_INVALID_TYPE -24 +#define GRIB_INVALID_TYPE -24 /** Unable to set step */ -#define GRIB_WRONG_STEP -25 +#define GRIB_WRONG_STEP -25 /** Wrong units for step (step must be integer) */ -#define GRIB_WRONG_STEP_UNIT -26 +#define GRIB_WRONG_STEP_UNIT -26 /** Invalid file id */ -#define GRIB_INVALID_FILE -27 +#define GRIB_INVALID_FILE -27 /** Invalid grib id */ -#define GRIB_INVALID_GRIB -28 +#define GRIB_INVALID_GRIB -28 /** Invalid index id */ -#define GRIB_INVALID_INDEX -29 +#define GRIB_INVALID_INDEX -29 /** Invalid iterator id */ -#define GRIB_INVALID_ITERATOR -30 +#define GRIB_INVALID_ITERATOR -30 /** Invalid keys iterator id */ -#define GRIB_INVALID_KEYS_ITERATOR -31 +#define GRIB_INVALID_KEYS_ITERATOR -31 /** Invalid nearest id */ -#define GRIB_INVALID_NEAREST -32 +#define GRIB_INVALID_NEAREST -32 /** Invalid order by */ -#define GRIB_INVALID_ORDERBY -33 +#define GRIB_INVALID_ORDERBY -33 /** Missing a key from the fieldset */ -#define GRIB_MISSING_KEY -34 +#define GRIB_MISSING_KEY -34 /** The point is out of the grid area */ -#define GRIB_OUT_OF_AREA -35 +#define GRIB_OUT_OF_AREA -35 /** Concept no match */ -#define GRIB_CONCEPT_NO_MATCH -36 +#define GRIB_CONCEPT_NO_MATCH -36 /** Hash array no match */ -#define GRIB_HASH_ARRAY_NO_MATCH -37 +#define GRIB_HASH_ARRAY_NO_MATCH -37 /** Definitions files not found */ -#define GRIB_NO_DEFINITIONS -38 +#define GRIB_NO_DEFINITIONS -38 /** Wrong type while packing */ -#define GRIB_WRONG_TYPE -39 +#define GRIB_WRONG_TYPE -39 /** End of resource */ -#define GRIB_END -40 +#define GRIB_END -40 /** Unable to code a field without values */ -#define GRIB_NO_VALUES -41 +#define GRIB_NO_VALUES -41 /** Grid description is wrong or inconsistent */ -#define GRIB_WRONG_GRID -42 +#define GRIB_WRONG_GRID -42 /** End of index reached */ -#define GRIB_END_OF_INDEX -43 +#define GRIB_END_OF_INDEX -43 /** Null index */ -#define GRIB_NULL_INDEX -44 +#define GRIB_NULL_INDEX -44 /** End of resource reached when reading message */ -#define GRIB_PREMATURE_END_OF_FILE -45 +#define GRIB_PREMATURE_END_OF_FILE -45 /** An internal array is too small */ -#define GRIB_INTERNAL_ARRAY_TOO_SMALL -46 +#define GRIB_INTERNAL_ARRAY_TOO_SMALL -46 /** Message is too large for the current architecture */ -#define GRIB_MESSAGE_TOO_LARGE -47 +#define GRIB_MESSAGE_TOO_LARGE -47 /** Constant field */ -#define GRIB_CONSTANT_FIELD -48 +#define GRIB_CONSTANT_FIELD -48 /** Switch unable to find a matching case */ -#define GRIB_SWITCH_NO_MATCH -49 +#define GRIB_SWITCH_NO_MATCH -49 /** Underflow */ -#define GRIB_UNDERFLOW -50 +#define GRIB_UNDERFLOW -50 /** Message malformed */ -#define GRIB_MESSAGE_MALFORMED -51 +#define GRIB_MESSAGE_MALFORMED -51 /** Index is corrupted */ -#define GRIB_CORRUPTED_INDEX -52 +#define GRIB_CORRUPTED_INDEX -52 /** Invalid number of bits per value */ -#define GRIB_INVALID_BPV -53 +#define GRIB_INVALID_BPV -53 /** Edition of two messages is different */ -#define GRIB_DIFFERENT_EDITION -54 +#define GRIB_DIFFERENT_EDITION -54 /** Value is different */ -#define GRIB_VALUE_DIFFERENT -55 +#define GRIB_VALUE_DIFFERENT -55 /** Invalid key value */ -#define GRIB_INVALID_KEY_VALUE -56 +#define GRIB_INVALID_KEY_VALUE -56 /** String is smaller than requested */ -#define GRIB_STRING_TOO_SMALL -57 +#define GRIB_STRING_TOO_SMALL -57 /** Wrong type conversion */ -#define GRIB_WRONG_CONVERSION -58 +#define GRIB_WRONG_CONVERSION -58 /** Missing BUFR table entry for descriptor */ -#define GRIB_MISSING_BUFR_ENTRY -59 +#define GRIB_MISSING_BUFR_ENTRY -59 /** Null pointer */ -#define GRIB_NULL_POINTER -60 +#define GRIB_NULL_POINTER -60 /** Attribute is already present, cannot add */ -#define GRIB_ATTRIBUTE_CLASH -61 +#define GRIB_ATTRIBUTE_CLASH -61 /** Too many attributes. Increase MAX_ACCESSOR_ATTRIBUTES */ -#define GRIB_TOO_MANY_ATTRIBUTES -62 +#define GRIB_TOO_MANY_ATTRIBUTES -62 /** Attribute not found. */ -#define GRIB_ATTRIBUTE_NOT_FOUND -63 +#define GRIB_ATTRIBUTE_NOT_FOUND -63 /** Edition not supported. */ -#define GRIB_UNSUPPORTED_EDITION -64 +#define GRIB_UNSUPPORTED_EDITION -64 /** Value out of coding range */ -#define GRIB_OUT_OF_RANGE -65 +#define GRIB_OUT_OF_RANGE -65 /** Size of bitmap is incorrect */ -#define GRIB_WRONG_BITMAP_SIZE -66 +#define GRIB_WRONG_BITMAP_SIZE -66 /** Functionality not enabled */ -#define GRIB_FUNCTIONALITY_NOT_ENABLED -67 +#define GRIB_FUNCTIONALITY_NOT_ENABLED -67 /*! @}*/ #endif diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h index fa1e7d167..48d3fd279 100644 --- a/src/grib_api_internal.h +++ b/src/grib_api_internal.h @@ -18,40 +18,40 @@ #ifdef __cplusplus - extern "C" { +extern "C" { #endif /* cmake config header */ #ifdef HAVE_ECCODES_CONFIG_H - #include "eccodes_config.h" +#include "eccodes_config.h" #endif /* autoconf config header */ #ifdef HAVE_CONFIG_H - #include "config.h" - #ifdef _LARGE_FILES - #undef _LARGE_FILE_API - #endif +#include "config.h" +#ifdef _LARGE_FILES +#undef _LARGE_FILE_API +#endif #endif #ifndef GRIB_INLINE - #define GRIB_INLINE +#define GRIB_INLINE #endif #if IS_BIG_ENDIAN - #if GRIB_MEM_ALIGN - #define FAST_BIG_ENDIAN 0 - #else - #define FAST_BIG_ENDIAN 1 - #endif +#if GRIB_MEM_ALIGN +#define FAST_BIG_ENDIAN 0 +#else +#define FAST_BIG_ENDIAN 1 +#endif #endif #if IEEE_BE - #define IEEE +#define IEEE #else - #if IEEE_LE - #define IEEE - #endif +#if IEEE_LE +#define IEEE +#endif #endif #include @@ -61,46 +61,46 @@ #include "eccodes_windef.h" #ifndef ECCODES_ON_WINDOWS - #include - #include - #include - #define ecc_snprintf snprintf +#include +#include +#include +#define ecc_snprintf snprintf #else - #include - #include +#include +#include - /* Replace C99/Unix rint() for Windows Visual C++ (only before VC++ 2013 versions) */ - #if defined _MSC_VER && _MSC_VER < 1800 - double rint(double x); - #endif +/* Replace C99/Unix rint() for Windows Visual C++ (only before VC++ 2013 versions) */ +#if defined _MSC_VER && _MSC_VER < 1800 +double rint(double x); +#endif - #ifndef S_ISREG - #define S_ISREG(mode) (mode & S_IFREG) - #endif +#ifndef S_ISREG +#define S_ISREG(mode) (mode & S_IFREG) +#endif - #ifndef S_ISDIR - #define S_ISDIR(mode) (mode & S_IFDIR) - #endif +#ifndef S_ISDIR +#define S_ISDIR(mode) (mode & S_IFDIR) +#endif - #ifndef M_PI - #define M_PI 3.14159265358979323846 - #endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif - #define R_OK 04 /* Needed for Windows */ +#define R_OK 04 /* Needed for Windows */ - # ifndef F_OK - # define F_OK 0 - # endif +#ifndef F_OK +#define F_OK 0 +#endif - # define mkdir(dirname,mode) _mkdir(dirname) +#define mkdir(dirname, mode) _mkdir(dirname) - # ifdef _MSC_VER - # define access(path,mode) _access(path,mode) - # define chmod(path,mode) _chmod(path,mode) - # define strdup(str) _strdup(str) - # endif +#ifdef _MSC_VER +#define access(path, mode) _access(path, mode) +#define chmod(path, mode) _chmod(path, mode) +#define strdup(str) _strdup(str) +#endif - #define ecc_snprintf _snprintf +#define ecc_snprintf _snprintf #endif @@ -111,89 +111,98 @@ #include -#ifdef HAVE_STRING_H - #include +#ifdef HAVE_STRING_H +#include #else - #include +#include #endif #if GRIB_LINUX_PTHREADS - extern int pthread_mutexattr_settype(pthread_mutexattr_t* attr,int type); +extern int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type); #endif #if GRIB_PTHREADS - #include - #define GRIB_MUTEX_INIT_ONCE(a,b) pthread_once(a,b); - #define GRIB_MUTEX_LOCK(a) pthread_mutex_lock(a); - #define GRIB_MUTEX_UNLOCK(a) pthread_mutex_unlock(a); - /* +#include +#define GRIB_MUTEX_INIT_ONCE(a, b) pthread_once(a, b); +#define GRIB_MUTEX_LOCK(a) pthread_mutex_lock(a); +#define GRIB_MUTEX_UNLOCK(a) pthread_mutex_unlock(a); +/* #define GRIB_MUTEX_LOCK(a) {pthread_mutex_lock(a); printf("MUTEX LOCK %p %s line %d\n",(void*)a,__FILE__,__LINE__);} #define GRIB_MUTEX_UNLOCK(a) {pthread_mutex_unlock(a);printf("MUTEX UNLOCK %p %s line %d\n",(void*)a,__FILE__,__LINE__);} */ #elif GRIB_OMP_THREADS - #include - #ifdef _MSC_VER - #define GRIB_OMP_CRITICAL(a) __pragma(omp critical (a)) - #else - #define GRIB_OMP_STR(a) #a - #define GRIB_OMP_XSTR(a) GRIB_OMP_STR(a) - #define GRIB_OMP_CRITICAL(a) _Pragma( GRIB_OMP_XSTR(omp critical (a) ) ) - #endif - #define GRIB_MUTEX_INIT_ONCE(a,b) (*(b))(); - #define GRIB_MUTEX_LOCK(a) omp_set_nest_lock(a); - #define GRIB_MUTEX_UNLOCK(a) omp_unset_nest_lock(a); +#include +#ifdef _MSC_VER +#define GRIB_OMP_CRITICAL(a) __pragma(omp critical(a)) #else - #define GRIB_MUTEX_INIT_ONCE(a,b) - #define GRIB_MUTEX_LOCK(a) - #define GRIB_MUTEX_UNLOCK(a) +#define GRIB_OMP_STR(a) #a +#define GRIB_OMP_XSTR(a) GRIB_OMP_STR(a) +#define GRIB_OMP_CRITICAL(a) _Pragma(GRIB_OMP_XSTR(omp critical(a))) +#endif +#define GRIB_MUTEX_INIT_ONCE(a, b) (*(b))(); +#define GRIB_MUTEX_LOCK(a) omp_set_nest_lock(a); +#define GRIB_MUTEX_UNLOCK(a) omp_unset_nest_lock(a); +#else +#define GRIB_MUTEX_INIT_ONCE(a, b) +#define GRIB_MUTEX_LOCK(a) +#define GRIB_MUTEX_UNLOCK(a) #endif #if GRIB_LINUX_PTHREADS - /* Note: in newer pthreads PTHREAD_MUTEX_RECURSIVE and PTHREAD_MUTEX_RECURSIVE_NP are enums */ - #if !defined (PTHREAD_MUTEX_RECURSIVE) - #define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP - #endif +/* Note: in newer pthreads PTHREAD_MUTEX_RECURSIVE and PTHREAD_MUTEX_RECURSIVE_NP are enums */ +#if !defined(PTHREAD_MUTEX_RECURSIVE) +#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP +#endif #endif #ifndef HAVE_FSEEKO - #define fseeko fseek - #define ftello ftell +#define fseeko fseek +#define ftello ftell #endif -#define Assert(a) do { if(!(a)) codes_assertion_failed(#a, __FILE__, __LINE__); } while(0) +#define Assert(a) \ + do { \ + if (!(a)) codes_assertion_failed(#a, __FILE__, __LINE__); \ + } while (0) #ifdef __gnu_hurd__ - #define COMPILE_TIME_ASSERT(condition) \ - extern int compile_time_assert[!!(condition) - 1] +#define COMPILE_TIME_ASSERT(condition) \ + extern int compile_time_assert[!!(condition)-1] #else - /* Compile time assertion - Thanks to Ralf Holly */ - #define COMPILE_TIME_ASSERT(condition) \ - do { \ - enum { assert_static__ = 1/(condition) }; \ - } while (0) +/* Compile time assertion - Thanks to Ralf Holly */ +#define COMPILE_TIME_ASSERT(condition) \ + do { \ + enum \ + { \ + assert_static__ = 1 / (condition) \ + }; \ + } while (0) #endif #ifdef DEBUG - #define DebugAssert(a) Assert(a) - #define DebugAssertAccess(array, index, size) \ - do { \ - if (!((index) >= 0 && (index) < (size)) ) {printf("ARRAY ACCESS ERROR: array=%s idx=%ld size=%ld @ %s +%d \n", #array, index, size, __FILE__, __LINE__); abort();} \ - } while(0) +#define DebugAssert(a) Assert(a) +#define DebugAssertAccess(array, index, size) \ + do { \ + if (!((index) >= 0 && (index) < (size))) { \ + printf("ARRAY ACCESS ERROR: array=%s idx=%ld size=%ld @ %s +%d \n", #array, index, size, __FILE__, __LINE__); \ + abort(); \ + } \ + } while (0) #else - #define DebugAssert(a) - #define DebugAssertAccess(array, index, size) +#define DebugAssert(a) +#define DebugAssertAccess(array, index, size) #endif /* Return true if two strings are equal */ -#define STR_EQ(a, b) (strcmp ((a), (b)) == 0) +#define STR_EQ(a, b) (strcmp((a), (b)) == 0) #include "grib_api.h" -#define GRIB_UNKNOWN_VALUE -9999.999 +#define GRIB_UNKNOWN_VALUE -9999.999 #define GRIB_KEY_UNDEF "undef" -#define GRIB_HANDLE_BIG_ECMWF_GRIB1 1 +#define GRIB_HANDLE_BIG_ECMWF_GRIB1 1 #define MAX_ACCESSOR_ATTRIBUTES 20 #define MAX_FILE_HANDLES_WITH_MULTI 10 @@ -201,176 +210,177 @@ #define MAX_NUM_CONCEPTS 2000 #define MAX_NUM_HASH_ARRAY 2000 -#define GRIB_NAMESPACE 10 -#define MAX_NAMESPACE_LEN 64 +#define GRIB_NAMESPACE 10 +#define MAX_NAMESPACE_LEN 64 -#define GRIB_MY_BUFFER 0 -#define GRIB_USER_BUFFER 1 +#define GRIB_MY_BUFFER 0 +#define GRIB_USER_BUFFER 1 -#define GRIB_REAL_MODE4 4 -#define GRIB_REAL_MODE8 8 +#define GRIB_REAL_MODE4 4 +#define GRIB_REAL_MODE8 8 -#define MAX_NUM_SECTIONS 12 +#define MAX_NUM_SECTIONS 12 -#define GRIB_DISPOSABLE_MEMORY 0 -#define GRIB_LONG_LASTING_MEMORY 1 +#define GRIB_DISPOSABLE_MEMORY 0 +#define GRIB_LONG_LASTING_MEMORY 1 -#define GRIB_LOG_PERROR (1<<10) +#define GRIB_LOG_PERROR (1 << 10) #define GRIB_HASH_ARRAY_TYPE_UNKNOWN 0 #define GRIB_HASH_ARRAY_TYPE_INTEGER 1 -#define GRIB_HASH_ARRAY_TYPE_DOUBLE 2 -#define GRIB_HASH_ARRAY_TYPE_STRING 3 +#define GRIB_HASH_ARRAY_TYPE_DOUBLE 2 +#define GRIB_HASH_ARRAY_TYPE_STRING 3 -#define CODES_GRIB 1 -#define CODES_BUFR 2 -#define CODES_METAR 3 -#define CODES_GTS 4 +#define CODES_GRIB 1 +#define CODES_BUFR 2 +#define CODES_METAR 3 +#define CODES_GTS 4 #define CODES_BUFR_UNPACK_STRUCTURE 0 -#define CODES_BUFR_UNPACK_FLAT 1 -#define CODES_BUFR_NEW_DATA 2 +#define CODES_BUFR_UNPACK_FLAT 1 +#define CODES_BUFR_NEW_DATA 2 #define MAX_SMART_TABLE_COLUMNS 20 #define MAX_CODETABLE_ENTRIES 65536 /* ACCESSOR COMPARE FLAGS */ -#define GRIB_COMPARE_NAMES (1<<0) -#define GRIB_COMPARE_TYPES (1<<1) +#define GRIB_COMPARE_NAMES (1 << 0) +#define GRIB_COMPARE_TYPES (1 << 1) -typedef struct grib_expression grib_expression; -typedef struct grib_arguments grib_arguments; +typedef struct grib_expression grib_expression; +typedef struct grib_arguments grib_arguments; -typedef struct grib_action_file grib_action_file; -typedef struct grib_action_file_list grib_action_file_list; -typedef struct grib_block_of_accessors grib_block_of_accessors; -typedef struct grib_buffer grib_buffer; -typedef struct grib_accessor_class grib_accessor_class; -typedef struct grib_action grib_action; -typedef struct grib_action_class grib_action_class; -typedef struct grib_section grib_section; -typedef struct grib_packer grib_packer; -typedef struct grib_codetable grib_codetable; -typedef struct grib_smart_table grib_smart_table; +typedef struct grib_action_file grib_action_file; +typedef struct grib_action_file_list grib_action_file_list; +typedef struct grib_block_of_accessors grib_block_of_accessors; +typedef struct grib_buffer grib_buffer; +typedef struct grib_accessor_class grib_accessor_class; +typedef struct grib_action grib_action; +typedef struct grib_action_class grib_action_class; +typedef struct grib_section grib_section; +typedef struct grib_packer grib_packer; +typedef struct grib_codetable grib_codetable; +typedef struct grib_smart_table grib_smart_table; -typedef struct grib_accessor grib_accessor; -typedef struct grib_iterator_class grib_iterator_class; -typedef struct grib_nearest_class grib_nearest_class; -typedef struct grib_box_class grib_box_class; -typedef struct grib_dumper grib_dumper; -typedef struct grib_dumper_class grib_dumper_class; -typedef struct grib_dependency grib_dependency; -typedef struct string_feed string_feed; +typedef struct grib_accessor grib_accessor; +typedef struct grib_iterator_class grib_iterator_class; +typedef struct grib_nearest_class grib_nearest_class; +typedef struct grib_box_class grib_box_class; +typedef struct grib_dumper grib_dumper; +typedef struct grib_dumper_class grib_dumper_class; +typedef struct grib_dependency grib_dependency; +typedef struct string_feed string_feed; typedef struct codes_condition codes_condition; /* typedef void (*dynamic_key_proc) (const char*, void*) */ -typedef void (*nearest_init_class_proc) (grib_nearest_class*); -typedef int (*nearest_init_proc) (grib_nearest* i,grib_handle*,grib_arguments*); +typedef void (*nearest_init_class_proc)(grib_nearest_class*); +typedef int (*nearest_init_proc)(grib_nearest* i, grib_handle*, grib_arguments*); -typedef int (*nearest_find_proc) (grib_nearest* nearest, grib_handle* h, - double inlat, double inlon, - unsigned long flags, double* outlats, - double* outlons,double *values, - double* distances, int* indexes,size_t *len); -typedef int (*nearest_destroy_proc) (grib_nearest* nearest); +typedef int (*nearest_find_proc)(grib_nearest* nearest, grib_handle* h, + double inlat, double inlon, + unsigned long flags, double* outlats, + double* outlons, double* values, + double* distances, int* indexes, size_t* len); +typedef int (*nearest_destroy_proc)(grib_nearest* nearest); -typedef void (*box_init_class_proc) (grib_box_class*); -typedef int (*box_destroy_proc) (grib_box*); -typedef int (*box_init_proc) (grib_box* ,grib_handle*,grib_arguments*); -typedef grib_points* (*box_get_points_proc) (grib_box*, double, double, double,double, int*); +typedef void (*box_init_class_proc)(grib_box_class*); +typedef int (*box_destroy_proc)(grib_box*); +typedef int (*box_init_proc)(grib_box*, grib_handle*, grib_arguments*); +typedef grib_points* (*box_get_points_proc)(grib_box*, double, double, double, double, int*); -typedef void (*iterator_init_class_proc) (grib_iterator_class*); -typedef int (*iterator_init_proc) (grib_iterator* i,grib_handle*,grib_arguments*); +typedef void (*iterator_init_class_proc)(grib_iterator_class*); +typedef int (*iterator_init_proc)(grib_iterator* i, grib_handle*, grib_arguments*); -typedef int (*iterator_next_proc) (grib_iterator* i, double *lat, double *lon, double *val); -typedef int (*iterator_previous_proc) (grib_iterator* i, double *lat, double *lon, double *val); -typedef int (*iterator_reset_proc) (grib_iterator* i); -typedef int (*iterator_destroy_proc) (grib_iterator* i); -typedef long (*iterator_has_next_proc) (grib_iterator* i); +typedef int (*iterator_next_proc)(grib_iterator* i, double* lat, double* lon, double* val); +typedef int (*iterator_previous_proc)(grib_iterator* i, double* lat, double* lon, double* val); +typedef int (*iterator_reset_proc)(grib_iterator* i); +typedef int (*iterator_destroy_proc)(grib_iterator* i); +typedef long (*iterator_has_next_proc)(grib_iterator* i); -typedef int (*grib_pack_proc) (grib_handle* h,const double* in, size_t inlen, void* out, size_t* outlen); -typedef int (*grib_unpack_proc) (grib_handle* h,const void* in, size_t inlen, double* out, size_t* outlen); +typedef int (*grib_pack_proc)(grib_handle* h, const double* in, size_t inlen, void* out, size_t* outlen); +typedef int (*grib_unpack_proc)(grib_handle* h, const void* in, size_t inlen, double* out, size_t* outlen); -typedef void (*accessor_destroy_proc) (grib_context* , grib_accessor* ); +typedef void (*accessor_destroy_proc)(grib_context*, grib_accessor*); -typedef int (*accessor_unpack_long_proc) (grib_accessor*, long*, size_t *len); -typedef int (*accessor_unpack_double_proc) (grib_accessor*, double*, size_t *len); -typedef int (*accessor_unpack_double_element_proc) (grib_accessor*, size_t, double*); -typedef int (*accessor_unpack_double_subarray_proc) (grib_accessor*, double*,size_t , size_t); -typedef int (*accessor_unpack_string_proc) (grib_accessor*, char*, size_t *len); -typedef int (*accessor_unpack_string_array_proc) (grib_accessor*, char**, size_t *len); -typedef int (*accessor_unpack_bytes_proc) (grib_accessor*, unsigned char*, size_t *len); -typedef int (*accessor_get_native_type_proc) (grib_accessor*); -typedef int (*accessor_notify_change_proc) (grib_accessor*,grib_accessor*); -typedef void (*accessor_update_size_proc) (grib_accessor*,size_t); -typedef size_t (*accessor_preferred_size_proc) (grib_accessor*,int); -typedef void (*accessor_resize_proc) (grib_accessor*,size_t); +typedef int (*accessor_unpack_long_proc)(grib_accessor*, long*, size_t* len); +typedef int (*accessor_unpack_double_proc)(grib_accessor*, double*, size_t* len); +typedef int (*accessor_unpack_double_element_proc)(grib_accessor*, size_t, double*); +typedef int (*accessor_unpack_double_subarray_proc)(grib_accessor*, double*, size_t, size_t); +typedef int (*accessor_unpack_string_proc)(grib_accessor*, char*, size_t* len); +typedef int (*accessor_unpack_string_array_proc)(grib_accessor*, char**, size_t* len); +typedef int (*accessor_unpack_bytes_proc)(grib_accessor*, unsigned char*, size_t* len); +typedef int (*accessor_get_native_type_proc)(grib_accessor*); +typedef int (*accessor_notify_change_proc)(grib_accessor*, grib_accessor*); +typedef void (*accessor_update_size_proc)(grib_accessor*, size_t); +typedef size_t (*accessor_preferred_size_proc)(grib_accessor*, int); +typedef void (*accessor_resize_proc)(grib_accessor*, size_t); -typedef grib_accessor* (*accessor_next_proc) (grib_accessor*,int); -typedef grib_section* (*accessor_sub_section_proc) (grib_accessor*); +typedef grib_accessor* (*accessor_next_proc)(grib_accessor*, int); +typedef grib_section* (*accessor_sub_section_proc)(grib_accessor*); -typedef int (*accessor_pack_missing_proc) (grib_accessor*); -typedef int (*accessor_pack_is_missing_proc) (grib_accessor*); -typedef int (*accessor_pack_long_proc) (grib_accessor*, const long*, size_t *len); -typedef int (*accessor_pack_double_proc) (grib_accessor*, const double*, size_t *len); -typedef int (*accessor_pack_string_proc) (grib_accessor*, const char*, size_t *len); -typedef int (*accessor_pack_string_array_proc) (grib_accessor*, const char**, size_t *len); -typedef int (*accessor_pack_bytes_proc) (grib_accessor*, const unsigned char*, size_t *len); -typedef int (*accessor_pack_expression_proc) (grib_accessor*, grib_expression*); -typedef int (*accessor_clear_proc) (grib_accessor*); -typedef grib_accessor* (*accessor_clone_proc) (grib_accessor*,grib_section*,int*); +typedef int (*accessor_pack_missing_proc)(grib_accessor*); +typedef int (*accessor_pack_is_missing_proc)(grib_accessor*); +typedef int (*accessor_pack_long_proc)(grib_accessor*, const long*, size_t* len); +typedef int (*accessor_pack_double_proc)(grib_accessor*, const double*, size_t* len); +typedef int (*accessor_pack_string_proc)(grib_accessor*, const char*, size_t* len); +typedef int (*accessor_pack_string_array_proc)(grib_accessor*, const char**, size_t* len); +typedef int (*accessor_pack_bytes_proc)(grib_accessor*, const unsigned char*, size_t* len); +typedef int (*accessor_pack_expression_proc)(grib_accessor*, grib_expression*); +typedef int (*accessor_clear_proc)(grib_accessor*); +typedef grib_accessor* (*accessor_clone_proc)(grib_accessor*, grib_section*, int*); -typedef void (*accessor_init_class_proc) (grib_accessor_class*); +typedef void (*accessor_init_class_proc)(grib_accessor_class*); -typedef int (*accessor_compare_proc) (grib_accessor*, grib_accessor*); -typedef size_t (*accessor_string_proc) (grib_accessor*); -typedef int (*accessor_value_with_ret_proc) (grib_accessor*,long*); -typedef long (*accessor_value_proc) (grib_accessor*); -typedef void (*accessor_dump_proc) (grib_accessor*, grib_dumper*); -typedef void (*accessor_init_proc) (grib_accessor*, const long len, grib_arguments*); -typedef void (*accessor_post_init_proc) (grib_accessor*); +typedef int (*accessor_compare_proc)(grib_accessor*, grib_accessor*); +typedef size_t (*accessor_string_proc)(grib_accessor*); +typedef int (*accessor_value_with_ret_proc)(grib_accessor*, long*); +typedef long (*accessor_value_proc)(grib_accessor*); +typedef void (*accessor_dump_proc)(grib_accessor*, grib_dumper*); +typedef void (*accessor_init_proc)(grib_accessor*, const long len, grib_arguments*); +typedef void (*accessor_post_init_proc)(grib_accessor*); -typedef int (*accessor_nearest_proc) (grib_accessor*, double,double*); +typedef int (*accessor_nearest_proc)(grib_accessor*, double, double*); -typedef long (*grib_binop_long_proc) (long,long); -typedef long (*grib_unop_long_proc) (long); +typedef long (*grib_binop_long_proc)(long, long); +typedef long (*grib_unop_long_proc)(long); -typedef double (*grib_binop_double_proc) (double,double); -typedef double (*grib_unop_double_proc) (double); +typedef double (*grib_binop_double_proc)(double, double); +typedef double (*grib_unop_double_proc)(double); -typedef int (*grib_binop_string_proc) (char*,char*); +typedef int (*grib_binop_string_proc)(char*, char*); typedef struct second_order_packed second_order_packed; -typedef void grib_expression_visit_proc (void* udata, grib_expression *e); +typedef void grib_expression_visit_proc(void* udata, grib_expression* e); - -struct grib_key_value_list { +struct grib_key_value_list +{ const char* name; - int type; - int size; - long* long_value; - double* double_value; + int type; + int size; + long* long_value; + double* double_value; grib_key_value_list* namespace_value; char* string_value; - int has_value; - int error; + int has_value; + int error; grib_key_value_list* next; }; -struct second_order_packed { - unsigned long nbits_per_widths; - unsigned long nbits_per_group_size; - size_t size_of_group_array; - size_t packed_byte_count; +struct second_order_packed +{ + unsigned long nbits_per_widths; + unsigned long nbits_per_group_size; + size_t size_of_group_array; + size_t packed_byte_count; unsigned long* array_of_group_size; unsigned long* array_of_group_width; - long* array_of_group_refs; + long* array_of_group_refs; }; /** @@ -379,25 +389,27 @@ struct second_order_packed { * * @see grib_action_create_data */ -struct grib_packer { - const char* name; - grib_pack_proc pack; /** < packing procedure */ - grib_unpack_proc unpack; /** < unpacking procedure */ +struct grib_packer +{ + const char* name; + grib_pack_proc pack; /** < packing procedure */ + grib_unpack_proc unpack; /** < unpacking procedure */ }; /* --------------- */ typedef struct grib_loader grib_loader; -typedef int (*grib_loader_init_accessor_proc)(grib_loader*,grib_accessor*,grib_arguments*); -typedef int (*grib_loader_lookup_long_proc) (grib_context*,grib_loader*,const char* name, long* value); +typedef int (*grib_loader_init_accessor_proc)(grib_loader*, grib_accessor*, grib_arguments*); +typedef int (*grib_loader_lookup_long_proc)(grib_context*, grib_loader*, const char* name, long* value); -struct grib_loader { - void* data; +struct grib_loader +{ + void* data; grib_loader_init_accessor_proc init_accessor; - grib_loader_lookup_long_proc lookup_long; - int list_is_resized; /** will be true if we resize a list */ - int changing_edition; + grib_loader_lookup_long_proc lookup_long; + int list_is_resized; /** will be true if we resize a list */ + int changing_edition; }; /** @@ -408,23 +420,24 @@ struct grib_loader { */ struct grib_action { - char* name; /** name of the definition statement */ - char* op; /** operator of the definition statement */ - char* name_space; /** namespace of the definition statement */ - grib_action* next; /** next action in the list */ - grib_action_class* cclass; /** link to the structure containing a specific behaviour */ - grib_context* context; /** Context */ - unsigned long flags; - char* defaultkey; /** name of the key used as default if not found */ - grib_arguments* default_value; /** default expression as in .def file */ - char* set; - char* debug_info; /** purely for debugging and tracing */ + char* name; /** name of the definition statement */ + char* op; /** operator of the definition statement */ + char* name_space; /** namespace of the definition statement */ + grib_action* next; /** next action in the list */ + grib_action_class* cclass; /** link to the structure containing a specific behaviour */ + grib_context* context; /** Context */ + unsigned long flags; + char* defaultkey; /** name of the key used as default if not found */ + grib_arguments* default_value; /** default expression as in .def file */ + char* set; + char* debug_info; /** purely for debugging and tracing */ }; typedef struct grib_accessors_list grib_accessors_list; -struct grib_accessors_list { - grib_accessor* accessor; +struct grib_accessors_list +{ + grib_accessor* accessor; int rank; grib_accessors_list* next; grib_accessors_list* prev; @@ -432,16 +445,16 @@ struct grib_accessors_list { }; -typedef int (*action_create_accessors_handle_proc) (grib_section* p, grib_action* a, grib_loader* h); -typedef int (*action_notify_change_proc) (grib_action* a, grib_accessor* observer,grib_accessor * observed); +typedef int (*action_create_accessors_handle_proc)(grib_section* p, grib_action* a, grib_loader* h); +typedef int (*action_notify_change_proc)(grib_action* a, grib_accessor* observer, grib_accessor* observed); -typedef void (*grib_dump_proc) (grib_action*, FILE*, int ); -typedef void (*grib_xref_proc) (grib_action*, FILE*,const char*); -typedef void (*action_init_class_proc) (grib_action_class* a); -typedef void (*action_init_proc) (grib_action* a); -typedef void (*action_destroy_proc) (grib_context* context, grib_action* a); -typedef grib_action* (*action_reparse_proc) (grib_action* a,grib_accessor*,int*); -typedef int (*action_execute_proc) (grib_action* a,grib_handle*); +typedef void (*grib_dump_proc)(grib_action*, FILE*, int); +typedef void (*grib_xref_proc)(grib_action*, FILE*, const char*); +typedef void (*action_init_class_proc)(grib_action_class* a); +typedef void (*action_init_proc)(grib_action* a); +typedef void (*action_destroy_proc)(grib_context* context, grib_action* a); +typedef grib_action* (*action_reparse_proc)(grib_action* a, grib_accessor*, int*); +typedef int (*action_execute_proc)(grib_action* a, grib_handle*); /** * an action_class @@ -451,41 +464,39 @@ typedef int (*action_execute_proc) (grib_action* a,grib_handle*); */ struct grib_action_class { - grib_action_class** super; /** < link to a more general behaviour */ - const char* name; /** < name of the behaviour class */ - size_t size; /** < size in bytes of the structure */ + grib_action_class** super; /** < link to a more general behaviour */ + const char* name; /** < name of the behaviour class */ + size_t size; /** < size in bytes of the structure */ - int inited; - action_init_class_proc init_class; + int inited; + action_init_class_proc init_class; - action_init_proc init; - action_destroy_proc destroy; /** < destructor method to release the memory */ + action_init_proc init; + action_destroy_proc destroy; /** < destructor method to release the memory */ - grib_dump_proc dump; /** < dump method of the action */ - grib_xref_proc xref; /** < dump method of the action */ - action_create_accessors_handle_proc create_accessor; /** < method to create the corresponding accessor from a handle*/ - action_notify_change_proc notify_change; /** < method to create the corresponding accessor from a handle*/ - - action_reparse_proc reparse; - action_execute_proc execute; + grib_dump_proc dump; /** < dump method of the action */ + grib_xref_proc xref; /** < dump method of the action */ + action_create_accessors_handle_proc create_accessor; /** < method to create the corresponding accessor from a handle*/ + action_notify_change_proc notify_change; /** < method to create the corresponding accessor from a handle*/ + action_reparse_proc reparse; + action_execute_proc execute; }; - /** * a buffer * Structure containing the data of a message */ struct grib_buffer { - int property; /** < property parameter of buffer */ - int validity; /** < validity parameter of buffer */ - int growable; /** < buffer can be grown */ - size_t length; /** < Buffer length */ - size_t ulength; /** < length used of the buffer */ - size_t ulength_bits; /** < length used of the buffer in bits */ - unsigned char* data; /** < the data byte array */ + int property; /** < property parameter of buffer */ + int validity; /** < validity parameter of buffer */ + int growable; /** < buffer can be grown */ + size_t length; /** < Buffer length */ + size_t ulength; /** < length used of the buffer */ + size_t ulength_bits; /** < length used of the buffer in bits */ + unsigned char* data; /** < the data byte array */ }; /** @@ -498,62 +509,63 @@ struct grib_buffer typedef struct grib_virtual_value grib_virtual_value; -struct grib_virtual_value { - long lval; - double dval; - char* cval; - int missing; - int length; - int type; +struct grib_virtual_value +{ + long lval; + double dval; + char* cval; + int missing; + int length; + int type; }; struct grib_accessor { - const char* name; /** < name of the accessor */ - const char* name_space; /** < namespace to which the accessor belongs */ - grib_context* context; - grib_handle* h; - grib_action* creator; /** < action that created the accessor */ - long length; /** < byte length of the accessor */ - long offset; /** < offset of the data in the buffer */ - grib_section* parent; /** < section to which the accessor is attached */ - grib_accessor* next; /** < next accessor in list */ - grib_accessor* previous; /** < next accessor in list */ - grib_accessor_class* cclass; /** < behaviour of the accessor */ - unsigned long flags; /** < Various flags */ - grib_section* sub_section; + const char* name; /** < name of the accessor */ + const char* name_space; /** < namespace to which the accessor belongs */ + grib_context* context; + grib_handle* h; + grib_action* creator; /** < action that created the accessor */ + long length; /** < byte length of the accessor */ + long offset; /** < offset of the data in the buffer */ + grib_section* parent; /** < section to which the accessor is attached */ + grib_accessor* next; /** < next accessor in list */ + grib_accessor* previous; /** < next accessor in list */ + grib_accessor_class* cclass; /** < behaviour of the accessor */ + unsigned long flags; /** < Various flags */ + grib_section* sub_section; - const char* all_names[MAX_ACCESSOR_NAMES]; /** < name of the accessor */ - const char* all_name_spaces[MAX_ACCESSOR_NAMES]; /** < namespace to which the accessor belongs */ - int dirty; + const char* all_names[MAX_ACCESSOR_NAMES]; /** < name of the accessor */ + const char* all_name_spaces[MAX_ACCESSOR_NAMES]; /** < namespace to which the accessor belongs */ + int dirty; - grib_accessor* same; /** < accessors with the same name */ - long loop; /** < used in lists */ - long bufr_subset_number; /** < bufr subset (bufr data accessors belong to different subsets)*/ - long bufr_group_number; /** < used in bufr */ - grib_virtual_value* vvalue; /** < virtual value used when transient flag on **/ - const char* set; - grib_accessor* attributes[MAX_ACCESSOR_ATTRIBUTES]; /** < attributes are accessors */ - grib_accessor* parent_as_attribute; + grib_accessor* same; /** < accessors with the same name */ + long loop; /** < used in lists */ + long bufr_subset_number; /** < bufr subset (bufr data accessors belong to different subsets)*/ + long bufr_group_number; /** < used in bufr */ + grib_virtual_value* vvalue; /** < virtual value used when transient flag on **/ + const char* set; + grib_accessor* attributes[MAX_ACCESSOR_ATTRIBUTES]; /** < attributes are accessors */ + grib_accessor* parent_as_attribute; }; -#define GRIB_ACCESSOR_FLAG_READ_ONLY (1<<1) -#define GRIB_ACCESSOR_FLAG_DUMP (1<<2) -#define GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC (1<<3) -#define GRIB_ACCESSOR_FLAG_CAN_BE_MISSING (1<<4) -#define GRIB_ACCESSOR_FLAG_HIDDEN (1<<5) -#define GRIB_ACCESSOR_FLAG_CONSTRAINT (1<<6) -#define GRIB_ACCESSOR_FLAG_BUFR_DATA (1<<7) -#define GRIB_ACCESSOR_FLAG_NO_COPY (1<<8) -#define GRIB_ACCESSOR_FLAG_COPY_OK (1<<9) -#define GRIB_ACCESSOR_FLAG_FUNCTION (1<<10) -#define GRIB_ACCESSOR_FLAG_DATA (1<<11) -#define GRIB_ACCESSOR_FLAG_NO_FAIL (1<<12) -#define GRIB_ACCESSOR_FLAG_TRANSIENT (1<<13) -#define GRIB_ACCESSOR_FLAG_STRING_TYPE (1<<14) -#define GRIB_ACCESSOR_FLAG_LONG_TYPE (1<<15) -#define GRIB_ACCESSOR_FLAG_DOUBLE_TYPE (1<<16) -#define GRIB_ACCESSOR_FLAG_LOWERCASE (1<<17) +#define GRIB_ACCESSOR_FLAG_READ_ONLY (1 << 1) +#define GRIB_ACCESSOR_FLAG_DUMP (1 << 2) +#define GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC (1 << 3) +#define GRIB_ACCESSOR_FLAG_CAN_BE_MISSING (1 << 4) +#define GRIB_ACCESSOR_FLAG_HIDDEN (1 << 5) +#define GRIB_ACCESSOR_FLAG_CONSTRAINT (1 << 6) +#define GRIB_ACCESSOR_FLAG_BUFR_DATA (1 << 7) +#define GRIB_ACCESSOR_FLAG_NO_COPY (1 << 8) +#define GRIB_ACCESSOR_FLAG_COPY_OK (1 << 9) +#define GRIB_ACCESSOR_FLAG_FUNCTION (1 << 10) +#define GRIB_ACCESSOR_FLAG_DATA (1 << 11) +#define GRIB_ACCESSOR_FLAG_NO_FAIL (1 << 12) +#define GRIB_ACCESSOR_FLAG_TRANSIENT (1 << 13) +#define GRIB_ACCESSOR_FLAG_STRING_TYPE (1 << 14) +#define GRIB_ACCESSOR_FLAG_LONG_TYPE (1 << 15) +#define GRIB_ACCESSOR_FLAG_DOUBLE_TYPE (1 << 16) +#define GRIB_ACCESSOR_FLAG_LOWERCASE (1 << 17) /** * a section accessor @@ -562,146 +574,152 @@ struct grib_accessor */ struct grib_section { - grib_accessor* owner; - grib_handle* h; /** < Handles of all accessors and buffer */ - grib_accessor* aclength; /** < block of the length of the block */ - grib_block_of_accessors* block; /** < block */ - grib_action* branch; /** < branch that created the block */ - size_t length; - size_t padding; + grib_accessor* owner; + grib_handle* h; /** < Handles of all accessors and buffer */ + grib_accessor* aclength; /** < block of the length of the block */ + grib_block_of_accessors* block; /** < block */ + grib_action* branch; /** < branch that created the block */ + size_t length; + size_t padding; }; +struct grib_iterator_class +{ + grib_iterator_class** super; + char* name; + size_t size; -struct grib_iterator_class{ - grib_iterator_class** super; - char* name; - size_t size; + int inited; + iterator_init_class_proc init_class; - int inited; - iterator_init_class_proc init_class; - - iterator_init_proc init; - iterator_destroy_proc destroy; - - iterator_next_proc next; - iterator_previous_proc previous; - iterator_reset_proc reset; - iterator_has_next_proc has_next; + iterator_init_proc init; + iterator_destroy_proc destroy; + iterator_next_proc next; + iterator_previous_proc previous; + iterator_reset_proc reset; + iterator_has_next_proc has_next; }; -struct grib_nearest_class{ - grib_nearest_class** super; - char* name; - size_t size; +struct grib_nearest_class +{ + grib_nearest_class** super; + char* name; + size_t size; - int inited; - nearest_init_class_proc init_class; + int inited; + nearest_init_class_proc init_class; - nearest_init_proc init; - nearest_destroy_proc destroy; + nearest_init_proc init; + nearest_destroy_proc destroy; - nearest_find_proc find; + nearest_find_proc find; }; -struct grib_box_class{ - grib_box_class** super; - char* name; - size_t size; - int inited; - box_init_class_proc init_class; - box_init_proc init; - box_destroy_proc destroy; - box_get_points_proc get_points; +struct grib_box_class +{ + grib_box_class** super; + char* name; + size_t size; + int inited; + box_init_class_proc init_class; + box_init_proc init; + box_destroy_proc destroy; + box_get_points_proc get_points; }; /* --------------- */ /* --------------- */ -typedef void (*search_all_callback_proc)(grib_accessor*,void* data); +typedef void (*search_all_callback_proc)(grib_accessor*, void* data); /* --------------- */ -typedef int (*dumper_init_proc) (grib_dumper*); -typedef void (*dumper_dump_proc) (grib_dumper*,grib_accessor*,const char* comment); -typedef void (*dumper_dump_section_proc)(grib_dumper*,grib_accessor*,grib_block_of_accessors* block); -typedef void (*dumper_dump_values_proc) (grib_dumper*,grib_accessor*); -typedef int (*dumper_destroy_proc) (grib_dumper*); -typedef void (*dumper_header_proc) (grib_dumper*,grib_handle*); -typedef void (*dumper_footer_proc) (grib_dumper*,grib_handle*); -typedef void (*dumper_init_class_proc) (grib_dumper_class*); +typedef int (*dumper_init_proc)(grib_dumper*); +typedef void (*dumper_dump_proc)(grib_dumper*, grib_accessor*, const char* comment); +typedef void (*dumper_dump_section_proc)(grib_dumper*, grib_accessor*, grib_block_of_accessors* block); +typedef void (*dumper_dump_values_proc)(grib_dumper*, grib_accessor*); +typedef int (*dumper_destroy_proc)(grib_dumper*); +typedef void (*dumper_header_proc)(grib_dumper*, grib_handle*); +typedef void (*dumper_footer_proc)(grib_dumper*, grib_handle*); +typedef void (*dumper_init_class_proc)(grib_dumper_class*); -struct grib_dumper { - FILE* out; - unsigned long option_flags; - void* arg; - int depth; - long count; - grib_handle* handle; - grib_dumper_class* cclass; - }; - -struct grib_dumper_class { - grib_dumper_class** super; - char* name; - size_t size; - int inited; - dumper_init_class_proc init_class; - dumper_init_proc init; - dumper_destroy_proc destroy; - dumper_dump_proc dump_long; - dumper_dump_proc dump_double; - dumper_dump_proc dump_string; - dumper_dump_proc dump_string_array; - dumper_dump_proc dump_label; - dumper_dump_proc dump_bytes; - dumper_dump_proc dump_bits; - dumper_dump_section_proc dump_section; - dumper_dump_values_proc dump_values; - dumper_header_proc header; - dumper_footer_proc footer; +struct grib_dumper +{ + FILE* out; + unsigned long option_flags; + void* arg; + int depth; + long count; + grib_handle* handle; + grib_dumper_class* cclass; }; -struct grib_iterator{ - grib_arguments* args; /** args of iterator */ - grib_handle* h; - long e; /** current element */ - size_t nv; /** number of values */ - double* data; /** data values */ - grib_iterator_class* cclass; - unsigned long flags; +struct grib_dumper_class +{ + grib_dumper_class** super; + char* name; + size_t size; + int inited; + dumper_init_class_proc init_class; + dumper_init_proc init; + dumper_destroy_proc destroy; + dumper_dump_proc dump_long; + dumper_dump_proc dump_double; + dumper_dump_proc dump_string; + dumper_dump_proc dump_string_array; + dumper_dump_proc dump_label; + dumper_dump_proc dump_bytes; + dumper_dump_proc dump_bits; + dumper_dump_section_proc dump_section; + dumper_dump_values_proc dump_values; + dumper_header_proc header; + dumper_footer_proc footer; }; -struct grib_nearest{ - grib_arguments* args; /** args of iterator */ - grib_handle* h; - grib_context* context; - double* values; - size_t values_count; - grib_nearest_class* cclass; - unsigned long flags; - +struct grib_iterator +{ + grib_arguments* args; /** args of iterator */ + grib_handle* h; + long e; /** current element */ + size_t nv; /** number of values */ + double* data; /** data values */ + grib_iterator_class* cclass; + unsigned long flags; }; -struct grib_box { - grib_box_class* cclass; - grib_context* context; - grib_arguments* args; - grib_handle* h; - unsigned long flags; - grib_points* points; +struct grib_nearest +{ + grib_arguments* args; /** args of iterator */ + grib_handle* h; + grib_context* context; + double* values; + size_t values_count; + grib_nearest_class* cclass; + unsigned long flags; }; -struct grib_dependency { - grib_dependency* next; - grib_accessor* observed; - grib_accessor* observer; - int run; +struct grib_box +{ + grib_box_class* cclass; + grib_context* context; + grib_arguments* args; + grib_handle* h; + unsigned long flags; + grib_points* points; +}; + +struct grib_dependency +{ + grib_dependency* next; + grib_accessor* observed; + grib_accessor* observer; + int run; }; struct grib_block_of_accessors { - grib_accessor* first; - grib_accessor* last; + grib_accessor* first; + grib_accessor* last; }; @@ -711,422 +729,442 @@ typedef struct grib_trie_with_rank grib_trie_with_rank; typedef struct grib_itrie grib_itrie; -struct grib_sarray { - char** v; - size_t size; - size_t n; - size_t incsize; - grib_context* context; -} ; - -struct grib_oarray { - void** v; - size_t size; - size_t n; - size_t incsize; - grib_context* context; -} ; - -struct grib_darray { - double* v; - size_t size; - size_t n; - size_t incsize; - grib_context* context; -} ; - -struct grib_iarray { - long* v; - size_t size; - size_t n; - size_t incsize; - size_t number_of_pop_front; - grib_context* context; -} ; - -struct grib_vdarray { - grib_darray** v; - size_t size; - size_t n; - size_t incsize; - grib_context* context; -} ; - -struct grib_vsarray { - grib_sarray** v; - size_t size; - size_t n; - size_t incsize; - grib_context* context; -} ; - -struct grib_viarray { - grib_iarray** v; - size_t size; - size_t n; - size_t incsize; - grib_context* context; -} ; - -/* types of BUFR descriptors used in bufr_descriptor->type*/ -#define BUFR_DESCRIPTOR_TYPE_UNKNOWN 0 -#define BUFR_DESCRIPTOR_TYPE_STRING 1 -#define BUFR_DESCRIPTOR_TYPE_DOUBLE 2 -#define BUFR_DESCRIPTOR_TYPE_LONG 3 -#define BUFR_DESCRIPTOR_TYPE_TABLE 4 -#define BUFR_DESCRIPTOR_TYPE_FLAG 5 -#define BUFR_DESCRIPTOR_TYPE_REPLICATION 6 -#define BUFR_DESCRIPTOR_TYPE_OPERATOR 7 -#define BUFR_DESCRIPTOR_TYPE_SEQUENCE 8 - -struct bufr_descriptor { - grib_context* context; - long code; - int F; - int X; - int Y; - int type; - /*char* name; Not needed: All usage commented out. See ECC-489 */ - char* shortName; - char* units; - long scale; - double factor; - long reference; - long width; - int nokey; /* set if descriptor does not have an associated key */ - grib_accessor* a; +struct grib_sarray +{ + char** v; + size_t size; + size_t n; + size_t incsize; + grib_context* context; }; -struct bufr_descriptors_array { - bufr_descriptor** v; - size_t size; - size_t n; - size_t incsize; - size_t number_of_pop_front; - grib_context* context; -} ; +struct grib_oarray +{ + void** v; + size_t size; + size_t n; + size_t incsize; + grib_context* context; +}; -struct bufr_descriptors_map_list { - bufr_descriptors_array* unexpanded; - bufr_descriptors_array* expanded; - bufr_descriptors_map_list* next; +struct grib_darray +{ + double* v; + size_t size; + size_t n; + size_t incsize; + grib_context* context; +}; + +struct grib_iarray +{ + long* v; + size_t size; + size_t n; + size_t incsize; + size_t number_of_pop_front; + grib_context* context; +}; + +struct grib_vdarray +{ + grib_darray** v; + size_t size; + size_t n; + size_t incsize; + grib_context* context; +}; + +struct grib_vsarray +{ + grib_sarray** v; + size_t size; + size_t n; + size_t incsize; + grib_context* context; +}; + +struct grib_viarray +{ + grib_iarray** v; + size_t size; + size_t n; + size_t incsize; + grib_context* context; +}; + +/* types of BUFR descriptors used in bufr_descriptor->type*/ +#define BUFR_DESCRIPTOR_TYPE_UNKNOWN 0 +#define BUFR_DESCRIPTOR_TYPE_STRING 1 +#define BUFR_DESCRIPTOR_TYPE_DOUBLE 2 +#define BUFR_DESCRIPTOR_TYPE_LONG 3 +#define BUFR_DESCRIPTOR_TYPE_TABLE 4 +#define BUFR_DESCRIPTOR_TYPE_FLAG 5 +#define BUFR_DESCRIPTOR_TYPE_REPLICATION 6 +#define BUFR_DESCRIPTOR_TYPE_OPERATOR 7 +#define BUFR_DESCRIPTOR_TYPE_SEQUENCE 8 + +struct bufr_descriptor +{ + grib_context* context; + long code; + int F; + int X; + int Y; + int type; + /*char* name; Not needed: All usage commented out. See ECC-489 */ + char* shortName; + char* units; + long scale; + double factor; + long reference; + long width; + int nokey; /* set if descriptor does not have an associated key */ + grib_accessor* a; +}; + +struct bufr_descriptors_array +{ + bufr_descriptor** v; + size_t size; + size_t n; + size_t incsize; + size_t number_of_pop_front; + grib_context* context; +}; + +struct bufr_descriptors_map_list +{ + bufr_descriptors_array* unexpanded; + bufr_descriptors_array* expanded; + bufr_descriptors_map_list* next; }; /* BUFR: Operator 203YYY: Linked list storing Table B changed reference values */ typedef struct bufr_tableb_override bufr_tableb_override; -struct bufr_tableb_override { - bufr_tableb_override* next; - int code; - long new_ref_val; +struct bufr_tableb_override +{ + bufr_tableb_override* next; + int code; + long new_ref_val; }; -struct codes_condition { - char* left; - int rightType; - char* rightString; - long rightLong; - double rightDouble; +struct codes_condition +{ + char* left; + int rightType; + char* rightString; + long rightLong; + double rightDouble; }; void codes_assertion_failed(const char* message, const char* file, int line); -#define MAX_SET_VALUES 10 -#define MAX_ACCESSOR_CACHE 100 +#define MAX_SET_VALUES 10 +#define MAX_ACCESSOR_CACHE 100 struct grib_handle { - grib_context* context; /** < context attached to this handle */ - grib_buffer* buffer ; /** < buffer attached to the handle */ - grib_section* root; /** the root section*/ - grib_section* asserts; /** the assertion section*/ - grib_section* rules; /** the rules section*/ - grib_dependency* dependencies; /** List of dependencies */ - grib_handle* main; /** Used during reparsing */ - grib_handle* kid; /** Used during reparsing */ - grib_loader* loader; /** Used during reparsing */ - int values_stack; - const grib_values* values[MAX_SET_VALUES]; /** Used when setting multiple values at once */ - size_t values_count[MAX_SET_VALUES]; /** Used when setting multiple values at once */ - int dont_trigger; /** Don't notify triggers */ - int partial; /** Not a complete message (just headers) */ - int header_mode; /** Header not jet complete */ - char* gts_header; - size_t gts_header_len; - int use_trie; - int trie_invalid; - grib_accessor* accessors[ACCESSORS_ARRAY_SIZE]; - char* section_offset[MAX_NUM_SECTIONS]; - char* section_length[MAX_NUM_SECTIONS]; - int sections_count; - off_t offset; - long bufr_subset_number; /* bufr subset number */ - long bufr_group_number; /* used in bufr */ + grib_context* context; /** < context attached to this handle */ + grib_buffer* buffer; /** < buffer attached to the handle */ + grib_section* root; /** the root section*/ + grib_section* asserts; /** the assertion section*/ + grib_section* rules; /** the rules section*/ + grib_dependency* dependencies; /** List of dependencies */ + grib_handle* main; /** Used during reparsing */ + grib_handle* kid; /** Used during reparsing */ + grib_loader* loader; /** Used during reparsing */ + int values_stack; + const grib_values* values[MAX_SET_VALUES]; /** Used when setting multiple values at once */ + size_t values_count[MAX_SET_VALUES]; /** Used when setting multiple values at once */ + int dont_trigger; /** Don't notify triggers */ + int partial; /** Not a complete message (just headers) */ + int header_mode; /** Header not jet complete */ + char* gts_header; + size_t gts_header_len; + int use_trie; + int trie_invalid; + grib_accessor* accessors[ACCESSORS_ARRAY_SIZE]; + char* section_offset[MAX_NUM_SECTIONS]; + char* section_length[MAX_NUM_SECTIONS]; + int sections_count; + off_t offset; + long bufr_subset_number; /* bufr subset number */ + long bufr_group_number; /* used in bufr */ /* grib_accessor* groups[MAX_NUM_GROUPS]; */ - long missingValueLong; - double missingValueDouble; - ProductKind product_kind; - grib_trie* bufr_elements_table; + long missingValueLong; + double missingValueDouble; + ProductKind product_kind; + grib_trie* bufr_elements_table; }; -struct grib_multi_handle { - grib_context* context; /** < context attached to this handle */ - grib_buffer* buffer; /** < buffer attached to the handle */ - size_t offset; - size_t length; +struct grib_multi_handle +{ + grib_context* context; /** < context attached to this handle */ + grib_buffer* buffer; /** < buffer attached to the handle */ + size_t offset; + size_t length; }; struct grib_accessor_class { - grib_accessor_class** super; - const char* name; - size_t size; + grib_accessor_class** super; + const char* name; + size_t size; - int inited; - accessor_init_class_proc init_class; + int inited; + accessor_init_class_proc init_class; - accessor_init_proc init; - accessor_post_init_proc post_init; - accessor_destroy_proc destroy; + accessor_init_proc init; + accessor_post_init_proc post_init; + accessor_destroy_proc destroy; - accessor_dump_proc dump; - accessor_value_proc next_offset; + accessor_dump_proc dump; + accessor_value_proc next_offset; - accessor_string_proc string_length; - accessor_value_with_ret_proc value_count; + accessor_string_proc string_length; + accessor_value_with_ret_proc value_count; - accessor_value_proc byte_count; - accessor_value_proc byte_offset; + accessor_value_proc byte_count; + accessor_value_proc byte_offset; - accessor_get_native_type_proc get_native_type; + accessor_get_native_type_proc get_native_type; - accessor_sub_section_proc sub_section; + accessor_sub_section_proc sub_section; - accessor_pack_missing_proc pack_missing ; - accessor_pack_is_missing_proc is_missing ; + accessor_pack_missing_proc pack_missing; + accessor_pack_is_missing_proc is_missing; - accessor_pack_long_proc pack_long ; - accessor_unpack_long_proc unpack_long ; + accessor_pack_long_proc pack_long; + accessor_unpack_long_proc unpack_long; - accessor_pack_double_proc pack_double; - accessor_unpack_double_proc unpack_double; + accessor_pack_double_proc pack_double; + accessor_unpack_double_proc unpack_double; - accessor_pack_string_proc pack_string; - accessor_unpack_string_proc unpack_string; + accessor_pack_string_proc pack_string; + accessor_unpack_string_proc unpack_string; - accessor_pack_string_array_proc pack_string_array; - accessor_unpack_string_array_proc unpack_string_array; + accessor_pack_string_array_proc pack_string_array; + accessor_unpack_string_array_proc unpack_string_array; - accessor_pack_bytes_proc pack_bytes; - accessor_unpack_bytes_proc unpack_bytes; + accessor_pack_bytes_proc pack_bytes; + accessor_unpack_bytes_proc unpack_bytes; - accessor_pack_expression_proc pack_expression; + accessor_pack_expression_proc pack_expression; - accessor_notify_change_proc notify_change; - accessor_update_size_proc update_size; + accessor_notify_change_proc notify_change; + accessor_update_size_proc update_size; - accessor_preferred_size_proc preferred_size; - accessor_resize_proc resize; + accessor_preferred_size_proc preferred_size; + accessor_resize_proc resize; - accessor_nearest_proc nearest_smaller_value; - accessor_next_proc next; - accessor_compare_proc compare; - accessor_unpack_double_element_proc unpack_double_element; - accessor_unpack_double_subarray_proc unpack_double_subarray; - accessor_clear_proc clear; - accessor_clone_proc make_clone; + accessor_nearest_proc nearest_smaller_value; + accessor_next_proc next; + accessor_compare_proc compare; + accessor_unpack_double_element_proc unpack_double_element; + accessor_unpack_double_subarray_proc unpack_double_subarray; + accessor_clear_proc clear; + accessor_clone_proc make_clone; }; typedef struct grib_multi_support grib_multi_support; -struct grib_multi_support { - FILE* file; - size_t offset; - unsigned char* message; - size_t message_length; - unsigned char* sections[8]; - unsigned char* bitmap_section; - size_t bitmap_section_length; - size_t sections_length[9]; - int section_number; - grib_multi_support* next; +struct grib_multi_support +{ + FILE* file; + size_t offset; + unsigned char* message; + size_t message_length; + unsigned char* sections[8]; + unsigned char* bitmap_section; + size_t bitmap_section_length; + size_t sections_length[9]; + int section_number; + grib_multi_support* next; }; /* Hash_array */ typedef struct grib_hash_array_value grib_hash_array_value; -struct grib_hash_array_value { - grib_hash_array_value* next; - char* name; - int type; - grib_iarray* iarray; - grib_darray* darray; - grib_trie* index; +struct grib_hash_array_value +{ + grib_hash_array_value* next; + char* name; + int type; + grib_iarray* iarray; + grib_darray* darray; + grib_trie* index; }; /* Concepts */ typedef struct grib_concept_condition grib_concept_condition; -struct grib_concept_condition { - grib_concept_condition* next; - char* name; - grib_expression* expression; - grib_iarray* iarray; +struct grib_concept_condition +{ + grib_concept_condition* next; + char* name; + grib_expression* expression; + grib_iarray* iarray; }; typedef struct grib_concept_value_name grib_concept_value_name; -struct grib_concept_value_name { - grib_concept_value_name* next; - char* name; +struct grib_concept_value_name +{ + grib_concept_value_name* next; + char* name; }; typedef struct grib_concept_value grib_concept_value; -struct grib_concept_value { - grib_concept_value* next; - char* name; - grib_concept_condition* conditions; - grib_trie* index; +struct grib_concept_value +{ + grib_concept_value* next; + char* name; + grib_concept_condition* conditions; + grib_trie* index; }; /* ----------*/ struct grib_context { - int inited; - int debug; - int write_on_fail; - int no_abort; - int io_buffer_size; - int no_big_group_split; - int no_spd; - int keep_matrix; - char* grib_definition_files_path; - char* grib_samples_path; - char* grib_concept_path; + int inited; + int debug; + int write_on_fail; + int no_abort; + int io_buffer_size; + int no_big_group_split; + int no_spd; + int keep_matrix; + char* grib_definition_files_path; + char* grib_samples_path; + char* grib_concept_path; - grib_action_file_list* grib_reader; - void* user_data; - int real_mode; + grib_action_file_list* grib_reader; + void* user_data; + int real_mode; - grib_free_proc free_mem; - grib_malloc_proc alloc_mem; - grib_realloc_proc realloc_mem; + grib_free_proc free_mem; + grib_malloc_proc alloc_mem; + grib_realloc_proc realloc_mem; - grib_free_proc free_persistent_mem; - grib_malloc_proc alloc_persistent_mem; + grib_free_proc free_persistent_mem; + grib_malloc_proc alloc_persistent_mem; - grib_free_proc free_buffer_mem; - grib_malloc_proc alloc_buffer_mem; - grib_realloc_proc realloc_buffer_mem; + grib_free_proc free_buffer_mem; + grib_malloc_proc alloc_buffer_mem; + grib_realloc_proc realloc_buffer_mem; - grib_data_read_proc read; - grib_data_write_proc write; - grib_data_tell_proc tell; - grib_data_seek_proc seek; - grib_data_eof_proc eof; + grib_data_read_proc read; + grib_data_write_proc write; + grib_data_tell_proc tell; + grib_data_seek_proc seek; + grib_data_eof_proc eof; - grib_log_proc output_log; - grib_print_proc print; + grib_log_proc output_log; + grib_print_proc print; - grib_codetable* codetable; - grib_smart_table* smart_table; - char* outfilename; - int multi_support_on; - grib_multi_support* multi_support; - grib_string_list* grib_definition_files_dir; - int handle_file_count; - int handle_total_count; - off_t message_file_offset; - int no_fail_on_wrong_length; - int gts_header_on; - int gribex_mode_on; - int large_constant_fields; - grib_itrie* keys; - int keys_count; - grib_itrie* concepts_index; - int concepts_count; - grib_concept_value* concepts[MAX_NUM_CONCEPTS]; - grib_itrie* hash_array_index; - int hash_array_count; - grib_hash_array_value* hash_array[MAX_NUM_HASH_ARRAY]; - grib_trie* def_files; - grib_string_list* blacklist; - int ieee_packing; - int bufrdc_mode; - int bufr_set_to_missing_if_out_of_range; - int bufr_multi_element_constant_arrays; - int grib_data_quality_checks; - FILE* log_stream; - grib_trie* classes; - grib_trie* lists; - grib_trie* expanded_descriptors; - int file_pool_max_opened_files; + grib_codetable* codetable; + grib_smart_table* smart_table; + char* outfilename; + int multi_support_on; + grib_multi_support* multi_support; + grib_string_list* grib_definition_files_dir; + int handle_file_count; + int handle_total_count; + off_t message_file_offset; + int no_fail_on_wrong_length; + int gts_header_on; + int gribex_mode_on; + int large_constant_fields; + grib_itrie* keys; + int keys_count; + grib_itrie* concepts_index; + int concepts_count; + grib_concept_value* concepts[MAX_NUM_CONCEPTS]; + grib_itrie* hash_array_index; + int hash_array_count; + grib_hash_array_value* hash_array[MAX_NUM_HASH_ARRAY]; + grib_trie* def_files; + grib_string_list* blacklist; + int ieee_packing; + int bufrdc_mode; + int bufr_set_to_missing_if_out_of_range; + int bufr_multi_element_constant_arrays; + int grib_data_quality_checks; + FILE* log_stream; + grib_trie* classes; + grib_trie* lists; + grib_trie* expanded_descriptors; + int file_pool_max_opened_files; #if GRIB_PTHREADS - pthread_mutex_t mutex; + pthread_mutex_t mutex; #elif GRIB_OMP_THREADS - omp_nest_lock_t mutex; + omp_nest_lock_t mutex; #endif - }; /* expression*/ -typedef int (*expression_evaluate_long_proc)(grib_expression*,grib_handle*,long*); -typedef int (*expression_evaluate_double_proc)(grib_expression*,grib_handle*,double*); -typedef const char* (*expression_evaluate_string_proc)(grib_expression*,grib_handle*,char*,size_t*,int*); +typedef int (*expression_evaluate_long_proc)(grib_expression*, grib_handle*, long*); +typedef int (*expression_evaluate_double_proc)(grib_expression*, grib_handle*, double*); +typedef const char* (*expression_evaluate_string_proc)(grib_expression*, grib_handle*, char*, size_t*, int*); typedef const char* (*expression_get_name_proc)(grib_expression*); -typedef void (*expression_print_proc)(grib_context*,grib_expression*,grib_handle*); -typedef void (*expression_add_dependency_proc) (grib_expression*e, grib_accessor* observer ); +typedef void (*expression_print_proc)(grib_context*, grib_expression*, grib_handle*); +typedef void (*expression_add_dependency_proc)(grib_expression* e, grib_accessor* observer); typedef struct grib_expression_class grib_expression_class; -typedef void (*expression_class_init_proc) (grib_expression_class*e); -typedef void (*expression_init_proc) (grib_expression*e); -typedef void (*expression_destroy_proc) (grib_context*,grib_expression*e); +typedef void (*expression_class_init_proc)(grib_expression_class* e); +typedef void (*expression_init_proc)(grib_expression* e); +typedef void (*expression_destroy_proc)(grib_context*, grib_expression* e); -typedef int (*expression_native_type_proc)(grib_expression*,grib_handle*); +typedef int (*expression_native_type_proc)(grib_expression*, grib_handle*); -struct grib_expression { +struct grib_expression +{ grib_expression_class* cclass; }; -struct grib_expression_class { +struct grib_expression_class +{ grib_expression_class** super; - const char* name; - size_t size; - int inited; + const char* name; + size_t size; + int inited; expression_class_init_proc init_class; expression_init_proc init; expression_destroy_proc destroy; - expression_print_proc print; - expression_add_dependency_proc add_dependency; + expression_print_proc print; + expression_add_dependency_proc add_dependency; - expression_native_type_proc native_type; - expression_get_name_proc get_name; + expression_native_type_proc native_type; + expression_get_name_proc get_name; - expression_evaluate_long_proc evaluate_long; - expression_evaluate_double_proc evaluate_double; - expression_evaluate_string_proc evaluate_string; + expression_evaluate_long_proc evaluate_long; + expression_evaluate_double_proc evaluate_double; + expression_evaluate_string_proc evaluate_string; }; -struct grib_arguments { +struct grib_arguments +{ struct grib_arguments* next; - grib_expression* expression; - char value[80]; + grib_expression* expression; + char value[80]; }; -long grib_expression_evaluate(grib_handle*,grib_expression*); -void grib_expression_free(grib_context*,grib_expression*); +long grib_expression_evaluate(grib_handle*, grib_expression*); +void grib_expression_free(grib_context*, grib_expression*); -grib_arguments* grib_arguments_new(grib_context*,grib_expression*,grib_arguments*); -void grib_arguments_free(grib_context*,grib_arguments*); +grib_arguments* grib_arguments_new(grib_context*, grib_expression*, grib_arguments*); +void grib_arguments_free(grib_context*, grib_arguments*); const char* grib_argument_next(grib_arguments**); @@ -1136,24 +1174,26 @@ extern grib_string_list grib_file_not_found; typedef struct grib_file grib_file; typedef struct grib_file_pool grib_file_pool; -struct grib_file { - grib_context* context; - char* name; - FILE* handle; - char* mode; - char* buffer; - long refcount; - grib_file* next; - short id; -} ; +struct grib_file +{ + grib_context* context; + char* name; + FILE* handle; + char* mode; + char* buffer; + long refcount; + grib_file* next; + short id; +}; -struct grib_file_pool { - grib_context* context; - grib_file* first; - grib_file* current; - size_t size; - int number_of_opened_files; - int max_opened_files; +struct grib_file_pool +{ + grib_context* context; + grib_file* first; + grib_file* current; + size_t size; + int number_of_opened_files; + int max_opened_files; }; /* fieldset */ @@ -1162,87 +1202,96 @@ typedef struct grib_column grib_column; typedef struct grib_fields grib_fields; typedef struct grib_int_array grib_int_array; -struct grib_where { - grib_context* context; - char* string; +struct grib_where +{ + grib_context* context; + char* string; }; -struct grib_column { - grib_context* context; - int refcount; - char* name; - int type; - size_t size; - size_t values_array_size; - long* long_values; - double* double_values; - char** string_values; - int* errors; -} ; +struct grib_column +{ + grib_context* context; + int refcount; + char* name; + int type; + size_t size; + size_t values_array_size; + long* long_values; + double* double_values; + char** string_values; + int* errors; +}; -struct grib_order_by { - char* key; - int idkey; - int mode; - grib_order_by* next; -} ; +struct grib_order_by +{ + char* key; + int idkey; + int mode; + grib_order_by* next; +}; #ifdef NEWDB -struct grib_query { - grib_context* context; - char* where_string; - grib_order_by* order_by; +struct grib_query +{ + grib_context* context; + char* where_string; + grib_order_by* order_by; }; #endif -struct grib_field { - grib_file* file; - off_t offset; - long length; - grib_field* next; +struct grib_field +{ + grib_file* file; + off_t offset; + long length; + grib_field* next; }; -struct grib_int_array { - grib_context* context; - size_t size; - int* el; -} ; +struct grib_int_array +{ + grib_context* context; + size_t size; + int* el; +}; #ifndef NEWDB -struct grib_fieldset { - grib_context* context; - grib_int_array* filter; - grib_int_array* order; - size_t fields_array_size; - size_t size; - grib_column* columns; - size_t columns_size; - grib_where* where; - grib_order_by* order_by; - long current; - grib_field** fields; +struct grib_fieldset +{ + grib_context* context; + grib_int_array* filter; + grib_int_array* order; + size_t fields_array_size; + size_t size; + grib_column* columns; + size_t columns_size; + grib_where* where; + grib_order_by* order_by; + long current; + grib_field** fields; }; #endif #ifdef NEWDB /* grib db */ -struct grib_db { - grib_context* context; - size_t size; - size_t fields_array_size; - grib_column* columns; - size_t columns_size; - grib_field** fields; +struct grib_db +{ + grib_context* context; + size_t size; + size_t fields_array_size; + grib_column* columns; + size_t columns_size; + grib_field** fields; }; -struct grib_fieldset { - grib_context* context; - grib_db* db; - grib_int_array* filter; - grib_int_array* order; - size_t size; - grib_query* query; - long current; +struct grib_fieldset +{ + grib_context* context; + grib_db* db; + grib_int_array* filter; + grib_int_array* order; + size_t size; + grib_query* query; + long current; }; #endif @@ -1254,28 +1303,32 @@ typedef struct grib_conditions_tree grib_conditions_tree; typedef struct grib_concept_entry grib_concept_entry; typedef struct grib_concept_key grib_concept_key; -struct grib_concept_index_entry { - char* name; - char* value; - int type; - grib_concept_entry* next; +struct grib_concept_index_entry +{ + char* name; + char* value; + int type; + grib_concept_entry* next; }; -struct grib_concept_index_key { - char* name; - int type; - grib_concept_key* next; +struct grib_concept_index_key +{ + char* name; + int type; + grib_concept_key* next; }; -struct grib_concept_index { +struct grib_concept_index +{ grib_context* context; grib_concept_key* keys; grib_conditions_tree* conditions; }; -struct grib_conditions_tree { - char* value; - void* object; +struct grib_conditions_tree +{ + char* value; + void* object; grib_conditions_tree* next; grib_conditions_tree* next_key; }; @@ -1291,221 +1344,238 @@ extern FILE* codes_memfs_open(const char* path); typedef struct grib_field_tree grib_field_tree; -struct grib_field_tree { - grib_field* field; - char* value; - grib_field_tree* next; - grib_field_tree* next_level; +struct grib_field_tree +{ + grib_field* field; + char* value; + grib_field_tree* next; + grib_field_tree* next_level; }; typedef struct grib_index_key grib_index_key; -struct grib_index_key { - char* name; - int type; - char value[STRING_VALUE_LEN]; - grib_string_list* values; - grib_string_list* current; - int values_count; - int count; - grib_index_key* next; +struct grib_index_key +{ + char* name; + int type; + char value[STRING_VALUE_LEN]; + grib_string_list* values; + grib_string_list* current; + int values_count; + int count; + grib_index_key* next; }; typedef struct grib_field_list grib_field_list; -struct grib_field_list { - grib_field* field; - grib_field_list* next; +struct grib_field_list +{ + grib_field* field; + grib_field_list* next; }; -struct grib_index { - grib_context* context; - grib_index_key* keys; - int rewind; - int orderby; - grib_index_key* orederby_keys; - grib_field_tree* fields; - grib_field_list* fieldset; - grib_field_list* current; - grib_file* files; - int count; +struct grib_index +{ + grib_context* context; + grib_index_key* keys; + int rewind; + int orderby; + grib_index_key* orederby_keys; + grib_field_tree* fields; + grib_field_list* fieldset; + grib_field_list* current; + grib_file* files; + int count; }; /* header compute */ typedef struct grib_math grib_math; -struct grib_math{ - struct grib_math* left; - struct grib_math* right; - char* name; - int arity; +struct grib_math +{ + struct grib_math* left; + struct grib_math* right; + char* name; + int arity; }; typedef double (*mathproc)(void); -typedef int (*funcproc)(grib_math*,mathproc); +typedef int (*funcproc)(grib_math*, mathproc); -typedef struct func { - char* name; - funcproc addr; - mathproc proc; - int arity; - char* info; +typedef struct func +{ + char* name; + funcproc addr; + mathproc proc; + int arity; + char* info; } func; /* action file */ struct grib_action_file { - char* filename; - grib_action* root; + char* filename; + grib_action* root; grib_action_file* next; }; struct grib_action_file_list { - grib_action_file * first; - grib_action_file * last ; + grib_action_file* first; + grib_action_file* last; }; /* Common keys iterator */ -struct grib_keys_iterator{ - grib_handle *handle; - unsigned long filter_flags; /** flags to filter out accessors */ - unsigned long accessor_flags_skip; - grib_accessor *current; - char *name_space; - int at_start; - int match; - int i_curr_attribute; - grib_accessor** attributes; - char* prefix; - grib_trie *seen; +struct grib_keys_iterator +{ + grib_handle* handle; + unsigned long filter_flags; /** flags to filter out accessors */ + unsigned long accessor_flags_skip; + grib_accessor* current; + char* name_space; + int at_start; + int match; + int i_curr_attribute; + grib_accessor** attributes; + char* prefix; + grib_trie* seen; }; /* BUFR-specific keys iterator */ -struct bufr_keys_iterator{ - grib_handle* handle; - unsigned long filter_flags; /** flags to filter out accessors */ - unsigned long accessor_flags_skip; - unsigned long accessor_flags_only; - grib_accessor* current; - char* key_name; - int at_start; - int match; - int i_curr_attribute; - grib_accessor** attributes; - char* prefix; - grib_trie* seen; +struct bufr_keys_iterator +{ + grib_handle* handle; + unsigned long filter_flags; /** flags to filter out accessors */ + unsigned long accessor_flags_skip; + unsigned long accessor_flags_only; + grib_accessor* current; + char* key_name; + int at_start; + int match; + int i_curr_attribute; + grib_accessor** attributes; + char* prefix; + grib_trie* seen; }; /* ----------*/ /* md5 */ typedef unsigned long cvs_uint32; -struct cvs_MD5Context { - cvs_uint32 buf[4]; - cvs_uint32 bits[2]; - unsigned char in[64]; +struct cvs_MD5Context +{ + cvs_uint32 buf[4]; + cvs_uint32 bits[2]; + unsigned char in[64]; }; /* --- */ typedef struct grib_rule_entry grib_rule_entry; -struct grib_rule_entry { - grib_rule_entry* next; - char* name; - grib_expression* value; +struct grib_rule_entry +{ + grib_rule_entry* next; + char* name; + grib_expression* value; }; typedef struct grib_rule grib_rule; -struct grib_rule { - grib_rule* next; - grib_expression* condition; - grib_rule_entry* entries; +struct grib_rule +{ + grib_rule* next; + grib_expression* condition; + grib_rule_entry* entries; }; typedef struct grib_case grib_case; -struct grib_case { - grib_arguments* values; - grib_action* action; - grib_case* next; +struct grib_case +{ + grib_arguments* values; + grib_action* action; + grib_case* next; }; /* ----------*/ -typedef struct code_table_entry { - char* abbreviation; - char* title; - char* units; +typedef struct code_table_entry +{ + char* abbreviation; + char* title; + char* units; } code_table_entry; -struct grib_codetable { - char* filename[2]; - char* recomposed_name[2]; - grib_codetable* next; - size_t size; - code_table_entry entries[1]; +struct grib_codetable +{ + char* filename[2]; + char* recomposed_name[2]; + grib_codetable* next; + size_t size; + code_table_entry entries[1]; }; -typedef struct grib_smart_table_entry { - /*int code;*/ - char* abbreviation; - char* column[MAX_SMART_TABLE_COLUMNS]; +typedef struct grib_smart_table_entry +{ + /*int code;*/ + char* abbreviation; + char* column[MAX_SMART_TABLE_COLUMNS]; } grib_smart_table_entry; -struct grib_smart_table { - char* filename[3]; - char* recomposed_name[3]; - grib_smart_table* next; - size_t numberOfEntries; - grib_smart_table_entry* entries; +struct grib_smart_table +{ + char* filename[3]; + char* recomposed_name[3]; + grib_smart_table* next; + size_t numberOfEntries; + grib_smart_table_entry* entries; }; #if GRIB_TIMER -typedef struct grib_timer { - +typedef struct grib_timer +{ struct timeval start_; double timer_; - int active_; - char *name_; - int count_; + int active_; + char* name_; + int count_; long total_; int elapsed_; - double cpu_; - double total_cpu_; + double cpu_; + double total_cpu_; - char *statname_; + char* statname_; grib_context* context; - struct grib_timer *next_; + struct grib_timer* next_; } grib_timer; #else -typedef struct grib_timer { +typedef struct grib_timer +{ char nothing; } grib_timer; #endif -typedef struct j2k_encode_helper { +typedef struct j2k_encode_helper +{ + size_t buffer_size; - size_t buffer_size; + long width; + long height; + long bits_per_value; - long width; - long height; - long bits_per_value; + float compression; - float compression; + long no_values; + const double* values; + double reference_value; + double divisor; + double decimal; - long no_values; - const double* values; - double reference_value; - double divisor; - double decimal; - - long jpeg_length; - unsigned char* jpeg_buffer; + long jpeg_length; + unsigned char* jpeg_buffer; } j2k_encode_helper; @@ -1520,29 +1590,29 @@ typedef struct j2k_encode_helper { #ifndef grib_errors_internal_H #define grib_errors_internal_H /** Value mismatch */ -#define GRIB_VALUE_MISMATCH 1 +#define GRIB_VALUE_MISMATCH 1 /** double values are different */ -#define GRIB_DOUBLE_VALUE_MISMATCH 2 +#define GRIB_DOUBLE_VALUE_MISMATCH 2 /** long values are different */ -#define GRIB_LONG_VALUE_MISMATCH 3 +#define GRIB_LONG_VALUE_MISMATCH 3 /** byte values are different */ -#define GRIB_BYTE_VALUE_MISMATCH 4 +#define GRIB_BYTE_VALUE_MISMATCH 4 /** string values are different */ -#define GRIB_STRING_VALUE_MISMATCH 5 +#define GRIB_STRING_VALUE_MISMATCH 5 /** Offset mismatch */ -#define GRIB_OFFSET_MISMATCH 6 +#define GRIB_OFFSET_MISMATCH 6 /** Count mismatch */ -#define GRIB_COUNT_MISMATCH 7 +#define GRIB_COUNT_MISMATCH 7 /** Name mismatch */ -#define GRIB_NAME_MISMATCH 8 +#define GRIB_NAME_MISMATCH 8 /** Type mismatch */ -#define GRIB_TYPE_MISMATCH 9 +#define GRIB_TYPE_MISMATCH 9 /** Type and value mismatch */ -#define GRIB_TYPE_AND_VALUE_MISMATCH 10 +#define GRIB_TYPE_AND_VALUE_MISMATCH 10 /** Unable to compare accessors */ -#define GRIB_UNABLE_TO_COMPARE_ACCESSORS 11 +#define GRIB_UNABLE_TO_COMPARE_ACCESSORS 11 /** Unable to reset iterator */ -#define GRIB_UNABLE_TO_RESET_ITERATOR 12 +#define GRIB_UNABLE_TO_RESET_ITERATOR 12 /** Assertion failure */ -#define GRIB_ASSERTION_FAILURE 13 +#define GRIB_ASSERTION_FAILURE 13 #endif diff --git a/src/grib_api_prototypes.h b/src/grib_api_prototypes.h index 3a91d5c73..71878f680 100644 --- a/src/grib_api_prototypes.h +++ b/src/grib_api_prototypes.h @@ -1,28 +1,28 @@ /* action.c */ -void grib_dump(grib_action *a, FILE *f, int l); -void grib_xref(grib_action *a, FILE *f, const char *path); -void grib_action_delete(grib_context *context, grib_action *a); -int grib_create_accessor(grib_section *p, grib_action *a, grib_loader *h); -int grib_action_notify_change(grib_action *a, grib_accessor *observer, grib_accessor *observed); -grib_action *grib_action_reparse(grib_action *a, grib_accessor *acc, int *doit); -int grib_action_execute(grib_action *a, grib_handle *h); -void grib_dump_action_branch(FILE *out, grib_action *a, int decay); -void grib_dump_action_tree(grib_context *ctx, FILE *out); -void grib_xref_action_branch(FILE *out, grib_action *a, const char *path); +void grib_dump(grib_action* a, FILE* f, int l); +void grib_xref(grib_action* a, FILE* f, const char* path); +void grib_action_delete(grib_context* context, grib_action* a); +int grib_create_accessor(grib_section* p, grib_action* a, grib_loader* h); +int grib_action_notify_change(grib_action* a, grib_accessor* observer, grib_accessor* observed); +grib_action* grib_action_reparse(grib_action* a, grib_accessor* acc, int* doit); +int grib_action_execute(grib_action* a, grib_handle* h); +void grib_dump_action_branch(FILE* out, grib_action* a, int decay); +void grib_dump_action_tree(grib_context* ctx, FILE* out); +void grib_xref_action_branch(FILE* out, grib_action* a, const char* path); /* action_class_alias.c */ -grib_action *grib_action_create_alias(grib_context *context, const char *name, const char *arg1, const char *name_space, int flags); +grib_action* grib_action_create_alias(grib_context* context, const char* name, const char* arg1, const char* name_space, int flags); /* action_class_gen.c */ -grib_action *grib_action_create_gen(grib_context *context, const char *name, const char *op, const long len, grib_arguments *params, grib_arguments *default_value, int flags, const char *name_space, const char *set); +grib_action* grib_action_create_gen(grib_context* context, const char* name, const char* op, const long len, grib_arguments* params, grib_arguments* default_value, int flags, const char* name_space, const char* set); /* action_class_if.c */ -grib_action *grib_action_create_if(grib_context *context, grib_expression *expression, grib_action *block_true, grib_action *block_false, int transient, int lineno, char *file_being_parsed); +grib_action* grib_action_create_if(grib_context* context, grib_expression* expression, grib_action* block_true, grib_action* block_false, int transient, int lineno, char* file_being_parsed); /* action_class_switch.c */ -grib_action *grib_action_create_switch(grib_context *context, grib_arguments *args, grib_case *Case, grib_action *Default); -grib_case *grib_case_new(grib_context *c, grib_arguments *values, grib_action *action); +grib_action* grib_action_create_switch(grib_context* context, grib_arguments* args, grib_case* Case, grib_action* Default); +grib_case* grib_case_new(grib_context* c, grib_arguments* values, grib_action* action); /* grib_accessor_class_g1fcperiod.c */ @@ -33,245 +33,245 @@ grib_case *grib_case_new(grib_context *c, grib_arguments *values, grib_action *a /* action_class_section.c */ /* action_class_list.c */ -grib_action *grib_action_create_list(grib_context *context, const char *name, grib_expression *expression, grib_action *block); +grib_action* grib_action_create_list(grib_context* context, const char* name, grib_expression* expression, grib_action* block); /* action_class_while.c */ -grib_action *grib_action_create_while(grib_context *context, grib_expression *expression, grib_action *block); +grib_action* grib_action_create_while(grib_context* context, grib_expression* expression, grib_action* block); /* action_class_put.c */ -grib_action *grib_action_create_put(grib_context *context, const char *name, grib_arguments *args); +grib_action* grib_action_create_put(grib_context* context, const char* name, grib_arguments* args); /* action_class_meta.c */ -grib_action *grib_action_create_meta(grib_context *context, const char *name, const char *op, grib_arguments *params, grib_arguments *default_value, unsigned long flags, const char *name_space); +grib_action* grib_action_create_meta(grib_context* context, const char* name, const char* op, grib_arguments* params, grib_arguments* default_value, unsigned long flags, const char* name_space); /* action_class_remove.c */ -grib_action *grib_action_create_remove(grib_context *context, grib_arguments *args); +grib_action* grib_action_create_remove(grib_context* context, grib_arguments* args); /* action_class_rename.c */ -grib_action *grib_action_create_rename(grib_context *context, char *the_old, char *the_new); +grib_action* grib_action_create_rename(grib_context* context, char* the_old, char* the_new); /* action_class_assert.c */ -grib_action *grib_action_create_assert(grib_context *context, grib_expression *expression); +grib_action* grib_action_create_assert(grib_context* context, grib_expression* expression); /* action_class_template.c */ -grib_action *grib_action_create_template(grib_context *context, int nofail, const char *name, const char *arg1); -grib_action *get_empty_template(grib_context *c, int *err); +grib_action* grib_action_create_template(grib_context* context, int nofail, const char* name, const char* arg1); +grib_action* get_empty_template(grib_context* c, int* err); /* action_class_trigger.c */ -grib_action *grib_action_create_trigger(grib_context *context, grib_arguments *args, grib_action *block); +grib_action* grib_action_create_trigger(grib_context* context, grib_arguments* args, grib_action* block); /* action_class_when.c */ -grib_action *grib_action_create_when(grib_context *context, grib_expression *expression, grib_action *block_true, grib_action *block_false); +grib_action* grib_action_create_when(grib_context* context, grib_expression* expression, grib_action* block_true, grib_action* block_false); /* action_class_concept.c */ -grib_concept_value *action_concept_get_concept(grib_accessor *a); -int action_concept_get_nofail(grib_accessor *a); -grib_action *grib_action_create_concept(grib_context *context, const char *name, grib_concept_value *concept, const char *basename, const char *name_space, const char *defaultkey, const char *masterDir, const char *localDir, const char *ecmfDir, int flags, int nofail); +grib_concept_value* action_concept_get_concept(grib_accessor* a); +int action_concept_get_nofail(grib_accessor* a); +grib_action* grib_action_create_concept(grib_context* context, const char* name, grib_concept_value* concept, const char* basename, const char* name_space, const char* defaultkey, const char* masterDir, const char* localDir, const char* ecmfDir, int flags, int nofail); int get_concept_condition_string(grib_handle* h, const char* key, const char* value, char* result); /* action_class_hash_array.c */ -grib_action *grib_action_create_hash_array(grib_context *context, const char *name, grib_hash_array_value *hash_array, const char *basename, const char *name_space, const char *defaultkey, const char *masterDir, const char *localDir, const char *ecmfDir, int flags, int nofail); -grib_hash_array_value *get_hash_array(grib_handle *h, grib_action *a); +grib_action* grib_action_create_hash_array(grib_context* context, const char* name, grib_hash_array_value* hash_array, const char* basename, const char* name_space, const char* defaultkey, const char* masterDir, const char* localDir, const char* ecmfDir, int flags, int nofail); +grib_hash_array_value* get_hash_array(grib_handle* h, grib_action* a); /* action_class_set.c */ -grib_action *grib_action_create_set(grib_context *context, const char *name, grib_expression *expression, int nofail); +grib_action* grib_action_create_set(grib_context* context, const char* name, grib_expression* expression, int nofail); /* action_class_set_darray.c */ -grib_action *grib_action_create_set_darray(grib_context *context, const char *name, grib_darray *darray); +grib_action* grib_action_create_set_darray(grib_context* context, const char* name, grib_darray* darray); /* action_class_set_iarray.c */ -grib_action *grib_action_create_set_iarray(grib_context *context, const char *name, grib_iarray *iarray); +grib_action* grib_action_create_set_iarray(grib_context* context, const char* name, grib_iarray* iarray); /* action_class_set_sarray.c */ -grib_action *grib_action_create_set_sarray(grib_context *context, const char *name, grib_sarray *sarray); +grib_action* grib_action_create_set_sarray(grib_context* context, const char* name, grib_sarray* sarray); /* action_class_noop.c */ -grib_action *grib_action_create_noop(grib_context *context, const char *fname); +grib_action* grib_action_create_noop(grib_context* context, const char* fname); /* action_class_write.c */ -grib_action *grib_action_create_write(grib_context *context, const char *name, int append, int padtomultiple); +grib_action* grib_action_create_write(grib_context* context, const char* name, int append, int padtomultiple); /* action_class_print.c */ -grib_action *grib_action_create_print(grib_context *context, const char *name, char *outname); +grib_action* grib_action_create_print(grib_context* context, const char* name, char* outname); /* action_class_close.c */ -grib_action *grib_action_create_close(grib_context *context, char *filename); +grib_action* grib_action_create_close(grib_context* context, char* filename); /* action_class_variable.c */ -grib_action *grib_action_create_variable(grib_context *context, const char *name, const char *op, const long len, grib_arguments *params, grib_arguments *default_value, int flags, const char *name_space); +grib_action* grib_action_create_variable(grib_context* context, const char* name, const char* op, const long len, grib_arguments* params, grib_arguments* default_value, int flags, const char* name_space); /* action_class_modify.c */ -grib_action *grib_action_create_modify(grib_context *context, const char *name, long flags); +grib_action* grib_action_create_modify(grib_context* context, const char* name, long flags); /* action_class_transient_darray.c */ -grib_action *grib_action_create_transient_darray(grib_context *context, const char *name, grib_darray *darray, int flags); +grib_action* grib_action_create_transient_darray(grib_context* context, const char* name, grib_darray* darray, int flags); /* grib_accessor.c */ -void grib_accessor_dump(grib_accessor *a, grib_dumper *f); -int grib_pack_missing(grib_accessor *a); -int grib_pack_zero(grib_accessor *a); -int grib_is_missing_internal(grib_accessor *a); -int grib_pack_double(grib_accessor *a, const double *v, size_t *len); -int grib_pack_expression(grib_accessor *a, grib_expression *e); -int grib_pack_string(grib_accessor *a, const char *v, size_t *len); -int grib_pack_string_array(grib_accessor *a, const char **v, size_t *len); -int grib_pack_long(grib_accessor *a, const long *v, size_t *len); -int grib_pack_bytes(grib_accessor *a, const unsigned char *v, size_t *len); -int grib_unpack_bytes(grib_accessor *a, unsigned char *v, size_t *len); -int grib_unpack_double_subarray(grib_accessor *a, double *v, size_t start, size_t len); -int grib_unpack_double(grib_accessor *a, double *v, size_t *len); -int grib_unpack_double_element(grib_accessor *a, size_t i, double *v); -int grib_unpack_string(grib_accessor *a, char *v, size_t *len); -int grib_unpack_string_array(grib_accessor *a, char **v, size_t *len); -int grib_accessors_list_unpack_long(grib_accessors_list *al, long *val, size_t *buffer_len); -int grib_accessors_list_unpack_double(grib_accessors_list *al, double *val, size_t *buffer_len); -int grib_accessors_list_unpack_string(grib_accessors_list *al, char **val, size_t *buffer_len); -int grib_unpack_long(grib_accessor *a, long *v, size_t *len); -long grib_accessor_get_native_type(grib_accessor *a); -long grib_get_next_position_offset(grib_accessor *a); -long grib_string_length(grib_accessor *a); -long grib_byte_offset(grib_accessor *a); -long grib_byte_count(grib_accessor *a); -int grib_value_count(grib_accessor *a, long *count); -int grib_accessors_list_value_count(grib_accessors_list *al, size_t *count); -int grib_accessor_notify_change(grib_accessor *a, grib_accessor *changed); -void grib_init_accessor(grib_accessor *a, const long len, grib_arguments *args); -void grib_accessor_delete(grib_context *ct, grib_accessor *a); -grib_accessor *grib_accessor_clone(grib_accessor *a, grib_section *s, int *err); -void grib_update_size(grib_accessor *a, size_t len); -int grib_nearest_smaller_value(grib_accessor *a, double val, double *nearest); -size_t grib_preferred_size(grib_accessor *a, int from_handle); -grib_accessor *grib_next_accessor(grib_accessor *a); -void grib_resize(grib_accessor *a, size_t new_size); -int grib_compare_accessors(grib_accessor *a1, grib_accessor *a2, int compare_flags); -const char *grib_get_type_name(int type); -int grib_accessor_add_attribute(grib_accessor *a, grib_accessor *attr, int nest_if_clash); -int grib_accessor_replace_attribute(grib_accessor *a, grib_accessor *attr); -int grib_accessor_delete_attribute(grib_accessor *a, const char *name); -grib_accessor *grib_accessor_get_attribute_by_index(grib_accessor *a, int index); -const char *grib_accessor_get_name(grib_accessor *a); -grib_accessor *_grib_accessor_get_attribute(grib_accessor *a, const char *name, int *index); -int grib_accessor_has_attributes(grib_accessor *a); -grib_accessor *grib_accessor_get_attribute(grib_accessor *a, const char *name); -grib_accessors_list *grib_accessors_list_create(grib_context *c); -void grib_accessors_list_push(grib_accessors_list *al, grib_accessor *a, int rank); -grib_accessors_list *grib_accessors_list_last(grib_accessors_list *al); -grib_accessors_list *grib_accessors_list_find(grib_accessors_list *al, grib_accessor *a); -void grib_accessors_list_delete(grib_context *c, grib_accessors_list *al); +void grib_accessor_dump(grib_accessor* a, grib_dumper* f); +int grib_pack_missing(grib_accessor* a); +int grib_pack_zero(grib_accessor* a); +int grib_is_missing_internal(grib_accessor* a); +int grib_pack_double(grib_accessor* a, const double* v, size_t* len); +int grib_pack_expression(grib_accessor* a, grib_expression* e); +int grib_pack_string(grib_accessor* a, const char* v, size_t* len); +int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len); +int grib_pack_long(grib_accessor* a, const long* v, size_t* len); +int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len); +int grib_unpack_bytes(grib_accessor* a, unsigned char* v, size_t* len); +int grib_unpack_double_subarray(grib_accessor* a, double* v, size_t start, size_t len); +int grib_unpack_double(grib_accessor* a, double* v, size_t* len); +int grib_unpack_double_element(grib_accessor* a, size_t i, double* v); +int grib_unpack_string(grib_accessor* a, char* v, size_t* len); +int grib_unpack_string_array(grib_accessor* a, char** v, size_t* len); +int grib_accessors_list_unpack_long(grib_accessors_list* al, long* val, size_t* buffer_len); +int grib_accessors_list_unpack_double(grib_accessors_list* al, double* val, size_t* buffer_len); +int grib_accessors_list_unpack_string(grib_accessors_list* al, char** val, size_t* buffer_len); +int grib_unpack_long(grib_accessor* a, long* v, size_t* len); +long grib_accessor_get_native_type(grib_accessor* a); +long grib_get_next_position_offset(grib_accessor* a); +long grib_string_length(grib_accessor* a); +long grib_byte_offset(grib_accessor* a); +long grib_byte_count(grib_accessor* a); +int grib_value_count(grib_accessor* a, long* count); +int grib_accessors_list_value_count(grib_accessors_list* al, size_t* count); +int grib_accessor_notify_change(grib_accessor* a, grib_accessor* changed); +void grib_init_accessor(grib_accessor* a, const long len, grib_arguments* args); +void grib_accessor_delete(grib_context* ct, grib_accessor* a); +grib_accessor* grib_accessor_clone(grib_accessor* a, grib_section* s, int* err); +void grib_update_size(grib_accessor* a, size_t len); +int grib_nearest_smaller_value(grib_accessor* a, double val, double* nearest); +size_t grib_preferred_size(grib_accessor* a, int from_handle); +grib_accessor* grib_next_accessor(grib_accessor* a); +void grib_resize(grib_accessor* a, size_t new_size); +int grib_compare_accessors(grib_accessor* a1, grib_accessor* a2, int compare_flags); +const char* grib_get_type_name(int type); +int grib_accessor_add_attribute(grib_accessor* a, grib_accessor* attr, int nest_if_clash); +int grib_accessor_replace_attribute(grib_accessor* a, grib_accessor* attr); +int grib_accessor_delete_attribute(grib_accessor* a, const char* name); +grib_accessor* grib_accessor_get_attribute_by_index(grib_accessor* a, int index); +const char* grib_accessor_get_name(grib_accessor* a); +grib_accessor* _grib_accessor_get_attribute(grib_accessor* a, const char* name, int* index); +int grib_accessor_has_attributes(grib_accessor* a); +grib_accessor* grib_accessor_get_attribute(grib_accessor* a, const char* name); +grib_accessors_list* grib_accessors_list_create(grib_context* c); +void grib_accessors_list_push(grib_accessors_list* al, grib_accessor* a, int rank); +grib_accessors_list* grib_accessors_list_last(grib_accessors_list* al); +grib_accessors_list* grib_accessors_list_find(grib_accessors_list* al, grib_accessor* a); +void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al); /* grib_concept.c */ -grib_concept_value *grib_concept_value_new(grib_context *c, const char *name, grib_concept_condition *conditions); -void grib_concept_value_delete(grib_context *c, grib_concept_value *v); -grib_concept_condition *grib_concept_condition_new(grib_context *c, const char *name, grib_expression *expression, grib_iarray *iarray); -void grib_concept_condition_delete(grib_context *c, grib_concept_condition *v); +grib_concept_value* grib_concept_value_new(grib_context* c, const char* name, grib_concept_condition* conditions); +void grib_concept_value_delete(grib_context* c, grib_concept_value* v); +grib_concept_condition* grib_concept_condition_new(grib_context* c, const char* name, grib_expression* expression, grib_iarray* iarray); +void grib_concept_condition_delete(grib_context* c, grib_concept_condition* v); /* grib_hash_array.c */ -grib_hash_array_value *grib_integer_hash_array_value_new(grib_context *c, const char *name, grib_iarray *array); -grib_hash_array_value *grib_double_hash_array_value_new(grib_context *c, const char *name, grib_darray *array); -void grib_hash_array_value_delete(grib_context *c, grib_hash_array_value *v); +grib_hash_array_value* grib_integer_hash_array_value_new(grib_context* c, const char* name, grib_iarray* array); +grib_hash_array_value* grib_double_hash_array_value_new(grib_context* c, const char* name, grib_darray* array); +void grib_hash_array_value_delete(grib_context* c, grib_hash_array_value* v); /* grib_bufr_descriptor.c */ -bufr_descriptor *grib_bufr_descriptor_new(grib_accessor *tables_accessor, int code, int *err); -bufr_descriptor *grib_bufr_descriptor_clone(bufr_descriptor *d); -int grib_bufr_descriptor_set_code(grib_accessor *tables_accessor, int code, bufr_descriptor *v); -void grib_bufr_descriptor_set_reference(bufr_descriptor *v, long reference); -void grib_bufr_descriptor_set_width(bufr_descriptor *v, long width); -void grib_bufr_descriptor_set_scale(bufr_descriptor *v, long scale); -int grib_bufr_descriptor_can_be_missing(bufr_descriptor *v); -void grib_bufr_descriptor_delete(bufr_descriptor *v); +bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int* err); +bufr_descriptor* grib_bufr_descriptor_clone(bufr_descriptor* d); +int grib_bufr_descriptor_set_code(grib_accessor* tables_accessor, int code, bufr_descriptor* v); +void grib_bufr_descriptor_set_reference(bufr_descriptor* v, long reference); +void grib_bufr_descriptor_set_width(bufr_descriptor* v, long width); +void grib_bufr_descriptor_set_scale(bufr_descriptor* v, long scale); +int grib_bufr_descriptor_can_be_missing(bufr_descriptor* v); +void grib_bufr_descriptor_delete(bufr_descriptor* v); /* grib_bufr_descriptors_array.c */ -bufr_descriptors_array *grib_bufr_descriptors_array_new(grib_context *c, size_t size, size_t incsize); -bufr_descriptor *grib_bufr_descriptors_array_pop(bufr_descriptors_array *a); -bufr_descriptor *grib_bufr_descriptors_array_pop_front(bufr_descriptors_array *a); -bufr_descriptors_array *grib_bufr_descriptors_array_resize_to(bufr_descriptors_array *v, size_t newsize); -bufr_descriptors_array *grib_bufr_descriptors_array_resize(bufr_descriptors_array *v); -bufr_descriptors_array *grib_bufr_descriptors_array_push(bufr_descriptors_array *v, bufr_descriptor *val); -bufr_descriptors_array *grib_bufr_descriptors_array_append(bufr_descriptors_array *v, bufr_descriptors_array *ar); -bufr_descriptors_array *grib_bufr_descriptors_array_push_front(bufr_descriptors_array *v, bufr_descriptor *val); -bufr_descriptor *grib_bufr_descriptors_array_get(bufr_descriptors_array *a, size_t i); -void grib_bufr_descriptors_array_set(bufr_descriptors_array *a, size_t i, bufr_descriptor *v); -void grib_bufr_descriptors_array_delete(bufr_descriptors_array *v); -void grib_bufr_descriptors_array_delete_array(bufr_descriptors_array *v); -bufr_descriptor **grib_bufr_descriptors_array_get_array(bufr_descriptors_array *v); -size_t grib_bufr_descriptors_array_used_size(bufr_descriptors_array *v); +bufr_descriptors_array* grib_bufr_descriptors_array_new(grib_context* c, size_t size, size_t incsize); +bufr_descriptor* grib_bufr_descriptors_array_pop(bufr_descriptors_array* a); +bufr_descriptor* grib_bufr_descriptors_array_pop_front(bufr_descriptors_array* a); +bufr_descriptors_array* grib_bufr_descriptors_array_resize_to(bufr_descriptors_array* v, size_t newsize); +bufr_descriptors_array* grib_bufr_descriptors_array_resize(bufr_descriptors_array* v); +bufr_descriptors_array* grib_bufr_descriptors_array_push(bufr_descriptors_array* v, bufr_descriptor* val); +bufr_descriptors_array* grib_bufr_descriptors_array_append(bufr_descriptors_array* v, bufr_descriptors_array* ar); +bufr_descriptors_array* grib_bufr_descriptors_array_push_front(bufr_descriptors_array* v, bufr_descriptor* val); +bufr_descriptor* grib_bufr_descriptors_array_get(bufr_descriptors_array* a, size_t i); +void grib_bufr_descriptors_array_set(bufr_descriptors_array* a, size_t i, bufr_descriptor* v); +void grib_bufr_descriptors_array_delete(bufr_descriptors_array* v); +void grib_bufr_descriptors_array_delete_array(bufr_descriptors_array* v); +bufr_descriptor** grib_bufr_descriptors_array_get_array(bufr_descriptors_array* v); +size_t grib_bufr_descriptors_array_used_size(bufr_descriptors_array* v); /* grib_darray.c */ void grib_darray_print(const char* title, const grib_darray* darray); -grib_darray *grib_darray_new_from_array(grib_context *c, double *a, size_t size); -grib_darray *grib_darray_new(grib_context *c, size_t size, size_t incsize); -grib_darray *grib_darray_resize(grib_context *c, grib_darray *v); -grib_darray *grib_darray_push(grib_context *c, grib_darray *v, double val); -void grib_darray_delete(grib_context *c, grib_darray *v); -double *grib_darray_get_array(grib_context *c, grib_darray *v); -int grib_darray_is_constant(grib_darray *v, double eps); -size_t grib_darray_used_size(grib_darray *v); +grib_darray* grib_darray_new_from_array(grib_context* c, double* a, size_t size); +grib_darray* grib_darray_new(grib_context* c, size_t size, size_t incsize); +grib_darray* grib_darray_resize(grib_context* c, grib_darray* v); +grib_darray* grib_darray_push(grib_context* c, grib_darray* v, double val); +void grib_darray_delete(grib_context* c, grib_darray* v); +double* grib_darray_get_array(grib_context* c, grib_darray* v); +int grib_darray_is_constant(grib_darray* v, double eps); +size_t grib_darray_used_size(grib_darray* v); /* grib_sarray.c */ -grib_sarray *grib_sarray_new(grib_context *c, size_t size, size_t incsize); -grib_sarray *grib_sarray_resize(grib_context *c, grib_sarray *v); -grib_sarray *grib_sarray_push(grib_context *c, grib_sarray *v, char *val); -void grib_sarray_delete(grib_context *c, grib_sarray *v); -void grib_sarray_delete_content(grib_context *c, grib_sarray *v); -char **grib_sarray_get_array(grib_context *c, grib_sarray *v); -size_t grib_sarray_used_size(grib_sarray *v); +grib_sarray* grib_sarray_new(grib_context* c, size_t size, size_t incsize); +grib_sarray* grib_sarray_resize(grib_context* c, grib_sarray* v); +grib_sarray* grib_sarray_push(grib_context* c, grib_sarray* v, char* val); +void grib_sarray_delete(grib_context* c, grib_sarray* v); +void grib_sarray_delete_content(grib_context* c, grib_sarray* v); +char** grib_sarray_get_array(grib_context* c, grib_sarray* v); +size_t grib_sarray_used_size(grib_sarray* v); /* grib_oarray.c */ -grib_oarray *grib_oarray_new(grib_context *c, size_t size, size_t incsize); -grib_oarray *grib_oarray_resize(grib_context *c, grib_oarray *v); -grib_oarray *grib_oarray_push(grib_context *c, grib_oarray *v, void *val); -void grib_oarray_delete(grib_context *c, grib_oarray *v); -void grib_oarray_delete_content(grib_context *c, grib_oarray *v); -void **grib_oarray_get_array(grib_context *c, grib_oarray *v); -void *grib_oarray_get(grib_oarray *v, int i); -size_t grib_oarray_used_size(grib_oarray *v); +grib_oarray* grib_oarray_new(grib_context* c, size_t size, size_t incsize); +grib_oarray* grib_oarray_resize(grib_context* c, grib_oarray* v); +grib_oarray* grib_oarray_push(grib_context* c, grib_oarray* v, void* val); +void grib_oarray_delete(grib_context* c, grib_oarray* v); +void grib_oarray_delete_content(grib_context* c, grib_oarray* v); +void** grib_oarray_get_array(grib_context* c, grib_oarray* v); +void* grib_oarray_get(grib_oarray* v, int i); +size_t grib_oarray_used_size(grib_oarray* v); /* grib_iarray.c */ void grib_iarray_print(const char* title, const grib_iarray* iarray); -grib_iarray *grib_iarray_new_from_array(grib_context *c, long *a, size_t size); -grib_iarray *grib_iarray_new(grib_context *c, size_t size, size_t incsize); -long grib_iarray_pop(grib_iarray *a); -long grib_iarray_pop_front(grib_iarray *a); -grib_iarray *grib_iarray_resize_to(grib_iarray *v, size_t newsize); -grib_iarray *grib_iarray_resize(grib_iarray *v); -grib_iarray *grib_iarray_push(grib_iarray *v, long val); -grib_iarray *grib_iarray_push_front(grib_iarray *v, long val); -grib_iarray *grib_iarray_push_array(grib_iarray *v, long *val, size_t size); -long grib_iarray_get(grib_iarray *a, size_t i); -void grib_iarray_set(grib_iarray *a, size_t i, long v); -void grib_iarray_delete(grib_iarray *v); -void grib_iarray_delete_array(grib_iarray *v); -long *grib_iarray_get_array(grib_iarray *v); -size_t grib_iarray_used_size(grib_iarray *v); -int grib_iarray_is_constant(grib_iarray *v); +grib_iarray* grib_iarray_new_from_array(grib_context* c, long* a, size_t size); +grib_iarray* grib_iarray_new(grib_context* c, size_t size, size_t incsize); +long grib_iarray_pop(grib_iarray* a); +long grib_iarray_pop_front(grib_iarray* a); +grib_iarray* grib_iarray_resize_to(grib_iarray* v, size_t newsize); +grib_iarray* grib_iarray_resize(grib_iarray* v); +grib_iarray* grib_iarray_push(grib_iarray* v, long val); +grib_iarray* grib_iarray_push_front(grib_iarray* v, long val); +grib_iarray* grib_iarray_push_array(grib_iarray* v, long* val, size_t size); +long grib_iarray_get(grib_iarray* a, size_t i); +void grib_iarray_set(grib_iarray* a, size_t i, long v); +void grib_iarray_delete(grib_iarray* v); +void grib_iarray_delete_array(grib_iarray* v); +long* grib_iarray_get_array(grib_iarray* v); +size_t grib_iarray_used_size(grib_iarray* v); +int grib_iarray_is_constant(grib_iarray* v); /* grib_vdarray.c */ void grib_vdarray_print(const char* title, const grib_vdarray* vdarray); -grib_vdarray *grib_vdarray_new(grib_context *c, size_t size, size_t incsize); -grib_vdarray *grib_vdarray_resize(grib_context *c, grib_vdarray *v); -grib_vdarray *grib_vdarray_push(grib_context *c, grib_vdarray *v, grib_darray *val); -void grib_vdarray_delete(grib_context *c, grib_vdarray *v); -void grib_vdarray_delete_content(grib_context *c, grib_vdarray *v); -grib_darray **grib_vdarray_get_array(grib_context *c, grib_vdarray *v); -size_t grib_vdarray_used_size(grib_vdarray *v); +grib_vdarray* grib_vdarray_new(grib_context* c, size_t size, size_t incsize); +grib_vdarray* grib_vdarray_resize(grib_context* c, grib_vdarray* v); +grib_vdarray* grib_vdarray_push(grib_context* c, grib_vdarray* v, grib_darray* val); +void grib_vdarray_delete(grib_context* c, grib_vdarray* v); +void grib_vdarray_delete_content(grib_context* c, grib_vdarray* v); +grib_darray** grib_vdarray_get_array(grib_context* c, grib_vdarray* v); +size_t grib_vdarray_used_size(grib_vdarray* v); /* grib_vsarray.c */ -grib_vsarray *grib_vsarray_new(grib_context *c, size_t size, size_t incsize); -grib_vsarray *grib_vsarray_resize(grib_context *c, grib_vsarray *v); -grib_vsarray *grib_vsarray_push(grib_context *c, grib_vsarray *v, grib_sarray *val); -void grib_vsarray_delete(grib_context *c, grib_vsarray *v); -void grib_vsarray_delete_content(grib_context *c, grib_vsarray *v); -grib_sarray **grib_vsarray_get_array(grib_context *c, grib_vsarray *v); -size_t grib_vsarray_used_size(grib_vsarray *v); +grib_vsarray* grib_vsarray_new(grib_context* c, size_t size, size_t incsize); +grib_vsarray* grib_vsarray_resize(grib_context* c, grib_vsarray* v); +grib_vsarray* grib_vsarray_push(grib_context* c, grib_vsarray* v, grib_sarray* val); +void grib_vsarray_delete(grib_context* c, grib_vsarray* v); +void grib_vsarray_delete_content(grib_context* c, grib_vsarray* v); +grib_sarray** grib_vsarray_get_array(grib_context* c, grib_vsarray* v); +size_t grib_vsarray_used_size(grib_vsarray* v); /* grib_viarray.c */ -grib_viarray *grib_viarray_new(grib_context *c, size_t size, size_t incsize); -grib_viarray *grib_viarray_resize(grib_context *c, grib_viarray *v); -grib_viarray *grib_viarray_push(grib_context *c, grib_viarray *v, grib_iarray *val); -void grib_viarray_delete(grib_context *c, grib_viarray *v); -void grib_viarray_delete_content(grib_context *c, grib_viarray *v); -grib_iarray **grib_viarray_get_array(grib_context *c, grib_viarray *v); -size_t grib_viarray_used_size(grib_viarray *v); +grib_viarray* grib_viarray_new(grib_context* c, size_t size, size_t incsize); +grib_viarray* grib_viarray_resize(grib_context* c, grib_viarray* v); +grib_viarray* grib_viarray_push(grib_context* c, grib_viarray* v, grib_iarray* val); +void grib_viarray_delete(grib_context* c, grib_viarray* v); +void grib_viarray_delete_content(grib_context* c, grib_viarray* v); +grib_iarray** grib_viarray_get_array(grib_context* c, grib_viarray* v); +size_t grib_viarray_used_size(grib_viarray* v); /* grib_accessor_class_array.c */ @@ -292,25 +292,25 @@ size_t grib_viarray_used_size(grib_viarray *v); /* grib_accessor_class_bufr_clear_tables.c */ /* grib_accessor_class_bufr_data_array.c */ -grib_vsarray *accessor_bufr_data_array_get_stringValues(grib_accessor *a); -grib_accessors_list *accessor_bufr_data_array_get_dataAccessors(grib_accessor *a); -grib_trie_with_rank *accessor_bufr_data_array_get_dataAccessorsTrie(grib_accessor *a); -void accessor_bufr_data_array_set_unpackMode(grib_accessor *a, int unpackMode); +grib_vsarray* accessor_bufr_data_array_get_stringValues(grib_accessor* a); +grib_accessors_list* accessor_bufr_data_array_get_dataAccessors(grib_accessor* a); +grib_trie_with_rank* accessor_bufr_data_array_get_dataAccessorsTrie(grib_accessor* a); +void accessor_bufr_data_array_set_unpackMode(grib_accessor* a, int unpackMode); /* grib_accessor_class_bufr_data_element.c */ -void accessor_bufr_data_element_set_index(grib_accessor *a, long index); -void accessor_bufr_data_element_set_type(grib_accessor *a, int type); -void accessor_bufr_data_element_set_numberOfSubsets(grib_accessor *a, long numberOfSubsets); -void accessor_bufr_data_element_set_subsetNumber(grib_accessor *a, long subsetNumber); -void accessor_bufr_data_element_set_compressedData(grib_accessor *a, int compressedData); -void accessor_bufr_data_element_set_descriptors(grib_accessor *a, bufr_descriptors_array *descriptors); -void accessor_bufr_data_element_set_numericValues(grib_accessor *a, grib_vdarray *numericValues); -void accessor_bufr_data_element_set_stringValues(grib_accessor *a, grib_vsarray *stringValues); -void accessor_bufr_data_element_set_elementsDescriptorsIndex(grib_accessor *a, grib_viarray *elementsDescriptorsIndex); +void accessor_bufr_data_element_set_index(grib_accessor* a, long index); +void accessor_bufr_data_element_set_type(grib_accessor* a, int type); +void accessor_bufr_data_element_set_numberOfSubsets(grib_accessor* a, long numberOfSubsets); +void accessor_bufr_data_element_set_subsetNumber(grib_accessor* a, long subsetNumber); +void accessor_bufr_data_element_set_compressedData(grib_accessor* a, int compressedData); +void accessor_bufr_data_element_set_descriptors(grib_accessor* a, bufr_descriptors_array* descriptors); +void accessor_bufr_data_element_set_numericValues(grib_accessor* a, grib_vdarray* numericValues); +void accessor_bufr_data_element_set_stringValues(grib_accessor* a, grib_vsarray* stringValues); +void accessor_bufr_data_element_set_elementsDescriptorsIndex(grib_accessor* a, grib_viarray* elementsDescriptorsIndex); /* grib_accessor_class_bufr_elements_table.c */ -int bufr_descriptor_is_marker(bufr_descriptor *d); -bufr_descriptor *accessor_bufr_elements_table_get_descriptor(grib_accessor *a, int code, int *err); +int bufr_descriptor_is_marker(bufr_descriptor* d); +bufr_descriptor* accessor_bufr_elements_table_get_descriptor(grib_accessor* a, int code, int* err); /* grib_accessor_class_bufr_group.c */ @@ -329,7 +329,7 @@ bufr_descriptor *accessor_bufr_elements_table_get_descriptor(grib_accessor *a, i /* grib_accessor_class_bufr_has_delayed_replication.c */ /* grib_accessor_class_apply_operators.c */ -size_t compute_size_AO(long *descriptors, size_t numberOfDescriptors); +size_t compute_size_AO(long* descriptors, size_t numberOfDescriptors); /* grib_accessor_class_non_alpha.c */ @@ -354,14 +354,14 @@ size_t compute_size_AO(long *descriptors, size_t numberOfDescriptors); /* grib_accessor_class_bytes.c */ /* grib_accessor_class.c */ -grib_section *grib_create_root_section(const grib_context *context, grib_handle *h); -grib_accessor *grib_accessor_factory(grib_section *p, grib_action *creator, const long len, grib_arguments *params); -void grib_push_accessor(grib_accessor *a, grib_block_of_accessors *l); -void grib_section_post_init(grib_section *s); -int grib_section_adjust_sizes(grib_section *s, int update, int depth); -int grib_get_block_length(grib_section *s, size_t *l); -grib_accessor *find_paddings(grib_section *s); -void grib_update_paddings(grib_section *s); +grib_section* grib_create_root_section(const grib_context* context, grib_handle* h); +grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, const long len, grib_arguments* params); +void grib_push_accessor(grib_accessor* a, grib_block_of_accessors* l); +void grib_section_post_init(grib_section* s); +int grib_section_adjust_sizes(grib_section* s, int update, int depth); +int grib_get_block_length(grib_section* s, size_t* l); +grib_accessor* find_paddings(grib_section* s); +void grib_update_paddings(grib_section* s); /* grib_accessor_class_change_scanning_direction.c */ @@ -370,12 +370,12 @@ void grib_update_paddings(grib_section *s); /* grib_accessor_class_codeflag.c */ /* grib_accessor_class_smart_table.c */ -void grib_smart_table_delete(grib_context *c); +void grib_smart_table_delete(grib_context* c); /* grib_accessor_class_smart_table_column.c */ /* grib_accessor_class_codetable.c */ -void grib_codetable_delete(grib_context *c); +void grib_codetable_delete(grib_context* c); /* grib_accessor_class_codetable_units.c */ @@ -410,8 +410,8 @@ void grib_codetable_delete(grib_context *c); /* grib_accessor_class_g1forecastmonth.c */ /* grib_accessor_class_g1step_range.c */ -int grib_g1_step_get_steps(grib_accessor *a, long *start, long *theEnd); -int grib_g1_step_apply_units(long *start, long *theEnd, long *step_unit, long *P1, long *P2, long *unit, const int max, const int instant); +int grib_g1_step_get_steps(grib_accessor* a, long* start, long* theEnd); +int grib_g1_step_apply_units(long* start, long* theEnd, long* step_unit, long* P1, long* P2, long* unit, const int max, const int instant); /* grib_accessor_class_g2step_range.c */ @@ -516,19 +516,19 @@ int grib_g1_step_apply_units(long *start, long *theEnd, long *step_unit, long *P /* grib_accessor_class_ieeefloat.c */ /* grib_accessor_class_constant.c */ -void accessor_constant_set_type(grib_accessor *a, int type); -void accessor_constant_set_dval(grib_accessor *a, double dval); +void accessor_constant_set_type(grib_accessor* a, int type); +void accessor_constant_set_dval(grib_accessor* a, double dval); /* grib_accessor_class_iterator.c */ -grib_iterator *grib_iterator_new(const grib_handle *h, unsigned long flags, int *error); +grib_iterator* grib_iterator_new(const grib_handle* h, unsigned long flags, int* error); /* grib_accessor_class_message.c */ /* grib_accessor_class_nearest.c */ -grib_nearest *grib_nearest_new(const grib_handle *h, int *error); +grib_nearest* grib_nearest_new(const grib_handle* h, int* error); /* grib_accessor_class_box.c */ -grib_box *grib_box_new(grib_handle *h, int *error); +grib_box* grib_box_new(grib_handle* h, int* error); /* grib_accessor_class_ksec1expver.c */ @@ -571,7 +571,7 @@ grib_box *grib_box_new(grib_handle *h, int *error); /* grib_accessor_class_section_length.c */ /* grib_accessor_class_g1_message_length.c */ -int grib_get_g1_message_size(grib_handle *h, grib_accessor *tl, grib_accessor *s4, long *total_length, long *sec4_len); +int grib_get_g1_message_size(grib_handle* h, grib_accessor* tl, grib_accessor* s4, long* total_length, long* sec4_len); /* grib_accessor_class_g1_section4_length.c */ @@ -620,11 +620,11 @@ int grib_get_g1_message_size(grib_handle *h, grib_accessor *tl, grib_accessor *s /* grib_accessor_class_data_dummy_field.c */ /* grib_2order_packer_simple.c */ -void grib_free_second_order_groups(grib_context *c, second_order_packed *sp); -second_order_packed *grib_get_second_order_groups(grib_context *c, const unsigned long *vals, size_t len); +void grib_free_second_order_groups(grib_context* c, second_order_packed* sp); +second_order_packed* grib_get_second_order_groups(grib_context* c, const unsigned long* vals, size_t len); /* grib_accessor_class_variable.c */ -void accessor_variable_set_type(grib_accessor *a, int type); +void accessor_variable_set_type(grib_accessor* a, int type); /* grib_accessor_class_second_order_bits_per_value.c */ @@ -653,8 +653,8 @@ void accessor_variable_set_type(grib_accessor *a, int type); /* grib_accessor_class_unexpanded_descriptors.c */ /* grib_accessor_class_expanded_descriptors.c */ -int grib_accessor_class_expanded_descriptors_set_do_expand(grib_accessor *a, long do_expand); -bufr_descriptors_array *grib_accessor_class_expanded_descriptors_get_expanded(grib_accessor *a, int *err); +int grib_accessor_class_expanded_descriptors_set_do_expand(grib_accessor* a, long do_expand); +bufr_descriptors_array* grib_accessor_class_expanded_descriptors_get_expanded(grib_accessor* a, int* err); /* grib_accessor_class_bufrdc_expanded_descriptors.c */ @@ -703,64 +703,64 @@ bufr_descriptors_array *grib_accessor_class_expanded_descriptors_get_expanded(gr /* grib_accessor_class_md5.c */ /* grib_jasper_encoding.c */ -int grib_jasper_decode(grib_context *c, unsigned char *buf, size_t *buflen, double *values, size_t *no_values); -int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper); -int grib_jasper_decode(grib_context *c, unsigned char *buf, size_t *buflen, double *val, size_t *n_vals); -int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper); +int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* values, size_t* no_values); +int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper); +int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals); +int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper); /* grib_openjpeg_encoding.c */ -int grib_openjpeg_encode(grib_context *c, j2k_encode_helper *helper); -int grib_openjpeg_decode(grib_context *c, unsigned char *buf, size_t *buflen, double *val, size_t *n_vals); +int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper); +int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals); /* action_class_set_missing.c */ -grib_action *grib_action_create_set_missing(grib_context *context, const char *name); +grib_action* grib_action_create_set_missing(grib_context* context, const char* name); /* grib_accessor_class_number_of_points.c */ /* grib_accessor_class_suppressed.c */ /* grib_index.c */ -int grib_index_compress(grib_index *index); -int grib_read_uchar(FILE *fh, unsigned char *val); -int grib_read_short(FILE *fh, short *val); -int grib_read_long(FILE *fh, long *val); -int grib_read_unsigned_long(FILE *fh, unsigned long *val); -int grib_write_uchar(FILE *fh, unsigned char val); -int grib_write_short(FILE *fh, short val); -int grib_write_long(FILE *fh, long val); -int grib_write_unsigned_long(FILE *fh, unsigned long val); -int grib_write_string(FILE *fh, const char *s); -int grib_write_identifier(FILE *fh); -int grib_write_null_marker(FILE *fh); -int grib_write_not_null_marker(FILE *fh); -char *grib_read_string(grib_context *c, FILE *fh, int *err); -grib_field_tree *grib_read_field_tree(grib_context *c, FILE *fh, grib_file **files, int *err); -grib_index *grib_index_new(grib_context *c, const char *key, int *err); -void grib_index_delete(grib_index *index); -int grib_index_write(grib_index *index, const char *filename); -grib_index *grib_index_read(grib_context *c, const char *filename, int *err); -int grib_index_search_same(grib_index *index, grib_handle *h); -int grib_index_add_file(grib_index *index, const char *filename); -grib_handle *new_message_from_file(int message_type, grib_context *c, FILE *f, int *error); -int _codes_index_add_file(grib_index *index, const char *filename, int message_type); -int grib_index_add_file(grib_index *index, const char *filename); -grib_index *grib_index_new_from_file(grib_context *c, char *filename, const char *keys, int *err); -int grib_index_get_size(const grib_index *index, const char *key, size_t *size); -int grib_index_get_string(const grib_index *index, const char *key, char **values, size_t *size); -int grib_index_get_long(const grib_index *index, const char *key, long *values, size_t *size); -int grib_index_get_double(const grib_index *index, const char *key, double *values, size_t *size); -int grib_index_select_long(grib_index *index, const char *skey, long value); -int grib_index_select_double(grib_index *index, const char *skey, double value); -int grib_index_select_string(grib_index *index, const char *skey, char *value); -grib_handle *grib_index_get_handle(grib_field *field, int *err); -grib_handle *codes_index_get_handle(grib_field *field, int message_type, int *err); -int grib_index_dump_file(FILE *fout, const char *filename); -void grib_index_dump(FILE *fout, grib_index *index); -char *grib_get_field_file(grib_index *index, off_t *offset); -grib_handle *grib_handle_new_from_index(grib_index *index, int *err); -grib_handle *codes_new_from_index(grib_index *index, int message_type, int *err); -void grib_index_rewind(grib_index *index); -int grib_index_search(grib_index *index, grib_index_key *keys); +int grib_index_compress(grib_index* index); +int grib_read_uchar(FILE* fh, unsigned char* val); +int grib_read_short(FILE* fh, short* val); +int grib_read_long(FILE* fh, long* val); +int grib_read_unsigned_long(FILE* fh, unsigned long* val); +int grib_write_uchar(FILE* fh, unsigned char val); +int grib_write_short(FILE* fh, short val); +int grib_write_long(FILE* fh, long val); +int grib_write_unsigned_long(FILE* fh, unsigned long val); +int grib_write_string(FILE* fh, const char* s); +int grib_write_identifier(FILE* fh); +int grib_write_null_marker(FILE* fh); +int grib_write_not_null_marker(FILE* fh); +char* grib_read_string(grib_context* c, FILE* fh, int* err); +grib_field_tree* grib_read_field_tree(grib_context* c, FILE* fh, grib_file** files, int* err); +grib_index* grib_index_new(grib_context* c, const char* key, int* err); +void grib_index_delete(grib_index* index); +int grib_index_write(grib_index* index, const char* filename); +grib_index* grib_index_read(grib_context* c, const char* filename, int* err); +int grib_index_search_same(grib_index* index, grib_handle* h); +int grib_index_add_file(grib_index* index, const char* filename); +grib_handle* new_message_from_file(int message_type, grib_context* c, FILE* f, int* error); +int _codes_index_add_file(grib_index* index, const char* filename, int message_type); +int grib_index_add_file(grib_index* index, const char* filename); +grib_index* grib_index_new_from_file(grib_context* c, char* filename, const char* keys, int* err); +int grib_index_get_size(const grib_index* index, const char* key, size_t* size); +int grib_index_get_string(const grib_index* index, const char* key, char** values, size_t* size); +int grib_index_get_long(const grib_index* index, const char* key, long* values, size_t* size); +int grib_index_get_double(const grib_index* index, const char* key, double* values, size_t* size); +int grib_index_select_long(grib_index* index, const char* skey, long value); +int grib_index_select_double(grib_index* index, const char* skey, double value); +int grib_index_select_string(grib_index* index, const char* skey, char* value); +grib_handle* grib_index_get_handle(grib_field* field, int* err); +grib_handle* codes_index_get_handle(grib_field* field, int message_type, int* err); +int grib_index_dump_file(FILE* fout, const char* filename); +void grib_index_dump(FILE* fout, grib_index* index); +char* grib_get_field_file(grib_index* index, off_t* offset); +grib_handle* grib_handle_new_from_index(grib_index* index, int* err); +grib_handle* codes_new_from_index(grib_index* index, int message_type, int* err); +void grib_index_rewind(grib_index* index); +int grib_index_search(grib_index* index, grib_index_key* keys); /* grib_accessor_class_number_of_points_gaussian.c */ @@ -779,13 +779,13 @@ int grib_index_search(grib_index *index, grib_index_key *keys); /* grib_accessor_class_statistics_spectral.c */ /* grib_accessor_class_unsigned.c */ -int pack_long_unsigned_helper(grib_accessor *a, const long *val, size_t *len, int check); +int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, int check); /* grib_accessor_class_unsigned_bits.c */ /* grib_accessor_class_raw.c */ -void accessor_raw_set_length(grib_accessor *a, size_t len); -long accessor_raw_get_offset(grib_accessor *a); +void accessor_raw_set_length(grib_accessor* a, size_t len); +long accessor_raw_get_offset(grib_accessor* a); /* grib_accessor_class_bufr_extract_subsets.c */ @@ -808,47 +808,47 @@ long accessor_raw_get_offset(grib_accessor *a); /* grib_accessor_class_long_vector.c */ /* grib_gaussian_reduced.c */ -void grib_get_reduced_row_wrapper(grib_handle *h, long pl, double lon_first, double lon_last, long *npoints, long *ilon_first, long *ilon_last); -void grib_get_reduced_row_legacy(long pl, double lon_first, double lon_last, long *npoints, long *ilon_first, long *ilon_last); -void grib_get_reduced_row(long pl, double lon_first, double lon_last, long *npoints, long *ilon_first, long *ilon_last); -void grib_get_reduced_row_p(long pl, double lon_first, double lon_last, long *npoints, double *olon_first, double *olon_last); +void grib_get_reduced_row_wrapper(grib_handle* h, long pl, double lon_first, double lon_last, long* npoints, long* ilon_first, long* ilon_last); +void grib_get_reduced_row_legacy(long pl, double lon_first, double lon_last, long* npoints, long* ilon_first, long* ilon_last); +void grib_get_reduced_row(long pl, double lon_first, double lon_last, long* npoints, long* ilon_first, long* ilon_last); +void grib_get_reduced_row_p(long pl, double lon_first, double lon_last, long* npoints, double* olon_first, double* olon_last); /* grib_accessor_class_abstract_vector.c */ /* grib_accessor_class_abstract_long_vector.c */ /* grib_loader_from_handle.c */ -int grib_lookup_long_from_handle(grib_context *gc, grib_loader *loader, const char *name, long *value); -int grib_init_accessor_from_handle(grib_loader *loader, grib_accessor *ga, grib_arguments *default_value); +int grib_lookup_long_from_handle(grib_context* gc, grib_loader* loader, const char* name, long* value); +int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_arguments* default_value); /* grib_bits.c */ -unsigned long grib_decode_unsigned_byte_long(const unsigned char *p, long o, int l); -long grib_decode_signed_long(const unsigned char *p, long o, int l); -int grib_encode_signed_long(unsigned char *p, long val, long o, int l); -void grib_set_bits_on(unsigned char *p, long *bitp, long nbits); -int grib_get_bit(const unsigned char *p, long bitp); -void grib_set_bit(unsigned char *p, long bitp, int val); -long grib_decode_signed_longb(const unsigned char *p, long *bitp, long nbits); -int grib_encode_signed_longb(unsigned char *p, long val, long *bitp, long nb); +unsigned long grib_decode_unsigned_byte_long(const unsigned char* p, long o, int l); +long grib_decode_signed_long(const unsigned char* p, long o, int l); +int grib_encode_signed_long(unsigned char* p, long val, long o, int l); +void grib_set_bits_on(unsigned char* p, long* bitp, long nbits); +int grib_get_bit(const unsigned char* p, long bitp); +void grib_set_bit(unsigned char* p, long bitp, int val); +long grib_decode_signed_longb(const unsigned char* p, long* bitp, long nbits); +int grib_encode_signed_longb(unsigned char* p, long val, long* bitp, long nb); /* grib_timer.c */ double proc_cpu(void); -char *timename(double t); -grib_timer *grib_get_timer(grib_context *c, const char *name, const char *statname, int elapsed); -int grib_timer_start(grib_timer *t); -int grib_timer_stop(grib_timer *t, long total); -double grib_timer_value(grib_timer *t); -const char *bytename(double bytes); -void grib_timer_print(grib_timer *t); -void grib_timer_partial_rate(grib_timer *t, double start, long total); +char* timename(double t); +grib_timer* grib_get_timer(grib_context* c, const char* name, const char* statname, int elapsed); +int grib_timer_start(grib_timer* t); +int grib_timer_stop(grib_timer* t, long total); +double grib_timer_value(grib_timer* t); +const char* bytename(double bytes); +void grib_timer_print(grib_timer* t); +void grib_timer_partial_rate(grib_timer* t, double start, long total); void grib_print_all_timers(void); void grib_reset_all_timers(void); -grib_timer *grib_get_timer(grib_context *c, const char *name, const char *statname, int elapsed); -int grib_timer_start(grib_timer *t); -int grib_timer_stop(grib_timer *t, long total); -double grib_timer_value(grib_timer *t); -void grib_timer_print(grib_timer *t); -void grib_timer_partial_rate(grib_timer *t, double start, long total); +grib_timer* grib_get_timer(grib_context* c, const char* name, const char* statname, int elapsed); +int grib_timer_start(grib_timer* t); +int grib_timer_stop(grib_timer* t, long total); +double grib_timer_value(grib_timer* t); +void grib_timer_print(grib_timer* t); +void grib_timer_partial_rate(grib_timer* t, double start, long total); void grib_print_all_timers(void); void grib_reset_all_timers(void); @@ -859,7 +859,7 @@ double grib_long_to_ibm(unsigned long x); double grib_ibm_table_e(unsigned long e); double grib_ibm_table_v(unsigned long e); unsigned long grib_ibm_nearest_smaller_to_long(double x); -int grib_nearest_smaller_ibm_float(double a, double *ret); +int grib_nearest_smaller_ibm_float(double a, double* ret); /* grib_ieeefloat.c */ double grib_ieee_table_e(unsigned long e); @@ -868,57 +868,57 @@ unsigned long grib_ieee_to_long(double x); double grib_ieeefloat_error(double x); double grib_long_to_ieee(unsigned long x); unsigned long grib_ieee_nearest_smaller_to_long(double x); -int grib_nearest_smaller_ieee_float(double a, double *ret); +int grib_nearest_smaller_ieee_float(double a, double* ret); double grib_ieeefloat_error(double x); double grib_long_to_ieee(unsigned long x); -int grib_nearest_smaller_ieee_float(double a, double *x); +int grib_nearest_smaller_ieee_float(double a, double* x); unsigned long grib_ieee_to_long(double x); unsigned long grib_ieee64_to_long(double x); double grib_long_to_ieee64(unsigned long x); -int grib_ieee_decode_array(grib_context *c, unsigned char *buf, size_t nvals, int bytes, double *val); -int grib_ieee_decode_array(grib_context *c, unsigned char *buf, size_t nvals, int bytes, double *val); -int grib_ieee_encode_array(grib_context *c, double *val, size_t nvals, int bytes, unsigned char *buf); -int grib_ieee_encode_array(grib_context *c, double *val, size_t nvals, int bytes, unsigned char *buf); +int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val); +int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val); +int grib_ieee_encode_array(grib_context* c, double* val, size_t nvals, int bytes, unsigned char* buf); +int grib_ieee_encode_array(grib_context* c, double* val, size_t nvals, int bytes, unsigned char* buf); /* grib_accessor_class_reference_value_error.c */ /* grib_memory.c */ -void *grib_transient_malloc(const grib_context *c, size_t s); -void *grib_transient_realloc(const grib_context *c, void *p, size_t s); -void grib_transient_free(const grib_context *c, void *p); -void *grib_permanent_malloc(const grib_context *c, size_t s); -void *grib_permanent_realloc(const grib_context *c, void *p, size_t s); -void grib_permanent_free(const grib_context *c, void *p); -void *grib_buffer_malloc(const grib_context *c, size_t s); -void grib_buffer_free(const grib_context *c, void *p); -void *grib_buffer_realloc(const grib_context *c, void *p, size_t s); +void* grib_transient_malloc(const grib_context* c, size_t s); +void* grib_transient_realloc(const grib_context* c, void* p, size_t s); +void grib_transient_free(const grib_context* c, void* p); +void* grib_permanent_malloc(const grib_context* c, size_t s); +void* grib_permanent_realloc(const grib_context* c, void* p, size_t s); +void grib_permanent_free(const grib_context* c, void* p); +void* grib_buffer_malloc(const grib_context* c, size_t s); +void grib_buffer_free(const grib_context* c, void* p); +void* grib_buffer_realloc(const grib_context* c, void* p, size_t s); /* grib_buffer.c */ -void grib_get_buffer_ownership(const grib_context *c, grib_buffer *b); -grib_buffer *grib_create_growable_buffer(const grib_context *c); -grib_buffer *grib_new_buffer(const grib_context *c, const unsigned char *data, size_t buflen); -void grib_buffer_delete(const grib_context *c, grib_buffer *b); -void grib_grow_buffer(const grib_context *c, grib_buffer *b, size_t new_size); -void grib_buffer_set_ulength_bits(const grib_context *c, grib_buffer *b, size_t length_bits); -void grib_buffer_set_ulength(const grib_context *c, grib_buffer *b, size_t length); -void grib_recompute_sections_lengths(grib_section *s); -void grib_buffer_replace(grib_accessor *a, const unsigned char *data, size_t newsize, int update_lengths, int update_paddings); -void grib_update_sections_lengths(grib_handle *h); +void grib_get_buffer_ownership(const grib_context* c, grib_buffer* b); +grib_buffer* grib_create_growable_buffer(const grib_context* c); +grib_buffer* grib_new_buffer(const grib_context* c, const unsigned char* data, size_t buflen); +void grib_buffer_delete(const grib_context* c, grib_buffer* b); +void grib_grow_buffer(const grib_context* c, grib_buffer* b, size_t new_size); +void grib_buffer_set_ulength_bits(const grib_context* c, grib_buffer* b, size_t length_bits); +void grib_buffer_set_ulength(const grib_context* c, grib_buffer* b, size_t length); +void grib_recompute_sections_lengths(grib_section* s); +void grib_buffer_replace(grib_accessor* a, const unsigned char* data, size_t newsize, int update_lengths, int update_paddings); +void grib_update_sections_lengths(grib_handle* h); /* grib_dumper.c */ -void grib_init_dumper(grib_dumper *d); -void grib_dumper_delete(grib_dumper *d); -void grib_dump_long(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_double(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_string(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_string_array(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_label(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_bytes(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_bits(grib_dumper *d, grib_accessor *a, const char *comment); -void grib_dump_section(grib_dumper *d, grib_accessor *a, grib_block_of_accessors *block); -void grib_dump_values(grib_dumper *d, grib_accessor *a); -void grib_dump_header(grib_dumper *d, const grib_handle *h); -void grib_dump_footer(grib_dumper *d, const grib_handle *h); +void grib_init_dumper(grib_dumper* d); +void grib_dumper_delete(grib_dumper* d); +void grib_dump_long(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_double(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_string(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_string_array(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_label(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_bits(grib_dumper* d, grib_accessor* a, const char* comment); +void grib_dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accessors* block); +void grib_dump_values(grib_dumper* d, grib_accessor* a); +void grib_dump_header(grib_dumper* d, const grib_handle* h); +void grib_dump_footer(grib_dumper* d, const grib_handle* h); /* grib_dumper_class_serialize.c */ @@ -953,66 +953,66 @@ void grib_dump_footer(grib_dumper *d, const grib_handle *h); /* grib_dumper_class_wmo.c */ /* grib_dumper_class.c */ -grib_dumper *grib_dumper_factory(const char *op, const grib_handle *h, FILE *out, unsigned long option_flags, void *arg); -void grib_dump_accessors_block(grib_dumper *dumper, grib_block_of_accessors *block); -void grib_dump_accessors_list(grib_dumper *dumper, grib_accessors_list *al); -int grib_print(grib_handle *h, const char *name, grib_dumper *d); -void grib_dump_content(const grib_handle *h, FILE *f, const char *mode, unsigned long flags, void *data); -void grib_dump_keys(grib_handle* h, FILE* f, const char* mode, unsigned long flags, void *data, const char **keys, size_t num_keys); -grib_dumper *grib_dump_content_with_dumper(grib_handle *h, grib_dumper *dumper, FILE *f, const char *mode, unsigned long flags, void *data); -void codes_dump_bufr_flat(grib_accessors_list *al, grib_handle *h, FILE *f, const char *mode, unsigned long flags, void *data); +grib_dumper* grib_dumper_factory(const char* op, const grib_handle* h, FILE* out, unsigned long option_flags, void* arg); +void grib_dump_accessors_block(grib_dumper* dumper, grib_block_of_accessors* block); +void grib_dump_accessors_list(grib_dumper* dumper, grib_accessors_list* al); +int grib_print(grib_handle* h, const char* name, grib_dumper* d); +void grib_dump_content(const grib_handle* h, FILE* f, const char* mode, unsigned long flags, void* data); +void grib_dump_keys(grib_handle* h, FILE* f, const char* mode, unsigned long flags, void* data, const char** keys, size_t num_keys); +grib_dumper* grib_dump_content_with_dumper(grib_handle* h, grib_dumper* dumper, FILE* f, const char* mode, unsigned long flags, void* data); +void codes_dump_bufr_flat(grib_accessors_list* al, grib_handle* h, FILE* f, const char* mode, unsigned long flags, void* data); /* grib_context.c */ -size_t grib_context_read(const grib_context *c, void *ptr, size_t size, void *stream); -off_t grib_context_tell(const grib_context *c, void *stream); -int grib_context_seek(const grib_context *c, off_t offset, int whence, void *stream); -int grib_context_eof(const grib_context *c, void *stream); -size_t grib_context_write(const grib_context *c, const void *ptr, size_t size, void *stream); -void grib_context_set_print_proc(grib_context *c, grib_print_proc p); -void grib_context_set_debug(grib_context *c, int mode); -void grib_context_set_logging_proc(grib_context *c, grib_log_proc p); +size_t grib_context_read(const grib_context* c, void* ptr, size_t size, void* stream); +off_t grib_context_tell(const grib_context* c, void* stream); +int grib_context_seek(const grib_context* c, off_t offset, int whence, void* stream); +int grib_context_eof(const grib_context* c, void* stream); +size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream); +void grib_context_set_print_proc(grib_context* c, grib_print_proc p); +void grib_context_set_debug(grib_context* c, int mode); +void grib_context_set_logging_proc(grib_context* c, grib_log_proc p); long grib_get_api_version(void); -void grib_print_api_version(FILE *out); -const char *grib_get_package_name(void); -grib_context *grib_context_get_default(void); -char *grib_context_full_defs_path(grib_context *c, const char *basename); -char *grib_samples_path(const grib_context *c); -char *grib_definition_path(const grib_context *c); -void grib_context_free(const grib_context *c, void *p); -void grib_context_free_persistent(const grib_context *c, void *p); -void grib_context_reset(grib_context *c); -void grib_context_delete(grib_context *c); +void grib_print_api_version(FILE* out); +const char* grib_get_package_name(void); +grib_context* grib_context_get_default(void); +char* grib_context_full_defs_path(grib_context* c, const char* basename); +char* grib_samples_path(const grib_context* c); +char* grib_definition_path(const grib_context* c); +void grib_context_free(const grib_context* c, void* p); +void grib_context_free_persistent(const grib_context* c, void* p); +void grib_context_reset(grib_context* c); +void grib_context_delete(grib_context* c); void codes_bufr_multi_element_constant_arrays_on(grib_context* c); void codes_bufr_multi_element_constant_arrays_off(grib_context* c); -void grib_context_set_definitions_path(grib_context *c, const char *path); -void grib_context_set_samples_path(grib_context *c, const char *path); -void *grib_context_malloc_persistent(const grib_context *c, size_t size); -char *grib_context_strdup_persistent(const grib_context *c, const char *s); -void *grib_context_malloc_clear_persistent(const grib_context *c, size_t size); -void *grib_context_malloc(const grib_context *c, size_t size); -void *grib_context_realloc(const grib_context *c, void *p, size_t size); -char *grib_context_strdup(const grib_context *c, const char *s); -void *grib_context_malloc_clear(const grib_context *c, size_t size); -void *grib_context_buffer_malloc(const grib_context *c, size_t size); -void grib_context_buffer_free(const grib_context *c, void *p); -void *grib_context_buffer_realloc(const grib_context *c, void *p, size_t size); -void *grib_context_buffer_malloc_clear(const grib_context *c, size_t size); -void grib_context_set_memory_proc(grib_context *c, grib_malloc_proc m, grib_free_proc f, grib_realloc_proc r); -void grib_context_set_persistent_memory_proc(grib_context *c, grib_malloc_proc m, grib_free_proc f); -void grib_context_set_buffer_memory_proc(grib_context *c, grib_malloc_proc m, grib_free_proc f, grib_realloc_proc r); -void grib_context_set_data_accessing_proc(grib_context *c, grib_data_read_proc read, grib_data_write_proc write, grib_data_tell_proc tell); -void grib_context_log(const grib_context *c, int level, const char *fmt, ...); -void grib_context_print(const grib_context *c, void *descriptor, const char *fmt, ...); -int grib_context_get_handle_file_count(grib_context *c); -int grib_context_get_handle_total_count(grib_context *c); -void grib_context_set_handle_file_count(grib_context *c, int new_count); -void grib_context_set_handle_total_count(grib_context *c, int new_count); -void grib_context_increment_handle_file_count(grib_context *c); -void grib_context_increment_handle_total_count(grib_context *c); -bufr_descriptors_array* grib_context_expanded_descriptors_list_get(grib_context* c,const char* key,long* u,size_t size); -void grib_context_expanded_descriptors_list_push(grib_context* c,const char* key,bufr_descriptors_array* expanded,bufr_descriptors_array* unexpanded); +void grib_context_set_definitions_path(grib_context* c, const char* path); +void grib_context_set_samples_path(grib_context* c, const char* path); +void* grib_context_malloc_persistent(const grib_context* c, size_t size); +char* grib_context_strdup_persistent(const grib_context* c, const char* s); +void* grib_context_malloc_clear_persistent(const grib_context* c, size_t size); +void* grib_context_malloc(const grib_context* c, size_t size); +void* grib_context_realloc(const grib_context* c, void* p, size_t size); +char* grib_context_strdup(const grib_context* c, const char* s); +void* grib_context_malloc_clear(const grib_context* c, size_t size); +void* grib_context_buffer_malloc(const grib_context* c, size_t size); +void grib_context_buffer_free(const grib_context* c, void* p); +void* grib_context_buffer_realloc(const grib_context* c, void* p, size_t size); +void* grib_context_buffer_malloc_clear(const grib_context* c, size_t size); +void grib_context_set_memory_proc(grib_context* c, grib_malloc_proc m, grib_free_proc f, grib_realloc_proc r); +void grib_context_set_persistent_memory_proc(grib_context* c, grib_malloc_proc m, grib_free_proc f); +void grib_context_set_buffer_memory_proc(grib_context* c, grib_malloc_proc m, grib_free_proc f, grib_realloc_proc r); +void grib_context_set_data_accessing_proc(grib_context* c, grib_data_read_proc read, grib_data_write_proc write, grib_data_tell_proc tell); +void grib_context_log(const grib_context* c, int level, const char* fmt, ...); +void grib_context_print(const grib_context* c, void* descriptor, const char* fmt, ...); +int grib_context_get_handle_file_count(grib_context* c); +int grib_context_get_handle_total_count(grib_context* c); +void grib_context_set_handle_file_count(grib_context* c, int new_count); +void grib_context_set_handle_total_count(grib_context* c, int new_count); +void grib_context_increment_handle_file_count(grib_context* c); +void grib_context_increment_handle_total_count(grib_context* c); +bufr_descriptors_array* grib_context_expanded_descriptors_list_get(grib_context* c, const char* key, long* u, size_t size); +void grib_context_expanded_descriptors_list_push(grib_context* c, const char* key, bufr_descriptors_array* expanded, bufr_descriptors_array* unexpanded); void codes_set_codes_assertion_failed_proc(codes_assertion_failed_proc proc); -void codes_assertion_failed(const char *message, const char *file, int line); +void codes_assertion_failed(const char* message, const char* file, int line); int grib_get_gribex_mode(grib_context* c); void grib_gribex_mode_on(grib_context* c); void grib_gribex_mode_off(grib_context* c); @@ -1022,363 +1022,363 @@ void grib_multi_support_on(grib_context* c); void grib_multi_support_off(grib_context* c); /* grib_date.c */ -int grib_julian_to_datetime(double jd, long *year, long *month, long *day, long *hour, long *minute, long *second); -int grib_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double *jd); -int grib_datetime_to_julian_d(long year,long month,long day,long hour,long minute,double second, double* jd); +int grib_julian_to_datetime(double jd, long* year, long* month, long* day, long* hour, long* minute, long* second); +int grib_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double* jd); +int grib_datetime_to_julian_d(long year, long month, long day, long hour, long minute, double second, double* jd); long grib_julian_to_date(long jdate); long grib_date_to_julian(long ddate); /* grib_fieldset.c */ -int grib_fieldset_new_column(grib_fieldset *set, int id, char *key, int type); -int grib_fieldset_column_copy_from_handle(grib_handle *h, grib_fieldset *set, int i); -grib_fieldset *grib_fieldset_new_from_files(grib_context *c, char *filenames[], int nfiles, char **keys, int nkeys, const char *where_string, const char *order_by_string, int *err); -int grib_fieldset_apply_where(grib_fieldset *set, const char *where_string); -int grib_fieldset_apply_order_by(grib_fieldset *set, const char *order_by_string); -void grib_fieldset_delete_order_by(grib_context *c, grib_order_by *order_by); -void grib_fieldset_delete(grib_fieldset *set); -int grib_fieldset_add(grib_fieldset *set, char *filename); -void grib_fieldset_rewind(grib_fieldset *set); -grib_handle *grib_fieldset_next_handle(grib_fieldset *set, int *err); -int grib_fieldset_count(grib_fieldset *set); -grib_handle *grib_fieldset_retrieve(grib_fieldset *set, int i, int *err); +int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type); +int grib_fieldset_column_copy_from_handle(grib_handle* h, grib_fieldset* set, int i); +grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err); +int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string); +int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string); +void grib_fieldset_delete_order_by(grib_context* c, grib_order_by* order_by); +void grib_fieldset_delete(grib_fieldset* set); +int grib_fieldset_add(grib_fieldset* set, char* filename); +void grib_fieldset_rewind(grib_fieldset* set); +grib_handle* grib_fieldset_next_handle(grib_fieldset* set, int* err); +int grib_fieldset_count(grib_fieldset* set); +grib_handle* grib_fieldset_retrieve(grib_fieldset* set, int i, int* err); /* grib_filepool.c */ void grib_file_pool_clean(void); -grib_file *grib_file_pool_get_files(void); -int grib_file_pool_read(grib_context *c, FILE *fh); -int grib_file_pool_write(FILE *fh); -grib_file *grib_file_open(const char *filename, const char *mode, int *err); -void grib_file_pool_delete_file(grib_file *file); -void grib_file_close(const char *filename, int force, int *err); -void grib_file_close_all(int *err); -grib_file *grib_get_file(const char *filename, int *err); -grib_file *grib_find_file(short id); -grib_file *grib_file_new(grib_context *c, const char *name, int *err); -void grib_file_delete(grib_file *file); +grib_file* grib_file_pool_get_files(void); +int grib_file_pool_read(grib_context* c, FILE* fh); +int grib_file_pool_write(FILE* fh); +grib_file* grib_file_open(const char* filename, const char* mode, int* err); +void grib_file_pool_delete_file(grib_file* file); +void grib_file_close(const char* filename, int force, int* err); +void grib_file_close_all(int* err); +grib_file* grib_get_file(const char* filename, int* err); +grib_file* grib_find_file(short id); +grib_file* grib_file_new(grib_context* c, const char* name, int* err); +void grib_file_delete(grib_file* file); /* grib_geography.c */ -int grib_get_gaussian_latitudes(long trunc, double *lats); -int is_gaussian_global(double lat1, double lat2, double lon1, double lon2, long num_points_equator, const double *latitudes, double angular_precision); +int grib_get_gaussian_latitudes(long trunc, double* lats); +int is_gaussian_global(double lat1, double lat2, double lon1, double lon2, long num_points_equator, const double* latitudes, double angular_precision); void rotate(const double inlat, const double inlon, const double angleOfRot, const double southPoleLat, const double southPoleLon, double* outlat, double* outlon); -void unrotate(const double inlat, const double inlon, const double angleOfRot, const double southPoleLat, const double southPoleLon, double *outlat, double *outlon); +void unrotate(const double inlat, const double inlon, const double angleOfRot, const double southPoleLat, const double southPoleLon, double* outlat, double* outlon); /* grib_handle.c */ -grib_section *grib_section_create(grib_handle *h, grib_accessor *owner); -void grib_swap_sections(grib_section *the_old, grib_section *the_new); -void grib_empty_section(grib_context *c, grib_section *b); -void grib_section_delete(grib_context *c, grib_section *b); -int grib_handle_delete(grib_handle *h); -grib_handle *grib_new_handle(grib_context *c); -grib_handle *grib_handle_new_from_samples(grib_context *c, const char *name); -grib_handle *codes_bufr_handle_new_from_samples(grib_context *c, const char *name); -int grib_write_message(const grib_handle *h, const char *file, const char *mode); -grib_handle *grib_handle_clone(const grib_handle *h); -grib_handle *codes_handle_new_from_file(grib_context *c, FILE *f, ProductKind product, int *error); -grib_handle *codes_grib_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *codes_bufr_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *codes_metar_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *codes_gts_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *grib_handle_new_from_message_copy(grib_context *c, const void *data, size_t size); -grib_handle *grib_handle_new_from_partial_message_copy(grib_context *c, const void *data, size_t size); -grib_handle *grib_handle_new_from_partial_message(grib_context *c, const void *data, size_t buflen); -grib_handle *grib_handle_new_from_message(grib_context *c, const void *data, size_t buflen); -grib_handle *grib_handle_new_from_multi_message(grib_context *c, void **data, size_t *buflen, int *error); -grib_handle *grib_handle_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *grib_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *gts_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *taf_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *metar_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *bufr_new_from_file(grib_context *c, FILE *f, int *error); -grib_handle *any_new_from_file(grib_context *c, FILE *f, int *error); -grib_multi_handle *grib_multi_handle_new(grib_context *c); -int grib_multi_handle_delete(grib_multi_handle *h); -int grib_multi_handle_append(grib_handle *h, int start_section, grib_multi_handle *mh); -int grib_multi_handle_write(grib_multi_handle *h, FILE *f); -int grib_get_partial_message(grib_handle *h, const void **msg, size_t *len, int start_section); -int grib_get_partial_message_copy(grib_handle *h, void *message, size_t *len, int start_section); -int grib_get_message_copy(const grib_handle *h, void *message, size_t *len); -int grib_get_message_offset(const grib_handle *h, off_t *offset); -int codes_get_product_kind(const grib_handle *h, ProductKind *product_kind); -int codes_check_message_header(const void *bytes, size_t length, ProductKind product); -int codes_check_message_footer(const void *bytes, size_t length, ProductKind product); -int grib_get_message_size(const grib_handle *h, size_t *size); -int grib_get_message(const grib_handle *h, const void **msg, size_t *size); -int grib_get_message_headers(grib_handle *h, const void **msg, size_t *size); -grib_handle *grib_handle_new(grib_context *c); -grib_action *grib_action_from_filter(const char *filter); -int grib_handle_apply_action(grib_handle *h, grib_action *a); -int grib_handle_prepare_action(grib_handle *h, grib_action *a); -void grib_multi_support_reset_file(grib_context *c, FILE *f); -void grib_multi_support_reset(grib_context *c); +grib_section* grib_section_create(grib_handle* h, grib_accessor* owner); +void grib_swap_sections(grib_section* the_old, grib_section* the_new); +void grib_empty_section(grib_context* c, grib_section* b); +void grib_section_delete(grib_context* c, grib_section* b); +int grib_handle_delete(grib_handle* h); +grib_handle* grib_new_handle(grib_context* c); +grib_handle* grib_handle_new_from_samples(grib_context* c, const char* name); +grib_handle* codes_bufr_handle_new_from_samples(grib_context* c, const char* name); +int grib_write_message(const grib_handle* h, const char* file, const char* mode); +grib_handle* grib_handle_clone(const grib_handle* h); +grib_handle* codes_handle_new_from_file(grib_context* c, FILE* f, ProductKind product, int* error); +grib_handle* codes_grib_handle_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* codes_bufr_handle_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* codes_metar_handle_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* codes_gts_handle_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* grib_handle_new_from_message_copy(grib_context* c, const void* data, size_t size); +grib_handle* grib_handle_new_from_partial_message_copy(grib_context* c, const void* data, size_t size); +grib_handle* grib_handle_new_from_partial_message(grib_context* c, const void* data, size_t buflen); +grib_handle* grib_handle_new_from_message(grib_context* c, const void* data, size_t buflen); +grib_handle* grib_handle_new_from_multi_message(grib_context* c, void** data, size_t* buflen, int* error); +grib_handle* grib_handle_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* grib_new_from_file(grib_context* c, FILE* f, int headers_only, int* error); +grib_handle* gts_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* taf_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* metar_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* bufr_new_from_file(grib_context* c, FILE* f, int* error); +grib_handle* any_new_from_file(grib_context* c, FILE* f, int* error); +grib_multi_handle* grib_multi_handle_new(grib_context* c); +int grib_multi_handle_delete(grib_multi_handle* h); +int grib_multi_handle_append(grib_handle* h, int start_section, grib_multi_handle* mh); +int grib_multi_handle_write(grib_multi_handle* h, FILE* f); +int grib_get_partial_message(grib_handle* h, const void** msg, size_t* len, int start_section); +int grib_get_partial_message_copy(grib_handle* h, void* message, size_t* len, int start_section); +int grib_get_message_copy(const grib_handle* h, void* message, size_t* len); +int grib_get_message_offset(const grib_handle* h, off_t* offset); +int codes_get_product_kind(const grib_handle* h, ProductKind* product_kind); +int codes_check_message_header(const void* bytes, size_t length, ProductKind product); +int codes_check_message_footer(const void* bytes, size_t length, ProductKind product); +int grib_get_message_size(const grib_handle* h, size_t* size); +int grib_get_message(const grib_handle* h, const void** msg, size_t* size); +int grib_get_message_headers(grib_handle* h, const void** msg, size_t* size); +grib_handle* grib_handle_new(grib_context* c); +grib_action* grib_action_from_filter(const char* filter); +int grib_handle_apply_action(grib_handle* h, grib_action* a); +int grib_handle_prepare_action(grib_handle* h, grib_action* a); +void grib_multi_support_reset_file(grib_context* c, FILE* f); +void grib_multi_support_reset(grib_context* c); /* grib_header_compute.c */ -void print_math(grib_math *m); -grib_math *grib_math_clone(grib_context *c, grib_math *m); -void grib_math_delete(grib_context *c, grib_math *m); -grib_math *grib_math_new(grib_context *c, const char *formula, int *err); +void print_math(grib_math* m); +grib_math* grib_math_clone(grib_context* c, grib_math* m); +void grib_math_delete(grib_context* c, grib_math* m); +grib_math* grib_math_new(grib_context* c, const char* formula, int* err); /* grib_hash_keys.c */ -const struct grib_keys_hash *grib_keys_hash_get(const char *str, unsigned int len); -grib_itrie *grib_hash_keys_new(grib_context *c, int *count); -void grib_hash_keys_delete(grib_itrie *t); -int grib_hash_keys_get_id(grib_itrie *t, const char *key); -int grib_hash_keys_insert(grib_itrie *t, const char *key); -int grib_hash_keys_get_size(grib_itrie *t); +const struct grib_keys_hash* grib_keys_hash_get(const char* str, unsigned int len); +grib_itrie* grib_hash_keys_new(grib_context* c, int* count); +void grib_hash_keys_delete(grib_itrie* t); +int grib_hash_keys_get_id(grib_itrie* t, const char* key); +int grib_hash_keys_insert(grib_itrie* t, const char* key); +int grib_hash_keys_get_size(grib_itrie* t); /* grib_io.c */ -off_t stdio_tell(void *data); -int stdio_seek(void *data, off_t len); -int stdio_seek_from_start(void *data, off_t len); -size_t stdio_read(void *data, void *buf, size_t len, int *err); -int wmo_read_any_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_grib_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_bufr_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_gts_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_taf_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_metar_from_file(FILE *f, void *buffer, size_t *len); -int wmo_read_any_from_stream(void *stream_data, long (*stream_proc )(void *, void *buffer, long len ), void *buffer, size_t *len); -void* wmo_read_any_from_stream_malloc(void* stream_data,long (*stream_proc)(void*,void* buffer,long len) ,size_t *size, int* err); -void *wmo_read_gts_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); -void *wmo_read_taf_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); -void *wmo_read_metar_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); -void *wmo_read_any_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); -void *wmo_read_grib_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); -void *wmo_read_bufr_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err); -int grib_read_any_headers_only_from_file(grib_context *ctx, FILE *f, void *buffer, size_t *len); -int grib_read_any_from_file(grib_context *ctx, FILE *f, void *buffer, size_t *len); -int grib_read_any_from_memory_alloc(grib_context *ctx, unsigned char **data, size_t *data_length, void **buffer, size_t *length); -int grib_read_any_from_memory(grib_context *ctx, unsigned char **data, size_t *data_length, void *buffer, size_t *len); -int grib_count_in_file(grib_context *c, FILE *f, int *n); -int grib_count_in_filename(grib_context *c, const char *filename, int *n); +off_t stdio_tell(void* data); +int stdio_seek(void* data, off_t len); +int stdio_seek_from_start(void* data, off_t len); +size_t stdio_read(void* data, void* buf, size_t len, int* err); +int wmo_read_any_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_grib_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_bufr_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len); +int wmo_read_any_from_stream(void* stream_data, long (*stream_proc)(void*, void* buffer, long len), void* buffer, size_t* len); +void* wmo_read_any_from_stream_malloc(void* stream_data, long (*stream_proc)(void*, void* buffer, long len), size_t* size, int* err); +void* wmo_read_gts_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_taf_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_metar_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_any_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_grib_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +void* wmo_read_bufr_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err); +int grib_read_any_headers_only_from_file(grib_context* ctx, FILE* f, void* buffer, size_t* len); +int grib_read_any_from_file(grib_context* ctx, FILE* f, void* buffer, size_t* len); +int grib_read_any_from_memory_alloc(grib_context* ctx, unsigned char** data, size_t* data_length, void** buffer, size_t* length); +int grib_read_any_from_memory(grib_context* ctx, unsigned char** data, size_t* data_length, void* buffer, size_t* len); +int grib_count_in_file(grib_context* c, FILE* f, int* n); +int grib_count_in_filename(grib_context* c, const char* filename, int* n); /* grib_trie.c */ -grib_trie *grib_trie_new(grib_context *c); -void grib_trie_delete_container(grib_trie *t); -void grib_trie_delete(grib_trie *t); -void grib_trie_clear(grib_trie *t); -void *grib_trie_insert(grib_trie *t, const char *key, void *data); -void *grib_trie_insert_no_replace(grib_trie *t, const char *key, void *data); -void *grib_trie_get(grib_trie *t, const char *key); +grib_trie* grib_trie_new(grib_context* c); +void grib_trie_delete_container(grib_trie* t); +void grib_trie_delete(grib_trie* t); +void grib_trie_clear(grib_trie* t); +void* grib_trie_insert(grib_trie* t, const char* key, void* data); +void* grib_trie_insert_no_replace(grib_trie* t, const char* key, void* data); +void* grib_trie_get(grib_trie* t, const char* key); /* grib_trie_with_rank.c */ -grib_trie_with_rank *grib_trie_with_rank_new(grib_context *c); -void grib_trie_with_rank_delete_container(grib_trie_with_rank *t); -void grib_trie_with_rank_delete(grib_trie_with_rank *t); -void grib_trie_with_rank_clear(grib_trie_with_rank *t); -int grib_trie_with_rank_insert(grib_trie_with_rank *t, const char *key, void *data); -void *grib_trie_with_rank_get(grib_trie_with_rank *t, const char *key, int rank); +grib_trie_with_rank* grib_trie_with_rank_new(grib_context* c); +void grib_trie_with_rank_delete_container(grib_trie_with_rank* t); +void grib_trie_with_rank_delete(grib_trie_with_rank* t); +void grib_trie_with_rank_clear(grib_trie_with_rank* t); +int grib_trie_with_rank_insert(grib_trie_with_rank* t, const char* key, void* data); +void* grib_trie_with_rank_get(grib_trie_with_rank* t, const char* key, int rank); /* grib_itrie.c */ -grib_itrie *grib_itrie_new(grib_context *c, int *count); -void grib_itrie_delete(grib_itrie *t); -int grib_itrie_get_id(grib_itrie *t, const char *key); -int grib_itrie_insert(grib_itrie *t, const char *key); -int grib_itrie_get_size(grib_itrie *t); +grib_itrie* grib_itrie_new(grib_context* c, int* count); +void grib_itrie_delete(grib_itrie* t); +int grib_itrie_get_id(grib_itrie* t, const char* key); +int grib_itrie_insert(grib_itrie* t, const char* key); +int grib_itrie_get_size(grib_itrie* t); /* grib_rules.c */ -grib_rule_entry *grib_new_rule_entry(grib_context *c, const char *name, grib_expression *expression); -grib_rule *grib_new_rule(grib_context *c, grib_expression *condition, grib_rule_entry *entries); +grib_rule_entry* grib_new_rule_entry(grib_context* c, const char* name, grib_expression* expression); +grib_rule* grib_new_rule(grib_context* c, grib_expression* condition, grib_rule_entry* entries); /* grib_keys_iterator.c */ -grib_keys_iterator *grib_keys_iterator_new(grib_handle *h, unsigned long filter_flags, const char *name_space); -int grib_keys_iterator_set_flags(grib_keys_iterator *ki, unsigned long flags); -int grib_keys_iterator_rewind(grib_keys_iterator *ki); -int grib_keys_iterator_next(grib_keys_iterator *kiter); -const char *grib_keys_iterator_get_name(const grib_keys_iterator *kiter); -grib_accessor *grib_keys_iterator_get_accessor(grib_keys_iterator *kiter); -int grib_keys_iterator_delete(grib_keys_iterator *kiter); -int grib_keys_iterator_get_long(const grib_keys_iterator *kiter, long *v, size_t *len); -int grib_keys_iterator_get_double(const grib_keys_iterator *kiter, double *v, size_t *len); -int grib_keys_iterator_get_string(const grib_keys_iterator *kiter, char *v, size_t *len); -int grib_keys_iterator_get_bytes(const grib_keys_iterator *kiter, unsigned char *v, size_t *len); -int grib_keys_iterator_get_native_type(const grib_keys_iterator *kiter); +grib_keys_iterator* grib_keys_iterator_new(grib_handle* h, unsigned long filter_flags, const char* name_space); +int grib_keys_iterator_set_flags(grib_keys_iterator* ki, unsigned long flags); +int grib_keys_iterator_rewind(grib_keys_iterator* ki); +int grib_keys_iterator_next(grib_keys_iterator* kiter); +const char* grib_keys_iterator_get_name(const grib_keys_iterator* kiter); +grib_accessor* grib_keys_iterator_get_accessor(grib_keys_iterator* kiter); +int grib_keys_iterator_delete(grib_keys_iterator* kiter); +int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len); +int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len); +int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len); +int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len); +int grib_keys_iterator_get_native_type(const grib_keys_iterator* kiter); /* bufr_keys_iterator.c */ -bufr_keys_iterator *codes_bufr_keys_iterator_new(grib_handle *h, unsigned long filter_flags); -bufr_keys_iterator *codes_bufr_data_section_keys_iterator_new(grib_handle *h); -int codes_bufr_keys_iterator_rewind(bufr_keys_iterator *ki); -int codes_bufr_keys_iterator_next(bufr_keys_iterator *kiter); -char *codes_bufr_keys_iterator_get_name(const bufr_keys_iterator *kiter); -grib_accessor *codes_bufr_keys_iterator_get_accessor(bufr_keys_iterator *kiter); -int codes_bufr_keys_iterator_delete(bufr_keys_iterator *kiter); +bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h, unsigned long filter_flags); +bufr_keys_iterator* codes_bufr_data_section_keys_iterator_new(grib_handle* h); +int codes_bufr_keys_iterator_rewind(bufr_keys_iterator* ki); +int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter); +char* codes_bufr_keys_iterator_get_name(const bufr_keys_iterator* kiter); +grib_accessor* codes_bufr_keys_iterator_get_accessor(bufr_keys_iterator* kiter); +int codes_bufr_keys_iterator_delete(bufr_keys_iterator* kiter); /* grib_parse_utils.c */ -int grib_recompose_name(grib_handle *h, grib_accessor *observer, const char *uname, char *fname, int fail); -int grib_accessor_print(grib_accessor *a, const char *name, int type, const char *format, const char *separator, int maxcols, int *newline, FILE *out); -int grib_accessors_list_print(grib_handle *h, grib_accessors_list *al, const char *name, int type, const char *format, const char *separator, int maxcols, int *newline, FILE *out); -int grib_recompose_print(grib_handle *h, grib_accessor *observer, const char *uname, int fail, FILE *out); -grib_action_file *grib_find_action_file(const char *fname, grib_action_file_list *afl); -void grib_push_action_file(grib_action_file *af, grib_action_file_list *afl); +int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* uname, char* fname, int fail); +int grib_accessor_print(grib_accessor* a, const char* name, int type, const char* format, const char* separator, int maxcols, int* newline, FILE* out); +int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const char* name, int type, const char* format, const char* separator, int maxcols, int* newline, FILE* out); +int grib_recompose_print(grib_handle* h, grib_accessor* observer, const char* uname, int fail, FILE* out); +grib_action_file* grib_find_action_file(const char* fname, grib_action_file_list* afl); +void grib_push_action_file(grib_action_file* af, grib_action_file_list* afl); int grib_yywrap(void); -char *file_being_parsed(void); -int grib_yyerror(const char *msg); -void grib_parser_include(const char *included_fname); -grib_concept_value *grib_parse_concept_file(grib_context *gc, const char *filename); -grib_hash_array_value *grib_parse_hash_array_file(grib_context *gc, const char *filename); -grib_rule *grib_parse_rules_file(grib_context *gc, const char *filename); -grib_action *grib_parse_file(grib_context *gc, const char *filename); +char* file_being_parsed(void); +int grib_yyerror(const char* msg); +void grib_parser_include(const char* included_fname); +grib_concept_value* grib_parse_concept_file(grib_context* gc, const char* filename); +grib_hash_array_value* grib_parse_hash_array_file(grib_context* gc, const char* filename); +grib_rule* grib_parse_rules_file(grib_context* gc, const char* filename); +grib_action* grib_parse_file(grib_context* gc, const char* filename); int grib_type_to_int(char id); /* grib_query.c */ -grib_accessors_list *grib_find_accessors_list(const grib_handle *h, const char *name); -char *grib_split_name_attribute(grib_context *c, const char *name, char *attribute_name); -grib_accessor *grib_find_accessor(const grib_handle *h, const char *name); -grib_accessor *grib_find_attribute(grib_handle *h, const char *name, const char *attr_name, int *err); -grib_accessor *grib_find_accessor_fast(grib_handle *h, const char *name); +grib_accessors_list* grib_find_accessors_list(const grib_handle* h, const char* name); +char* grib_split_name_attribute(grib_context* c, const char* name, char* attribute_name); +grib_accessor* grib_find_accessor(const grib_handle* h, const char* name); +grib_accessor* grib_find_attribute(grib_handle* h, const char* name, const char* attr_name, int* err); +grib_accessor* grib_find_accessor_fast(grib_handle* h, const char* name); /* grib_scaling.c */ double grib_power(long s, long n); -long grib_get_binary_scale_fact(double max, double min, long bpval, int *ret); +long grib_get_binary_scale_fact(double max, double min, long bpval, int* ret); long grib_get_bits_per_value(double max, double min, long binary_scale_factor); long grib_get_decimal_scale_fact(double max, double min, long bpval, long binary_scale); /* grib_templates.c */ /*grib_handle *grib_internal_sample(grib_context *c, const char *name);*/ -grib_handle *grib_external_template(grib_context *c, const char *name); -grib_handle *bufr_external_template(grib_context *c, const char *name); -char *grib_external_template_path(grib_context *c, const char *name); +grib_handle* grib_external_template(grib_context* c, const char* name); +grib_handle* bufr_external_template(grib_context* c, const char* name); +char* grib_external_template_path(grib_context* c, const char* name); /* grib_dependency.c */ -grib_handle *grib_handle_of_accessor(grib_accessor *a); -void grib_dependency_add(grib_accessor *observer, grib_accessor *observed); -void grib_dependency_remove_observed(grib_accessor *observed); +grib_handle* grib_handle_of_accessor(grib_accessor* a); +void grib_dependency_add(grib_accessor* observer, grib_accessor* observed); +void grib_dependency_remove_observed(grib_accessor* observed); int _grib_dependency_notify_change(grib_handle* h, grib_accessor* observed); -int grib_dependency_notify_change(grib_accessor *observed); -void grib_dependency_remove_observer(grib_accessor *observer); -void grib_dependency_observe_expression(grib_accessor *observer, grib_expression *e); -void grib_dependency_observe_arguments(grib_accessor *observer, grib_arguments *a); +int grib_dependency_notify_change(grib_accessor* observed); +void grib_dependency_remove_observer(grib_accessor* observer); +void grib_dependency_observe_expression(grib_accessor* observer, grib_expression* e); +void grib_dependency_observe_arguments(grib_accessor* observer, grib_arguments* a); /* grib_value.c */ -int grib_set_expression(grib_handle *h, const char *name, grib_expression *e); -int grib_set_expression_internal(grib_handle *h, const char *name, grib_expression *e); -int grib_set_long_internal(grib_handle *h, const char *name, long val); -int grib_set_long(grib_handle *h, const char *name, long val); -int grib_set_double_internal(grib_handle *h, const char *name, double val); -int grib_copy_namespace(grib_handle *dest, const char *name, grib_handle *src); -int grib_set_double(grib_handle *h, const char *name, double val); -int grib_set_string_internal(grib_handle *h, const char *name, const char *val, size_t *length); -int grib_set_string(grib_handle *h, const char *name, const char *val, size_t *length); -int grib_set_string_array(grib_handle *h, const char *name, const char **val, size_t length); -int grib_set_bytes_internal(grib_handle *h, const char *name, const unsigned char *val, size_t *length); -int grib_set_bytes(grib_handle *h, const char *name, const unsigned char *val, size_t *length); -int grib_clear(grib_handle *h, const char *name); -int grib_set_missing_internal(grib_handle *h, const char *name); -int grib_set_missing(grib_handle *h, const char *name); -int grib_is_missing_long(grib_accessor *a, long x); -int grib_is_missing_double(grib_accessor *a, double x); -int grib_is_missing_string(grib_accessor *a, unsigned char *x, size_t len); -int grib_accessor_is_missing(grib_accessor *a, int *err); -int grib_is_missing(const grib_handle *h, const char *name, int *err); -int grib_is_defined(const grib_handle *h, const char *name); -int grib_set_flag(grib_handle *h, const char *name, unsigned long flag); -int grib_set_double_array_internal(grib_handle *h, const char *name, const double *val, size_t length); -int grib_set_force_double_array(grib_handle *h, const char *name, const double *val, size_t length); -int grib_set_double_array(grib_handle *h, const char *name, const double *val, size_t length); -int grib_set_long_array_internal(grib_handle *h, const char *name, const long *val, size_t length); -int grib_set_long_array(grib_handle *h, const char *name, const long *val, size_t length); -int grib_get_long_internal(grib_handle *h, const char *name, long *val); -int grib_is_in_dump(grib_handle *h, const char *name); -int grib_attributes_count(grib_accessor *a, size_t *size); -int grib_get_long(const grib_handle *h, const char *name, long *val); -int grib_get_double_internal(grib_handle *h, const char *name, double *val); -int grib_get_double(const grib_handle *h, const char *name, double *val); -int grib_get_double_element_internal(grib_handle *h, const char *name, int i, double *val); -int grib_get_double_element(const grib_handle *h, const char *name, int i, double *val); -int grib_points_get_values(grib_handle *h, grib_points *points, double *val); -int grib_get_double_elements(const grib_handle *h, const char *name, int *index_array, long len, double *val_array); -int grib_get_string_internal(grib_handle *h, const char *name, char *val, size_t *length); -int grib_get_string(const grib_handle *h, const char *name, char *val, size_t *length); -int grib_get_bytes_internal(const grib_handle *h, const char *name, unsigned char *val, size_t *length); -int grib_get_bytes(const grib_handle *h, const char *name, unsigned char *val, size_t *length); -int grib_get_native_type(const grib_handle *h, const char *name, int *type); -const char *grib_get_accessor_class_name(grib_handle *h, const char *name); -int _grib_get_double_array_internal(const grib_handle *h, grib_accessor *a, double *val, size_t buffer_len, size_t *decoded_length); -int grib_get_double_array_internal(const grib_handle *h, const char *name, double *val, size_t *length); -int grib_get_double_array(const grib_handle *h, const char *name, double *val, size_t *length); -int _grib_get_string_length(grib_accessor *a, size_t *size); -int grib_get_string_length(const grib_handle *h, const char *name, size_t *size); -int _grib_get_size(const grib_handle *h, grib_accessor *a, size_t *size); -int grib_get_size(const grib_handle *h, const char *name, size_t *size); -int grib_get_length(const grib_handle *h, const char *name, size_t *length); -int grib_get_count(grib_handle *h, const char *name, size_t *size); -int grib_get_offset(const grib_handle *h, const char *key, size_t *val); -int _grib_get_string_array_internal(const grib_handle *h, grib_accessor *a, char **val, size_t buffer_len, size_t *decoded_length); -int grib_get_string_array(const grib_handle *h, const char *name, char **val, size_t *length); -int _grib_get_long_array_internal(const grib_handle *h, grib_accessor *a, long *val, size_t buffer_len, size_t *decoded_length); -int grib_get_long_array_internal(grib_handle *h, const char *name, long *val, size_t *length); -int grib_get_long_array(const grib_handle *h, const char *name, long *val, size_t *length); -grib_key_value_list *grib_key_value_list_clone(grib_context *c, grib_key_value_list *list); -void grib_key_value_list_delete(grib_context *c, grib_key_value_list *kvl); -int grib_get_key_value_list(grib_handle *h, grib_key_value_list *list); -int grib_get_values(grib_handle *h, grib_values *args, size_t count); -int grib_set_values(grib_handle *h, grib_values *args, size_t count); -int grib_get_nearest_smaller_value(grib_handle *h, const char *name, double val, double *nearest); -void grib_print_values(grib_values *values, int count); -int grib_values_check(grib_handle *h, grib_values *values, int count); -int grib_key_equal(grib_handle *h1, grib_handle *h2, const char *key, int type, int *err); -int codes_copy_key(grib_handle *h1, grib_handle *h2, const char *key, int type); +int grib_set_expression(grib_handle* h, const char* name, grib_expression* e); +int grib_set_expression_internal(grib_handle* h, const char* name, grib_expression* e); +int grib_set_long_internal(grib_handle* h, const char* name, long val); +int grib_set_long(grib_handle* h, const char* name, long val); +int grib_set_double_internal(grib_handle* h, const char* name, double val); +int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src); +int grib_set_double(grib_handle* h, const char* name, double val); +int grib_set_string_internal(grib_handle* h, const char* name, const char* val, size_t* length); +int grib_set_string(grib_handle* h, const char* name, const char* val, size_t* length); +int grib_set_string_array(grib_handle* h, const char* name, const char** val, size_t length); +int grib_set_bytes_internal(grib_handle* h, const char* name, const unsigned char* val, size_t* length); +int grib_set_bytes(grib_handle* h, const char* name, const unsigned char* val, size_t* length); +int grib_clear(grib_handle* h, const char* name); +int grib_set_missing_internal(grib_handle* h, const char* name); +int grib_set_missing(grib_handle* h, const char* name); +int grib_is_missing_long(grib_accessor* a, long x); +int grib_is_missing_double(grib_accessor* a, double x); +int grib_is_missing_string(grib_accessor* a, unsigned char* x, size_t len); +int grib_accessor_is_missing(grib_accessor* a, int* err); +int grib_is_missing(const grib_handle* h, const char* name, int* err); +int grib_is_defined(const grib_handle* h, const char* name); +int grib_set_flag(grib_handle* h, const char* name, unsigned long flag); +int grib_set_double_array_internal(grib_handle* h, const char* name, const double* val, size_t length); +int grib_set_force_double_array(grib_handle* h, const char* name, const double* val, size_t length); +int grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length); +int grib_set_long_array_internal(grib_handle* h, const char* name, const long* val, size_t length); +int grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length); +int grib_get_long_internal(grib_handle* h, const char* name, long* val); +int grib_is_in_dump(grib_handle* h, const char* name); +int grib_attributes_count(grib_accessor* a, size_t* size); +int grib_get_long(const grib_handle* h, const char* name, long* val); +int grib_get_double_internal(grib_handle* h, const char* name, double* val); +int grib_get_double(const grib_handle* h, const char* name, double* val); +int grib_get_double_element_internal(grib_handle* h, const char* name, int i, double* val); +int grib_get_double_element(const grib_handle* h, const char* name, int i, double* val); +int grib_points_get_values(grib_handle* h, grib_points* points, double* val); +int grib_get_double_elements(const grib_handle* h, const char* name, int* index_array, long len, double* val_array); +int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t* length); +int grib_get_string(const grib_handle* h, const char* name, char* val, size_t* length); +int grib_get_bytes_internal(const grib_handle* h, const char* name, unsigned char* val, size_t* length); +int grib_get_bytes(const grib_handle* h, const char* name, unsigned char* val, size_t* length); +int grib_get_native_type(const grib_handle* h, const char* name, int* type); +const char* grib_get_accessor_class_name(grib_handle* h, const char* name); +int _grib_get_double_array_internal(const grib_handle* h, grib_accessor* a, double* val, size_t buffer_len, size_t* decoded_length); +int grib_get_double_array_internal(const grib_handle* h, const char* name, double* val, size_t* length); +int grib_get_double_array(const grib_handle* h, const char* name, double* val, size_t* length); +int _grib_get_string_length(grib_accessor* a, size_t* size); +int grib_get_string_length(const grib_handle* h, const char* name, size_t* size); +int _grib_get_size(const grib_handle* h, grib_accessor* a, size_t* size); +int grib_get_size(const grib_handle* h, const char* name, size_t* size); +int grib_get_length(const grib_handle* h, const char* name, size_t* length); +int grib_get_count(grib_handle* h, const char* name, size_t* size); +int grib_get_offset(const grib_handle* h, const char* key, size_t* val); +int _grib_get_string_array_internal(const grib_handle* h, grib_accessor* a, char** val, size_t buffer_len, size_t* decoded_length); +int grib_get_string_array(const grib_handle* h, const char* name, char** val, size_t* length); +int _grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, long* val, size_t buffer_len, size_t* decoded_length); +int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t* length); +int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t* length); +grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list); +void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl); +int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list); +int grib_get_values(grib_handle* h, grib_values* args, size_t count); +int grib_set_values(grib_handle* h, grib_values* args, size_t count); +int grib_get_nearest_smaller_value(grib_handle* h, const char* name, double val, double* nearest); +void grib_print_values(grib_values* values, int count); +int grib_values_check(grib_handle* h, grib_values* values, int count); +int grib_key_equal(grib_handle* h1, grib_handle* h2, const char* key, int type, int* err); +int codes_copy_key(grib_handle* h1, grib_handle* h2, const char* key, int type); /* grib_errors.c */ -const char *grib_get_error_message(int code); -void grib_check(const char *call, const char *file, int line, int e, const char *msg); +const char* grib_get_error_message(int code); +void grib_check(const char* call, const char* file, int line, int e, const char* msg); /* grib_expression_class_binop.c */ -grib_expression *new_binop_expression(grib_context *c, grib_binop_long_proc long_func, grib_binop_double_proc double_func, grib_expression *left, grib_expression *right); +grib_expression* new_binop_expression(grib_context* c, grib_binop_long_proc long_func, grib_binop_double_proc double_func, grib_expression* left, grib_expression* right); /* grib_expression_class_logical_and.c */ -grib_expression *new_logical_and_expression(grib_context *c, grib_expression *left, grib_expression *right); +grib_expression* new_logical_and_expression(grib_context* c, grib_expression* left, grib_expression* right); /* grib_expression_class_logical_or.c */ -grib_expression *new_logical_or_expression(grib_context *c, grib_expression *left, grib_expression *right); +grib_expression* new_logical_or_expression(grib_context* c, grib_expression* left, grib_expression* right); /* grib_expression_class_is_in_dict.c */ -grib_expression *new_is_in_dict_expression(grib_context *c, const char *name, const char *list); +grib_expression* new_is_in_dict_expression(grib_context* c, const char* name, const char* list); /* grib_expression_class_true.c */ -grib_expression *new_true_expression(grib_context *c); +grib_expression* new_true_expression(grib_context* c); /* grib_expression_class_string_compare.c */ -grib_expression *new_string_compare_expression(grib_context *c, grib_expression *left, grib_expression *right); +grib_expression* new_string_compare_expression(grib_context* c, grib_expression* left, grib_expression* right); /* grib_expression_class_unop.c */ -grib_expression *new_unop_expression(grib_context *c, grib_unop_long_proc long_func, grib_unop_double_proc double_func, grib_expression *exp); +grib_expression* new_unop_expression(grib_context* c, grib_unop_long_proc long_func, grib_unop_double_proc double_func, grib_expression* exp); /* grib_expression_class_functor.c */ -grib_expression *new_func_expression(grib_context *c, const char *name, grib_arguments *args); +grib_expression* new_func_expression(grib_context* c, const char* name, grib_arguments* args); /* grib_expression_class_accessor.c */ -grib_expression *new_accessor_expression(grib_context *c, const char *name, long start, size_t length); +grib_expression* new_accessor_expression(grib_context* c, const char* name, long start, size_t length); /* grib_expression_class_is_in_list.c */ -grib_expression *new_is_in_list_expression(grib_context *c, const char *name, const char *list); +grib_expression* new_is_in_list_expression(grib_context* c, const char* name, const char* list); /* grib_expression_class_is_integer.c */ -grib_expression *new_is_integer_expression(grib_context *c, const char *name, int start, int length); +grib_expression* new_is_integer_expression(grib_context* c, const char* name, int start, int length); /* grib_expression_class_length.c */ -grib_expression *new_length_expression(grib_context *c, const char *name); +grib_expression* new_length_expression(grib_context* c, const char* name); /* grib_expression_class_long.c */ -grib_expression *new_long_expression(grib_context *c, long value); +grib_expression* new_long_expression(grib_context* c, long value); /* grib_expression_class_double.c */ -grib_expression *new_double_expression(grib_context *c, double value); +grib_expression* new_double_expression(grib_context* c, double value); /* grib_expression_class_string.c */ -grib_expression *new_string_expression(grib_context *c, const char *value); +grib_expression* new_string_expression(grib_context* c, const char* value); /* grib_expression_class_sub_string.c */ -grib_expression *new_sub_string_expression(grib_context *c, const char *value, size_t start, size_t length); +grib_expression* new_sub_string_expression(grib_context* c, const char* value, size_t start, size_t length); /* grib_box.c */ -grib_points *grib_box_get_points(grib_box *box, double north, double west, double south, double east, int *err); -int grib_box_init(grib_box *box, grib_handle *h, grib_arguments *args); -int grib_box_delete(grib_box *box); -grib_points *grib_points_new(grib_context *c, size_t size); -void grib_points_delete(grib_points *points); +grib_points* grib_box_get_points(grib_box* box, double north, double west, double south, double east, int* err); +int grib_box_init(grib_box* box, grib_handle* h, grib_arguments* args); +int grib_box_delete(grib_box* box); +grib_points* grib_points_new(grib_context* c, size_t size); +void grib_points_delete(grib_points* points); /* grib_box_class.c */ -grib_box *grib_box_factory(grib_handle *h, grib_arguments *args); +grib_box* grib_box_factory(grib_handle* h, grib_arguments* args); /* grib_box_class_gen.c */ @@ -1387,15 +1387,15 @@ grib_box *grib_box_factory(grib_handle *h, grib_arguments *args); /* grib_box_class_reduced_gaussian.c */ /* grib_nearest.c */ -int grib_nearest_find(grib_nearest *nearest, const grib_handle *h, double inlat, double inlon, unsigned long flags, double *outlats, double *outlons, double *values, double *distances, int *indexes, size_t *len); -int grib_nearest_init(grib_nearest *i, grib_handle *h, grib_arguments *args); -int grib_nearest_delete(grib_nearest *i); -void grib_binary_search(double xx[], const unsigned long n, double x, int *ju, int *jl); +int grib_nearest_find(grib_nearest* nearest, const grib_handle* h, double inlat, double inlon, unsigned long flags, double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len); +int grib_nearest_init(grib_nearest* i, grib_handle* h, grib_arguments* args); +int grib_nearest_delete(grib_nearest* i); +void grib_binary_search(double xx[], const unsigned long n, double x, int* ju, int* jl); double grib_nearest_distance(double radius, double lon1, double lat1, double lon2, double lat2); -int grib_nearest_find_multiple(const grib_handle *h, int is_lsm, const double *inlats, const double *inlons, long npoints, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, const double* inlats, const double* inlons, long npoints, double* outlats, double* outlons, double* values, double* distances, int* indexes); /* grib_nearest_class.c */ -grib_nearest *grib_nearest_factory(grib_handle *h, grib_arguments *args); +grib_nearest* grib_nearest_factory(grib_handle* h, grib_arguments* args); /* grib_nearest_class_gen.c */ @@ -1418,16 +1418,16 @@ grib_nearest *grib_nearest_factory(grib_handle *h, grib_arguments *args); /* grib_iterator_class_lambert_conformal.c */ /* grib_iterator.c */ -int grib_get_data(const grib_handle *h, double *lats, double *lons, double *values); -int grib_iterator_next(grib_iterator *i, double *lat, double *lon, double *value); -int grib_iterator_has_next(grib_iterator *i); -int grib_iterator_previous(grib_iterator *i, double *lat, double *lon, double *value); -int grib_iterator_reset(grib_iterator *i); -int grib_iterator_init(grib_iterator *i, grib_handle *h, grib_arguments *args); -int grib_iterator_delete(grib_iterator *i); +int grib_get_data(const grib_handle* h, double* lats, double* lons, double* values); +int grib_iterator_next(grib_iterator* i, double* lat, double* lon, double* value); +int grib_iterator_has_next(grib_iterator* i); +int grib_iterator_previous(grib_iterator* i, double* lat, double* lon, double* value); +int grib_iterator_reset(grib_iterator* i); +int grib_iterator_init(grib_iterator* i, grib_handle* h, grib_arguments* args); +int grib_iterator_delete(grib_iterator* i); /* grib_iterator_class.c */ -grib_iterator *grib_iterator_factory(grib_handle *h, grib_arguments *args, unsigned long flags, int *ret); +grib_iterator* grib_iterator_factory(grib_handle* h, grib_arguments* args, unsigned long flags, int* ret); /* grib_iterator_class_gaussian.c */ @@ -1436,7 +1436,7 @@ grib_iterator *grib_iterator_factory(grib_handle *h, grib_arguments *args, unsig /* grib_iterator_class_latlon_reduced.c */ /* grib_iterator_class_gen.c */ -int transform_iterator_data(grib_handle *h, double *data, long iScansNegatively, long jScansPositively, long jPointsAreConsecutive, long alternativeRowScanning, size_t numPoints, long nx, long ny); +int transform_iterator_data(grib_handle* h, double* data, long iScansNegatively, long jScansPositively, long jPointsAreConsecutive, long alternativeRowScanning, size_t numPoints, long nx, long ny); /* grib_iterator_class_latlon.c */ @@ -1445,61 +1445,61 @@ int transform_iterator_data(grib_handle *h, double *data, long iScansNegatively, /* grib_iterator_class_space_view.c */ /* grib_expression.c */ -int grib_expression_native_type(grib_handle *h, grib_expression *g); -int grib_expression_evaluate_long(grib_handle *h, grib_expression *g, long *result); -int grib_expression_evaluate_double(grib_handle *h, grib_expression *g, double *result); -const char *grib_expression_evaluate_string(grib_handle *h, grib_expression *g, char *buf, size_t *size, int *err); -const char *grib_expression_get_name(grib_expression *g); -void grib_expression_print(grib_context *ctx, grib_expression *g, grib_handle *f); -void grib_expression_free(grib_context *ctx, grib_expression *g); -void grib_expression_add_dependency(grib_expression *e, grib_accessor *observer); -int grib_expression_set_value(grib_handle *h, grib_expression *g, grib_values *v); -grib_arguments *grib_arguments_new(grib_context *c, grib_expression *g, grib_arguments *n); -void grib_arguments_free(grib_context *c, grib_arguments *g); -void grib_arguments_print(grib_context *c, grib_arguments *g, grib_handle *f); -const char *grib_arguments_get_name(grib_handle *h, grib_arguments *args, int n); -const char *grib_arguments_get_string(grib_handle *h, grib_arguments *args, int n); -long grib_arguments_get_long(grib_handle *h, grib_arguments *args, int n); -double grib_arguments_get_double(grib_handle *h, grib_arguments *args, int n); -grib_expression *grib_arguments_get_expression(grib_handle *h, grib_arguments *args, int n); +int grib_expression_native_type(grib_handle* h, grib_expression* g); +int grib_expression_evaluate_long(grib_handle* h, grib_expression* g, long* result); +int grib_expression_evaluate_double(grib_handle* h, grib_expression* g, double* result); +const char* grib_expression_evaluate_string(grib_handle* h, grib_expression* g, char* buf, size_t* size, int* err); +const char* grib_expression_get_name(grib_expression* g); +void grib_expression_print(grib_context* ctx, grib_expression* g, grib_handle* f); +void grib_expression_free(grib_context* ctx, grib_expression* g); +void grib_expression_add_dependency(grib_expression* e, grib_accessor* observer); +int grib_expression_set_value(grib_handle* h, grib_expression* g, grib_values* v); +grib_arguments* grib_arguments_new(grib_context* c, grib_expression* g, grib_arguments* n); +void grib_arguments_free(grib_context* c, grib_arguments* g); +void grib_arguments_print(grib_context* c, grib_arguments* g, grib_handle* f); +const char* grib_arguments_get_name(grib_handle* h, grib_arguments* args, int n); +const char* grib_arguments_get_string(grib_handle* h, grib_arguments* args, int n); +long grib_arguments_get_long(grib_handle* h, grib_arguments* args, int n); +double grib_arguments_get_double(grib_handle* h, grib_arguments* args, int n); +grib_expression* grib_arguments_get_expression(grib_handle* h, grib_arguments* args, int n); /* codes_util.c */ char get_dir_separator_char(void); int path_is_directory(const char* filename); -char *codes_getenv(const char *name); +char* codes_getenv(const char* name); /* grib_util.c */ -grib_handle *grib_util_sections_copy(grib_handle *hfrom, grib_handle *hto, int what, int *err); -grib_string_list *grib_util_get_param_id(const char *mars_param); -grib_string_list *grib_util_get_mars_param(const char *param_id); -grib_handle *grib_util_set_spec(grib_handle *h, const grib_util_grid_spec *spec, const grib_util_packing_spec *packing_spec, int flags, const double *data_values, size_t data_values_count, int *err); -grib_handle *grib_util_set_spec2(grib_handle *h, const grib_util_grid_spec2 *spec, const grib_util_packing_spec *packing_spec, int flags, const double *data_values, size_t data_values_count, int *err); -int grib_moments(grib_handle *h, double east, double north, double west, double south, int order, double *moments, long *count); -int parse_keyval_string(const char *grib_tool, char *arg, int values_required, int default_type, grib_values values[], int *count); +grib_handle* grib_util_sections_copy(grib_handle* hfrom, grib_handle* hto, int what, int* err); +grib_string_list* grib_util_get_param_id(const char* mars_param); +grib_string_list* grib_util_get_mars_param(const char* param_id); +grib_handle* grib_util_set_spec(grib_handle* h, const grib_util_grid_spec* spec, const grib_util_packing_spec* packing_spec, int flags, const double* data_values, size_t data_values_count, int* err); +grib_handle* grib_util_set_spec2(grib_handle* h, const grib_util_grid_spec2* spec, const grib_util_packing_spec* packing_spec, int flags, const double* data_values, size_t data_values_count, int* err); +int grib_moments(grib_handle* h, double east, double north, double west, double south, int order, double* moments, long* count); +int parse_keyval_string(const char* grib_tool, char* arg, int values_required, int default_type, grib_values values[], int* count); int grib2_is_PDTN_EPS(long productDefinitionTemplateNumber); int grib2_is_PDTN_Chemical(long productDefinitionTemplateNumber); int grib2_is_PDTN_ChemicalDistFunc(long productDefinitionTemplateNumber); int grib2_is_PDTN_Aerosol(long productDefinitionTemplateNumber); int grib2_is_PDTN_AerosolOptical(long productDefinitionTemplateNumber); int grib2_select_PDTN(int is_eps, int is_instant, int is_chemical, int is_chemical_distfn, int is_aerosol, int is_aerosol_optical); -int is_grib_index_file(const char *filename); +int is_grib_index_file(const char* filename); size_t sum_of_pl_array(const long* pl, size_t plsize); int grib_is_earth_oblate(grib_handle* h); int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max_val); /* bufr_util.c */ -int compute_bufr_key_rank(grib_handle *h, grib_string_list *keys, const char *key); -char **codes_bufr_copy_data_return_copied_keys(grib_handle *hin, grib_handle *hout, size_t *nkeys, int *err); -int codes_bufr_copy_data(grib_handle *hin, grib_handle *hout); +int compute_bufr_key_rank(grib_handle* h, grib_string_list* keys, const char* key); +char** codes_bufr_copy_data_return_copied_keys(grib_handle* hin, grib_handle* hout, size_t* nkeys, int* err); +int codes_bufr_copy_data(grib_handle* hin, grib_handle* hout); int codes_bufr_extract_headers_malloc(grib_context* c, const char* filename, codes_bufr_header** result, int* num_messages, int strict_mode); -int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char *val, size_t *len); +int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* val, size_t* len); /* string_util.c */ -int strcmp_nocase(const char *s1, const char *s2); -void rtrim(char *s); -const char *extract_filename(const char *filepath); -char **string_split(char *inputString, const char *delimiter); +int strcmp_nocase(const char* s1, const char* s2); +void rtrim(char* s); +const char* extract_filename(const char* filepath); +char** string_split(char* inputString, const char* delimiter); int string_to_long(const char* input, long* output); int string_ends_with(const char* str1, const char* str2); @@ -1533,38 +1533,38 @@ double grib_op_lt_d(double a, double b); double grib_op_gt_d(double a, double b); double grib_op_ge_d(double a, double b); double grib_op_le_d(double a, double b); -const char *grib_binop_long_proc_name(grib_binop_long_proc proc); -const char *grib_binop_double_proc_name(grib_binop_double_proc proc); -const char *grib_unop_long_proc_name(grib_unop_long_proc proc); -const char *grib_unop_double_proc_name(grib_unop_double_proc proc); +const char* grib_binop_long_proc_name(grib_binop_long_proc proc); +const char* grib_binop_double_proc_name(grib_binop_double_proc proc); +const char* grib_unop_long_proc_name(grib_unop_long_proc proc); +const char* grib_unop_double_proc_name(grib_unop_double_proc proc); /* codes_memfs.c */ -FILE *codes_fopen(const char *name, const char *mode); -int codes_access(const char *name, int mode); +FILE* codes_fopen(const char* name, const char* mode); +int codes_access(const char* name, int mode); /* grib_accessor_class_data_g2bifourier_packing.c */ /* grib_optimize_decimal_factor.c */ -int grib_optimize_decimal_factor(grib_accessor *a, const char *reference_value, const double pmax, const double pmin, const int knbit, const int compat_gribex, const int compat_32bit, long *kdec, long *kbin, double *ref); +int grib_optimize_decimal_factor(grib_accessor* a, const char* reference_value, const double pmax, const double pmin, const int knbit, const int compat_gribex, const int compat_32bit, long* kdec, long* kbin, double* ref); /* grib_api_version.c */ -const char *grib_get_git_sha1(void); +const char* grib_get_git_sha1(void); /* grib_bits_any_endian.c */ int grib_is_all_bits_one(long val, long nbits); -int grib_encode_string(unsigned char *bitStream, long *bitOffset, size_t numberOfCharacters, const char *string); -char *grib_decode_string(const unsigned char *bitStream, long *bitOffset, size_t numberOfCharacters, char *string); -unsigned long grib_decode_unsigned_long(const unsigned char *p, long *bitp, long nbits); -int grib_encode_unsigned_long(unsigned char *p, unsigned long val, long *bitp, long nbits); +int grib_encode_string(unsigned char* bitStream, long* bitOffset, size_t numberOfCharacters, const char* string); +char* grib_decode_string(const unsigned char* bitStream, long* bitOffset, size_t numberOfCharacters, char* string); +unsigned long grib_decode_unsigned_long(const unsigned char* p, long* bitp, long nbits); +int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, long nbits); size_t grib_decode_size_t(const unsigned char* p, long* bitp, long nbits); -int grib_encode_unsigned_longb(unsigned char *p, unsigned long val, long *bitp, long nb); -int grib_encode_size_tb(unsigned char* p, size_t val ,long *bitp, long nb); +int grib_encode_unsigned_longb(unsigned char* p, unsigned long val, long* bitp, long nb); +int grib_encode_size_tb(unsigned char* p, size_t val, long* bitp, long nb); /* grib_bits_any_endian_simple.c */ -int grib_decode_long_array(const unsigned char *p, long *bitp, long bitsPerValue, size_t n_vals, long *val); -int grib_decode_double_array(const unsigned char *p, long *bitp, long bitsPerValue, double reference_value, double s, double d, size_t n_vals, double *val); -int grib_decode_double_array_complex(const unsigned char *p, long *bitp, long nbits, double reference_value, double s, double *d, size_t size, double *val); -int grib_encode_long_array(size_t n_vals, const long *val, long bits_per_value, unsigned char *p, long *off); -int grib_encode_double_array(size_t n_vals, const double *val, long bits_per_value, double reference_value, double d, double divisor, unsigned char *p, long *off); -int grib_encode_double_array_complex(size_t n_vals, double *val, long nbits, double reference_value, double *scal, double d, double divisor, unsigned char *p, long *bitp); +int grib_decode_long_array(const unsigned char* p, long* bitp, long bitsPerValue, size_t n_vals, long* val); +int grib_decode_double_array(const unsigned char* p, long* bitp, long bitsPerValue, double reference_value, double s, double d, size_t n_vals, double* val); +int grib_decode_double_array_complex(const unsigned char* p, long* bitp, long nbits, double reference_value, double s, double* d, size_t size, double* val); +int grib_encode_long_array(size_t n_vals, const long* val, long bits_per_value, unsigned char* p, long* off); +int grib_encode_double_array(size_t n_vals, const double* val, long bits_per_value, double reference_value, double d, double divisor, unsigned char* p, long* off); +int grib_encode_double_array_complex(size_t n_vals, double* val, long nbits, double reference_value, double* scal, double d, double divisor, unsigned char* p, long* bitp); diff --git a/src/grib_emoslib.h b/src/grib_emoslib.h index 9a358a8c4..0b15aef3a 100644 --- a/src/grib_emoslib.h +++ b/src/grib_emoslib.h @@ -8,7 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -int igglat_(long* KLAT, float *PGAUSS, long* KPR, long* KERR); -void gribex_(long* KSEC0, long* KSEC1, long* KSEC2, double *PSEC2,long* KSEC3, double *PSEC3, long* KSEC4, - double *PSEC4, long* KLENP, void* KGRIB, long* KLENG,long* KWORD, char* HOPER, long* KRET); - +int igglat_(long* KLAT, float* PGAUSS, long* KPR, long* KERR); +void gribex_(long* KSEC0, long* KSEC1, long* KSEC2, double* PSEC2, long* KSEC3, double* PSEC3, long* KSEC4, + double* PSEC4, long* KLENP, void* KGRIB, long* KLENG, long* KWORD, char* HOPER, long* KRET); diff --git a/src/jgribapi_GribFile.h b/src/jgribapi_GribFile.h index 0d8061daa..580118d80 100644 --- a/src/jgribapi_GribFile.h +++ b/src/jgribapi_GribFile.h @@ -22,48 +22,42 @@ extern "C" { * Method: gribGetNextHandle * Signature: (J)Ljgribapi/GribHandle; */ -JNIEXPORT jobject JNICALL Java_jgribapi_GribFile_gribGetNextHandle - (JNIEnv *, jobject, jlong); +JNIEXPORT jobject JNICALL Java_jgribapi_GribFile_gribGetNextHandle(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribFile * Method: gribEOFReached * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribFile_gribEOFReached - (JNIEnv *, jobject, jlong); +JNIEXPORT jlong JNICALL Java_jgribapi_GribFile_gribEOFReached(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribFile * Method: gribGetGribFile * Signature: (Ljava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribFile_gribGetGribFile - (JNIEnv *, jobject, jstring); +JNIEXPORT jlong JNICALL Java_jgribapi_GribFile_gribGetGribFile(JNIEnv*, jobject, jstring); /* * Class: jgribapi_GribFile * Method: gribCloseFile * Signature: (J)V */ -JNIEXPORT void JNICALL Java_jgribapi_GribFile_gribCloseFile - (JNIEnv *, jobject, jlong); +JNIEXPORT void JNICALL Java_jgribapi_GribFile_gribCloseFile(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribFile * Method: gribNewFile * Signature: (Ljava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribFile_gribNewFile - (JNIEnv *, jobject, jstring); +JNIEXPORT jlong JNICALL Java_jgribapi_GribFile_gribNewFile(JNIEnv*, jobject, jstring); /* * Class: jgribapi_GribFile * Method: gribWriteHandle * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_jgribapi_GribFile_gribWriteHandle - (JNIEnv *, jobject, jlong, jlong); +JNIEXPORT void JNICALL Java_jgribapi_GribFile_gribWriteHandle(JNIEnv*, jobject, jlong, jlong); #ifdef __cplusplus } diff --git a/src/jgribapi_GribHandle.h b/src/jgribapi_GribHandle.h index ff0775f49..668ea4f1f 100644 --- a/src/jgribapi_GribHandle.h +++ b/src/jgribapi_GribHandle.h @@ -22,152 +22,133 @@ extern "C" { * Method: getIteratorID * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribHandle_getIteratorID - (JNIEnv *, jobject, jlong); +JNIEXPORT jlong JNICALL Java_jgribapi_GribHandle_getIteratorID(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribHandle * Method: gribGetString * Signature: (JLjava/lang/String;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetString - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetString(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribGetLong * Signature: (JLjava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribHandle_gribGetLong - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jlong JNICALL Java_jgribapi_GribHandle_gribGetLong(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribGetDouble * Signature: (JLjava/lang/String;)D */ -JNIEXPORT jdouble JNICALL Java_jgribapi_GribHandle_gribGetDouble - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jdouble JNICALL Java_jgribapi_GribHandle_gribGetDouble(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribGetLongArray * Signature: (JLjava/lang/String;)[J */ -JNIEXPORT jlongArray JNICALL Java_jgribapi_GribHandle_gribGetLongArray - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jlongArray JNICALL Java_jgribapi_GribHandle_gribGetLongArray(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribGetDoubleArray * Signature: (JLjava/lang/String;)[D */ -JNIEXPORT jdoubleArray JNICALL Java_jgribapi_GribHandle_gribGetDoubleArray - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jdoubleArray JNICALL Java_jgribapi_GribHandle_gribGetDoubleArray(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribSetString * Signature: (JLjava/lang/String;Ljava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetString - (JNIEnv *, jobject, jlong, jstring, jstring); +JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetString(JNIEnv*, jobject, jlong, jstring, jstring); /* * Class: jgribapi_GribHandle * Method: gribCreateNext * Signature: (J)Ljgribapi/GribKey; */ -JNIEXPORT jobject JNICALL Java_jgribapi_GribHandle_gribCreateNext - (JNIEnv *, jobject, jlong); +JNIEXPORT jobject JNICALL Java_jgribapi_GribHandle_gribCreateNext(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribHandle * Method: gribSetSearch * Signature: (JLjava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribHandle_gribSetSearch - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jlong JNICALL Java_jgribapi_GribHandle_gribSetSearch(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribSetLong * Signature: (JLjava/lang/String;J)I */ -JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetLong - (JNIEnv *, jobject, jlong, jstring, jlong); +JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetLong(JNIEnv*, jobject, jlong, jstring, jlong); /* * Class: jgribapi_GribHandle * Method: gribSetDouble * Signature: (JLjava/lang/String;D)I */ -JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetDouble - (JNIEnv *, jobject, jlong, jstring, jdouble); +JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetDouble(JNIEnv*, jobject, jlong, jstring, jdouble); /* * Class: jgribapi_GribHandle * Method: gribSetLongArray * Signature: (JLjava/lang/String;[J)I */ -JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetLongArray - (JNIEnv *, jobject, jlong, jstring, jlongArray); +JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetLongArray(JNIEnv*, jobject, jlong, jstring, jlongArray); /* * Class: jgribapi_GribHandle * Method: gribSetDoubleArray * Signature: (JLjava/lang/String;[D)I */ -JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetDoubleArray - (JNIEnv *, jobject, jlong, jstring, jdoubleArray); +JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribSetDoubleArray(JNIEnv*, jobject, jlong, jstring, jdoubleArray); /* * Class: jgribapi_GribHandle * Method: gribGetXml * Signature: (J)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetXml__J - (JNIEnv *, jobject, jlong); +JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetXml__J(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribHandle * Method: gribGetXml * Signature: (JLjava/lang/String;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetXml__JLjava_lang_String_2 - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetXml__JLjava_lang_String_2(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribGetAscii * Signature: (JLjava/lang/String;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetAscii - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jstring JNICALL Java_jgribapi_GribHandle_gribGetAscii(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribGetBytes * Signature: (JLjava/lang/String;)[B */ -JNIEXPORT jbyteArray JNICALL Java_jgribapi_GribHandle_gribGetBytes - (JNIEnv *, jobject, jlong, jstring); +JNIEXPORT jbyteArray JNICALL Java_jgribapi_GribHandle_gribGetBytes(JNIEnv*, jobject, jlong, jstring); /* * Class: jgribapi_GribHandle * Method: gribDeleteHandle * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribDeleteHandle - (JNIEnv *, jobject, jlong); +JNIEXPORT jint JNICALL Java_jgribapi_GribHandle_gribDeleteHandle(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribHandle * Method: gribResetHandle * Signature: (J)V */ -JNIEXPORT void JNICALL Java_jgribapi_GribHandle_gribResetHandle - (JNIEnv *, jobject, jlong); +JNIEXPORT void JNICALL Java_jgribapi_GribHandle_gribResetHandle(JNIEnv*, jobject, jlong); #ifdef __cplusplus } diff --git a/src/jgribapi_GribIterator.h b/src/jgribapi_GribIterator.h index 782e578bd..fcbad5b7b 100644 --- a/src/jgribapi_GribIterator.h +++ b/src/jgribapi_GribIterator.h @@ -22,16 +22,14 @@ extern "C" { * Method: gribIteratorGetNext * Signature: (J)Ljgribapi/GribPoint; */ -JNIEXPORT jobject JNICALL Java_jgribapi_GribIterator_gribIteratorGetNext - (JNIEnv *, jobject, jlong); +JNIEXPORT jobject JNICALL Java_jgribapi_GribIterator_gribIteratorGetNext(JNIEnv*, jobject, jlong); /* * Class: jgribapi_GribIterator * Method: gribIteratorHasNext * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_jgribapi_GribIterator_gribIteratorHasNext - (JNIEnv *, jobject, jlong); +JNIEXPORT jlong JNICALL Java_jgribapi_GribIterator_gribIteratorHasNext(JNIEnv*, jobject, jlong); #ifdef __cplusplus } diff --git a/src/md5.h b/src/md5.h index 973d2981c..16acfeb84 100644 --- a/src/md5.h +++ b/src/md5.h @@ -14,7 +14,8 @@ #include #include -typedef struct grib_md5_state { +typedef struct grib_md5_state +{ uint64_t size; unsigned long words[64]; @@ -31,6 +32,6 @@ typedef struct grib_md5_state { void grib_md5_init(grib_md5_state* s); void grib_md5_add(grib_md5_state* s, const void* data, size_t len); -void grib_md5_end(grib_md5_state* s, char *digest); +void grib_md5_end(grib_md5_state* s, char* digest); #endif