Array support
[IRC.git] / Robust / src / Runtime / runtime.c
1 #include "runtime.h"
2 #include "structdefs.h"
3 extern int classsize[];
4
5 int ___Object______hashcode____(struct ___Object___ * ___this___) {
6   return (int) ___this___;
7 }
8
9 void ___System______printInt____I(int x) {
10   printf("%d\n",x);
11 }
12
13 void * allocate_new(int type) {
14   void * v=calloc(1,classsize[type]);
15   *((int *)v)=type;
16   return v;
17 }
18
19 void * allocate_newarray(int type, int length) {
20   void * v=calloc(1,sizeof(struct ArrayObject)+length*classsize[type]);
21   ((int *)v)[0]=type;
22   ((int *)v)[1]=length;
23   return v;
24 }