| 1 |
< |
/* HydroCmd.h */ |
| 1 |
> |
/** @file HydroCmd.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 |
|
|
| 3 |
– |
/* File autogenerated by gengetopt version 2.11 */ |
| 4 |
– |
|
| 8 |
|
#ifndef HYDROCMD_H |
| 9 |
|
#define HYDROCMD_H |
| 10 |
|
|
| 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 "Hydro" |
| 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 |
< |
char * input_arg; /* input dump file. */ |
| 36 |
< |
char * output_arg; /* output file prefix (default='hydro'). */ |
| 37 |
< |
char * model_arg; /* hydrodynamics model (support RoughShell and BeadModel). */ |
| 38 |
< |
int beads_flag; /* generate the beads only, hydrodynamics will be performed (default=off). */ |
| 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 * input_arg; /**< @brief input MetaData (md) file. */ |
| 38 |
> |
char * input_orig; /**< @brief input MetaData (md) file original value given at command line. */ |
| 39 |
> |
const char *input_help; /**< @brief input MetaData (md) file help description. */ |
| 40 |
> |
char * output_arg; /**< @brief output file prefix (default='hydro'). */ |
| 41 |
> |
char * output_orig; /**< @brief output file prefix original value given at command line. */ |
| 42 |
> |
const char *output_help; /**< @brief output file prefix help description. */ |
| 43 |
> |
char * model_arg; /**< @brief hydrodynamics model (supports RoughShell and BeadModel). */ |
| 44 |
> |
char * model_orig; /**< @brief hydrodynamics model (supports RoughShell and BeadModel) original value given at command line. */ |
| 45 |
> |
const char *model_help; /**< @brief hydrodynamics model (supports RoughShell and BeadModel) help description. */ |
| 46 |
> |
int beads_flag; /**< @brief generate the beads only, hydrodynamics will be performed (default=off). */ |
| 47 |
> |
const char *beads_help; /**< @brief generate the beads only, hydrodynamics will be performed 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 input_given ; /**< @brief Whether input was given. */ |
| 52 |
> |
unsigned int output_given ; /**< @brief Whether output was given. */ |
| 53 |
> |
unsigned int model_given ; /**< @brief Whether model was given. */ |
| 54 |
> |
unsigned int beads_given ; /**< @brief Whether beads was given. */ |
| 55 |
|
|
| 56 |
< |
int help_given ; /* Whether help was given. */ |
| 33 |
< |
int version_given ; /* Whether version was given. */ |
| 34 |
< |
int input_given ; /* Whether input was given. */ |
| 35 |
< |
int output_given ; /* Whether output was given. */ |
| 36 |
< |
int model_given ; /* Whether model was given. */ |
| 37 |
< |
int beads_given ; /* Whether beads was given. */ |
| 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 |
< |
int cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info); |
| 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 * const *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 * const *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 * const *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 */ |