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

@ -18,53 +18,54 @@ See http://www.delorie.com/gnu/docs/automake/automake_48.html
*/
#define yymaxdepth grib_filter_maxdepth
#define yyparse grib_filter_parse
#define yylex grib_filter_lex
#define yyerror grib_filter_error
#define yylval grib_filter_lval
#define yychar grib_filter_char
#define yydebug grib_filter_debug
#define yypact grib_filter_pact
#define yyr1 grib_filter_r1
#define yyr2 grib_filter_r2
#define yydef grib_filter_def
#define yychk grib_filter_chk
#define yypgo grib_filter_pgo
#define yyact grib_filter_act
#define yyexca grib_filter_exca
#define yymaxdepth grib_filter_maxdepth
#define yyparse grib_filter_parse
#define yylex grib_filter_lex
#define yyerror grib_filter_error
#define yylval grib_filter_lval
#define yychar grib_filter_char
#define yydebug grib_filter_debug
#define yypact grib_filter_pact
#define yyr1 grib_filter_r1
#define yyr2 grib_filter_r2
#define yydef grib_filter_def
#define yychk grib_filter_chk
#define yypgo grib_filter_pgo
#define yyact grib_filter_act
#define yyexca grib_filter_exca
#define yyerrflag grib_filter_errflag
#define yynerrs grib_filter_nerrs
#define yyps grib_filter_ps
#define yypv grib_filter_pv
#define yys grib_filter_s
#define yy_yys grib_filter_yys
#define yystate grib_filter_state
#define yytmp grib_filter_tmp
#define yyv grib_filter_v
#define yy_yyv grib_filter_yyv
#define yyval grib_filter_val
#define yylloc grib_filter_lloc
#define yyreds grib_filter_reds
#define yytoks grib_filter_toks
#define yylhs grib_filter_yylhs
#define yylen grib_filter_yylen
#define yynerrs grib_filter_nerrs
#define yyps grib_filter_ps
#define yypv grib_filter_pv
#define yys grib_filter_s
#define yy_yys grib_filter_yys
#define yystate grib_filter_state
#define yytmp grib_filter_tmp
#define yyv grib_filter_v
#define yy_yyv grib_filter_yyv
#define yyval grib_filter_val
#define yylloc grib_filter_lloc
#define yyreds grib_filter_reds
#define yytoks grib_filter_toks
#define yylhs grib_filter_yylhs
#define yylen grib_filter_yylen
#define yydefred grib_filter_yydefred
#define yydgoto grib_filter_yydgoto
#define yydgoto grib_filter_yydgoto
#define yysindex grib_filter_yysindex
#define yyrindex grib_filter_yyrindex
#define yygindex grib_filter_yygindex
#define yytable grib_filter_yytable
#define yycheck grib_filter_yycheck
#define yyname grib_filter_yyname
#define yyrule grib_filter_yyrule
#define yytable grib_filter_yytable
#define yycheck grib_filter_yycheck
#define yyname grib_filter_yyname
#define yyrule grib_filter_yyrule
#define MAX_KEYS 40
#define MAX_RULES 40
#define MAX_SET 40
#define MAX_SET 40
typedef struct key_value key_value;
struct key_value {
char* key;
grib_runtime_type value;
struct key_value
{
char* key;
grib_runtime_type value;
}

View File

@ -9,24 +9,24 @@
*/
#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
#include "grib_api_internal.h"
#include <stdio.h>
#ifndef ECCODES_ON_WINDOWS
# include <unistd.h>
#include <unistd.h>
#endif
#ifndef GRIB_TOOLS_H
#define GRIB_TOOLS_H
#ifndef S_IFMT
#define S_IFMT 0170000 /* type of file */
#define S_IFMT 0170000 /* type of file */
#endif
#ifndef S_IFLNK
#define S_IFLNK 0120000 /* symbolic link */
#define S_IFLNK 0120000 /* symbolic link */
#endif
#ifndef S_ISLNK
@ -34,21 +34,22 @@
#endif
#define MAX_KEYS 1000
#define MAX_STRING_LEN 512
#define MAX_FAILED 1024
#define MAX_STRING_LEN 512
#define MAX_FAILED 1024
#define MAX_CONSTRAINT_VALUES 500
#define MODE_GRIB 0
#define MODE_GTS 1
#define MODE_BUFR 2
#define MODE_METAR 3
#define MODE_TAF 5
#define MODE_ANY 6
#define MODE_GRIB 0
#define MODE_GTS 1
#define MODE_BUFR 2
#define MODE_METAR 3
#define MODE_TAF 5
#define MODE_ANY 6
typedef union grib_typed_value {
long* long_value;
double* double_value;
const char* string_value;
typedef union grib_typed_value
{
long* long_value;
double* double_value;
const char* string_value;
} grib_typed_value;
/*
@ -62,107 +63,112 @@ typedef struct grib_constraints {
} grib_constraints;
*/
typedef struct grib_options_help {
const char* id;
const char* args;
const char* help;
typedef struct grib_options_help
{
const char* id;
const char* args;
const char* help;
} grib_options_help;
typedef struct grib_option {
char* id;
char* args;
char* help;
int on;
int command_line;
char* value;
typedef struct grib_option
{
char* id;
char* args;
char* help;
int on;
int command_line;
char* value;
} grib_option;
typedef struct grib_failed grib_failed;
struct grib_failed {
int count;
int error;
grib_failed* next;
struct grib_failed
{
int count;
int error;
grib_failed* next;
};
typedef struct grib_tools_file grib_tools_file;
struct grib_tools_file {
FILE* file;
char* name;
int handle_count;
int filter_handle_count;
grib_failed* failed;
grib_tools_file* next;
struct grib_tools_file
{
FILE* file;
char* name;
int handle_count;
int filter_handle_count;
grib_failed* failed;
grib_tools_file* next;
};
typedef struct grib_runtime_options {
int verbose;
int fail;
int skip;
int default_print_width;
int print_header;
char* name_space;
int print_number;
int print_statistics;
grib_values requested_print_keys[MAX_KEYS];
int requested_print_keys_count;
grib_values print_keys[MAX_KEYS];
int print_keys_count;
int strict;
int multi_support;
int set_values_count;
grib_values set_values[MAX_KEYS];
grib_values constraints[MAX_KEYS];
int constraints_count;
grib_values compare[MAX_KEYS];
int compare_count;
int handle_count;
int filter_handle_count;
int file_count;
grib_tools_file* infile_extra;
grib_tools_file* current_infile;
grib_tools_file* infile;
grib_tools_file* outfile;
grib_action* action;
grib_rule* rules;
int dump_flags;
char* dump_mode;
int repack;
int error;
int gts;
char* orderby;
char* latlon;
double lats[4];
double lons[4];
double values[4];
double distances[4];
int indexes[4];
int latlon_mode;
char* latlon_mask;
int latlon_idx;
double mask_values[4];
int index;
int index_on;
double constant;
char* dump_filename;
grib_fieldset* idx;
int random;
char* format;
int onlyfiles;
int tolerance_count;
int through_index;
grib_index* index1;
grib_index* index2;
grib_context* context;
int stop;
int mode;
int headers_only;
int skip_all;
grib_values tolerance[MAX_KEYS];
off_t infile_offset;
int json_output;
typedef struct grib_runtime_options
{
int verbose;
int fail;
int skip;
int default_print_width;
int print_header;
char* name_space;
int print_number;
int print_statistics;
grib_values requested_print_keys[MAX_KEYS];
int requested_print_keys_count;
grib_values print_keys[MAX_KEYS];
int print_keys_count;
int strict;
int multi_support;
int set_values_count;
grib_values set_values[MAX_KEYS];
grib_values constraints[MAX_KEYS];
int constraints_count;
grib_values compare[MAX_KEYS];
int compare_count;
int handle_count;
int filter_handle_count;
int file_count;
grib_tools_file* infile_extra;
grib_tools_file* current_infile;
grib_tools_file* infile;
grib_tools_file* outfile;
grib_action* action;
grib_rule* rules;
int dump_flags;
char* dump_mode;
int repack;
int error;
int gts;
char* orderby;
char* latlon;
double lats[4];
double lons[4];
double values[4];
double distances[4];
int indexes[4];
int latlon_mode;
char* latlon_mask;
int latlon_idx;
double mask_values[4];
int index;
int index_on;
double constant;
char* dump_filename;
grib_fieldset* idx;
int random;
char* format;
int onlyfiles;
int tolerance_count;
int through_index;
grib_index* index1;
grib_index* index2;
grib_context* context;
int stop;
int mode;
int headers_only;
int skip_all;
grib_values tolerance[MAX_KEYS];
off_t infile_offset;
int json_output;
} grib_runtime_options;
extern grib_option grib_options[];
@ -175,9 +181,9 @@ extern FILE* dump_file;
char* grib_options_get_option(const char* id);
int grib_options_on(const char* id);
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_tool(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_tool(int argc, char** argv);
char* grib_options_get_help(char* id);
char* grib_options_get_args(char* id);
int grib_options_command_line(const char* id);
@ -185,21 +191,20 @@ void usage(void);
void usage_doxygen(void);
int grib_tool_before_getopt(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_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);
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_file_statistics(grib_runtime_options* options,grib_tools_file* file);
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_file_statistics(grib_runtime_options* options, grib_tools_file* file);
void grib_print_full_statistics(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_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);
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_no_handle_action(grib_runtime_options* options,int err);
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 exit_if_input_is_directory(const char* tool_name, const char* filename);
#endif

View File

@ -8,16 +8,16 @@
* 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 dump_file(const char*,const char*);
int load_file(const char*, const char*);
int dump_file(const char*, const char*);
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_string(const char* name,const char* value);
void load_double(const char* name,double value);
void load_string(const char* name, const char* value);
void load_double(const char* name, double value);
void load_start_array();
void load_end_array(const char* name);
void load_double_value(double value);

View File

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