1 |
/** @file thermalizerCmd.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 THERMALIZERCMD_H |
9 |
#define THERMALIZERCMD_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 "thermalizer" |
25 |
#endif |
26 |
|
27 |
#ifndef CMDLINE_PARSER_VERSION |
28 |
/** @brief the program version */ |
29 |
#define CMDLINE_PARSER_VERSION "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 |
char * output_arg; /**< @brief Output file name. */ |
38 |
char * output_orig; /**< @brief Output file name original value given at command line. */ |
39 |
const char *output_help; /**< @brief Output file name help description. */ |
40 |
double temperature_arg; /**< @brief temperature (K). */ |
41 |
char * temperature_orig; /**< @brief temperature (K) original value given at command line. */ |
42 |
const char *temperature_help; /**< @brief temperature (K) help description. */ |
43 |
|
44 |
unsigned int help_given ; /**< @brief Whether help was given. */ |
45 |
unsigned int version_given ; /**< @brief Whether version was given. */ |
46 |
unsigned int output_given ; /**< @brief Whether output was given. */ |
47 |
unsigned int temperature_given ; /**< @brief Whether temperature was given. */ |
48 |
|
49 |
char **inputs ; /**< @brief unamed options (options without names) */ |
50 |
unsigned inputs_num ; /**< @brief unamed options number */ |
51 |
} ; |
52 |
|
53 |
/** @brief The additional parameters to pass to parser functions */ |
54 |
struct cmdline_parser_params |
55 |
{ |
56 |
int override; /**< @brief whether to override possibly already present options (default 0) */ |
57 |
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ |
58 |
int check_required; /**< @brief whether to check that all required options were provided (default 1) */ |
59 |
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ |
60 |
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ |
61 |
} ; |
62 |
|
63 |
/** @brief the purpose string of the program */ |
64 |
extern const char *gengetopt_args_info_purpose; |
65 |
/** @brief the usage string of the program */ |
66 |
extern const char *gengetopt_args_info_usage; |
67 |
/** @brief all the lines making the help output */ |
68 |
extern const char *gengetopt_args_info_help[]; |
69 |
|
70 |
/** |
71 |
* The command line parser |
72 |
* @param argc the number of command line options |
73 |
* @param argv the command line options |
74 |
* @param args_info the structure where option information will be stored |
75 |
* @return 0 if everything went fine, NON 0 if an error took place |
76 |
*/ |
77 |
int cmdline_parser (int argc, char * const *argv, |
78 |
struct gengetopt_args_info *args_info); |
79 |
|
80 |
/** |
81 |
* The command line parser (version with additional parameters - deprecated) |
82 |
* @param argc the number of command line options |
83 |
* @param argv the command line options |
84 |
* @param args_info the structure where option information will be stored |
85 |
* @param override whether to override possibly already present options |
86 |
* @param initialize whether to initialize the option structure my_args_info |
87 |
* @param check_required whether to check that all required options were provided |
88 |
* @return 0 if everything went fine, NON 0 if an error took place |
89 |
* @deprecated use cmdline_parser_ext() instead |
90 |
*/ |
91 |
int cmdline_parser2 (int argc, char * const *argv, |
92 |
struct gengetopt_args_info *args_info, |
93 |
int override, int initialize, int check_required); |
94 |
|
95 |
/** |
96 |
* The command line parser (version with additional parameters) |
97 |
* @param argc the number of command line options |
98 |
* @param argv the command line options |
99 |
* @param args_info the structure where option information will be stored |
100 |
* @param params additional parameters for the parser |
101 |
* @return 0 if everything went fine, NON 0 if an error took place |
102 |
*/ |
103 |
int cmdline_parser_ext (int argc, char * const *argv, |
104 |
struct gengetopt_args_info *args_info, |
105 |
struct cmdline_parser_params *params); |
106 |
|
107 |
/** |
108 |
* Save the contents of the option struct into an already open FILE stream. |
109 |
* @param outfile the stream where to dump options |
110 |
* @param args_info the option struct to dump |
111 |
* @return 0 if everything went fine, NON 0 if an error took place |
112 |
*/ |
113 |
int cmdline_parser_dump(FILE *outfile, |
114 |
struct gengetopt_args_info *args_info); |
115 |
|
116 |
/** |
117 |
* Save the contents of the option struct into a (text) file. |
118 |
* This file can be read by the config file parser (if generated by gengetopt) |
119 |
* @param filename the file where to save |
120 |
* @param args_info the option struct to save |
121 |
* @return 0 if everything went fine, NON 0 if an error took place |
122 |
*/ |
123 |
int cmdline_parser_file_save(const char *filename, |
124 |
struct gengetopt_args_info *args_info); |
125 |
|
126 |
/** |
127 |
* Print the help |
128 |
*/ |
129 |
void cmdline_parser_print_help(void); |
130 |
/** |
131 |
* Print the version |
132 |
*/ |
133 |
void cmdline_parser_print_version(void); |
134 |
|
135 |
/** |
136 |
* Initializes all the fields a cmdline_parser_params structure |
137 |
* to their default values |
138 |
* @param params the structure to initialize |
139 |
*/ |
140 |
void cmdline_parser_params_init(struct cmdline_parser_params *params); |
141 |
|
142 |
/** |
143 |
* Allocates dynamically a cmdline_parser_params structure and initializes |
144 |
* all its fields to their default values |
145 |
* @return the created and initialized cmdline_parser_params structure |
146 |
*/ |
147 |
struct cmdline_parser_params *cmdline_parser_params_create(void); |
148 |
|
149 |
/** |
150 |
* Initializes the passed gengetopt_args_info structure's fields |
151 |
* (also set default values for options that have a default) |
152 |
* @param args_info the structure to initialize |
153 |
*/ |
154 |
void cmdline_parser_init (struct gengetopt_args_info *args_info); |
155 |
/** |
156 |
* Deallocates the string fields of the gengetopt_args_info structure |
157 |
* (but does not deallocate the structure itself) |
158 |
* @param args_info the structure to deallocate |
159 |
*/ |
160 |
void cmdline_parser_free (struct gengetopt_args_info *args_info); |
161 |
|
162 |
/** |
163 |
* Checks that all the required options were specified |
164 |
* @param args_info the structure to check |
165 |
* @param prog_name the name of the program that will be used to print |
166 |
* possible errors |
167 |
* @return |
168 |
*/ |
169 |
int cmdline_parser_required (struct gengetopt_args_info *args_info, |
170 |
const char *prog_name); |
171 |
|
172 |
|
173 |
#ifdef __cplusplus |
174 |
} |
175 |
#endif /* __cplusplus */ |
176 |
#endif /* THERMALIZERCMD_H */ |