BEAN.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // basically a header to include them all
  2. // plus a runtime funtion to initialize the library
  3. //~ ⠀⠀⠀⠀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡀⢀⡀⠀⠀⠀
  4. //~ ⣤⣶⣶⡿⠿⠿⠿⠿⠿⣶⣶⣶⠄⠀⠀⠐⢶⣶⣶⣿⡿⠿⠿⠿⠿⢿⣷⠦⠀
  5. //~ ⠙⠏⠁⠀⣤⣶⣶⣶⣶⣒⢳⣆⠀⠀⠀⠀⢠⡞⣒⣲⣶⣖⣶⣦⡀⠀⠉⠛⠁
  6. //~ ⠀⠀⠴⢯⣁⣿⣿⣿⣏⣿⡀⠟⠀⠀⠀⠀⠸⠀⣼⣋⣿⣿⣿⣦⣭⠷⠀⠀⠀
  7. //~ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  8. //~ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀
  9. //~ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠀⠀
  10. //~ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡄⠀⢰⠏⠀⠀⠀
  11. //~ ⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⡴⠟⠁⢀⡟⠀⠀⠀⠀
  12. //~ ⠀⠀⠀⠀⠀⠀⠸⡗⠶⠶⠶⠶⠶⠖⠚⠛⠛⠋⠉⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀
  13. //~ ⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠀⠀⠀⠀⠀
  14. #ifndef BEAN_HEADER
  15. #define BEAN_HEADER
  16. // standard headers
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. // custom headers
  20. #include "BASIC_TYPES.h"
  21. #include "MEM_SPACE.h"
  22. #include "ENDIAN.h"
  23. #include "ARRAY/BYTE_ARR.h"
  24. #include "ARRAY/ARRAY.h"
  25. // table to hold all existant variable sizes
  26. // this table has to be synced with the var_[header] enums
  27. umax VAR_SIZE[] = {
  28. sizeof(char),
  29. sizeof(byte),
  30. sizeof(smax),
  31. sizeof(umax),
  32. sizeof(fmax),
  33. sizeof(bool),
  34. sizeof(var_basic_types),
  35. sizeof(mem_space),
  36. sizeof(mem_space_err),
  37. sizeof(endian_type),
  38. sizeof(byteshift_type),
  39. sizeof(bytarr),
  40. };
  41. // table to hold all existant variable names
  42. // this table has to be synced with the var_[header] enums
  43. char * VAR_NAME[] = {
  44. "CHAR",
  45. "BYTE",
  46. "SMAX",
  47. "UMAX",
  48. "FMAX",
  49. "BOOL",
  50. "VAR_BASIC_TYPES",
  51. "MEM_SPACE",
  52. "MEM_SPACE_ERR",
  53. "ENDIAN_TYPE",
  54. "BYTESHIFT_TYPE",
  55. "BYTARR",
  56. };
  57. // bean startup function
  58. void BEAN_INIT(void)
  59. {
  60. CHECK_SYS_ENDIAN();
  61. return;
  62. }
  63. // print all bean's variable type info
  64. void BEAN_PRINT_VAR_INFO(void)
  65. {
  66. printf("BEAN'S VARIABLE TYPES LIST:\n");
  67. printf("NAME - VALUE - SIZE\n");
  68. for (umax i = 0; i < sizeof(VAR_SIZE) / sizeof(umax); i++)
  69. printf("%-15s - %llu - %llu\n", VAR_NAME[i], i, VAR_SIZE[i]);
  70. putchar('\n');
  71. return;
  72. }
  73. #endif // BEAN_HEADER