Started working on a C wrapper
This commit is contained in:
parent
3e9ed4e16b
commit
ee53759ca5
3 changed files with 50 additions and 3 deletions
22
src/GC/include/cheap.h
Normal file
22
src/GC/include/cheap.h
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef __CHEAP_H__
|
||||||
|
#define __CHEAP_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct cheap;
|
||||||
|
typedef struct cheap cheap_t;
|
||||||
|
|
||||||
|
cheap_t *cheap_the();
|
||||||
|
void cheap_init();
|
||||||
|
void cheap_dispose();
|
||||||
|
void *cheap_alloc(unsigned long size);
|
||||||
|
void cheap_set_profiler(bool mode);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __CHEAP_H__ */
|
||||||
25
src/GC/lib/cheap.cpp
Normal file
25
src/GC/lib/cheap.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "heap.hpp"
|
||||||
|
#include "cheap.h"
|
||||||
|
|
||||||
|
struct cheap {
|
||||||
|
void *obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
cheap_t *cheap_the() {
|
||||||
|
cheap_t *c;
|
||||||
|
GC::Heap *heap;
|
||||||
|
|
||||||
|
c = (cheap_t *)malloc(sizeof(*c));
|
||||||
|
heap = &GC::Heap::the();
|
||||||
|
c->obj = heap;
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cheap_init() {
|
||||||
|
GC::Heap::init();
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <chrono>
|
// #include <chrono>
|
||||||
#include <iostream>
|
// #include <iostream>
|
||||||
#include <list>
|
// #include <list>
|
||||||
|
|
||||||
#include "chunk.hpp"
|
#include "chunk.hpp"
|
||||||
#include "event.hpp"
|
#include "event.hpp"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue