]> Creatis software - creaImageIO.git/blob - appli/gimmick/gimmick_ggo.h
*** empty log message ***
[creaImageIO.git] / appli / gimmick / gimmick_ggo.h
1 /** @file gimmick_ggo.h
2  *  @brief The header file for the command line option parser
3  *  generated by GNU Gengetopt version 2.22
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 GIMMICK_GGO_H
9 #define GIMMICK_GGO_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 */
24 #define CMDLINE_PARSER_PACKAGE "gimmick"
25 #endif
26
27 #ifndef CMDLINE_PARSER_VERSION
28 /** @brief the program version */
29 #define CMDLINE_PARSER_VERSION "0.1.0"
30 #endif
31
32 /** @brief Where the command line options are stored */
33 struct gengetopt_args_info
34 {
35   const char *help_help; /**< @brief Print help and exit help description.  */
36   const char *version_help; /**< @brief Print version and exit help description.  */
37   int print_flag;       /**< @brief Prints the local database tree (default=off).  */
38   const char *print_help; /**< @brief Prints the local database tree help description.  */
39   char * file_arg;      /**< @brief Adds the file to local database.  */
40   char * file_orig;     /**< @brief Adds the file to local database original value given at command line.  */
41   const char *file_help; /**< @brief Adds the file to local database help description.  */
42   char * dir_arg;       /**< @brief Adds the directory to local database.  */
43   char * dir_orig;      /**< @brief Adds the directory to local database original value given at command line.  */
44   const char *dir_help; /**< @brief Adds the directory to local database help description.  */
45   int recurse_flag;     /**< @brief Recurse into sub-directories (default=off).  */
46   const char *recurse_help; /**< @brief Recurse into sub-directories help description.  */
47   int verbose_arg;      /**< @brief Verbosity level (default='1').  */
48   char * verbose_orig;  /**< @brief Verbosity level original value given at command line.  */
49   const char *verbose_help; /**< @brief Verbosity level help description.  */
50   int debug_arg;        /**< @brief Debug messages level (default='0').  */
51   char * debug_orig;    /**< @brief Debug messages level original value given at command line.  */
52   const char *debug_help; /**< @brief Debug messages level 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 print_given ;    /**< @brief Whether print was given.  */
57   unsigned int file_given ;     /**< @brief Whether file was given.  */
58   unsigned int dir_given ;      /**< @brief Whether dir was given.  */
59   unsigned int recurse_given ;  /**< @brief Whether recurse was given.  */
60   unsigned int verbose_given ;  /**< @brief Whether verbose was given.  */
61   unsigned int debug_given ;    /**< @brief Whether debug was given.  */
62
63   char **inputs ; /**< @brief unamed options (options without names) */
64   unsigned inputs_num ; /**< @brief unamed options number */
65 } ;
66
67 /** @brief The additional parameters to pass to parser functions */
68 struct cmdline_parser_params
69 {
70   int override; /**< @brief whether to override possibly already present options (default 0) */
71   int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
72   int check_required; /**< @brief whether to check that all required options were provided (default 1) */
73   int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
74   int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
75 } ;
76
77 /** @brief the purpose string of the program */
78 extern const char *gengetopt_args_info_purpose;
79 /** @brief the usage string of the program */
80 extern const char *gengetopt_args_info_usage;
81 /** @brief all the lines making the help output */
82 extern const char *gengetopt_args_info_help[];
83
84 /**
85  * The command line parser
86  * @param argc the number of command line options
87  * @param argv the command line options
88  * @param args_info the structure where option information will be stored
89  * @return 0 if everything went fine, NON 0 if an error took place
90  */
91 int cmdline_parser (int argc, char * const *argv,
92   struct gengetopt_args_info *args_info);
93
94 /**
95  * The command line parser (version with additional parameters - deprecated)
96  * @param argc the number of command line options
97  * @param argv the command line options
98  * @param args_info the structure where option information will be stored
99  * @param override whether to override possibly already present options
100  * @param initialize whether to initialize the option structure my_args_info
101  * @param check_required whether to check that all required options were provided
102  * @return 0 if everything went fine, NON 0 if an error took place
103  * @deprecated use cmdline_parser_ext() instead
104  */
105 int cmdline_parser2 (int argc, char * const *argv,
106   struct gengetopt_args_info *args_info,
107   int override, int initialize, int check_required);
108
109 /**
110  * The command line parser (version with additional parameters)
111  * @param argc the number of command line options
112  * @param argv the command line options
113  * @param args_info the structure where option information will be stored
114  * @param params additional parameters for the parser
115  * @return 0 if everything went fine, NON 0 if an error took place
116  */
117 int cmdline_parser_ext (int argc, char * const *argv,
118   struct gengetopt_args_info *args_info,
119   struct cmdline_parser_params *params);
120
121 /**
122  * Save the contents of the option struct into an already open FILE stream.
123  * @param outfile the stream where to dump options
124  * @param args_info the option struct to dump
125  * @return 0 if everything went fine, NON 0 if an error took place
126  */
127 int cmdline_parser_dump(FILE *outfile,
128   struct gengetopt_args_info *args_info);
129
130 /**
131  * Save the contents of the option struct into a (text) file.
132  * This file can be read by the config file parser (if generated by gengetopt)
133  * @param filename the file where to save
134  * @param args_info the option struct to save
135  * @return 0 if everything went fine, NON 0 if an error took place
136  */
137 int cmdline_parser_file_save(const char *filename,
138   struct gengetopt_args_info *args_info);
139
140 /**
141  * Print the help
142  */
143 void cmdline_parser_print_help(void);
144 /**
145  * Print the version
146  */
147 void cmdline_parser_print_version(void);
148
149 /**
150  * Initializes all the fields a cmdline_parser_params structure 
151  * to their default values
152  * @param params the structure to initialize
153  */
154 void cmdline_parser_params_init(struct cmdline_parser_params *params);
155
156 /**
157  * Allocates dynamically a cmdline_parser_params structure and initializes
158  * all its fields to their default values
159  * @return the created and initialized cmdline_parser_params structure
160  */
161 struct cmdline_parser_params *cmdline_parser_params_create(void);
162
163 /**
164  * Initializes the passed gengetopt_args_info structure's fields
165  * (also set default values for options that have a default)
166  * @param args_info the structure to initialize
167  */
168 void cmdline_parser_init (struct gengetopt_args_info *args_info);
169 /**
170  * Deallocates the string fields of the gengetopt_args_info structure
171  * (but does not deallocate the structure itself)
172  * @param args_info the structure to deallocate
173  */
174 void cmdline_parser_free (struct gengetopt_args_info *args_info);
175
176 /**
177  * The config file parser (deprecated version)
178  * @param filename the name of the config file
179  * @param args_info the structure where option information will be stored
180  * @param override whether to override possibly already present options
181  * @param initialize whether to initialize the option structure my_args_info
182  * @param check_required whether to check that all required options were provided
183  * @return 0 if everything went fine, NON 0 if an error took place
184  * @deprecated use cmdline_parser_config_file() instead
185  */
186 int cmdline_parser_configfile (char * const filename,
187   struct gengetopt_args_info *args_info,
188   int override, int initialize, int check_required);
189
190 /**
191  * The config file parser
192  * @param filename the name of the config file
193  * @param args_info the structure where option information will be stored
194  * @param params additional parameters for the parser
195  * @return 0 if everything went fine, NON 0 if an error took place
196  */
197 int cmdline_parser_config_file (char * const filename,
198   struct gengetopt_args_info *args_info,
199   struct cmdline_parser_params *params);
200
201 /**
202  * Checks that all the required options were specified
203  * @param args_info the structure to check
204  * @param prog_name the name of the program that will be used to print
205  *   possible errors
206  * @return
207  */
208 int cmdline_parser_required (struct gengetopt_args_info *args_info,
209   const char *prog_name);
210
211
212 #ifdef __cplusplus
213 }
214 #endif /* __cplusplus */
215 #endif /* GIMMICK_GGO_H */