ROSS
Main Page
Related Pages
Data Structures
Files
File List
Globals
core
tw-opts.h
Go to the documentation of this file.
1
#ifndef INC_tw_opts_h
2
#define INC_tw_opts_h
3
4
enum
tw_opttype
5
{
6
TWOPTTYPE_GROUP
= 1,
7
TWOPTTYPE_ULONG
,
/**< value must be an "unsigned long*" */
8
TWOPTTYPE_ULONGLONG
,
/**< value must be an "unsigned long long*" */
9
TWOPTTYPE_UINT
,
/**< value must be an "unsigned int*" */
10
TWOPTTYPE_STIME
,
/**< value must be a "tw_stime*" */
11
TWOPTTYPE_DOUBLE
,
/**< value must be a "double *" */
12
TWOPTTYPE_CHAR
,
/**< value must be a "char *" */
13
TWOPTTYPE_FLAG
,
/**< value must be an "unsigned int*" */
14
TWOPTTYPE_SHOWHELP
15
};
16
typedef
enum
tw_opttype
tw_opttype
;
17
18
typedef
struct
tw_optdef
tw_optdef
;
19
struct
tw_optdef
20
{
21
tw_opttype
type
;
22
const
char
*
name
;
23
const
char
*
help
;
24
void
*
value
;
25
};
26
27
#define TWOPT_GROUP(h) { TWOPTTYPE_GROUP, NULL, (h), NULL }
28
#define TWOPT_ULONG(n,v,h) { TWOPTTYPE_ULONG, (n), (h), &(v) }
29
#define TWOPT_ULONGLONG(n,v,h) { TWOPTTYPE_ULONGLONG, (n), (h), &(v) }
30
#define TWOPT_UINT(n,v,h) { TWOPTTYPE_UINT, (n), (h), &(v) }
31
#define TWOPT_STIME(n,v,h) { TWOPTTYPE_STIME, (n), (h), &(v) }
32
#define TWOPT_DOUBLE(n,v,h) { TWOPTTYPE_DOUBLE, (n), (h), &(v) }
33
#define TWOPT_CHAR(n,v,h) { TWOPTTYPE_CHAR, (n), (h), &(v) }
34
#define TWOPT_FLAG(n,v,h) { TWOPTTYPE_FLAG, (n), (h), &(v) }
35
#define TWOPT_END() { (tw_opttype)0, NULL, NULL, NULL }
36
37
/** Remove options from the command line arguments. */
38
extern
void
tw_opt_parse
(
int
*argc,
char
***argv);
39
/** Add an opt group */
40
extern
void
tw_opt_add
(
const
tw_optdef
*options);
41
/** Pretty-print the option descriptions (for --help) */
42
extern
void
tw_opt_print
(
void
);
43
/** Pretty-print the option descriptions and current values */
44
extern
void
tw_opt_settings
(FILE *f);
45
46
#endif
tw_opt_add
void tw_opt_add(const tw_optdef *options)
Definition:
tw-opts.c:14
tw_opt_print
void tw_opt_print(void)
Definition:
tw-opts.c:215
TWOPTTYPE_ULONG
Definition:
tw-opts.h:7
TWOPTTYPE_STIME
Definition:
tw-opts.h:10
tw_optdef
Definition:
tw-opts.h:19
TWOPTTYPE_UINT
Definition:
tw-opts.h:9
TWOPTTYPE_FLAG
Definition:
tw-opts.h:13
TWOPTTYPE_CHAR
Definition:
tw-opts.h:12
TWOPTTYPE_DOUBLE
Definition:
tw-opts.h:11
tw_optdef::value
void * value
Definition:
tw-opts.h:24
TWOPTTYPE_SHOWHELP
Definition:
tw-opts.h:14
tw_optdef::help
const char * help
Definition:
tw-opts.h:23
tw_optdef::type
tw_opttype type
Definition:
tw-opts.h:21
tw_opt_parse
void tw_opt_parse(int *argc, char ***argv)
Definition:
tw-opts.c:427
TWOPTTYPE_ULONGLONG
Definition:
tw-opts.h:8
TWOPTTYPE_GROUP
Definition:
tw-opts.h:6
tw_opttype
tw_opttype
Definition:
tw-opts.h:4
tw_optdef::name
const char * name
Definition:
tw-opts.h:22
tw_opt_settings
void tw_opt_settings(FILE *f)
Definition:
tw-opts.c:138
Generated by
1.8.6