Allocator.h 453 B

123456789101112131415161718192021222324252627282930
  1. #ifndef ALLOCATOR_H
  2. #define ALLOCATOR_H
  3. #include <stdbool.h>
  4. #include "Object.h"
  5. typedef struct {
  6. int length;
  7. int next;
  8. bool marked;
  9. Object* data;
  10. } Array;
  11. typedef struct {
  12. int capacity;
  13. int usedStart;
  14. int freeStart;
  15. Array* data;
  16. } Allocator;
  17. void aInit(Allocator* a);
  18. void aDelete(Allocator* a);
  19. int aAllocate(Allocator* a, int length);
  20. void aClearMarker(Allocator* a);
  21. void aRemoveUnmarked(Allocator* a);
  22. #endif