implemented Setup.hs to build boehm cpp libs and install them;
[hs-boehmgc.git] / gc-7.2 / tests / staticrootslib.c
1
2 /* This test file is intended to be compiled into a DLL. */
3
4 #include <stdio.h>
5
6 #ifndef GC_DEBUG
7 # define GC_DEBUG
8 #endif
9
10 #include "gc.h"
11
12 struct treenode {
13     struct treenode *x;
14     struct treenode *y;
15 } * root[10];
16
17 struct treenode * libsrl_mktree(int i)
18 {
19   struct treenode * r = GC_MALLOC(sizeof(struct treenode));
20   if (0 == i) return 0;
21   if (1 == i) r = GC_MALLOC_ATOMIC(sizeof(struct treenode));
22   if (r) {
23     r -> x = libsrl_mktree(i-1);
24     r -> y = libsrl_mktree(i-1);
25   }
26   return r;
27 }
28
29 void * libsrl_init(void)
30 {
31   GC_INIT();
32   return GC_MALLOC(sizeof(struct treenode));
33 }