Mercurial > hg > Gears > GearsAgda
view src/parallel_execution/examples/Add.cbc @ 344:b8be1d51f002
Add CodeGear interface
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 26 May 2017 07:39:23 +0900 |
parents | |
children | 2da00c034fbc |
line wrap: on
line source
#include "../../context.h" CodeGear* createAddCodeGear(struct Context* context) { struct CodeGear* codeGear = new CodeGear(); struct context* addContext = NEW(struct Context); codeGear->codeGear = (union Data*)addContext; initContext(addContext); codeGear->code = C_add; codeGear->setInfo = C_setAddCodeGearInfo; return codeGear; } CodeGear* setAddCodeGearInfo(struct Context* codeGear, union Data** dataGears) { codeGear->next = C_add; codeGear->idgCount = 2; codeGear->idg = codeGear->datanum; codeGear->data[codeGear->idg] = dataGears[0]; codeGear->data[codeGear->idg+1] = dataGears[1]; codeGear->maxIdg = codeGear->idg + 2; codeGear->odg = codeGear->maxIdg; codeGear->data[codeGear->odg] = dataGears[2]; task->maxOdg = task->odg + 1; goto meta(context, C_setWaitTask) } __code setWaitTask(struct Queue* queue, struct Context* task, Data* data, __code next(...)) { queue->queue = (Data *)GET_WAIT_LIST(data); queue->next = next; queue->data = (Data *)task; goto meta(context, queue->queue->Queue.put); } __code setWaitTask_stub(struct Context* context) { goto setWaitTask(context, Gearef(context, Queue), Gearef(context, TaskManager)->context, Gearef(context, TaskManager)->data, Gearef(context, TaskManager)->next); }