Debian Codegraph @

examples/ConvertExample/cmdline.h

raw
1 /** @file cmdline.h
2 * @brief The header file for the command line option parser
3 * generated by GNU Gengetopt version 2.22.6
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 CMDLINE_H
9 #define CMDLINE_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 "convert_example"
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 "convert_example"
30 #endif
31
32 #ifndef CMDLINE_PARSER_VERSION
33 /** @brief the program version */
34 #define CMDLINE_PARSER_VERSION "3.1"
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 char * input_format_arg; /**< @brief Input format. */
42 char * input_format_orig; /**< @brief Input format original value given at command line. */
43 const char *input_format_help; /**< @brief Input format help description. */
44 char * output_format_arg; /**< @brief Output format. */
45 char * output_format_orig; /**< @brief Output format original value given at command line. */
46 const char *output_format_help; /**< @brief Output format help description. */
47 char ** extensions_arg; /**< @brief Extensions, in a form extension=value, could be passed to readers/writers. */
48 char ** extensions_orig; /**< @brief Extensions, in a form extension=value, could be passed to readers/writers original value given at command line. */
49 unsigned int extensions_min; /**< @brief Extensions, in a form extension=value, could be passed to readers/writers's minimum occurreces */
50 unsigned int extensions_max; /**< @brief Extensions, in a form extension=value, could be passed to readers/writers's maximum occurreces */
51 const char *extensions_help; /**< @brief Extensions, in a form extension=value, could be passed to readers/writers help description. */
52 long events_limit_arg; /**< @brief Limit of events to read from input (default='100000000'). */
53 char * events_limit_orig; /**< @brief Limit of events to read from input original value given at command line. */
54 const char *events_limit_help; /**< @brief Limit of events to read from input help description. */
55 long first_event_number_arg; /**< @brief Lowest allowed event number (default='-100000000'). */
56 char * first_event_number_orig; /**< @brief Lowest allowed event number original value given at command line. */
57 const char *first_event_number_help; /**< @brief Lowest allowed event number help description. */
58 long last_event_number_arg; /**< @brief Highest allowed event number (default='100000000'). */
59 char * last_event_number_orig; /**< @brief Highest allowed event number original value given at command line. */
60 const char *last_event_number_help; /**< @brief Highest allowed event number help description. */
61 long print_every_events_parsed_arg; /**< @brief Frequency of parsing information printouts (default='100'). */
62 char * print_every_events_parsed_orig; /**< @brief Frequency of parsing information printouts original value given at command line. */
63 const char *print_every_events_parsed_help; /**< @brief Frequency of parsing information printouts help description. */
64
65 unsigned int help_given ; /**< @brief Whether help was given. */
66 unsigned int input_format_given ; /**< @brief Whether input-format was given. */
67 unsigned int output_format_given ; /**< @brief Whether output-format was given. */
68 unsigned int extensions_given ; /**< @brief Whether extensions was given. */
69 unsigned int events_limit_given ; /**< @brief Whether events-limit was given. */
70 unsigned int first_event_number_given ; /**< @brief Whether first-event-number was given. */
71 unsigned int last_event_number_given ; /**< @brief Whether last-event-number was given. */
72 unsigned int print_every_events_parsed_given ; /**< @brief Whether print-every-events-parsed was given. */
73
74 char **inputs ; /**< @brief unamed options (options without names) */
75 unsigned inputs_num ; /**< @brief unamed options number */
76 } ;
77
78 /** @brief The additional parameters to pass to parser functions */
79 struct cmdline_parser_params
80 {
81 int override; /**< @brief whether to override possibly already present options (default 0) */
82 int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
83 int check_required; /**< @brief whether to check that all required options were provided (default 1) */
84 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
85 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
86 } ;
87
88 /** @brief the purpose string of the program */
89 extern const char *gengetopt_args_info_purpose;
90 /** @brief the usage string of the program */
91 extern const char *gengetopt_args_info_usage;
92 /** @brief the description string of the program */
93 extern const char *gengetopt_args_info_description;
94 /** @brief all the lines making the help output */
95 extern const char *gengetopt_args_info_help[];
96
97 /**
98 * The command line parser
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 * @return 0 if everything went fine, NON 0 if an error took place
103 */
104 int cmdline_parser (int argc, char **argv,
105 struct gengetopt_args_info *args_info);
106
107 /**
108 * The command line parser (version with additional parameters - deprecated)
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 override whether to override possibly already present options
113 * @param initialize whether to initialize the option structure my_args_info
114 * @param check_required whether to check that all required options were provided
115 * @return 0 if everything went fine, NON 0 if an error took place
116 * @deprecated use cmdline_parser_ext() instead
117 */
118 int cmdline_parser2 (int argc, char **argv,
119 struct gengetopt_args_info *args_info,
120 int override, int initialize, int check_required);
121
122 /**
123 * The command line parser (version with additional parameters)
124 * @param argc the number of command line options
125 * @param argv the command line options
126 * @param args_info the structure where option information will be stored
127 * @param params additional parameters for the parser
128 * @return 0 if everything went fine, NON 0 if an error took place
129 */
130 int cmdline_parser_ext (int argc, char **argv,
131 struct gengetopt_args_info *args_info,
132 struct cmdline_parser_params *params);
133
134 /**
135 * Save the contents of the option struct into an already open FILE stream.
136 * @param outfile the stream where to dump options
137 * @param args_info the option struct to dump
138 * @return 0 if everything went fine, NON 0 if an error took place
139 */
140 int cmdline_parser_dump(FILE *outfile,
141 struct gengetopt_args_info *args_info);
142
143 /**
144 * Save the contents of the option struct into a (text) file.
145 * This file can be read by the config file parser (if generated by gengetopt)
146 * @param filename the file where to save
147 * @param args_info the option struct to save
148 * @return 0 if everything went fine, NON 0 if an error took place
149 */
150 int cmdline_parser_file_save(const char *filename,
151 struct gengetopt_args_info *args_info);
152
153 /**
154 * Print the help
155 */
156 void cmdline_parser_print_help(void);
157 /**
158 * Print the version
159 */
160 void cmdline_parser_print_version(void);
161
162 /**
163 * Initializes all the fields a cmdline_parser_params structure
164 * to their default values
165 * @param params the structure to initialize
166 */
167 void cmdline_parser_params_init(struct cmdline_parser_params *params);
168
169 /**
170 * Allocates dynamically a cmdline_parser_params structure and initializes
171 * all its fields to their default values
172 * @return the created and initialized cmdline_parser_params structure
173 */
174 struct cmdline_parser_params *cmdline_parser_params_create(void);
175
176 /**
177 * Initializes the passed gengetopt_args_info structure's fields
178 * (also set default values for options that have a default)
179 * @param args_info the structure to initialize
180 */
181 void cmdline_parser_init (struct gengetopt_args_info *args_info);
182 /**
183 * Deallocates the string fields of the gengetopt_args_info structure
184 * (but does not deallocate the structure itself)
185 * @param args_info the structure to deallocate
186 */
187 void cmdline_parser_free (struct gengetopt_args_info *args_info);
188
189 /**
190 * Checks that all the required options were specified
191 * @param args_info the structure to check
192 * @param prog_name the name of the program that will be used to print
193 * possible errors
194 * @return
195 */
196 int cmdline_parser_required (struct gengetopt_args_info *args_info,
197 const char *prog_name);
198
199 extern const char *cmdline_parser_input_format_values[]; /**< @brief Possible values for input-format. */
200 extern const char *cmdline_parser_output_format_values[]; /**< @brief Possible values for output-format. */
201
202
203 #ifdef __cplusplus
204 }
205 #endif /* __cplusplus */
206 #endif /* CMDLINE_H */