1 |
/** @file HydroCmd.h |
2 |
* @brief The header file for the command line option parser |
3 |
* generated by GNU Gengetopt version 2.22.4 |
4 |
* http://www.gnu.org/software/gengetopt. |
5 |
* DO NOT modify this file, since it can be overwritten |
6 |
* @author GNU Gengetopt by Lorenzo Bettini */ |
7 |
|
8 |
#ifndef HYDROCMD_H |
9 |
#define HYDROCMD_H |
10 |
|
11 |
/* If we use autoconf. */ |
12 |
#ifdef HAVE_CONFIG_H |
13 |
#include "config.h" |
14 |
#endif |
15 |
|
16 |
#include <stdio.h> /* for FILE */ |
17 |
|
18 |
#ifdef __cplusplus |
19 |
extern "C" { |
20 |
#endif /* __cplusplus */ |
21 |
|
22 |
#ifndef CMDLINE_PARSER_PACKAGE |
23 |
/** @brief the program name (used for printing errors) */ |
24 |
#define CMDLINE_PARSER_PACKAGE "Hydro" |
25 |
#endif |
26 |
|
27 |
#ifndef CMDLINE_PARSER_PACKAGE_NAME |
28 |
/** @brief the complete program name (used for help and version) */ |
29 |
#define CMDLINE_PARSER_PACKAGE_NAME "Hydro" |
30 |
#endif |
31 |
|
32 |
#ifndef CMDLINE_PARSER_VERSION |
33 |
/** @brief the program version */ |
34 |
#define CMDLINE_PARSER_VERSION "1.0" |
35 |
#endif |
36 |
|
37 |
/** @brief Where the command line options are stored */ |
38 |
struct gengetopt_args_info |
39 |
{ |
40 |
const char *help_help; /**< @brief Print help and exit help description. */ |
41 |
const char *version_help; /**< @brief Print version and exit help description. */ |
42 |
char * input_arg; /**< @brief input MetaData (md) file. */ |
43 |
char * input_orig; /**< @brief input MetaData (md) file original value given at command line. */ |
44 |
const char *input_help; /**< @brief input MetaData (md) file help description. */ |
45 |
char * output_arg; /**< @brief output file prefix (default='hydro'). */ |
46 |
char * output_orig; /**< @brief output file prefix original value given at command line. */ |
47 |
const char *output_help; /**< @brief output file prefix help description. */ |
48 |
char * model_arg; /**< @brief hydrodynamics model (supports RoughShell and BeadModel). */ |
49 |
char * model_orig; /**< @brief hydrodynamics model (supports RoughShell and BeadModel) original value given at command line. */ |
50 |
const char *model_help; /**< @brief hydrodynamics model (supports RoughShell and BeadModel) help description. */ |
51 |
int beads_flag; /**< @brief generate the beads only, hydrodynamics will be performed (default=off). */ |
52 |
const char *beads_help; /**< @brief generate the beads only, hydrodynamics will be performed help description. */ |
53 |
|
54 |
unsigned int help_given ; /**< @brief Whether help was given. */ |
55 |
unsigned int version_given ; /**< @brief Whether version was given. */ |
56 |
unsigned int input_given ; /**< @brief Whether input was given. */ |
57 |
unsigned int output_given ; /**< @brief Whether output was given. */ |
58 |
unsigned int model_given ; /**< @brief Whether model was given. */ |
59 |
unsigned int beads_given ; /**< @brief Whether beads was given. */ |
60 |
|
61 |
char **inputs ; /**< @brief unamed options (options without names) */ |
62 |
unsigned inputs_num ; /**< @brief unamed options number */ |
63 |
} ; |
64 |
|
65 |
/** @brief The additional parameters to pass to parser functions */ |
66 |
struct cmdline_parser_params |
67 |
{ |
68 |
int override; /**< @brief whether to override possibly already present options (default 0) */ |
69 |
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ |
70 |
int check_required; /**< @brief whether to check that all required options were provided (default 1) */ |
71 |
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ |
72 |
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ |
73 |
} ; |
74 |
|
75 |
/** @brief the purpose string of the program */ |
76 |
extern const char *gengetopt_args_info_purpose; |
77 |
/** @brief the usage string of the program */ |
78 |
extern const char *gengetopt_args_info_usage; |
79 |
/** @brief all the lines making the help output */ |
80 |
extern const char *gengetopt_args_info_help[]; |
81 |
|
82 |
/** |
83 |
* The command line parser |
84 |
* @param argc the number of command line options |
85 |
* @param argv the command line options |
86 |
* @param args_info the structure where option information will be stored |
87 |
* @return 0 if everything went fine, NON 0 if an error took place |
88 |
*/ |
89 |
int cmdline_parser (int argc, char **argv, |
90 |
struct gengetopt_args_info *args_info); |
91 |
|
92 |
/** |
93 |
* The command line parser (version with additional parameters - deprecated) |
94 |
* @param argc the number of command line options |
95 |
* @param argv the command line options |
96 |
* @param args_info the structure where option information will be stored |
97 |
* @param override whether to override possibly already present options |
98 |
* @param initialize whether to initialize the option structure my_args_info |
99 |
* @param check_required whether to check that all required options were provided |
100 |
* @return 0 if everything went fine, NON 0 if an error took place |
101 |
* @deprecated use cmdline_parser_ext() instead |
102 |
*/ |
103 |
int cmdline_parser2 (int argc, char **argv, |
104 |
struct gengetopt_args_info *args_info, |
105 |
int override, int initialize, int check_required); |
106 |
|
107 |
/** |
108 |
* The command line parser (version with additional parameters) |
109 |
* @param argc the number of command line options |
110 |
* @param argv the command line options |
111 |
* @param args_info the structure where option information will be stored |
112 |
* @param params additional parameters for the parser |
113 |
* @return 0 if everything went fine, NON 0 if an error took place |
114 |
*/ |
115 |
int cmdline_parser_ext (int argc, char **argv, |
116 |
struct gengetopt_args_info *args_info, |
117 |
struct cmdline_parser_params *params); |
118 |
|
119 |
/** |
120 |
* Save the contents of the option struct into an already open FILE stream. |
121 |
* @param outfile the stream where to dump options |
122 |
* @param args_info the option struct to dump |
123 |
* @return 0 if everything went fine, NON 0 if an error took place |
124 |
*/ |
125 |
int cmdline_parser_dump(FILE *outfile, |
126 |
struct gengetopt_args_info *args_info); |
127 |
|
128 |
/** |
129 |
* Save the contents of the option struct into a (text) file. |
130 |
* This file can be read by the config file parser (if generated by gengetopt) |
131 |
* @param filename the file where to save |
132 |
* @param args_info the option struct to save |
133 |
* @return 0 if everything went fine, NON 0 if an error took place |
134 |
*/ |
135 |
int cmdline_parser_file_save(const char *filename, |
136 |
struct gengetopt_args_info *args_info); |
137 |
|
138 |
/** |
139 |
* Print the help |
140 |
*/ |
141 |
void cmdline_parser_print_help(void); |
142 |
/** |
143 |
* Print the version |
144 |
*/ |
145 |
void cmdline_parser_print_version(void); |
146 |
|
147 |
/** |
148 |
* Initializes all the fields a cmdline_parser_params structure |
149 |
* to their default values |
150 |
* @param params the structure to initialize |
151 |
*/ |
152 |
void cmdline_parser_params_init(struct cmdline_parser_params *params); |
153 |
|
154 |
/** |
155 |
* Allocates dynamically a cmdline_parser_params structure and initializes |
156 |
* all its fields to their default values |
157 |
* @return the created and initialized cmdline_parser_params structure |
158 |
*/ |
159 |
struct cmdline_parser_params *cmdline_parser_params_create(void); |
160 |
|
161 |
/** |
162 |
* Initializes the passed gengetopt_args_info structure's fields |
163 |
* (also set default values for options that have a default) |
164 |
* @param args_info the structure to initialize |
165 |
*/ |
166 |
void cmdline_parser_init (struct gengetopt_args_info *args_info); |
167 |
/** |
168 |
* Deallocates the string fields of the gengetopt_args_info structure |
169 |
* (but does not deallocate the structure itself) |
170 |
* @param args_info the structure to deallocate |
171 |
*/ |
172 |
void cmdline_parser_free (struct gengetopt_args_info *args_info); |
173 |
|
174 |
/** |
175 |
* Checks that all the required options were specified |
176 |
* @param args_info the structure to check |
177 |
* @param prog_name the name of the program that will be used to print |
178 |
* possible errors |
179 |
* @return |
180 |
*/ |
181 |
int cmdline_parser_required (struct gengetopt_args_info *args_info, |
182 |
const char *prog_name); |
183 |
|
184 |
|
185 |
#ifdef __cplusplus |
186 |
} |
187 |
#endif /* __cplusplus */ |
188 |
#endif /* HYDROCMD_H */ |