Mercurial > hg > CbC > old > CbC_scripts
changeset 9:185d545a9a8e
context generation
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Sep 2015 14:56:49 +0900 |
parents | ae45108716a2 |
children | eec116fe2387 |
files | meta_connector/meta_connect_test_name.c meta_connector/meta_connector_name.py |
diffstat | 2 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/meta_connector/meta_connect_test_name.c Mon Sep 14 13:13:17 2015 +0900 +++ b/meta_connector/meta_connect_test_name.c Mon Sep 14 14:56:49 2015 +0900 @@ -41,7 +41,7 @@ goto code1(context, &context->data[Allocate]->allocate); } -__code code2(struct Context* context, long* count) { +__code code2(long* count) { *count = 0; goto meta(context, Code3); } @@ -50,7 +50,7 @@ goto code2(context, &context->data[Counter]->count); } -__code code3(struct Context* context, long* count, struct Allocate* allocate) { +__code code3(long* count, struct Allocate* allocate) { long loop = *count; if(loop == NUM) { goto meta(context, ThreadExit); @@ -64,7 +64,7 @@ goto code3(context, &context->data[Counter]->count, &context->data[Allocate]->allocate); } -__code code4(struct Context* context, long* count, struct Allocate* allocate, struct Element* element) { +__code code4(long* count, struct Allocate* allocate, struct Element* element) { allocate->after_put = Code3; element->value = (*count)++; goto meta(context, Sender); @@ -80,7 +80,7 @@ goto (context->code[next])(context); } -__code sender(struct Context* context, struct Queue* queue) { +__code sender(struct Queue* queue) { // goto meta_sender(context, queue, Put); goto put(queue); } @@ -97,7 +97,7 @@ goto (context->code[next])(context); } -__code put(struct Context* context, struct Allocate* allocate, struct Queue* queue, struct Element* element) { +__code put(struct Allocate* allocate, struct Queue* queue, struct Element* element) { if(queue->first) { queue->last->next = element; } else { @@ -114,7 +114,7 @@ goto put(context, &context->data[Allocate]->allocate, &context->data[Queue]->queue, &context->data[context->dataNum]->element); } -__code code5(struct Context* context, struct Allocate* allocate) { +__code code5(struct Allocate* allocate) { allocate->size = sizeof(long); allocate->next = Code6; goto meta(context, Allocator); @@ -124,7 +124,7 @@ goto code5(context, &context->data[Allocate]->allocate); } -__code code6(struct Context* context, long* count) { +__code code6(long* count) { *count = 0; goto meta(context, Code7); } @@ -133,7 +133,7 @@ goto code6(context, &context->data[Counter]->count); } -__code code7(struct Context* context, long* count, struct Allocate* allocate) { +__code code7(long* count, struct Allocate* allocate) { long loop = *count; if(loop == NUM) { goto meta(context, ThreadExit); @@ -153,7 +153,7 @@ goto (context->code[next])(context); } -__code receiver(struct Context* context, struct Queue* queue) { +__code receiver(struct Queue* queue) { // goto meta_receiver(context, queue, Get); goto get(queue); } @@ -166,7 +166,7 @@ goto (context->code[next])(context); } -__code get(struct Context* context, struct Allocate* allocate, struct Queue* queue, struct Element* element) { +__code get(struct Allocate* allocate, struct Queue* queue, struct Element* element) { // thread wait if queue is empty while (queue->count == 0) { pthread_cond_wait(&queue->cond, &queue->mutex);
--- a/meta_connector/meta_connector_name.py Mon Sep 14 13:13:17 2015 +0900 +++ b/meta_connector/meta_connector_name.py Mon Sep 14 14:56:49 2015 +0900 @@ -47,9 +47,13 @@ caller_name = regexed_l.group(0).rstrip('(') if re.search(r"^ *meta_*|stub$",caller_name) is not None: isMetaOrStub = True + file.write(l) else: isMetaOrStub = False - file.write(l) + splited = l.split('(',1) + file.write("/*-- generated by script */\n") + file.write('// '+l) + file.write('{0:s}(struct Context* context, {1:s}'.format(splited[0],splited[1])) elif not isMetaOrStub and regexed_l is not None and re.search(r"^ *goto",l): callee_name = regexed_l.group(0).rstrip('(') if meta_search(lines, callee_name):