123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #ifndef byte_arr_h
- #define byte_arr_h
- // all dependencies
- #include "../mem_space.h"
- #include "../endian.h"
- // functions to handle raw byte arrays
- // enum with byte shifting modes
- typedef enum
- {
- BYTESHIFT_RIGHT,
- BYTESHIFT_LEFT,
- } owl_byteshift_dir;
- // the second big type, owl_bytarr
- // it is basically a re-typedef of owl_mem_space
- // but with the intention to write and manage data on it
- typedef owl_mem_space owl_bytarr;
- // var_basic_types enum
- // the first variable types enum
- typedef enum
- {
- OWL_TYPE_BYTESHIFT_DIR = OWL_TYPE_ENDIAN + 1,
- OWL_TYPE_BYTARR,
- } owl_type_byte_arr_h;
- // bytarr functions
- owl_bool owl_check_bytarr_pointer(owl_byte * src, owl_umax size);
- owl_bool owl_check_bytarr_members(owl_byte * ptr, owl_umax size);
- owl_bool owl_check_bytarr_all(owl_bytarr * data, owl_umax size);
- owl_bytarr * owl_create_bytarr(owl_byte * data, owl_umax size);
- owl_umax owl_free_bytarr(owl_bytarr * arr);
- owl_umax owl_print_bytarr(owl_byte * src, owl_umax size);
- owl_bool owl_comp_bytarr(owl_byte * bytarr1, owl_byte * bytarr2);
- // specific functions
- owl_bytarr owl_copy_bytarr(owl_bytarr * src, owl_bytarr * dest);
- owl_umax owl_get_bytarr_mismatch_index(owl_bytarr * arr1, owl_bytarr * arr2);
- owl_bytarr owl_ignore_bytarr_bytes(owl_bytarr * arr, owl_bytarr * skip);
- owl_bytarr owl_search_bytarr(owl_bytarr * src, owl_bytarr * search);
- owl_umax owl_reverse_bytarr(owl_bytarr * arr);
- owl_bool owl_check_byteshift_dir(owl_byteshift_dir shift); // internal use
- owl_umax owl_bytarr_shift(owl_bytarr * arr, owl_byteshift_dir shift);
- owl_umax owl_bytarr_n_shift(owl_bytarr * arr, owl_byteshift_dir shift, owl_umax n);
- owl_umax owl_bytarr_circ_shift(owl_bytarr * arr, owl_byteshift_dir shift);
- owl_umax owl_bytarr_n_circ_shift(owl_bytarr * arr, owl_byteshift_dir shift, owl_umax n);
- owl_bytarr * owl_ins_bytarr(owl_bytarr * arr, owl_umax arr_ins_pos, owl_bytarr * insert);
- owl_umax owl_rm_bytarr(owl_bytarr * arr, owl_umax rm_pos, owl_umax rm_size);
- #include "byte_arr.c"
- #endif // byte_arr_h
|