| Bsoft 2.0.5 Bernard's software package

Macros | Functions | Variables
options.cpp File Reference

Functions to handle general options. More...

`#include "options.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Macros
#define | MAX_TAG_LEN 20

## Functions
Boption * | get_option_list (const char *use[], int argc, char *argv[], int &optind)
| Parses command line arguments based on a template. More...
int | option_kill (Boption *option)
| Deallocates a linked list of option structures. More...
int | get_option_verbose (char *optarg)
| Sets the verbose option. More...
int | get_option_verbose (Bstring &optarg)
double | get_option_mass (Bstring &optarg)
| Returns the adjusted mass based on the added character. More...

## Variables
int | verbose

## Detailed Description

Functions to handle general options.

Author
  Bernard Heymann

Date
  Created: 20010613
  Modified: 20190109

Definition in file options.cpp.

## Macro Definition Documentation

## ◆ MAX_TAG_LEN

#define MAX_TAG_LEN 20

Definition at line 12 of file options.cpp.

## Function Documentation

## ◆ get_option_list()

Boption* get_option_list | ( | const char * | use[],
|  | int | argc,
|  | char * | argv[],
|  | int & | optind
| ) |  |

Parses command line arguments based on a template.

Parameters

  *use[] | usage list of strings, the template.
  argc | number of command line arguments.
  *argv[] | array of command line argument strings.
  &optind | first argument after option list.

Returns
  Boption* linked list of tag-value pairs.

      The usage list is parsed to find the desired option tag.
      Each option in the usage list must have the following format:
          -<tag> <value,value,...>
      The first character on the line must be '-', the tag may not
      extend beyond the 17'th character and the value must start
      before the 19'th character.
      A partial input tag is tolerated as long as it is unambiguous.
      An ambiguous or unknown tag or a tag requiring a value but
      without one causes program abortion.
      Special tags:
          -verbose 3      sets the verbosity level for all programs.
          -help           returns the usage information and quits.

Definition at line 40 of file options.cpp.

## ◆ get_option_mass()

double get_option_mass | ( | Bstring & | optarg | ) |

Returns the adjusted mass based on the added character.

Parameters

  &optarg | mass with added character.

Returns
  double adjusted mass.

Definition at line 175 of file options.cpp.

## ◆ get_option_verbose() [1/2]

int get_option_verbose | ( | char * | optarg | ) |

Sets the verbose option.

Parameters

  &optarg | verbosity level.

Returns
  int verbosity number, <0 on error.

      The verbosity level is defined by the following constants setting
      particular bits:
          VERB_NONE       0       No output
          VERB_RESULT     1       Program results
          VERB_LABEL      2       Function information
          VERB_PROCESS    4       Selected processing information
          VERB_STATS      8       Statistical information on objects
          VERB_FULL       16      All processing information
          VERB_TIME       32      Timing information
          VERB_MEMORY     64      Memory allocation and freeing
          VERB_DEBUG      256     Debugging information
          VERB_DEBUG_STAR 512     STAR code debugging information

Definition at line 143 of file options.cpp.

## ◆ get_option_verbose() [2/2]

int get_option_verbose | ( | Bstring & | optarg | ) |

Definition at line 149 of file options.cpp.

## ◆ option_kill()

int option_kill | ( | Boption * | option | ) |

Deallocates a linked list of option structures.

Parameters

  *option | linked list of tag-value pairs.

Returns
  int 0.

Definition at line 109 of file options.cpp.

## Variable Documentation

## ◆ verbose

int verbose