From 1819d36ae82297acc7c2e9ac3917d6662f9ebdef Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 21 Aug 2006 20:37:41 +0000 Subject: [PATCH] checked in bug fixes... --- Robust/src/Runtime/runtime.c | 37 +++++++++++++++---------------- Robust/src/Runtime/runtime.h | 2 +- Robust/src/Tests/TaskExample.java | 3 ++- Robust/src/buildscripttask | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index 616754fc..818c6ac7 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -54,21 +54,24 @@ void flagorand(void * ptr, int ormask, int andmask) { struct parameterwrapper * parameter=objectqueues[((int *)ptr)[0]]; int i; flagptr=NULL; - for(i=0;inumberofterms;i++) { - int andmask=parameter->intarray[i*2]; - int checkmask=parameter->intarray[i*2+1]; - if ((flag&andmask)==checkmask) { - struct QueueItem * qitem=addNewItem(parameter->queue, ptr); - if (flagptr==NULL) { - flagptr=qitem; - tmpptr=flagptr; - } else { - tmpptr->nextqueue=qitem; - tmpptr=qitem; + while(parameter!=NULL) { + for(i=0;inumberofterms;i++) { + int andmask=parameter->intarray[i*2]; + int checkmask=parameter->intarray[i*2+1]; + if ((flag&andmask)==checkmask) { + struct QueueItem * qitem=addNewItem(parameter->queue, ptr); + if (flagptr==NULL) { + flagptr=qitem; + tmpptr=flagptr; + } else { + tmpptr->nextqueue=qitem; + tmpptr=qitem; + } + SimpleHashadd(activetasks, (int)parameter->task, (int)parameter->task); + break; } - SimpleHashadd(activetasks, (int)parameter->task, (int)parameter->task); - break; } + parameter=parameter->next; } ((struct QueueItem **)ptr)[2]=flagptr; } @@ -76,13 +79,10 @@ void flagorand(void * ptr, int ormask, int andmask) { void executetasks() { void * pointerarray[MAXTASKPARAMS]; - while(1) { newtask: - { + while(SimpleHashcountset(activetasks)!=0) { struct taskdescriptor * task=(struct taskdescriptor *) SimpleHashfirstkey(activetasks); int i; - if (task==NULL) - break; for(i=0;inumParameters;i++) { struct parameterwrapper * parameter=(struct parameterwrapper *) task->descriptorarray[i]->queue; struct Queue * queue=parameter->queue; @@ -93,7 +93,6 @@ void executetasks() { pointerarray[i]=getTail(queue)->objectptr; } ((void (*) (void **)) task->taskptr)(pointerarray); - } } } @@ -114,7 +113,7 @@ void processtasks() { parameter->intarray=param->intarray; parameter->task=task; /* Link new queue in */ - while(*ptr!=NULL) + while((*ptr)!=NULL) ptr=&((*ptr)->next); (*ptr)=parameter; } diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index 9e5dc81c..7bbc2de1 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -21,7 +21,7 @@ struct parameterwrapper { int numberofterms; int * intarray; struct taskdescriptor * task; -} +}; #endif #endif diff --git a/Robust/src/Tests/TaskExample.java b/Robust/src/Tests/TaskExample.java index 94a6c4c1..d271abe8 100644 --- a/Robust/src/Tests/TaskExample.java +++ b/Robust/src/Tests/TaskExample.java @@ -16,7 +16,7 @@ class Example { task Startup(StartupObject s {initialstate}) { for(int i=0;i<10;i++) { Example e=new Example() {needoperation}; - e.x=i; + e.x=i+2; e.y=2; e.operation=i%2; } @@ -43,5 +43,6 @@ task DoOperation(Example e{needoperation}) { task DoPrint(Example e{needprinting}) { System.printInt(e.z); + System.printString("\n"); taskexit(e {!needprinting}); } diff --git a/Robust/src/buildscripttask b/Robust/src/buildscripttask index ff598b74..07cb3d6d 100755 --- a/Robust/src/buildscripttask +++ b/Robust/src/buildscripttask @@ -4,4 +4,4 @@ MAINFILE=$1 shift mkdir tmpbuilddirectory java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary $ROBUSTROOT/ClassLibrary/ -dir tmpbuilddirectory -task $@ -gcc -I$ROBUSTROOT/Runtime -Itmpbuilddirectory -O0 -DTASK -g tmpbuilddirectory/methods.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c -o $MAINFILE.bin \ No newline at end of file +gcc -I$ROBUSTROOT/Runtime -Itmpbuilddirectory -O0 -DTASK -g tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c -o $MAINFILE.bin \ No newline at end of file -- 2.34.1