MPSolve 3.2.1
|
Implementation of option parsing for MPSolve. More...
#include <mps/mps.h>
Go to the source code of this file.
Classes | |
struct | mps_command_line_option |
This struct holds a configuration for a command line option. This is a step towards a more flexible implementation of the option parser, compared to the traditional getopts() call. More... | |
struct | mps_command_line_option_configuration |
Configuration for a command line parser. More... | |
struct | mps_opt |
Struct holding the options passed on the command line. More... | |
struct | mps_input_option |
This struct holds a key and the value associated with it. It's used for options that require a value associated. More... | |
struct | mps_input_configuration |
Configuration for an input stream; this struct contains the information on how the input stream should be parsed. More... | |
struct | mps_output_configuration |
Configuration for the output. More... | |
Functions | |
void | mps_parse_opts (mps_context *s, int argc, char *argv[]) |
mps_boolean | mps_getopts (mps_opt **opt, int *argc_ptr, char ***argv_ptr, const char *opt_format) |
Parse command line options in a similar way of getopts. More... | |
mps_command_line_option_configuration * | mps_command_line_option_configuration_new (void) |
Implementation of option parsing for MPSolve.
mps_boolean mps_getopts | ( | mps_opt ** | opt_ptr, |
int * | argc_ptr, | ||
char *** | argv_ptr, | ||
const char * | opt_format | ||
) |
Parse command line options in a similar way of getopts.
opt_ptr | A pointer to a previous used mps_opts that can be re-used, or NULL. If this is NULL it will be allocated. When this function return false the opt_ptr is automatically freed. |
argc_ptr | The address in memory of the argc variable obtained by the operating system. |
argv_ptr | The address in memory of the argv variable obtained by the operating system. |
opt_format | The option that mps_getopts() has to look for. It is passed as a string like "ab:n" where the ":" means that the preceding character needs an argument, while single characters not followed by ":" don't expect one. In this case a correct call to the program would be ./myprogram -a -n -b 7
./myprogam -a
|
The option are parsed from argc_ptr and argv_ptr and these are modified taking options away (as the program has been called wihtout these options) so after option parsing the program can still parse other options such as filenames or similar, without worrying about options switch.