ECC-1063: Apply consistent code style to source

This commit is contained in:
Shahram Najm 2020-01-29 10:27:59 +00:00
parent 1975eae139
commit 04bcc3792e
4 changed files with 170 additions and 165 deletions

View File

@ -64,7 +64,8 @@ See http://www.delorie.com/gnu/docs/automake/automake_48.html
#define MAX_SET 40 #define MAX_SET 40
typedef struct key_value key_value; typedef struct key_value key_value;
struct key_value { struct key_value
{
char* key; char* key;
grib_runtime_type value; grib_runtime_type value;
} }

View File

@ -9,13 +9,13 @@
*/ */
#ifdef __gnu_hurd__ #ifdef __gnu_hurd__
#define _FILE_OFFSET_BITS 64 /* 64-bit offsets off_t not the default on Hurd/i386 */ #define _FILE_OFFSET_BITS 64 /* 64-bit offsets off_t not the default on Hurd/i386 */
#endif #endif
#include "grib_api_internal.h" #include "grib_api_internal.h"
#include <stdio.h> #include <stdio.h>
#ifndef ECCODES_ON_WINDOWS #ifndef ECCODES_ON_WINDOWS
# include <unistd.h> #include <unistd.h>
#endif #endif
#ifndef GRIB_TOOLS_H #ifndef GRIB_TOOLS_H
@ -45,7 +45,8 @@
#define MODE_TAF 5 #define MODE_TAF 5
#define MODE_ANY 6 #define MODE_ANY 6
typedef union grib_typed_value { typedef union grib_typed_value
{
long* long_value; long* long_value;
double* double_value; double* double_value;
const char* string_value; const char* string_value;
@ -62,14 +63,16 @@ typedef struct grib_constraints {
} grib_constraints; } grib_constraints;
*/ */
typedef struct grib_options_help { typedef struct grib_options_help
{
const char* id; const char* id;
const char* args; const char* args;
const char* help; const char* help;
} grib_options_help; } grib_options_help;
typedef struct grib_option { typedef struct grib_option
{
char* id; char* id;
char* args; char* args;
char* help; char* help;
@ -80,7 +83,8 @@ typedef struct grib_option {
typedef struct grib_failed grib_failed; typedef struct grib_failed grib_failed;
struct grib_failed { struct grib_failed
{
int count; int count;
int error; int error;
grib_failed* next; grib_failed* next;
@ -88,7 +92,8 @@ struct grib_failed {
typedef struct grib_tools_file grib_tools_file; typedef struct grib_tools_file grib_tools_file;
struct grib_tools_file { struct grib_tools_file
{
FILE* file; FILE* file;
char* name; char* name;
int handle_count; int handle_count;
@ -97,7 +102,8 @@ struct grib_tools_file {
grib_tools_file* next; grib_tools_file* next;
}; };
typedef struct grib_runtime_options { typedef struct grib_runtime_options
{
int verbose; int verbose;
int fail; int fail;
int skip; int skip;
@ -175,9 +181,9 @@ extern FILE* dump_file;
char* grib_options_get_option(const char* id); char* grib_options_get_option(const char* id);
int grib_options_on(const char* id); int grib_options_on(const char* id);
int grib_options_get(int argc,char** argv); int grib_options_get(int argc, char** argv);
int grib_options_get_values(int argc,char** argv,int values_required,int default_type, grib_values values[],int* n,int* optind); int grib_options_get_values(int argc, char** argv, int values_required, int default_type, grib_values values[], int* n, int* optind);
int grib_tool(int argc, char **argv); int grib_tool(int argc, char** argv);
char* grib_options_get_help(char* id); char* grib_options_get_help(char* id);
char* grib_options_get_args(char* id); char* grib_options_get_args(char* id);
int grib_options_command_line(const char* id); int grib_options_command_line(const char* id);
@ -185,21 +191,20 @@ void usage(void);
void usage_doxygen(void); void usage_doxygen(void);
int grib_tool_before_getopt(grib_runtime_options* options); int grib_tool_before_getopt(grib_runtime_options* options);
int grib_tool_init(grib_runtime_options* options); int grib_tool_init(grib_runtime_options* options);
int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* file); int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file);
int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h); int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h);
int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h); int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h);
void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h); void grib_tool_print_key_values(grib_runtime_options* options, grib_handle* h);
int grib_tool_finalise_action(grib_runtime_options* options); int grib_tool_finalise_action(grib_runtime_options* options);
void grib_skip_check(grib_runtime_options* options,grib_handle* h); void grib_skip_check(grib_runtime_options* options, grib_handle* h);
void grib_print_key_values(grib_runtime_options* options,grib_handle* h); void grib_print_key_values(grib_runtime_options* options, grib_handle* h);
void grib_print_file_statistics(grib_runtime_options* options,grib_tools_file* file); void grib_print_file_statistics(grib_runtime_options* options, grib_tools_file* file);
void grib_print_full_statistics(grib_runtime_options* options); void grib_print_full_statistics(grib_runtime_options* options);
int grib_get_runtime_options(int argc,char** argv,grib_runtime_options* options); int grib_get_runtime_options(int argc, char** argv, grib_runtime_options* options);
int grib_process_runtime_options(grib_context* c,int argc,char** argv,grib_runtime_options* options); int grib_process_runtime_options(grib_context* c, int argc, char** argv, grib_runtime_options* options);
void grib_tools_write_message(grib_runtime_options* options, grib_handle* h); void grib_tools_write_message(grib_runtime_options* options, grib_handle* h);
int grib_tool_new_filename_action(grib_runtime_options* options,const char* file); int grib_tool_new_filename_action(grib_runtime_options* options, const char* file);
int grib_no_handle_action(grib_runtime_options* options,int err); int grib_no_handle_action(grib_runtime_options* options, int err);
int exit_if_input_is_directory(const char* tool_name, const char* filename); int exit_if_input_is_directory(const char* tool_name, const char* filename);
#endif #endif

View File

@ -8,16 +8,16 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/ */
extern char *prog; extern char* prog;
int load_file(const char*,const char*); int load_file(const char*, const char*);
int dump_file(const char*,const char*); int dump_file(const char*, const char*);
void load_finish(); void load_finish();
void load_long(const char* name,long value) ; void load_long(const char* name, long value);
void load_missing(const char* name); void load_missing(const char* name);
void load_string(const char* name,const char* value); void load_string(const char* name, const char* value);
void load_double(const char* name,double value); void load_double(const char* name, double value);
void load_start_array(); void load_start_array();
void load_end_array(const char* name); void load_end_array(const char* name);
void load_double_value(double value); void load_double_value(double value);

View File

@ -15,9 +15,8 @@
#ifdef ECCODES_ON_WINDOWS #ifdef ECCODES_ON_WINDOWS
extern int optind, opterr; extern int optind, opterr;
extern char *optarg; extern char* optarg;
int getopt(int argc, char *argv[], const char *optstring); int getopt(int argc, char* argv[], const char* optstring);
#endif #endif
#endif #endif