summaryrefslogtreecommitdiff
path: root/src/schedule
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-09-16 10:21:59 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-09-16 10:21:59 +0000
commitf22407251a90f727905140c8945532daf747e616 (patch)
tree8ec32f139531b39f7da35dba3596865f9932fa66 /src/schedule
parenta5a75fb524b775d90ec583e91b9bedad4b55e39a (diff)
Stuff for the new traversal routines.
Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@934 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/schedule')
-rw-r--r--src/schedule/Makefile4
-rw-r--r--src/schedule/Schedule.h36
-rw-r--r--src/schedule/ScheduleCreater.c55
3 files changed, 57 insertions, 38 deletions
diff --git a/src/schedule/Makefile b/src/schedule/Makefile
index 8bc56212..c44368c4 100644
--- a/src/schedule/Makefile
+++ b/src/schedule/Makefile
@@ -1,7 +1,7 @@
CC = gcc
-CFLAGS = -g -Wall -DDEBUG_SCHEDULAR -DTEST_SCHEDULECREATOR
+CFLAGS = -g -Wall -DDEBUG_SCHEDULAR -DTEST_SCHEDULETRAVERSE
-SRCS = ScheduleCreater.c ScheduleSorter.c ../util/StoreHandledData.c
+SRCS = ScheduleCreater.c ScheduleSorter.c ScheduleTraverse.c ../util/StoreHandledData.c
INCDIRS = ../include
EXE = schedtest
diff --git a/src/schedule/Schedule.h b/src/schedule/Schedule.h
index 29a2704d..36c868f6 100644
--- a/src/schedule/Schedule.h
+++ b/src/schedule/Schedule.h
@@ -9,6 +9,7 @@
@@*/
#include "cctki_schedule.h"
+#include "StoreHandledData.h"
#ifndef _SCHEDULE_H_
#define _SCHEDULE_H_
@@ -31,8 +32,43 @@ int CCTKi_ScheduleAddRow(int size,
int CCTKi_ScheduleSort(int size, signed char **array, int *order);
+cHandledData *CCTKi_ScheduleGetGroups(void);
+
#ifdef __cplusplus
}
#endif
+/* Internal type data */
+
+typedef enum {sched_item_none, sched_group, sched_function} t_sched_item_type;
+
+typedef struct
+{
+ char *name;
+
+ t_sched_item_type type;
+
+ void *function;
+ int group;
+
+ int n_whiles;
+ char **whiles;
+
+ void *attributes;
+
+ t_sched_modifier *modifiers;
+} t_sched_item;
+
+typedef struct
+{
+ char *name;
+ int *order;
+
+ int n_scheditems;
+
+ t_sched_item *scheditems;
+
+} t_sched_group;
+
+
#endif
diff --git a/src/schedule/ScheduleCreater.c b/src/schedule/ScheduleCreater.c
index 5e80c6af..59b6d8df 100644
--- a/src/schedule/ScheduleCreater.c
+++ b/src/schedule/ScheduleCreater.c
@@ -11,40 +11,8 @@
#include <stdlib.h>
#include <string.h>
-#include "Schedule.h"
#include "StoreHandledData.h"
-
-/* Internal type data */
-
-typedef enum {sched_item_none, sched_group, sched_function} t_sched_item_type;
-
-typedef struct
-{
- char *name;
-
- t_sched_item_type type;
-
- void *function;
- int group;
-
- int n_whiles;
- char **whiles;
-
- void *attributes;
-
- t_sched_modifier *modifiers;
-} t_sched_item;
-
-typedef struct
-{
- char *name;
- int *order;
-
- int n_scheditems;
-
- t_sched_item *scheditems;
-
-} t_sched_group;
+#include "Schedule.h"
/* Internal routine prototypes */
@@ -196,9 +164,11 @@ int CCTKi_ScheduleGroup(const char *gname,
{
int retcode;
int handle;
+ int thishandle;
t_sched_group *this_group;
t_sched_item *newitem;
+ /* Find the group within which to schedule this group */
handle = Util_GetHandle(schedule_groups, gname, (void **)&this_group);
if(handle < 0)
@@ -206,7 +176,15 @@ int CCTKi_ScheduleGroup(const char *gname,
handle = ScheduleCreateGroup(gname);
}
- if(handle < 0)
+ /* Find this group */
+ thishandle = Util_GetHandle(schedule_groups, thisname, (void **)&this_group);
+
+ if(thishandle < 0)
+ {
+ thishandle = ScheduleCreateGroup(thisname);
+ }
+
+ if(handle < 0 || thishandle < 0)
{
retcode = -1;
}
@@ -217,7 +195,7 @@ int CCTKi_ScheduleGroup(const char *gname,
if(newitem)
{
newitem->type = sched_group;
- newitem->group = handle;
+ newitem->group = thishandle;
retcode = ScheduleAddItem(handle, newitem);
}
else
@@ -273,6 +251,11 @@ int CCTKi_ScheduleSortAllGroups(void)
return -n_errors;
}
+cHandledData *CCTKi_ScheduleGetGroups(void)
+{
+ return schedule_groups;
+}
+
/********************************************************************
********************* Local Routines *************************
********************************************************************/
@@ -742,7 +725,7 @@ int main(int argc, char *argv[])
CCTKi_ScheduleFunction("group_a", "b", func_b, modifier, NULL);
CCTKi_ScheduleFunction("group_a", "a", func_a, NULL, NULL);
CCTKi_ScheduleFunction("group_b", "a", func_a, NULL, NULL);
- CCTKi_ScheduleFunction("group_b", "b", func_a, NULL, NULL);
+ CCTKi_ScheduleFunction("group_b", "b", func_b, NULL, NULL);
CCTKi_ScheduleGroup("group_a", "group_b", modifier, NULL);
CCTKi_ScheduleSortAllGroups();