-
Notifications
You must be signed in to change notification settings - Fork 24
/
plugin_before.c
55 lines (44 loc) · 1.1 KB
/
plugin_before.c
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
#include<pandaseq-plugin.h>
HELP("Include only sequences in the one before the provided sequence", "before:sequenceid");
VER_INFO("1.0");
struct data {
panda_seq_identifier marker_id;
bool state;
};
static bool precheck_func(
PandaLogProxy logger,
const panda_seq_identifier *id,
const panda_qual *forward,
size_t forward_length,
const panda_qual *reverse,
size_t reverse_length,
void *user_data) {
struct data *data = (struct data *) user_data;
(void) logger;
(void) forward;
(void) forward_length;
(void) reverse;
(void) reverse_length;
if (panda_seqid_equal(&data->marker_id, id)) {
data->state = true;
}
return !data->state;
}
OPEN {
struct data data;
(void) check;
if (args == NULL) {
panda_log_proxy_write_str(logger, "ERR\tBEFORE\tNO ID\n");
return false;
}
if (panda_seqid_parse(&data.marker_id, args[0] == '@' ? (args + 1) : args, PANDA_TAG_OPTIONAL) == 0) {
panda_log_proxy_write_f(logger, "ERR\tBEFORE\tBAD\t%s\n", args);
return false;
} else {
data.state = false;
*precheck = precheck_func;
*destroy = free;
*user_data = PANDA_STRUCT_DUP(&data);
return true;
}
}