27
29
#define TEST_VALUES_CMD_PARSER_VERSION "1.0"
32
enum enum_values_first_enums { values_first_enums_arg_FOO = 0 , values_first_enums_arg_BAR, values_first_enums_arg_ANOTHER, values_first_enums_arg_SOMETHING };
33
enum enum_values_second_enums { values_second_enums_arg_90 = 0 , values_second_enums_arg_180, values_second_enums_arg_270, values_second_enums_arg_360 };
34
enum enum_values_multiple_enums { values_multiple_enums_arg_FIRST = 0 , values_multiple_enums_arg_SECOND, values_multiple_enums_arg_THIRD, values_multiple_enums_arg_FOURTH };
30
36
/** @brief Where the command line options are stored */
31
37
struct gengetopt_args_info
62
68
char * string_values_group_arg; /**< @brief group string option with values and default (default='bar'). */
63
69
char * string_values_group_orig; /**< @brief group string option with values and default original value given at command line. */
64
70
const char *string_values_group_help; /**< @brief group string option with values and default help description. */
71
int int_values_arg; /**< @brief int option with values. */
72
char * int_values_orig; /**< @brief int option with values original value given at command line. */
73
const char *int_values_help; /**< @brief int option with values help description. */
74
int* int_values_m_arg; /**< @brief multiple int option with values. */
75
char ** int_values_m_orig; /**< @brief multiple int option with values original value given at command line. */
76
int int_values_m_min; /**< @brief multiple int option with values's minimum occurreces */
77
int int_values_m_max; /**< @brief multiple int option with values's maximum occurreces */
78
const char *int_values_m_help; /**< @brief multiple int option with values help description. */
79
int int_values_def_arg; /**< @brief int option with values and default (default='180'). */
80
char * int_values_def_orig; /**< @brief int option with values and default original value given at command line. */
81
const char *int_values_def_help; /**< @brief int option with values and default help description. */
82
enum enum_values_first_enums values_first_enums_arg; /**< @brief option with values and enums 1. */
83
char * values_first_enums_orig; /**< @brief option with values and enums 1 original value given at command line. */
84
const char *values_first_enums_help; /**< @brief option with values and enums 1 help description. */
85
enum enum_values_second_enums values_second_enums_arg; /**< @brief option with values and enums 2 with default (default='180'). */
86
char * values_second_enums_orig; /**< @brief option with values and enums 2 with default original value given at command line. */
87
const char *values_second_enums_help; /**< @brief option with values and enums 2 with default help description. */
88
enum enum_values_multiple_enums *values_multiple_enums_arg; /**< @brief multiple option with values and enums (default='FOURTH'). */
89
char ** values_multiple_enums_orig; /**< @brief multiple option with values and enums original value given at command line. */
90
int values_multiple_enums_min; /**< @brief multiple option with values and enums's minimum occurreces */
91
int values_multiple_enums_max; /**< @brief multiple option with values and enums's maximum occurreces */
92
const char *values_multiple_enums_help; /**< @brief multiple option with values and enums help description. */
93
char * file_save_arg; /**< @brief save the passed options into a file. */
94
char * file_save_orig; /**< @brief save the passed options into a file original value given at command line. */
95
const char *file_save_help; /**< @brief save the passed options into a file help description. */
66
int help_given ; /**< @brief Whether help was given. */
67
int version_given ; /**< @brief Whether version was given. */
68
int string_values_given ; /**< @brief Whether string-values was given. */
69
int string_values_def_given ; /**< @brief Whether string-values-def was given. */
70
int string_values_def_argopt_given ; /**< @brief Whether string-values-def-argopt was given. */
71
int string_values_no_short_given ; /**< @brief Whether string-values-no-short was given. */
97
unsigned int help_given ; /**< @brief Whether help was given. */
98
unsigned int version_given ; /**< @brief Whether version was given. */
99
unsigned int string_values_given ; /**< @brief Whether string-values was given. */
100
unsigned int string_values_def_given ; /**< @brief Whether string-values-def was given. */
101
unsigned int string_values_def_argopt_given ; /**< @brief Whether string-values-def-argopt was given. */
102
unsigned int string_values_no_short_given ; /**< @brief Whether string-values-no-short was given. */
72
103
unsigned int multistring_values_given ; /**< @brief Whether multistring-values was given. */
73
104
unsigned int multistring_values_def_given ; /**< @brief Whether multistring-values-def was given. */
74
105
unsigned int multistring_values_no_short_given ; /**< @brief Whether multistring-values-no-short was given. */
75
int string_values_group_given ; /**< @brief Whether string-values-group was given. */
106
unsigned int string_values_group_given ; /**< @brief Whether string-values-group was given. */
107
unsigned int int_values_given ; /**< @brief Whether int-values was given. */
108
unsigned int int_values_m_given ; /**< @brief Whether int-values-m was given. */
109
unsigned int int_values_def_given ; /**< @brief Whether int-values-def was given. */
110
unsigned int values_first_enums_given ; /**< @brief Whether values-first-enums was given. */
111
unsigned int values_second_enums_given ; /**< @brief Whether values-second-enums was given. */
112
unsigned int values_multiple_enums_given ; /**< @brief Whether values-multiple-enums was given. */
113
unsigned int file_save_given ; /**< @brief Whether file-save was given. */
77
115
char **inputs ; /**< @brief unamed options (options without names) */
78
116
unsigned inputs_num ; /**< @brief unamed options number */
83
121
struct test_values_cmd_parser_params
85
123
int override; /**< @brief whether to override possibly already present options (default 0) */
86
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 0) */
87
int check_required; /**< @brief whether to check that all required options were provided (default 0) */
124
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
125
int check_required; /**< @brief whether to check that all required options were provided (default 1) */
88
126
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
127
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
91
130
/** @brief the purpose string of the program */
133
172
struct test_values_cmd_parser_params *params);
175
* Save the contents of the option struct into an already open FILE stream.
176
* @param outfile the stream where to dump options
177
* @param args_info the option struct to dump
178
* @return 0 if everything went fine, NON 0 if an error took place
180
int test_values_cmd_parser_dump(FILE *outfile,
181
struct gengetopt_args_info *args_info);
136
184
* Save the contents of the option struct into a (text) file.
137
185
* This file can be read by the config file parser (if generated by gengetopt)
138
186
* @param filename the file where to save
152
200
void test_values_cmd_parser_print_version(void);
203
* Initializes all the fields a test_values_cmd_parser_params structure
204
* to their default values
205
* @param params the structure to initialize
207
void test_values_cmd_parser_params_init(struct test_values_cmd_parser_params *params);
155
210
* Allocates dynamically a test_values_cmd_parser_params structure and initializes
156
* all its fields to 0
157
* @return the initialized test_values_cmd_parser_params structure
211
* all its fields to their default values
212
* @return the created and initialized test_values_cmd_parser_params structure
159
struct test_values_cmd_parser_params *test_values_cmd_parser_params_init();
214
struct test_values_cmd_parser_params *test_values_cmd_parser_params_create(void);
162
217
* Initializes the passed gengetopt_args_info structure's fields
189
244
extern char *test_values_cmd_parser_multistring_values_def_values[] ; /**< @brief Possible values for multistring-values-def. */
190
245
extern char *test_values_cmd_parser_multistring_values_no_short_values[] ; /**< @brief Possible values for multistring-values-no-short. */
191
246
extern char *test_values_cmd_parser_string_values_group_values[] ; /**< @brief Possible values for string-values-group. */
247
extern char *test_values_cmd_parser_int_values_values[] ; /**< @brief Possible values for int-values. */
248
extern char *test_values_cmd_parser_int_values_m_values[] ; /**< @brief Possible values for int-values-m. */
249
extern char *test_values_cmd_parser_int_values_def_values[] ; /**< @brief Possible values for int-values-def. */
250
extern char *test_values_cmd_parser_values_first_enums_values[] ; /**< @brief Possible values for values-first-enums. */
251
extern char *test_values_cmd_parser_values_second_enums_values[] ; /**< @brief Possible values for values-second-enums. */
252
extern char *test_values_cmd_parser_values_multiple_enums_values[] ; /**< @brief Possible values for values-multiple-enums. */
194
255
#ifdef __cplusplus