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