diff options
-rw-r--r-- | lib/sbin/CreateScheduleBindings.pl | 19 | ||||
-rw-r--r-- | lib/sbin/ScheduleParser.pl | 15 | ||||
-rw-r--r-- | src/include/cctk_Schedule.h | 4 | ||||
-rw-r--r-- | src/include/cctki_ScheduleBindings.h | 5 | ||||
-rw-r--r-- | src/main/ScheduleInterface.c | 108 |
5 files changed, 135 insertions, 16 deletions
diff --git a/lib/sbin/CreateScheduleBindings.pl b/lib/sbin/CreateScheduleBindings.pl index 259473b1..cfe49ca3 100644 --- a/lib/sbin/CreateScheduleBindings.pl +++ b/lib/sbin/CreateScheduleBindings.pl @@ -255,6 +255,7 @@ sub ScheduleBlock my(@comm_groups); my(@trigger_groups); my(@sync_groups); + my(@options); my(@before_list); my(@after_list); my(@while_list); @@ -284,6 +285,8 @@ sub ScheduleBlock $rhschedule_db->{"\U$thorn\E BLOCK_$block SYNC"}, $rhinterface_db); + @options = split(/,/, $rhschedule_db->{"\U$thorn\E BLOCK_$block SYNC"}); + @before_list = &ScheduleSelectRoutines($thorn, $implementation, $rhschedule_db->{"\U$thorn\E BLOCK_$block BEFORE"}, $rhschedule_db); @@ -345,15 +348,17 @@ sub ScheduleBlock $buffer .= $indent . "\"" . $language . "\"" . ",\n"; } - $buffer .= $indent . scalar(@mem_groups) . ", /* Number of STORAGE groups */\n"; - $buffer .= $indent . scalar(@comm_groups) . ", /* Number of COMM groups */\n"; - $buffer .= $indent . scalar(@trigger_groups) . ", /* Number of TRIGGERS groups */\n"; - $buffer .= $indent . scalar(@sync_groups) . ", /* Number of SYNC groups */\n"; - $buffer .= $indent . scalar(@before_list) . ", /* Number of BEFORE routines */\n"; - $buffer .= $indent . scalar(@after_list) . ", /* Number of AFTER routines */\n"; + $buffer .= $indent . scalar(@mem_groups) . ", /* Number of STORAGE groups */\n"; + $buffer .= $indent . scalar(@comm_groups) . ", /* Number of COMM groups */\n"; + $buffer .= $indent . scalar(@trigger_groups) . ", /* Number of TRIGGERS groups */\n"; + $buffer .= $indent . scalar(@sync_groups) . ", /* Number of SYNC groups */\n"; + $buffer .= $indent . scalar(@options) . ", /* Number of Options */\n"; + $buffer .= $indent . scalar(@before_list) . ", /* Number of BEFORE routines */\n"; + $buffer .= $indent . scalar(@after_list) . ", /* Number of AFTER routines */\n"; $buffer .= $indent . scalar(@while_list) . " /* Number of WHILE variables */"; - foreach $item (@mem_groups, @comm_groups, @trigger_groups, @sync_groups, @before_list, @after_list, @while_list) + foreach $item (@mem_groups, @comm_groups, @trigger_groups, @sync_groups, + @options, @before_list, @after_list, @while_list) { $buffer .= ",\n" . $indent . "\"" . $item . "\"" ; } diff --git a/lib/sbin/ScheduleParser.pl b/lib/sbin/ScheduleParser.pl index 05f20b5e..8df7e9a2 100644 --- a/lib/sbin/ScheduleParser.pl +++ b/lib/sbin/ScheduleParser.pl @@ -90,7 +90,7 @@ sub parse_schedule_ccl ($line_number, $name, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $before_list, $after_list, $while_list) = &ParseScheduleBlock($line_number, @data); + $options,$before_list, $after_list, $while_list) = &ParseScheduleBlock($line_number, @data); $schedule_db{"\U$thorn\E BLOCK_$n_blocks NAME"} = $name; $schedule_db{"\U$thorn\E BLOCK_$n_blocks TYPE"} = $type; @@ -101,6 +101,7 @@ sub parse_schedule_ccl $schedule_db{"\U$thorn\E BLOCK_$n_blocks COMM"} = $comm_groups; $schedule_db{"\U$thorn\E BLOCK_$n_blocks TRIG"} = $trigger_groups; $schedule_db{"\U$thorn\E BLOCK_$n_blocks SYNC"} = $sync_groups; + $schedule_db{"\U$thorn\E BLOCK_$n_blocks OPTIONS"} = $options; $schedule_db{"\U$thorn\E BLOCK_$n_blocks BEFORE"} = $before_list; $schedule_db{"\U$thorn\E BLOCK_$n_blocks AFTER"} = $after_list; $schedule_db{"\U$thorn\E BLOCK_$n_blocks WHILE"} = $while_list; @@ -148,7 +149,7 @@ sub ParseScheduleBlock my($line_number, @data) = @_; my($name, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $before_list, $after_list, $while_list); + $options, $before_list, $after_list, $while_list); my(@fields); my($field); my(@before_list) = (); @@ -157,7 +158,8 @@ sub ParseScheduleBlock my(@mem_groups) = (); my(@comm_groups) = (); my(@trigger_groups) = (); - my(@sync_groups) = (); + my(@sync_groups) = (); + my(@options) = (); my($keyword) = ""; my(@current_sched_list) = (); @@ -364,6 +366,10 @@ sub ParseScheduleBlock { push(@sync_groups, split(/\s,/, $1)); } + elsif($data[$line_number] =~ m/^\s*OPTI[^:]*:\s*(.*)$/i) + { + push(@options, split(/\s,/, $1)); + } elsif($data[$line_number] =~ m/^\s*LANG[^:]*:\s*(.*)$/i) { if($language ne "") @@ -403,6 +409,7 @@ sub ParseScheduleBlock $comm_groups = join(",", @comm_groups); $trigger_groups = join(",", @trigger_groups); $sync_groups = join(",", @sync_groups); + $options = join(",", @options); $before_list = join(",", @before_list); $after_list = join(",", @after_list); $while_list = join(",", @while_list); @@ -411,7 +418,7 @@ sub ParseScheduleBlock return ($line_number, $name, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $before_list, $after_list, $while_list); + $options,$before_list, $after_list, $while_list); } diff --git a/src/include/cctk_Schedule.h b/src/include/cctk_Schedule.h index 107e297f..d5fdc60c 100644 --- a/src/include/cctk_Schedule.h +++ b/src/include/cctk_Schedule.h @@ -27,6 +27,10 @@ typedef struct int *SyncGroups; + /* Option Flags */ + + int global; + } cFunctionData; #ifdef __cplusplus diff --git a/src/include/cctki_ScheduleBindings.h b/src/include/cctki_ScheduleBindings.h index 6316f346..faeabd0d 100644 --- a/src/include/cctki_ScheduleBindings.h +++ b/src/include/cctki_ScheduleBindings.h @@ -29,11 +29,11 @@ int CCTKi_ScheduleFunction(void *function, int n_comm_groups, int n_trigger_groups, int n_sync_groups, + int n_options, int n_before, int n_after, int n_while, - ... - ); + ...); int CCTKi_ScheduleGroup(const char *name, const char *thorn, @@ -44,6 +44,7 @@ int CCTKi_ScheduleGroup(const char *name, int n_comm_groups, int n_trigger_groups, int n_sync_groups, + int n_options, int n_before, int n_after, int n_while, diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index c29d22aa..6d655007 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -100,8 +100,19 @@ static t_attribute *CreateAttribute(const char *description, int n_mem_groups, int n_comm_groups, int n_trigger_groups, - int n_sync_groups, + int n_sync_groups, + int n_options, va_list *ap); + +static int ParseOptionList(int n_items, + t_attribute *attribute, + va_list *ap); + +static int InitialiseOptionList(t_attribute *attribute); + +static int ParseOption(t_attribute *attribute, + const char *option); + static t_sched_modifier *CreateModifiers(int n_before, int n_after, int n_while, @@ -240,6 +251,7 @@ int CCTKi_ScheduleFunction(void *function, int n_comm_groups, int n_trigger_groups, int n_sync_groups, + int n_options, int n_before, int n_after, int n_while, @@ -255,7 +267,7 @@ int CCTKi_ScheduleFunction(void *function, attribute = CreateAttribute(description, language, thorn, implementation, n_mem_groups, n_comm_groups, n_trigger_groups, - n_sync_groups, &ap); + n_sync_groups, n_options, &ap); modifier = CreateModifiers(n_before, n_after, n_while, &ap); va_end(ap); @@ -303,6 +315,7 @@ int CCTKi_ScheduleGroup(const char *name, int n_comm_groups, int n_trigger_groups, int n_sync_groups, + int n_options, int n_before, int n_after, int n_while, @@ -318,7 +331,7 @@ int CCTKi_ScheduleGroup(const char *name, attribute = CreateAttribute(description, NULL, thorn, implementation, n_mem_groups, n_comm_groups, n_trigger_groups, - n_sync_groups, &ap); + n_sync_groups, n_options, &ap); modifier = CreateModifiers(n_before, n_after, n_while, &ap); va_end(ap); @@ -665,6 +678,7 @@ static t_attribute *CreateAttribute(const char *description, int n_comm_groups, int n_trigger_groups, int n_sync_groups, + int n_options, va_list *ap) { t_attribute *this; @@ -711,6 +725,11 @@ static t_attribute *CreateAttribute(const char *description, CreateGroupIndexList(n_comm_groups, this->comm_groups, ap); CreateGroupIndexList(n_trigger_groups, this->trigger_groups, ap); CreateGroupIndexList(n_sync_groups, this->FunctionData.SyncGroups, ap); + + /* Check the miscellaneous options */ + + InitialiseOptionList(this); + ParseOptionList(n_options, this, ap); this->n_mem_groups = n_mem_groups; this->n_comm_groups = n_comm_groups; @@ -793,6 +812,89 @@ static int CreateGroupIndexList(int n_items, int *array, va_list *ap) return 0; } + + /*@@ + @routine ParseOptionList + @date Thu Jan 27 20:26:42 2000 + @author Tom Goodale + @desc + Extracts the list of miscellaneous options in a schedule + group definition. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +static int ParseOptionList(int n_items, + t_attribute *attribute, + va_list *ap) +{ + int i; + const char *item; + + for(i=0; i < n_items; i++) + { + item = va_arg(*ap, const char *); + + ParseOption(attribute, item); + } + + return 0; +} + + /*@@ + @routine InitialiseOptionList + @date Thu Jan 27 20:36:54 2000 + @author Tom Goodale + @desc + Initialises the miscellaneous option list for a schedule group. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int InitialiseOptionList(t_attribute *attribute) +{ + attribute->FunctionData.global = 0; + + return 0; +} + + /*@@ + @routine ParseOption + @date Thu Jan 27 20:29:36 2000 + @author Tom Goodale + @desc + Parses an individual option to a schedule group. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +static int ParseOption(t_attribute *attribute, + const char *option) +{ + if(CCTK_Equals(option, "GLOBAL")) + { + attribute->FunctionData.global = 1; + } + else + { + CCTK_WARN(1, "Unknown option for schedule group.\n"); + } + + return 0; +} + /*@@ @routine CreateTypedModifier @date Fri Sep 17 21:50:59 1999 |