/src/cmp_tool/programs/cmp_io.h
Line | Count | Source |
1 | | /** |
2 | | * @file cmp_io.h |
3 | | * @author Dominik Loidolt (dominik.loidolt@univie.ac.at) |
4 | | * @author Johannes Seelig (johannes.seelig@univie.ac.at) |
5 | | * @date 2020 |
6 | | * |
7 | | * @copyright GPLv2 |
8 | | * This program is free software; you can redistribute it and/or modify it |
9 | | * under the terms and conditions of the GNU General Public License, |
10 | | * version 2, as published by the Free Software Foundation. |
11 | | * |
12 | | * This program is distributed in the hope it will be useful, but WITHOUT |
13 | | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
14 | | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
15 | | * more details. |
16 | | * |
17 | | * @brief compression tool input/output library header file |
18 | | */ |
19 | | |
20 | | |
21 | | #ifndef CMP_IO_H |
22 | | #define CMP_IO_H |
23 | | |
24 | | #include <string.h> |
25 | | |
26 | | #include <cmp_support.h> |
27 | | #include <cmp_chunk.h> |
28 | | #include <cmp_entity.h> |
29 | | |
30 | | #define MAX_CONFIG_LINE 256 |
31 | | |
32 | 1.75k | #define DEFAULT_OUTPUT_PREFIX "OUTPUT" |
33 | | |
34 | | #define BUFFER_LENGTH_DEF_FAKTOR 2 |
35 | | |
36 | | /* flags argument options (can be combined) */ |
37 | 1.79k | #define CMP_IO_BINARY 0x1 |
38 | 1.58k | #define CMP_IO_VERBOSE 0x2 |
39 | 1.80k | #define CMP_IO_VERBOSE_EXTRA 0x4 |
40 | | |
41 | | |
42 | | enum cmp_type { |
43 | | CMP_TYPE_RDCU, |
44 | | CMP_TYPE_CHUNK, |
45 | | CMP_TYPE_ERROR = -1 |
46 | | }; |
47 | | |
48 | | |
49 | | void print_help(const char *program_name); |
50 | | |
51 | | enum cmp_type cmp_cfg_read(const char *file_name, struct rdcu_cfg *rcfg, |
52 | | struct cmp_par *par, int verbose_en); |
53 | | int cmp_info_read(const char *file_name, struct cmp_info *info, int verbose_en); |
54 | | |
55 | | ssize_t read_file8(const char *file_name, uint8_t *buf, uint32_t buf_size, int flags); |
56 | | ssize_t read_file_data(const char *file_name, enum cmp_type cmp_type, |
57 | | void *buf, uint32_t buf_size, int flags); |
58 | | ssize_t read_file_cmp_entity(const char *file_name, struct cmp_entity *ent, |
59 | | uint32_t ent_size, int flags); |
60 | | |
61 | | uint32_t cmp_tool_gen_version_id(const char *version); |
62 | | |
63 | | int write_data_to_file(const void *buf, uint32_t buf_size, const char *output_prefix, |
64 | | const char *name_extension, int flags); |
65 | | int write_input_data_to_file(const void *data, uint32_t data_size, enum cmp_type cmp_type, |
66 | | const char *output_prefix, const char *name_extension, int flags); |
67 | | int cmp_cfg_fo_file(const struct rdcu_cfg *rcfg, const char *output_prefix, |
68 | | int verbose, int add_ap_pars); |
69 | | int cmp_info_to_file(const struct cmp_info *info, const char *output_prefix, |
70 | | int add_ap_pars); |
71 | | int cmp_par_fo_file(const struct cmp_par *par, const char *output_prefix, |
72 | | int verbose); |
73 | | void cmp_cfg_print(const struct rdcu_cfg *rcfg, int add_ap_pars); |
74 | | void cmp_par_print(const struct cmp_par *par); |
75 | | |
76 | | int atoui32(const char *dep_str, const char *val_str, uint32_t *red_val); |
77 | | int cmp_mode_parse(const char *cmp_mode_str, enum cmp_mode *cmp_mode); |
78 | | |
79 | | enum cmp_data_type string2data_type(const char *data_type_str); |
80 | | const char *data_type2string(enum cmp_data_type data_type); |
81 | | int case_insensitive_compare(const char *s1, const char *s2); |
82 | | |
83 | | #endif /* CMP_IO_H */ |