Mercurial > hg > Members > Moririn
annotate src/allocate/allocate.c @ 8:714d0ce1efd7
change configuring directory
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 01 Apr 2015 22:56:51 +0900 |
parents | src/allocate.c@ad48a076a8e5 |
children |
rev | line source |
---|---|
4 | 1 #include <stdlib.h> |
2 | |
3 #include "allocate.h" | |
4 | |
8
714d0ce1efd7
change configuring directory
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
5 __code allocate(Context* context, int size, int num, __code (*next)()) { |
714d0ce1efd7
change configuring directory
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
6 goto meta_allocate(context, size, num, next); |
4 | 7 } |
8 | |
8
714d0ce1efd7
change configuring directory
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
9 __code meta_allocate(Context* context, int size, int num, __code (*next)()) { |
714d0ce1efd7
change configuring directory
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
10 context->next = next; |
7 | 11 void* ds = context->ds; |
12 context->ds += size*num; | |
13 ((mdata*)context->mds)->ds = ds; | |
14 ((mdata*)context->mds)->size = size; | |
15 context->mds = (mdata*)context->mds+1; | |
8
714d0ce1efd7
change configuring directory
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
16 goto context->next(context, (data1*)ds, 0); |
7 | 17 } |