#ifndef AOC_2021_PUZZLE_INPUT_H #define AOC_2021_PUZZLE_INPUT_H #include typedef enum { PARSER_OK = 0, PARSER_INVALID = -1, PARSER_RANGE_OVERFLOW = -2, PARSE_FILE_ERR = -3, PARSE_NULL = -4, } parse_ret_t; typedef parse_ret_t (*input_parser_t)(char * buffer, void * data, uint16_t index); parse_ret_t read_input_single_line(const char * file_path, void * data, uint16_t max_len, input_parser_t parser, uint16_t * len); parse_ret_t read_input_split_on(const char * file_path, void * data, uint16_t max_len, input_parser_t parser, uint16_t * len, char split); parse_ret_t read_input_multi_line(const char * file_path, void * data, uint16_t max_len, char * sep, input_parser_t parser, uint16_t * len); // Parsers parse_ret_t parse_long_from_buff(char * buffer, void * data, uint16_t index); parse_ret_t parse_byte_from_buff(char * buffer, void * data, uint16_t index); parse_ret_t parse_long_base_2_from_buff(char * buffer, void * data, uint16_t index); //Helpers parse_ret_t parse_long(char * buffer, int64_t * val, int16_t base); #endif //AOC_2021_PUZZLE_INPUT_H