#ifndef BUFFER_OPS_H
#define BUFFER_OPS_H

#include <stdint.h>

/**
 * @brief Inserts a character at the beginning of the array.
 * Shifts all elements to the right and removes the last element if the array is full.
 * 
 * @param array Pointer to the array.
 * @param c Character to prepend.
 */
void prepend(uint8_t* array, uint8_t c);

/**
 * @brief Inserts a character at the end of the array.
 * Shifts all elements to the left and removes the first element if the array is full.
 * 
 * @param array Pointer to the array.
 * @param c Character to append.
 */
void append(uint8_t* array, uint8_t c);

/**
 * @brief Inserts a character at the beginning of the array.
 * Shifts all elements to the right. Note that this function assumes there is space
 * at the beginning of the array.
 * 
 * @param array Pointer to the array.
 * @param c Character to insert at the beginning.
 */
void append_first(uint8_t* array, uint8_t c);

/**
 * @brief Inserts a character at the end of the array.
 * Shifts all elements to the left. Note that this function assumes there is space
 * at the end of the array.
 * 
 * @param array Pointer to the array.
 * @param c Character to insert at the end.
 */
void append_last(uint8_t* array, uint8_t c);


char** split_string(const char* str, char delimiter, int* num_tokens);
void free_split_strings(char** tokens, int num_tokens);


#endif // BUFFER_OPS_H
