summaryrefslogtreecommitdiffstats
path: root/src/defs.h
blob: b06e181880368b3d1b42fda7eda102145090f624 (plain)
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
#ifndef ALGOS_DEFS_H_INCLUDED
#define ALGOS_DEFS_H_INCLUDED

#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>

/* for array implementation */
struct entry {
	uint64_t val;
};

/* for linked list implementation */
struct entry_l {
	struct entry;
	uint32_t next; /* """pointer""" to the next element. */
	uint32_t prev; /* """pointer""" to the previous element. */
};

enum opmode {
	mode_normal,
	mode_fetch,
	mode_generate
};

struct stream {
	size_t n;
	ssize_t prev_idx;
	int fd;
	int out;
	char *name;
};

struct settings {
	size_t ss;
	size_t to;
	size_t stride;
	char *filein;
	char *fileout;
	unsigned int flags;
	enum opmode opmode;
	int (*get)(struct stream, size_t, struct entry_l *, int);
	int (*put)(struct stream, size_t, struct entry_l *, int);
};

#endif /* ALGOS_DEFS_H_INCLUDED */