From 1d4ae0ce84926111a6d58fc05392246c54d8fb86 Mon Sep 17 00:00:00 2001 From: allen Date: Tue, 1 Feb 2000 10:25:23 +0000 Subject: Added specification for steerable parameters in param.ccl Notation REAL paramname "Description" [STEERABLE = never|always|recover] { .... } ",,," Default value is never The constants CCTK_STEERABLE_NEVER CCTK_STEERABLE_ALWAYS CCTK_STEERABLE_RECOVER are now there to use to check the type of steering available for a parameter. git-svn-id: http://svn.cactuscode.org/flesh/trunk@1329 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/CreateParameterBindings.pl | 23 ++++++++++++++++++++++- lib/sbin/parameter_parser.pl | 23 +++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl index b82714eb..45768004 100644 --- a/lib/sbin/CreateParameterBindings.pl +++ b/lib/sbin/CreateParameterBindings.pl @@ -479,6 +479,7 @@ sub NewParamStuff push(@data, "#include "); push(@data, ""); push(@data, "#include \"cctk_Config.h\""); + push(@data, "#include \"cctk_Constants.h\""); push(@data, "#include \"ParameterBindings.h\""); push(@data, "#include \"CParameterStructNames.h\""); @@ -604,11 +605,31 @@ sub CreateParameterRegistrationStuff # $quoted_default =~ s:\"::g; The database now strips all unescaped quotes. + # Set steerable details + $steerable = $rhparameter_db->{"\U$thorn $parameter\E steerable"}; + if ($steerable =~ /never/i || $steerable =~/^$/) + { + $steerable_type = "CCTK_STEERABLE_NEVER"; + } + elsif ($steerable =~ /always/i) + { + $steerable_type = "CCTK_STEERABLE_ALWAYS"; + } + elsif ($steerable =~ /recover/i) + { + $steerable_type = "CCTK_STEERABLE_RECOVER"; + } + else + { + $message = "Illegal steerable type ($steerable) for parameter $parameter in $thorn"; + &CST_error(0,$message,__LINE__,__FILE__); + } + $line=" CCTKi_ParameterCreate(\"$parameter\", /* The parameter name */\n". " \"$thorn\", /* The thorn */\n". " \"$type\", /* The parameter type*/\n". " \"$block\", /* The scoping block */\n". - " 0, /* Is it steerable ? */\n". + " $steerable_type, /* Is it steerable ? */\n". " " . $rhparameter_db->{"\U$thorn $parameter\E description"} . ", /* The description */\n" . " \"" . $quoted_default . "\", /* The default value */\n" . " &($structure.$parameter), /* The actual data pointer */\n". diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl index 63de8736..4dfce935 100644 --- a/lib/sbin/parameter_parser.pl +++ b/lib/sbin/parameter_parser.pl @@ -144,7 +144,7 @@ sub parse_param_ccl $parameter_db{"\U$thorn $block\E variables"} = ""; } } - elsif($line =~ m:(EXTENDS |USES )?\s*(?\:CCTK_)?(INT|REAL|LOGICAL|BOOLEAN|KEYWORD|STRING)\s*([a-zA-Z]+[a-zA-Z0-9_]*) \s*(\"[^\"]*\"):i) + elsif($line =~ m:(EXTENDS |USES )?\s*(?\:CCTK_)?(INT|REAL|LOGICAL|BOOLEAN|KEYWORD|STRING)\s*([a-zA-Z]+[a-zA-Z0-9_]*) \s*(\"[^\"]*\")\s*(.*)$:i) { # This is a parameter definition. @@ -152,6 +152,7 @@ sub parse_param_ccl $variable = $3; $description = $4; + $options = $5; # Logical is depricated if ($type =~ /LOGICAL/i) @@ -189,7 +190,25 @@ sub parse_param_ccl # Move past { $line_number++; $line_number++; - + + # Parse the options + %options = split(/\s*=\s*|\s+/, $options); + + foreach $option (keys %options) + { + if($option =~ m:STEERABLE:i) + { + $parameter_db{"\U$thorn $variable\E steerable"} = $options{$option}; + print "Got STEERABLE <$options{$option}> for $variable in $thorn\n"; + } + else + { + $message = "Unknown option $option for parameter $variable of thorn $thorn"; + &CST_error(0,$message,__LINE__,__FILE__); + } + } + + # Store data about this variable. $defined_parameters{"\U$variable\E"} = 1; -- cgit v1.2.3