Utils.h 598 B

1234567891011121314151617181920212223242526
  1. #ifndef BASIC_UTILS_H
  2. #define BASIC_UTILS_H
  3. #include "Types.h"
  4. #define CLEAN_LIST(var, Type, field) \
  5. do { \
  6. Type* v = var->field; \
  7. while(v != nullptr) { \
  8. Type* next = v->next; \
  9. memoryFree(v); \
  10. v = next; \
  11. } \
  12. var->field = nullptr; \
  13. } while(false)
  14. typedef struct {
  15. i8 data[4];
  16. u32 length;
  17. } UTF8;
  18. UTF8 convertUnicodeToUTF8(i32 c);
  19. i32 convertUTF8toUnicode(UTF8 c);
  20. bool isUTF8Remainder(i8 c);
  21. #endif