-
Notifications
You must be signed in to change notification settings - Fork 9
/
parse.h
63 lines (44 loc) · 1.11 KB
/
parse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef _PARSE_H_
#define _PARSE_H_
#include <argp.h>
#define CACHE_ARG_KEY 1337
#define RANGE_SUM_KEY 9999
struct ArgState {
/* Required Args */
char *filename;
int layers;
int subcommand_retval;
};
struct GetArgs {
long key;
/* Flags */
int key_set;
int xrp;
int threads;
int requests;
size_t cache_level;
size_t database_layers;
};
struct RangeArgs {
int dump_flag;
int xrp;
unsigned long range_begin;
unsigned long range_end;
long requests;
long range_size;
int agg_op;
};
static inline struct ArgState default_argstate(void) {
struct ArgState as = { 0 };
return as;
}
struct Range {
unsigned long begin;
unsigned long end;
};
int run_subcommand(struct argp_state *state, char *cmd_name, int(*subcommand)(int argc, char* argv[], struct ArgState*));
int parse_range(struct Range *range, char *range_str);
void parse_range_opts(int argc, char *argv[], struct RangeArgs *range_args);
void parse_get_opts(int argc, char *argv[], struct GetArgs *get_args);
void parse_create_opts(int argc, char *argv[]);
#endif /* _PARSE_H_ */