2020-12-26 03:32:21 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "kuroko.h"
|
2020-12-27 09:58:32 +03:00
|
|
|
#include "object.h"
|
|
|
|
#include "table.h"
|
2020-12-26 03:32:21 +03:00
|
|
|
|
|
|
|
#define GROW_CAPACITY(c) ((c) < 8 ? 8 : (c) * 2)
|
|
|
|
#define GROW_ARRAY(t,p,o,n) (t*)krk_reallocate(p,sizeof(t)*o,sizeof(t)*n)
|
|
|
|
|
|
|
|
#define FREE_ARRAY(t,a,c) krk_reallocate(a,sizeof(t) * c, 0)
|
|
|
|
#define FREE(t,p) krk_reallocate(p,sizeof(t),0)
|
|
|
|
|
|
|
|
#define ALLOCATE(type, count) (type*)krk_reallocate(NULL,0,sizeof(type)*(count))
|
|
|
|
|
|
|
|
extern void * krk_reallocate(void *, size_t, size_t);
|
|
|
|
extern void krk_freeObjects(void);
|
2020-12-27 09:58:32 +03:00
|
|
|
extern void krk_collectGarbage(void);
|
|
|
|
extern void krk_markValue(KrkValue value);
|
|
|
|
extern void krk_markObject(KrkObj * object);
|
|
|
|
extern void krk_markTable(KrkTable * table);
|
|
|
|
extern void krk_tableRemoveWhite(KrkTable * table);
|