diff options
Diffstat (limited to 'src/defs.h')
-rw-r--r-- | src/defs.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/defs.h b/src/defs.h new file mode 100644 index 0000000..b06e181 --- /dev/null +++ b/src/defs.h @@ -0,0 +1,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 */ |