Mercurial > hg > Gears > GearsAgda
view src/synchronizedQueue/synchronizedQueueContext.c @ 28:5d9f74220506
Add file synchronizedQueueContext
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 01 May 2015 18:23:44 +0900 |
parents | |
children | 240c045ebab2 |
line wrap: on
line source
#include "synchronizedQueueContext.h" extern __code code1(struct Context*); extern __code code2(struct Context*); extern __code code3(struct Context*); extern __code meta(struct Context*); extern __code allocate(struct Context*); extern __code put(struct Context*); extern __code take(struct Context*); extern __code exit_code(struct Context*); __code initSynchronizedQueueContext(struct Context* context) { context->codeSize = 3; context->code[Code1] = code1; context->code[Code2] = code2; context->code[Code3] = code3; context->code[Allocator] = allocate; context->code[Put] = put; context->code[Take] = take; context->code[Exit] = exit_code; context->dataSize = 0; context->heap += sizeof(struct Allocate); context->data[Allocate]->list_context = malloc(sizeof(union Data**)*ALLOCATE_SIZE); initListContext(context->data[Allocate]->list_context); } __code initListContext(struct ListContext* context) { context->data = malloc(sizeof(union ListData **)*ALLOCATE); context->heap = malloc(sizeof(union ListData *)*ALLOCATE); context->dataSize = 0; }