ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
|
Last change
on this file since 7527e63 was bee4283, checked in by Thierry Delisle <tdelisle@…>, 9 years ago |
|
GC files now compile, still working on a compiling example
|
-
Property mode
set to
100644
|
|
File size:
922 bytes
|
| Line | |
|---|
| 1 | #include "gc.h"
|
|---|
| 2 |
|
|---|
| 3 | struct List_t
|
|---|
| 4 | {
|
|---|
| 5 | gcpointer(List_t) next;
|
|---|
| 6 | int val;
|
|---|
| 7 | };
|
|---|
| 8 |
|
|---|
| 9 | void ?{}(List_t* this);
|
|---|
| 10 | List_t* ?=?(List_t* this, List_t* rhs);
|
|---|
| 11 |
|
|---|
| 12 | typedef gcpointer(List_t) LLL;
|
|---|
| 13 |
|
|---|
| 14 | #define MAX (1024 * 1024)
|
|---|
| 15 |
|
|---|
| 16 | // LLL buildLLL(int sz)
|
|---|
| 17 | void bla()
|
|---|
| 18 | {
|
|---|
| 19 | int i;
|
|---|
| 20 | // LLL ll0;//, lll, llc;
|
|---|
| 21 | //
|
|---|
| 22 | // ll0 = gcmalloc();
|
|---|
| 23 | // ll0->val = 0;
|
|---|
| 24 | // lll = ll0;
|
|---|
| 25 | //
|
|---|
| 26 | // for (i = 1; i < sz; i++)
|
|---|
| 27 | // {
|
|---|
| 28 | // llc = gcmalloc();
|
|---|
| 29 | // llc->val = i;
|
|---|
| 30 | // lll->next = llc;
|
|---|
| 31 | // lll = llc;
|
|---|
| 32 | // }
|
|---|
| 33 | //
|
|---|
| 34 | // return ll0;
|
|---|
| 35 | }
|
|---|
| 36 | //
|
|---|
| 37 | // void testLLL(LLL lll)
|
|---|
| 38 | // {
|
|---|
| 39 | // unsigned char *counted;
|
|---|
| 40 | //
|
|---|
| 41 | // counted = (unsigned char *) calloc(MAX, sizeof(unsigned char));
|
|---|
| 42 | // while (lll)
|
|---|
| 43 | // {
|
|---|
| 44 | // counted[lll->val]++;
|
|---|
| 45 | // if (counted[lll->val] > 1)
|
|---|
| 46 | // {
|
|---|
| 47 | // fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val);
|
|---|
| 48 | // exit(1);
|
|---|
| 49 | // }
|
|---|
| 50 | // lll = lll->next;
|
|---|
| 51 | // }
|
|---|
| 52 | //
|
|---|
| 53 | // return;
|
|---|
| 54 | // }
|
|---|
| 55 |
|
|---|
| 56 | int main(void)
|
|---|
| 57 | {
|
|---|
| 58 | LLL mylll;
|
|---|
| 59 |
|
|---|
| 60 | // mylll = buildLLL(MAX);
|
|---|
| 61 | //
|
|---|
| 62 | // testLLL(mylll);
|
|---|
| 63 |
|
|---|
| 64 | return 0;
|
|---|
| 65 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.