1 |
gezelter |
1630 |
/** @file simpleBuilderCmd.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 |
tim |
12 |
|
8 |
|
|
#ifndef SIMPLEBUILDERCMD_H |
9 |
|
|
#define SIMPLEBUILDERCMD_H |
10 |
|
|
|
11 |
|
|
/* If we use autoconf. */ |
12 |
|
|
#ifdef HAVE_CONFIG_H |
13 |
|
|
#include "config.h" |
14 |
|
|
#endif |
15 |
|
|
|
16 |
gezelter |
1630 |
#include <stdio.h> /* for FILE */ |
17 |
|
|
|
18 |
tim |
12 |
#ifdef __cplusplus |
19 |
|
|
extern "C" { |
20 |
|
|
#endif /* __cplusplus */ |
21 |
|
|
|
22 |
|
|
#ifndef CMDLINE_PARSER_PACKAGE |
23 |
gezelter |
1630 |
/** @brief the program name (used for printing errors) */ |
24 |
tim |
12 |
#define CMDLINE_PARSER_PACKAGE "simpleBuilder" |
25 |
|
|
#endif |
26 |
|
|
|
27 |
gezelter |
1630 |
#ifndef CMDLINE_PARSER_PACKAGE_NAME |
28 |
|
|
/** @brief the complete program name (used for help and version) */ |
29 |
|
|
#define CMDLINE_PARSER_PACKAGE_NAME "simpleBuilder" |
30 |
|
|
#endif |
31 |
|
|
|
32 |
tim |
12 |
#ifndef CMDLINE_PARSER_VERSION |
33 |
gezelter |
1630 |
/** @brief the program version */ |
34 |
tim |
12 |
#define CMDLINE_PARSER_VERSION "1.0" |
35 |
|
|
#endif |
36 |
|
|
|
37 |
gezelter |
1630 |
/** @brief Where the command line options are stored */ |
38 |
gezelter |
1067 |
struct gengetopt_args_info |
39 |
|
|
{ |
40 |
gezelter |
1630 |
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 * output_arg; /**< @brief Output file name. */ |
43 |
|
|
char * output_orig; /**< @brief Output file name original value given at command line. */ |
44 |
|
|
const char *output_help; /**< @brief Output file name help description. */ |
45 |
|
|
double density_arg; /**< @brief density (g/cm^3). */ |
46 |
|
|
char * density_orig; /**< @brief density (g/cm^3) original value given at command line. */ |
47 |
|
|
const char *density_help; /**< @brief density (g/cm^3) help description. */ |
48 |
|
|
int nx_arg; /**< @brief number of unit cells in x. */ |
49 |
|
|
char * nx_orig; /**< @brief number of unit cells in x original value given at command line. */ |
50 |
|
|
const char *nx_help; /**< @brief number of unit cells in x help description. */ |
51 |
|
|
int ny_arg; /**< @brief number of unit cells in y. */ |
52 |
|
|
char * ny_orig; /**< @brief number of unit cells in y original value given at command line. */ |
53 |
|
|
const char *ny_help; /**< @brief number of unit cells in y help description. */ |
54 |
|
|
int nz_arg; /**< @brief number of unit cells in z. */ |
55 |
|
|
char * nz_orig; /**< @brief number of unit cells in z original value given at command line. */ |
56 |
|
|
const char *nz_help; /**< @brief number of unit cells in z help description. */ |
57 |
gezelter |
1067 |
|
58 |
gezelter |
1630 |
unsigned int help_given ; /**< @brief Whether help was given. */ |
59 |
|
|
unsigned int version_given ; /**< @brief Whether version was given. */ |
60 |
|
|
unsigned int output_given ; /**< @brief Whether output was given. */ |
61 |
|
|
unsigned int density_given ; /**< @brief Whether density was given. */ |
62 |
|
|
unsigned int nx_given ; /**< @brief Whether nx was given. */ |
63 |
|
|
unsigned int ny_given ; /**< @brief Whether ny was given. */ |
64 |
|
|
unsigned int nz_given ; /**< @brief Whether nz was given. */ |
65 |
tim |
12 |
|
66 |
gezelter |
1630 |
char **inputs ; /**< @brief unamed options (options without names) */ |
67 |
|
|
unsigned inputs_num ; /**< @brief unamed options number */ |
68 |
gezelter |
1067 |
} ; |
69 |
tim |
12 |
|
70 |
gezelter |
1630 |
/** @brief The additional parameters to pass to parser functions */ |
71 |
|
|
struct cmdline_parser_params |
72 |
|
|
{ |
73 |
|
|
int override; /**< @brief whether to override possibly already present options (default 0) */ |
74 |
|
|
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ |
75 |
|
|
int check_required; /**< @brief whether to check that all required options were provided (default 1) */ |
76 |
|
|
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ |
77 |
|
|
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ |
78 |
|
|
} ; |
79 |
tim |
12 |
|
80 |
gezelter |
1630 |
/** @brief the purpose string of the program */ |
81 |
|
|
extern const char *gengetopt_args_info_purpose; |
82 |
|
|
/** @brief the usage string of the program */ |
83 |
|
|
extern const char *gengetopt_args_info_usage; |
84 |
|
|
/** @brief all the lines making the help output */ |
85 |
|
|
extern const char *gengetopt_args_info_help[]; |
86 |
|
|
|
87 |
|
|
/** |
88 |
|
|
* The command line parser |
89 |
|
|
* @param argc the number of command line options |
90 |
|
|
* @param argv the command line options |
91 |
|
|
* @param args_info the structure where option information will be stored |
92 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
93 |
|
|
*/ |
94 |
|
|
int cmdline_parser (int argc, char **argv, |
95 |
|
|
struct gengetopt_args_info *args_info); |
96 |
|
|
|
97 |
|
|
/** |
98 |
|
|
* The command line parser (version with additional parameters - deprecated) |
99 |
|
|
* @param argc the number of command line options |
100 |
|
|
* @param argv the command line options |
101 |
|
|
* @param args_info the structure where option information will be stored |
102 |
|
|
* @param override whether to override possibly already present options |
103 |
|
|
* @param initialize whether to initialize the option structure my_args_info |
104 |
|
|
* @param check_required whether to check that all required options were provided |
105 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
106 |
|
|
* @deprecated use cmdline_parser_ext() instead |
107 |
|
|
*/ |
108 |
|
|
int cmdline_parser2 (int argc, char **argv, |
109 |
|
|
struct gengetopt_args_info *args_info, |
110 |
|
|
int override, int initialize, int check_required); |
111 |
|
|
|
112 |
|
|
/** |
113 |
|
|
* The command line parser (version with additional parameters) |
114 |
|
|
* @param argc the number of command line options |
115 |
|
|
* @param argv the command line options |
116 |
|
|
* @param args_info the structure where option information will be stored |
117 |
|
|
* @param params additional parameters for the parser |
118 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
119 |
|
|
*/ |
120 |
|
|
int cmdline_parser_ext (int argc, char **argv, |
121 |
|
|
struct gengetopt_args_info *args_info, |
122 |
|
|
struct cmdline_parser_params *params); |
123 |
|
|
|
124 |
|
|
/** |
125 |
|
|
* Save the contents of the option struct into an already open FILE stream. |
126 |
|
|
* @param outfile the stream where to dump options |
127 |
|
|
* @param args_info the option struct to dump |
128 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
129 |
|
|
*/ |
130 |
|
|
int cmdline_parser_dump(FILE *outfile, |
131 |
|
|
struct gengetopt_args_info *args_info); |
132 |
|
|
|
133 |
|
|
/** |
134 |
|
|
* Save the contents of the option struct into a (text) file. |
135 |
|
|
* This file can be read by the config file parser (if generated by gengetopt) |
136 |
|
|
* @param filename the file where to save |
137 |
|
|
* @param args_info the option struct to save |
138 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
139 |
|
|
*/ |
140 |
|
|
int cmdline_parser_file_save(const char *filename, |
141 |
|
|
struct gengetopt_args_info *args_info); |
142 |
|
|
|
143 |
|
|
/** |
144 |
|
|
* Print the help |
145 |
|
|
*/ |
146 |
gezelter |
1067 |
void cmdline_parser_print_help(void); |
147 |
gezelter |
1630 |
/** |
148 |
|
|
* Print the version |
149 |
|
|
*/ |
150 |
gezelter |
1067 |
void cmdline_parser_print_version(void); |
151 |
tim |
12 |
|
152 |
gezelter |
1630 |
/** |
153 |
|
|
* Initializes all the fields a cmdline_parser_params structure |
154 |
|
|
* to their default values |
155 |
|
|
* @param params the structure to initialize |
156 |
|
|
*/ |
157 |
|
|
void cmdline_parser_params_init(struct cmdline_parser_params *params); |
158 |
|
|
|
159 |
|
|
/** |
160 |
|
|
* Allocates dynamically a cmdline_parser_params structure and initializes |
161 |
|
|
* all its fields to their default values |
162 |
|
|
* @return the created and initialized cmdline_parser_params structure |
163 |
|
|
*/ |
164 |
|
|
struct cmdline_parser_params *cmdline_parser_params_create(void); |
165 |
|
|
|
166 |
|
|
/** |
167 |
|
|
* Initializes the passed gengetopt_args_info structure's fields |
168 |
|
|
* (also set default values for options that have a default) |
169 |
|
|
* @param args_info the structure to initialize |
170 |
|
|
*/ |
171 |
gezelter |
1067 |
void cmdline_parser_init (struct gengetopt_args_info *args_info); |
172 |
gezelter |
1630 |
/** |
173 |
|
|
* Deallocates the string fields of the gengetopt_args_info structure |
174 |
|
|
* (but does not deallocate the structure itself) |
175 |
|
|
* @param args_info the structure to deallocate |
176 |
|
|
*/ |
177 |
gezelter |
1067 |
void cmdline_parser_free (struct gengetopt_args_info *args_info); |
178 |
tim |
12 |
|
179 |
gezelter |
1630 |
/** |
180 |
|
|
* Checks that all the required options were specified |
181 |
|
|
* @param args_info the structure to check |
182 |
|
|
* @param prog_name the name of the program that will be used to print |
183 |
|
|
* possible errors |
184 |
|
|
* @return |
185 |
|
|
*/ |
186 |
|
|
int cmdline_parser_required (struct gengetopt_args_info *args_info, |
187 |
|
|
const char *prog_name); |
188 |
gezelter |
1067 |
|
189 |
|
|
|
190 |
tim |
12 |
#ifdef __cplusplus |
191 |
|
|
} |
192 |
|
|
#endif /* __cplusplus */ |
193 |
|
|
#endif /* SIMPLEBUILDERCMD_H */ |