#include "support.h" #include #include #include "objref.c" #include "heap.h" void fatalError(char *msg){ printf("Fatal error: %s\n", msg); exit(1); } void * newPrimObject(int dataSize) { ObjRef bigObjRef; bigObjRef = my_malloc(sizeof(unsigned int) + dataSize * sizeof(unsigned char)); if (bigObjRef == NULL) { fatalError("newPrimObject() got no memory"); } bigObjRef->size = sizeof(unsigned int) + dataSize * sizeof(unsigned char); return bigObjRef; } void * getPrimObjectDataPointer(void * obj){ ObjRef oo = ((ObjRef) (obj)); return oo->data; }