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