MPSolve 3.2.1
Loading...
Searching...
No Matches
options.h File Reference

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...
 

Macros

#define MPS_STRUCTURE_IS_RATIONAL(x)   (mps_rational_structures[(x)])
 
#define MPS_STRUCTURE_IS_INTEGER(x)   (mps_integer_structures[(x)])
 
#define MPS_STRUCTURE_IS_FP(x)   (mps_fp_structures[(x)])
 
#define MPS_STRUCTURE_IS_REAL(x)   (mps_real_structures[(x)])
 
#define MPS_STRUCTURE_IS_COMPLEX(x)   (mps_complex_structures[(x)])
 
#define MPS_DENSITY_IS_SPARSE(x)   (mps_sparse_representations[(x)])
 
#define MPS_DENSITY_IS_DENSE(x)   (mps_dense_representations[(x)])
 
#define MPS_OUTPUT_PROPERTY_NONE   (0x00)
 
#define MPS_OUTPUT_PROPERTY_REAL   (0x01)
 
#define MPS_OUTPUT_PROPERTY_IMAGINARY   (0x01 << 1)
 

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_configurationmps_command_line_option_configuration_new (void)
 

Detailed Description

Implementation of option parsing for MPSolve.

Function Documentation

◆ mps_getopts()

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.

Parameters
opt_ptrA 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_ptrThe address in memory of the argc variable obtained by the operating system.
argv_ptrThe address in memory of the argv variable obtained by the operating system.
opt_formatThe 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
or even
./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.