source: src/common/cmdline.h @ f924e4b

Last change on this file since f924e4b was 5f4d9c3, checked in by Maciej Prill <mprill@…>, 13 years ago

Rewritten the build system, added lem UTF-8 version.

  • Property mode set to 100644
File size: 12.3 KB
Line 
1/** @file cmdline.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 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
19extern "C" {
20#endif /* __cplusplus */
21
22#ifndef CMDLINE_PARSER_PACKAGE
23/** @brief the program name (used for printing errors) */
24#define CMDLINE_PARSER_PACKAGE "guess"
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 "guess"
30#endif
31
32#ifndef CMDLINE_PARSER_VERSION
33/** @brief the program version */
34#define CMDLINE_PARSER_VERSION "0.1"
35#endif
36
37/** @brief Where the command line options are stored */
38struct gengetopt_args_info
39{
40  const char *help_help; /**< @brief Print help and exit help description.  */
41  const char *full_help_help; /**< @brief Print help, including hidden options, and exit help description.  */
42  const char *version_help; /**< @brief Print version and exit help description.  */
43  char * input_arg;     /**< @brief Input file.  */
44  char * input_orig;    /**< @brief Input file original value given at command line.  */
45  const char *input_help; /**< @brief Input file help description.  */
46  char * output_arg;    /**< @brief Output file for succesfully processed segments.  */
47  char * output_orig;   /**< @brief Output file for succesfully processed segments original value given at command line.  */
48  const char *output_help; /**< @brief Output file for succesfully processed segments help description.  */
49  char * fail_arg;      /**< @brief Output file for unsuccesfully processed segments .  */
50  char * fail_orig;     /**< @brief Output file for unsuccesfully processed segments  original value given at command line.  */
51  const char *fail_help; /**< @brief Output file for unsuccesfully processed segments  help description.  */
52  int only_fail_flag;   /**< @brief Print only segments the program failed to process (default=off).  */
53  const char *only_fail_help; /**< @brief Print only segments the program failed to process help description.  */
54  int no_fail_flag;     /**< @brief Print only segments the program processed (default=off).  */
55  const char *no_fail_help; /**< @brief Print only segments the program processed help description.  */
56  int copy_flag;        /**< @brief Copy succesfully processed segments to standard output (default=off).  */
57  const char *copy_help; /**< @brief Copy succesfully processed segments to standard output help description.  */
58  char ** process_arg;  /**< @brief Process segments with this tag.  */
59  char ** process_orig; /**< @brief Process segments with this tag original value given at command line.  */
60  unsigned int process_min; /**< @brief Process segments with this tag's minimum occurreces */
61  unsigned int process_max; /**< @brief Process segments with this tag's maximum occurreces */
62  const char *process_help; /**< @brief Process segments with this tag help description.  */
63  char ** select_arg;   /**< @brief Select only segments with this field.  */
64  char ** select_orig;  /**< @brief Select only segments with this field original value given at command line.  */
65  unsigned int select_min; /**< @brief Select only segments with this field's minimum occurreces */
66  unsigned int select_max; /**< @brief Select only segments with this field's maximum occurreces */
67  const char *select_help; /**< @brief Select only segments with this field help description.  */
68  char ** ignore_arg;   /**< @brief Select only segments without this field.  */
69  char ** ignore_orig;  /**< @brief Select only segments without this field original value given at command line.  */
70  unsigned int ignore_min; /**< @brief Select only segments without this field's minimum occurreces */
71  unsigned int ignore_max; /**< @brief Select only segments without this field's maximum occurreces */
72  const char *ignore_help; /**< @brief Select only segments without this field help description.  */
73  char * output_field_arg;      /**< @brief Output field name.  */
74  char * output_field_orig;     /**< @brief Output field name original value given at command line.  */
75  const char *output_field_help; /**< @brief Output field name help description.  */
76  char ** input_field_arg;      /**< @brief Input field name.  */
77  char ** input_field_orig;     /**< @brief Input field name original value given at command line.  */
78  unsigned int input_field_min; /**< @brief Input field name's minimum occurreces */
79  unsigned int input_field_max; /**< @brief Input field name's maximum occurreces */
80  const char *input_field_help; /**< @brief Input field name help description.  */
81  int interactive_flag; /**< @brief Toggle interactive mode (default=off).  */
82  const char *interactive_help; /**< @brief Toggle interactive mode help description.  */
83  char * config_arg;    /**< @brief Configuration file.  */
84  char * config_orig;   /**< @brief Configuration file original value given at command line.  */
85  const char *config_help; /**< @brief Configuration file help description.  */
86  int one_field_flag;   /**< @brief Print all results in one segments (creates ambiguous annotation) (default=off).  */
87  const char *one_field_help; /**< @brief Print all results in one segments (creates ambiguous annotation) help description.  */
88  int one_line_flag;    /**< @brief Print annotation alternatives as additional fields (default=off).  */
89  const char *one_line_help; /**< @brief Print annotation alternatives as additional fields help description.  */
90  char * language_arg;  /**< @brief Language..  */
91  char * language_orig; /**< @brief Language. original value given at command line.  */
92  const char *language_help; /**< @brief Language. help description.  */
93  int color_flag;       /**< @brief Show guessed descriptions in colour. (default=off).  */
94  const char *color_help; /**< @brief Show guessed descriptions in colour. help description.  */
95 
96  unsigned int help_given ;     /**< @brief Whether help was given.  */
97  unsigned int full_help_given ;        /**< @brief Whether full-help was given.  */
98  unsigned int version_given ;  /**< @brief Whether version was given.  */
99  unsigned int input_given ;    /**< @brief Whether input was given.  */
100  unsigned int output_given ;   /**< @brief Whether output was given.  */
101  unsigned int fail_given ;     /**< @brief Whether fail was given.  */
102  unsigned int only_fail_given ;        /**< @brief Whether only-fail was given.  */
103  unsigned int no_fail_given ;  /**< @brief Whether no-fail was given.  */
104  unsigned int copy_given ;     /**< @brief Whether copy was given.  */
105  unsigned int process_given ;  /**< @brief Whether process was given.  */
106  unsigned int select_given ;   /**< @brief Whether select was given.  */
107  unsigned int ignore_given ;   /**< @brief Whether ignore was given.  */
108  unsigned int output_field_given ;     /**< @brief Whether output-field was given.  */
109  unsigned int input_field_given ;      /**< @brief Whether input-field was given.  */
110  unsigned int interactive_given ;      /**< @brief Whether interactive was given.  */
111  unsigned int config_given ;   /**< @brief Whether config was given.  */
112  unsigned int one_field_given ;        /**< @brief Whether one-field was given.  */
113  unsigned int one_line_given ; /**< @brief Whether one-line was given.  */
114  unsigned int language_given ; /**< @brief Whether language was given.  */
115  unsigned int color_given ;    /**< @brief Whether color was given.  */
116
117} ;
118
119/** @brief The additional parameters to pass to parser functions */
120struct cmdline_parser_params
121{
122  int override; /**< @brief whether to override possibly already present options (default 0) */
123  int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
124  int check_required; /**< @brief whether to check that all required options were provided (default 1) */
125  int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
126  int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
127} ;
128
129/** @brief the purpose string of the program */
130extern const char *gengetopt_args_info_purpose;
131/** @brief the usage string of the program */
132extern const char *gengetopt_args_info_usage;
133/** @brief all the lines making the help output */
134extern const char *gengetopt_args_info_help[];
135/** @brief all the lines making the full help output (including hidden options) */
136extern const char *gengetopt_args_info_full_help[];
137
138/**
139 * The command line parser
140 * @param argc the number of command line options
141 * @param argv the command line options
142 * @param args_info the structure where option information will be stored
143 * @return 0 if everything went fine, NON 0 if an error took place
144 */
145int cmdline_parser (int argc, char **argv,
146  struct gengetopt_args_info *args_info);
147
148/**
149 * The command line parser (version with additional parameters - deprecated)
150 * @param argc the number of command line options
151 * @param argv the command line options
152 * @param args_info the structure where option information will be stored
153 * @param override whether to override possibly already present options
154 * @param initialize whether to initialize the option structure my_args_info
155 * @param check_required whether to check that all required options were provided
156 * @return 0 if everything went fine, NON 0 if an error took place
157 * @deprecated use cmdline_parser_ext() instead
158 */
159int cmdline_parser2 (int argc, char **argv,
160  struct gengetopt_args_info *args_info,
161  int override, int initialize, int check_required);
162
163/**
164 * The command line parser (version with additional parameters)
165 * @param argc the number of command line options
166 * @param argv the command line options
167 * @param args_info the structure where option information will be stored
168 * @param params additional parameters for the parser
169 * @return 0 if everything went fine, NON 0 if an error took place
170 */
171int cmdline_parser_ext (int argc, char **argv,
172  struct gengetopt_args_info *args_info,
173  struct cmdline_parser_params *params);
174
175/**
176 * Save the contents of the option struct into an already open FILE stream.
177 * @param outfile the stream where to dump options
178 * @param args_info the option struct to dump
179 * @return 0 if everything went fine, NON 0 if an error took place
180 */
181int cmdline_parser_dump(FILE *outfile,
182  struct gengetopt_args_info *args_info);
183
184/**
185 * Save the contents of the option struct into a (text) file.
186 * This file can be read by the config file parser (if generated by gengetopt)
187 * @param filename the file where to save
188 * @param args_info the option struct to save
189 * @return 0 if everything went fine, NON 0 if an error took place
190 */
191int cmdline_parser_file_save(const char *filename,
192  struct gengetopt_args_info *args_info);
193
194/**
195 * Print the help
196 */
197void cmdline_parser_print_help(void);
198/**
199 * Print the full help (including hidden options)
200 */
201void cmdline_parser_print_full_help(void);
202/**
203 * Print the version
204 */
205void cmdline_parser_print_version(void);
206
207/**
208 * Initializes all the fields a cmdline_parser_params structure
209 * to their default values
210 * @param params the structure to initialize
211 */
212void cmdline_parser_params_init(struct cmdline_parser_params *params);
213
214/**
215 * Allocates dynamically a cmdline_parser_params structure and initializes
216 * all its fields to their default values
217 * @return the created and initialized cmdline_parser_params structure
218 */
219struct cmdline_parser_params *cmdline_parser_params_create(void);
220
221/**
222 * Initializes the passed gengetopt_args_info structure's fields
223 * (also set default values for options that have a default)
224 * @param args_info the structure to initialize
225 */
226void cmdline_parser_init (struct gengetopt_args_info *args_info);
227/**
228 * Deallocates the string fields of the gengetopt_args_info structure
229 * (but does not deallocate the structure itself)
230 * @param args_info the structure to deallocate
231 */
232void cmdline_parser_free (struct gengetopt_args_info *args_info);
233
234/**
235 * Checks that all the required options were specified
236 * @param args_info the structure to check
237 * @param prog_name the name of the program that will be used to print
238 *   possible errors
239 * @return
240 */
241int cmdline_parser_required (struct gengetopt_args_info *args_info,
242  const char *prog_name);
243
244
245#ifdef __cplusplus
246}
247#endif /* __cplusplus */
248#endif /* CMDLINE_H */
Note: See TracBrowser for help on using the repository browser.