Mercurial > hg > Gears > Gears
changeset 1028:4fe4c52b148f
delete Unnecessary Files
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 31 Mar 2022 14:13:34 +0900 |
parents | a747a99ae1f2 |
children | 27e7dad30860 |
files | src/parallel_execution/CMakeLists.txt src/parallel_execution/examples/generics_hello/GHello.h src/parallel_execution/examples/generics_hello/GHelloImpl.cbc src/parallel_execution/examples/generics_hello/GHelloImpl.h src/parallel_execution/examples/generics_hello/String.h src/parallel_execution/examples/generics_hello/StringImpl.cbc src/parallel_execution/examples/generics_hello/StringImpl.h src/parallel_execution/examples/generics_hello/main.cbc src/parallel_execution/examples/generics_test/StackGenericsImpl.cbc src/parallel_execution/examples/generics_test/main.cbc src/parallel_execution/examples/new_wc/NewWcMain.h src/parallel_execution/examples/new_wc/Wc.h src/parallel_execution/examples/new_wc/WordCount.h src/parallel_execution/examples/new_wc/WordCountImpl.cbc src/parallel_execution/examples/new_wc/WordCountImpl.h src/parallel_execution/examples/new_wc/WordPut.h src/parallel_execution/examples/new_wc/WordPutImpl.cbc src/parallel_execution/examples/new_wc/WordPutImpl.h src/parallel_execution/examples/new_wc/main.cbc src/parallel_execution/examples/new_wc/wcString.h src/parallel_execution/examples/new_wc/wcStringImpl.cbc src/parallel_execution/examples/new_wc/wcStringImpl.h src/parallel_execution/examples/queueListTree/Key.h src/parallel_execution/examples/queueListTree/QueueListTree.h src/parallel_execution/examples/queueListTree/QueueListTreeImpl.h src/parallel_execution/examples/queueListTree/String.h src/parallel_execution/examples/queueListTree/main.cbc src/parallel_execution/examples/queueListTree/queueListTreeImpl.cbc src/parallel_execution/examples/socketQueue/DataTransfer.h src/parallel_execution/examples/socketQueue/DataTransferImpl.cbc src/parallel_execution/examples/socketQueue/DataTransferImpl.h src/parallel_execution/examples/socketQueue/wc_counter.cbc src/parallel_execution/examples/socketQueue/wc_sender.cbc |
diffstat | 33 files changed, 0 insertions(+), 950 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt Thu Mar 31 14:02:10 2022 +0900 +++ b/src/parallel_execution/CMakeLists.txt Thu Mar 31 14:13:34 2022 +0900 @@ -287,25 +287,3 @@ SOURCES examples/socketQueue/RemoteDGMQueue.cbc examples/socketQueue/wordCount_Remote.cbc AtomicReference.cbc SingleLinkedStack.cbc ) - - -GearsCommand( - TARGET - wc_sender - SOURCES - examples/socketQueue/RemoteDGMQueue.cbc examples/socketQueue/LocalDGMQueue.cbc examples/socketQueue/wc_sender.cbc AtomicReference.cbc SingleLinkedStack.cbc -) - -GearsCommand( - TARGET - wc_counter - SOURCES - examples/socketQueue/RemoteDGMQueue.cbc examples/socketQueue/LocalDGMQueue.cbc examples/socketQueue/wc_counter.cbc AtomicReference.cbc SingleLinkedStack.cbc -) - -GearsCommand( - TARGET - queueListTree - SOURCES - examples/queueListTree/main.cbc examples/queueListTree/queueListTreeImpl.cbc AtomicReference.cbc SynchronizedQueue.cbc SingleLinkedStack.cbc RedBlackTree.cbc compare.c -) \ No newline at end of file
--- a/src/parallel_execution/examples/generics_hello/GHello.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -typedef struct GHello <> { - union Data* gHello; - __code makeT(Impl* gHello, __code next(...)); - __code printT(Impl* gHello, __code next(...)); - __code next(...) -} GHello; \ No newline at end of file
--- a/src/parallel_execution/examples/generics_hello/GHelloImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -#interface "GHello.h" -#impl "GHello.h" as "GHelloImpl.h" - -//typedef struct GHelloImpl impl GHello { -// struct String<int> string; -// __code next(...); -//} GHelloImpl; - - -GHello *createGHelloImpl(struct Context* context, String<int> str) { - struct GHello* gHello = new GHello(); - struct GHelloImpl* g_hello_impl = new GHelloImpl(); - gHello->gHello; = (union Data*)g_hello_impl; - g_hello_impl->string = str; - gHello->makeT = C_makeTGHelloImpl; - gHello->printT = C_printTGHelloImpl; - return gHello;; -} -__code makeT(struct GHelloImpl* gHello, __code next(...)) { - - goto next(...); -} - -__code printT(struct GHelloImpl* gHello, __code next(...)) { - printf("%s", gHello->string); - goto next(...); -} -
--- a/src/parallel_execution/examples/generics_hello/GHelloImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -typedef struct GHelloImpl <> impl GHello { - String<int> string; - __code next(...); -} GHelloImpl;
--- a/src/parallel_execution/examples/generics_hello/String.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -typedef struct String <T>{ - __code setString(Impl* gHello, T str, __code next(...)); - __code next(...) -} String; \ No newline at end of file
--- a/src/parallel_execution/examples/generics_hello/StringImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -#include "../../../context.h" -#interface "String.h" -#impl "String.h" as "StringImpl.h" -#include <stdio.h> - -// ---- -// typedef struct StringImpl <T> impl String { -// __code next(...); -// } StringImpl; -// ---- - -String<T> *createStringImpl(struct Context* context, T str) { - struct String<T>* gHello = new String(); - struct StringImpl<T>* string_impl = new StringImpl(); - gHello->gHello = (union Data*)string_impl; - gHello->str = str; - gHello->setString = C_setStringStringImpl; - return gHello; -} -__code setString(struct StringImpl* gHello, T str, __code next(...)) { - goto next(...); -} -
--- a/src/parallel_execution/examples/generics_hello/StringImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -typedef struct StringImpl <T> impl String { - __code next(...); -} StringImpl;
--- a/src/parallel_execution/examples/generics_hello/main.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - - -#include "../../../context.h" -#interface "TaskManager.h" -#interface "GHello.h" - -int cpu_num = 1; -int length = 102400; -int split = 8; -int* array_ptr; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto code1(); -} - -__code code1(struct LoopCounter* loopCounter) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - printf("length/task:\t%d\n", length/split); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - goto createTask1(); -} - - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - String<int>* string = createStringImpl<int>(context, 123); - GHello* gHello = createHelloImpl(context, string); - goto gHello->printT(gHello->printT); -} - - -__code code2(struct TaskManager* taskManager) { - goto taskManager->shutdown(exit_code); -} - -__code code2_stub(struct Context* context) { - goto code2(context, &Gearef(context, TaskManager)->taskManager->TaskManager); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-s") == 0) - split = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - goto initDataGears(); -}
--- a/src/parallel_execution/examples/generics_test/StackGenericsImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -#include "../../context.h" -#interface "StackGenerics.h" - -// ---- -// typedef struct StackGenericsImpl <> impl StackGenerics { -// __code next(...); -// } StackGenericsImpl; -// ---- - -StackGenerics* createStackGenericsImpl(struct Context* context) { - struct StackGenerics* stack = new StackGenerics(); - struct StackGenericsImpl* stack_generics_impl = new StackGenericsImpl(); - stack->stack = (union Data*)stack_generics_impl; - stack->clear = C_clearStackGenericsImpl; - stack->push = C_pushStackGenericsImpl; - stack->pop = C_popStackGenericsImpl; - stack->pop2 = C_pop2StackGenericsImpl; - stack->isEmpty = C_isEmptyStackGenericsImpl; - stack->get = C_getStackGenericsImpl; - stack->get2 = C_get2StackGenericsImpl; - return stack; -} -__code clear_StackGenericsImpl(struct StackGenericsImpl* stack,__code next(...)) { - stack->top = NULL; - goto next(...); -} - -__code push_StackGenericsImpl(struct StackGenericsImpl* stack,T* data, __code next(...)) { - Element* element = new Element(); - element->next = stack->top; - element->data = (union Data*)*data; - stack->top = element; - goto next(...); -} - -__code pop_StackGenericsImpl(struct StackGenericsImpl* stack, __code next(T* data, ...)) { - if (stack->top) { - data = (T*)stack->top->data; - stack->top = stack->top->next; - } else { - data = NULL; - } - goto next(data, ...); -} - -__code pop2_StackGenericsImpl(struct StackGenericsImpl* stack, __code next(T* data, T* data1, ...)) { - if (stack->top) { - data = (T*)stack->top->data; - stack->top = stack->top->next; - } else { - data = NULL; - } - if (stack->top) { - data1 = (T*)tack->top->data; - stack->top = stack->top->next; - } else { - data1 = NULL; - } - goto next(data, data1, ...); -} - -__code isEmpty_StackGenericsImpl(struct StackGenericsImpl* stack, __code next(...), __code whenEmpty(...)) { - if (stack->top) { - goto next(...); - } else { - goto whenEmpty(...); - } -} - -__code get_StackGenericsImpl(struct StackGenericsImpl* stack, __code next(T* data, ...)) { - if (stack->top) { - data = (T*)stack->top->data; - } else { - data = NULL; - } - goto next(data, ...); -} - -__code get2_StackGenericsImpl(struct StackGenericsImpl* stack, __code next(T* data, T* data1, ...)) { - if (stack->top) { - data = (T*)stack->top->data; - if (stack->top->next) { - data1 = (T*)stack->top->next->data; - } else { - data1 = NULL; - } - } else { - data = NULL; - data1 = NULL; - } - goto next(data, data1, ...); -} -
--- a/src/parallel_execution/examples/generics_test/main.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#interface "StackGenerics.h" -#interface "Interger.h" - -__code gmain(){ - StackGenerics<Integer>* generics_list = createStackGenericsImpl(); - Integer* intA = new Integer(); - intA->value = 90; - goto generics_list->push(intA, shutdown); -}
--- a/src/parallel_execution/examples/new_wc/NewWcMain.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -typedef struct NewWcMain <>{ -struct LoopCounter* loopCounter; -struct TaskManager* taskManager; -} NewWcMain; \ No newline at end of file
--- a/src/parallel_execution/examples/new_wc/Wc.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -typedef struct Wc <> { - union Data* wc; - WcResult* result; - int line; - union Data* string; - __code openFile(Impl* wc, __code next(...)); - __code putString(Impl* wc, int line, __code next(...)); - __code countUp(Impl* wc, Type* string, __code next(...)); - __code next(...); -} Wc;
--- a/src/parallel_execution/examples/new_wc/WordCount.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -typedef struct WordCount <> { - union Data* wordCount; - struct WordPut* wordPut; - union Data* data; - __code getWord(Impl* wordCount, Type* wordPut, union Data* data,__code next(...)); - __code next(...); -} WordCount;
--- a/src/parallel_execution/examples/new_wc/WordCountImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -#interface "WordCount.h" -#impl "WordCount.h" as "WordCountImpl.h" -#interface "WordPut.h" - -#interface "wcString.h" - -// ---- -// typedef struct WordCountImpl <> impl WordCount { -// int wordNum; -// } WcImpl; -// ---- - -WordCount* createWordCountImpl(struct Context* context) { - struct WordCount* wordCount = new WordCount(); - struct WordCountImpl* word_count_impl = new WordCountImpl(); - wordCount->wordCount = (union Data*)word_count_impl; - word_count_impl->wordNum = 0; - wordCount->getWord = C_getWordWordCountImpl; - return wordCount; -} -__code getWord(struct WordCountImpl* wordCount, struct WordPut* wordPut, struct wcString* string, __code next(...)) { - printf("移動した\n"); - //goto next(num); -} -
--- a/src/parallel_execution/examples/new_wc/WordCountImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -typedef struct WordCountImpl <> impl WordCount { - int wordNum; - char* str; -} WordCountImpl;
--- a/src/parallel_execution/examples/new_wc/WordPut.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -typedef struct WordPut <> { - union Data* wordPut; - __code openFile(Impl* wordPut, __code next(...)); - __code Put(Impl* wordPut, struct WordCount* wordcount, __code next(...)); - __code next(...); -} WordPut;
--- a/src/parallel_execution/examples/new_wc/WordPutImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -#include "../../../context.h" -#interface "WordPut.h" -#impl "WordPut.h" as "WordCountImpl.h" -#interface "WordCount.h" -#include <stdio.h> - -#interface "wcString.h" - -// ---- -// typedef struct WordPutImpl <> impl WordPut { -// char* filename; -// } WordPutImpl; -// ---- - -WordPut* createWordPutImpl(struct Context* context, char* fn) { - struct WordPut* wordPut = new WordPut(); - struct WordPutImpl* word_put_impl = new WordPutImpl(); - wordPut->wordPut = (union Data*)word_put_impl; - word_put_impl->lineNum = 0; - word_put_impl->filename = fn; - wordPut->openFile = C_openFileWordPutImpl; - wordPut->Put = C_PutWordPutImpl; - word_put_impl->wordLen = 1000; - return wordPut; -} -__code openFile(struct WordPutImpl* wordPut, __code next(...)) { - printf("%s\n", wordPut->filename); - WordCount* wordCount = new WordCount(); - FILE* file = fopen(wordPut->filename, "r"); - if (file == NULL){ - printf("ファイルが開ませんでした\n"); - exit(1); - } else { - printf("file open\n"); - } - - wordPut->file = (union Data*)file; - wordPut->lineNum = 4; - goto Put(wordCount); -} - -__code Put(struct WordPutImpl* wordPut, struct WordCount* wordCount, __code next(...)) { - printf("Put\n"); - char* str; - int count = 0; - printf("%d\n", wordPut->lineNum); - while (fgets(str, wordPut->wordLen, wordPut->file) != NULL && count < wordPut->lineNum) { - if(count == wordPut->lineNum -1){ - wcString* string = new wcString()); - string->str = str; - printf("%s", string->str); - goto wordCount->getWord(wordPut, openFile); - } - count ++; - } -} -
--- a/src/parallel_execution/examples/new_wc/WordPutImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -typedef struct WordPutImpl <> impl WordPut { - char* filename; - int lineNum; - int wordLen; - union Data* file; -} WordPutImpl; \ No newline at end of file
--- a/src/parallel_execution/examples/new_wc/main.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - - -#include "../../../context.h" -#interface "TaskManager.h" -#interface "WordPut.h" -#interface "WordCount.h" - -int cpu_num = 1; -int length = 102400; -int split = 8; -int* array_ptr; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; -char* filename; - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto code1(); -} - -__code code1(struct LoopCounter* loopCounter) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - printf("length/task:\t%d\n", length/split); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - goto createTask1(); -} - - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - WordPut* wordPut = createWordPutImpl(context, filename); - //WordCount* wordCount = createWordCountImpl(context); - goto wordPut->openFile(code2); -} - - -__code code2(struct TaskManager* taskManager) { - printf("code2 & end\n"); - goto taskManager->shutdown(exit_code); -} - -__code code2_stub(struct Context* context) { - goto code2(context, &Gearef(context, TaskManager)->taskManager->TaskManager); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-s") == 0) - split = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } else if (strcmp(argv[i], "-f") == 0) { - filename = argv[i+1]; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - goto initDataGears(); -}
--- a/src/parallel_execution/examples/new_wc/wcString.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -typedef struct wcString <> { - char* str; -} wcString; \ No newline at end of file
--- a/src/parallel_execution/examples/new_wc/wcStringImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#include "../../../context.h" -#interface "wcString.h" - -// ---- -// typedef struct wcStringImpl <> impl wcString { -// char* string; -// __code next(...); -// } wcStringImpl; -// ---- - -* createwcString(struct Context* context) { - struct * char* string; = new (); - struct wcString* wc_string = new wcString(); - char* string;->char* string; = (union Data*)wc_string; - wc_string->wcString = NULL; - return char* string;; -}
--- a/src/parallel_execution/examples/new_wc/wcStringImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -typedef struct wcStringImpl <> impl wcString { - __code next(...); -} wcStringImpl; \ No newline at end of file
--- a/src/parallel_execution/examples/queueListTree/Key.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -typedef struct Key<>{ - int* keyNum; - char* keyName; -} Key;
--- a/src/parallel_execution/examples/queueListTree/QueueListTree.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -typedef struct QueueListTree<>{ - union Data* queueListTree; - union Data* data; - struct Key* key; - - __code put(Impl* queueListTree, struct Key* key, union Data* data, __code next(...)); - __code take(Impl* queueListTree, struct Key* key, __code next(...)); - __code peek(Impl* queueListTree, struct Key* key, __code next(...)); - __code addKey(Impl* queueListTree, struct Key* key, __code next(...)); - __code next(...); -} QueueListTree;
--- a/src/parallel_execution/examples/queueListTree/QueueListTreeImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -typedef struct QueueListTreeImpl <> impl QueueListTree{ - struct Tree* listTree; - struct Queue* currentQueue; - int* socket; -} QueueListTreeImpl;
--- a/src/parallel_execution/examples/queueListTree/String.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -typedef struct String<>{} - char* str; -} String;
--- a/src/parallel_execution/examples/queueListTree/main.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -#include "../../../context.h" -#interface "QueueListTree.h" -#interface "Key.h" -#interface "String.h" - -__code Task1(QueueListTree* queueListTreeImpl){ - Key* key = new Key(); - key->keyNum = 1; - goto queueListTreeImpl->addKey(key, Task2); -} - -__code Task1_stub(struct Context* context){ - QueueListTree* queueListTreeImpl = createQueueListTreeImpl(context); - goto Task1(context, queueListTreeImpl); -} - -__code Task2(QueueListTree* queueListTreeImpl){ - String* string = new String(); - string->str = "first"; - Key* key = new Key(); - key->keyNum = 1; - goto queueListTreeImpl->put(key, string, Task3); -} - -__code Task2_stub(struct Context* context){ - QueueListTree* queueListTreeImpl = (struct QueueListTree*)Gearef(context, QueueListTree)->queueListTree; - goto Task2(context, queueListTreeImpl); -} - - -__code Task3(QueueListTree* queueListTreeImpl){ - Key* key = new Key(); - key->keyNum = 1; - goto queueListTreeImpl->take(key, Task4); -} - -__code Task3_stub(struct Context* context){ - QueueListTree* queueListTreeImpl = (struct QueueListTree*)Gearef(context, QueueListTree)->queueListTree; - goto Task3(context, queueListTreeImpl); -} - -__code Task4(QueueListTree* queueListTreeImpl, String* str){ - -} - -__code Task4_stub(struct Context* context){ - QueueListTree* queueListTreeImpl = (struct QueueListTree*)Gearef(context, QueueListTree)->queueListTree; - String* str = Gearef(context, Queue)->data; - goto Task4(context, queueListTreeImpl, str); -} - - -int main(int argc, char** argv) { - printf("main\n"); - goto Task1(); -}
--- a/src/parallel_execution/examples/queueListTree/queueListTreeImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -#include "../../../context.h" -#interface "QueueListTree.h" -#interface "Queue.h" -#interface "Key.h" -#impl "QueueListTree.h" as "QueueListTreeImpl.h" - - -// ---- -// typedef struct QueueListTreeImpl <> impl QueueListTree{ -// struct Tree* listTree; -// struct Queue* currentQueue; -// int* socket; -// } QueueListTree; -// ---- - -QueueListTree* createQueueListTreeImpl(struct Context* context) { - struct QueueListTree* queueListTree = new QueueListTree(); - struct QueueListTreeImpl* queue_list_tree_impl = new QueueListTreeImpl(); - queueListTree->queueListTree = (union Data*)queue_list_tree_impl; - queueListTree->data = NULL; - queueListTree->key = NULL; - queue_list_tree_impl->listTree = createRedBlackTree(context); - queue_list_tree_impl->currentQueue = NULL; - queue_list_tree_impl->socket = NULL; - queueListTree->put = C_putQueueListTreeImpl; - queueListTree->take = C_takeQueueListTreeImpl; - queueListTree->peek = C_peekQueueListTreeImpl; - queueListTree->addKey = C_addKeyQueueListTreeImpl; - return queueListTree; -} -__code putQueueListTreeImpl(struct QueueListTreeImpl* queueListTree, struct Key* key, union Data* data, __code next(...)) { - struct Tree* tree = new Tree(); - tree = queueListTree->listTree; - Node* node = new Node(); - node->key = key->keyNum; - goto tree->get(node, put2QueueListTreeImpl); -} - -__code put2QueueListTreeImpl(struct QueueListTreeImpl* queueListTree, struct Node* node, union Data* data, __code next(...)) { - Queue* queue = new Queue(); - queue = node->value; - goto queue->put(data, next(...)); -} - -__code put2QueueListTreeImpl_stub(struct Context* context) { - QueueListTreeImpl* queueListTree = (QueueListTreeImpl*)GearImpl(context, QueueListTree, queueListTree); - union Data* data = Gearef(context, QueueListTree)->data; - Node* node = Gearef(context, Tree)->node; - enum Code next = Gearef(context, QueueListTree)->next; - goto put2QueueListTreeImpl(context, queueListTree, node, data, next); -} - -__code addKeyQueueListTreeImpl(struct QueueListTreeImpl* queueListTree, struct Key* key, __code next(...)) { - struct Queue* queue = createSynchronizedQueue(context); - Node* node = new Node(); - node->key = key->keyNum; - node->value = queue; - struct Tree* tree = new Tree(); - tree = queueListTree->listTree; - goto tree->put(node, next(...)); -} - -__code takeQueueListTreeImpl(struct QueueListTreeImpl* queueListTree, struct Key* key, __code next(...)) { - struct Tree* tree = new Tree(); - tree = queueListTree->listTree; - Node* node = new Node(); - node->key = key->keyNum; - goto tree->get(node, take2QueueListTreeImpl); -} - -__code take2QueueListTreeImpl(struct QueueListTreeImpl* queueListTree, struct Node* node, __code next(...)) { - Queue* queue = new Queue(); - queue = node->value; - goto queue->take(next(...)); -} - -__code take2QueueListTreeImpl_stub(struct Context* context) { - QueueListTreeImpl* queueListTree = (QueueListTreeImpl*)GearImpl(context, QueueListTree, queueListTree); - Node* node = Gearef(context, Tree)->node; - enum Code next = Gearef(context, QueueListTree)->next; - goto take2QueueListTreeImpl(context, queueListTree, node, next); -} - -__code returnMain(struct QueueListTreeImpl*,){ - -} - -__code peekQueueListTreeImpl(struct QueueListTreeImpl* queueListTree, struct Key* key, __code next(...)) { - -} -
--- a/src/parallel_execution/examples/socketQueue/DataTransfer.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -typedef struct DataTransfer<>{ - union Data* dataTransfer; - struct Element* element; - - __code getData(Impl* dataTransfer, __code next(...)); - __code putData(Impl* dataTransfer, Type* element, __code next(...)); - __code next(...); -} DataTransfer;
--- a/src/parallel_execution/examples/socketQueue/DataTransferImpl.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -#include "../../../context.h" -#interface "DataTransfer.h" -#impl "DataTransfer.h" as "DataTransfer.h" - - -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <netdb.h> -#define BUF_SIZR 1024 - - -// ---- -// typedef struct DataTransferImpl <> impl DataTransfer{ -// int* socket; -// } DataTransfer; -// ---- - -DataTransfer* createDataTransferImpl(struct Context* context) { - struct DataTransfer* dataTransfer = new DataTransfer(); - struct DataTransferImpl* data_transfer_impl = new DataTransferImpl(); - dataTransfer->dataTransfer = (union Data*)data_transfer_impl; - dataTransfer->element = NULL; - data_transfer_impl->socket = createSocket(); - dataTransfer->getData = C_getDataDataTransferImpl; - dataTransfer->putData = C_putDataDataTransferImpl; - return dataTransfer; -} - -int* createSocket(){ - int w_addr, c_sock; - struct sockaddr_in a_addr; - char *hostname = "Localhost"; - char *service = "8080"; - struct addrinfo hints, *res0, *res; - int err; - - memset(&hints, 0, sizeof(hints)); - hints.ai_socktype = SOCK_STREAM; - hints.ai_family = PF_UNSPEC; //UNSPECはIPv4,6両方のうち使えるものを返す - if((err = getaddrinfo(hostname, service, &hints, &res0)) != 0){ - printf("error %d\n" , err); - return 1; - } - - for (res=res0; res!=NULL; res=res->ai_next){ - w_addr = socket(res->ai_family, res->ai_socktype, res->ai_protocol); //AF_INETは古い - break; - } - - if (w_addr == -1) { - printf("socket error\n"); - return -1; - } - - struct in_addr { - u_int32_t s_addr; - }; - - memset(&a_addr, 0, sizeof(struct sockaddr_in)); - - a_addr.sin_family = PF_UNSPEC; - a_addr.sin_port = res->ai_addr; - a_addr.sin_addr.s_addr = res->ai_addrlen; - - if (bind(w_addr, res->ai_addr, res->ai_addrlen) == -1) { - printf("bind error\n"); - close(w_addr); - return -1; - } - - if (listen(w_addr, 3) == -1) { - printf("listen error\n"); - close(w_addr); - return -1; - } - - - printf("Waiting connect...\n"); - c_sock = accept(w_addr, NULL, NULL); - if (c_sock == -1) { - printf("accept error\n"); - close(w_addr); - return -1; - } - printf("Connected!!\n"); - return c_sock; -} - - -__code getData(struct DataTransferImpl* dataTransfer, __code next(...)) { - printf("getData"); - goto next(...); -} - -__code putData(struct DataTransferImpl* dataTransfer, struct DataTransfer* element, __code next(...)) { - - goto next(...); -} -
--- a/src/parallel_execution/examples/socketQueue/DataTransferImpl.h Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -typedef struct DataTransferImpl <> impl DataTransfer{ - int* socket; -} DataTransferImpl;
--- a/src/parallel_execution/examples/socketQueue/wc_counter.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#include "../../../context.h" -#interface "TQueue.h" -#interface "Integer.h" -#interface "FileString.h" -#interface "DataTransfer.h" - -#include <unistd.h> -#include <stdlib.h> -#include <fcntl.h> -#include <string.h> -#define BUFFERING_MODE _IOLBF -char* filename; -char* strTable[1024]; -int num = 0; -char* service_num; - - -__code createLDGM_RDGM(){ - TQueue* RDGM = createRemoteDGMQueue(context, "10001"); - TQueue* LDGM = createLocalDGMQueue(context, "10002"); - goto Task3(RDGM, LDGM) -} - - -__code LoopTask(TQueue* remoteDGMQueue){ - printf("Looping\n"); - goto Task3(); -} - -__code LoopTask_stub(struct Context* context){ - TQueue* remoteDGMQueue = (struct TQueue*)Gearef(context, TQueue)->tQueue; - goto LoopTask(context, remoteDGMQueue); -} - -__code Task3(TQueue* remoteDGMQueue, TQueue* LocalDGM){ - if (strTable[num] == NULL){ - goto putEOF(); - } - printf("size is %d\n", strlen(strTable[num])); - FileString* string = NEW(FileString); - memcpy(string->str, strTable[num], strlen(strTable[num])); - printf("%s\n", string->str); - num ++; - goto remoteDGMQueue->put(Task3, LoopTask); -} - -__code Task3_stub(struct Context* context){ - TQueue* remoteDGMQueue = (struct TQueue*)Gearef(context, TQueue)->tQueue; - goto Task3(context, remoteDGMQueue); -} - -__code putEOF(TQueue* remoteDGMQueue){ - FileString* string = NEW(FileString); - char EOF[1024] = "finish"; - - memcpy(string->str, EOF, strlen(EOF)); - printf("%s\n", EOF); - goto remoteDGMQueue->put(string, exit_code); -} - -__code putEOF_stub(struct Context* context){ - TQueue* remoteDGMQueue = (struct TQueue*)Gearef(context, TQueue)->tQueue; - goto putEOF(context, remoteDGMQueue); -} - - -int main(int argc, char** argv) { - printf("main\n"); - goto createLDGM_RDGM(); -}
--- a/src/parallel_execution/examples/socketQueue/wc_sender.cbc Thu Mar 31 14:02:10 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -#include "../../../context.h" -#interface "TQueue.h" -#interface "Integer.h" -#interface "FileString.h" -#interface "DataTransfer.h" -#interface "WcInterface.h" - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <fcntl.h> -#include <string.h> -#define BUFFERING_MODE _IOLBF -char* filename; -char* strTable[1024]; -int num = 0; -char* service_num; - -__code Task1(TQueue* lDGM, TQueue* rDGM){ - int fd = open(filename, O_RDONLY); - if (fd == -1){ - printf("ファイルが開ませんでした\n"); - exit(1); - } else { - printf("file open\n"); - } - - int buf_size = 10000; - char* buffer[buf_size]; - int rc = read(fd, buffer, buf_size); - if (rc == -1){ - printf("ファイルが読み込めませんでした"); - } else { - - } - - char* buff[1000]; - strcpy(buff ,buffer); - int count = 0; - strTable[0] = strtok(buff, "\n"); - printf("%s\n" ,strTable[count]); - while (strTable[count] != NULL){ - count++; - strTable[count] = strtok(NULL, "\n"); - printf("%s\n" ,strTable[count]); - } - - goto sendD(lDGM, rDGM); -} - -__code Task1_stub(struct Context* context){ - TQueue* lDGM = createLocalDGMQueue(context, "10001"); - sleep(1); - TQueue* rDGM = createRemoteDGMQueue(context, "10002") - Gearef(context, wcInterface)->LDGM = lDGM; - Gearef(context, wcInterface)->RDGM = rDGM; - goto Task1(context, lDGM, rDGM); -} - - - -__code sendD(TQueue* lDGM,TQueue* rDGM){ - if (strTable[num] == NULL){ - goto putEOF(); - } - printf("size is %d\n", strlen(strTable[num])); - FileString* string = NEW(FileString); - memcpy(string->str, strTable[num], strlen(strTable[num])); - printf("%s\n", string->str); - num ++; - goto rDGM->put(string, sendD); -} - -__code sendD_stub(struct Context* context){ - TQueue* lDGM = Gearef(context, WcInterface)->LDGM; - TQueue* rDGM = Gearef(context, WcInterface)->RDGM; - goto sendD(context, lDGM, rDGM); -} - -__code putEOF(TQueue* rDGM){ - FileString* string = NEW(FileString); - char endF[1024] = "finish"; - - memcpy(string->str, endF, strlen(endF)); - printf("%s\n", endF); - goto rDGM->put(string, exit_code); -} - -__code putEOF_stub(struct Context* context){ - TQueue* rDGM = (struct TQueue*)Gearef(context, TQueue)->tQueue; - goto putEOF(context, rDGM); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-f") == 0){ - filename = argv[i+1]; - } - } -} - -int main(int argc, char** argv) { - printf("main\n"); - init(argc, argv); - printf("%s\n", filename); - goto Task1(); -}