array.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef ARRAY_HEADER
  2. #define ARRAY_HEADER
  3. // this header needs
  4. #include "BYTE_ARR.h"
  5. // functions to handle raw arrays of different variable sizes
  6. // will have to use def directives to get around the variable
  7. // types not being found because of partial header inclusion
  8. bool check_array(byte * arr, umax asize, umax var_size);
  9. umax print_arr_elems(byte * arr, umax asize, umax var_size, umax (* print_elem) (byte *, umax));
  10. umax reverse_arr(byte * arr, umax asize, umax var_size);
  11. byte * find_arr_elem(byte * elem, umax esize, byte * arr, umax asize, bool (* comp_elems) (byte *, byte *));
  12. umax sort_arr(byte * arr, umax asize, umax var_size, bool (* comp_elems) (byte *, byte *));
  13. // the third big type, barr (bean's array, barr)
  14. // this array is different from bytarr in the sense that
  15. // it adds a few more information about the elements in the array
  16. typedef struct
  17. {
  18. bytarr * arr;
  19. var_type var;
  20. } barr;
  21. // barr functions
  22. barr * create_barr(bytarr * arr, var_type type);
  23. bool check_barr(barr * arr);
  24. umax free_barr(barr * arr);
  25. umax print_barr(byte * src, umax size);
  26. // copy of the above functions but to be used with the new structure
  27. umax print_barr_elems(barr * arr);
  28. umax reverse_barr(barr * arr);
  29. umax find_barr_elem(bytarr * elem, barr * arr);
  30. umax sort_barr(barr * arr);
  31. #include "ARRAY.c"
  32. #endif // ARRAY_HEADER