Classes | Macros | Enumerations | Functions
options.h File Reference
#include <stdio.h>
Include dependency graph for options.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  option
 
struct  option_alternative
 

Macros

#define OPTIONS_NAME_MAXSIZE   32
 
#define OPTIONS_VALUE_MAXSIZE   256
 

Enumerations

enum  option_type { OPTION_STRING =0, OPTION_INT =1, OPTION_DOUBLE =2, OPTION_ALTERNATIVE =3 }
 

Functions

int get_double (double *p, const char *s)
 
int get_int (int *p, const char *s)
 
struct optionoptions_allocate (int n)
 
void options_alternative (struct option *, const char *name, struct option_alternative *alt, int *value, const char *desc)
 
void options_banner (const char *message)
 
void options_double (struct option *, const char *name, double *p, double def_value, const char *desc)
 
void options_dump (struct option *options, FILE *f, int write_desc)
 
struct optionoptions_find (struct option *ops, const char *name)
 
void options_int (struct option *, const char *name, int *p, int def_value, const char *desc)
 
struct optionoptions_next_empty (struct option *ops)
 
int options_parse_args (struct option *ops, int argc, const char *argv[])
 
int options_parse_file (struct option *ops, const char *pwd, const char *file)
 
int options_parse_stream (struct option *ops, const char *pwd, FILE *file)
 
void options_print_help (struct option *ops, FILE *where)
 
int options_requires_argument (struct option *o)
 
int options_set (struct option *op, const char *value)
 
void options_set_passed (struct option *o)
 
void options_string (struct option *, const char *name, const char **p, const char *def_balue, const char *desc)
 
int options_try_pair (struct option *ops, const char *name, const char *value)
 
int options_valid (struct option *op)
 
char * strdup_ (const char *s)
 

Macro Definition Documentation

#define OPTIONS_NAME_MAXSIZE   32

Definition at line 45 of file options.h.

#define OPTIONS_VALUE_MAXSIZE   256

Definition at line 46 of file options.h.

Enumeration Type Documentation

Internal use

Enumerator
OPTION_STRING 
OPTION_INT 
OPTION_DOUBLE 
OPTION_ALTERNATIVE 

Definition at line 43 of file options.h.

Function Documentation

int get_double ( double *  p,
const char *  s 
)

Return 1 if ok.

Definition at line 58 of file options.c.

int get_int ( int *  p,
const char *  s 
)

Return 1 if ok.

Definition at line 47 of file options.c.

struct option* options_allocate ( int  n)

User-friendly interface

Definition at line 16 of file options_interface.c.

void options_alternative ( struct option ,
const char *  name,
struct option_alternative alt,
int *  value,
const char *  desc 
)

Definition at line 49 of file options_interface.c.

void options_banner ( const char *  message)

User-friendly interface

Definition at line 33 of file options.c.

void options_double ( struct option ,
const char *  name,
double *  p,
double  def_value,
const char *  desc 
)

Definition at line 62 of file options_interface.c.

void options_dump ( struct option options,
FILE *  f,
int  write_desc 
)

Definition at line 332 of file options.c.

struct option* options_find ( struct option ops,
const char *  name 
)

Finds an option in the array. Returns 0 if not found.

Definition at line 219 of file options.c.

void options_int ( struct option ,
const char *  name,
int *  p,
int  def_value,
const char *  desc 
)

Definition at line 39 of file options_interface.c.

struct option* options_next_empty ( struct option ops)

Definition at line 30 of file options_interface.c.

int options_parse_args ( struct option ops,
int  argc,
const char *  argv[] 
)

Returns 0 on error

Definition at line 66 of file options.c.

int options_parse_file ( struct option ops,
const char *  pwd,
const char *  file 
)

Returns 0 on error

Definition at line 180 of file options.c.

int options_parse_stream ( struct option ops,
const char *  pwd,
FILE *  file 
)

Definition at line 131 of file options.c.

void options_print_help ( struct option ops,
FILE *  where 
)

Definition at line 398 of file options.c.

int options_requires_argument ( struct option o)

Returns true if the option needs an argument

Definition at line 126 of file options.c.

int options_set ( struct option op,
const char *  value 
)

Returns 0 on error.

Definition at line 242 of file options.c.

void options_set_passed ( struct option o)

Flags the option as passed

Definition at line 120 of file options.c.

void options_string ( struct option ,
const char *  name,
const char **  p,
const char *  def_balue,
const char *  desc 
)

Definition at line 72 of file options_interface.c.

int options_try_pair ( struct option ops,
const char *  name,
const char *  value 
)

Returns 0 on error

Definition at line 228 of file options.c.

int options_valid ( struct option op)

Definition at line 238 of file options.c.

char* strdup_ ( const char *  s)

Our version of strdup.

Definition at line 38 of file options.c.



csm
Author(s): Andrea Censi
autogenerated on Tue May 11 2021 02:18:23