diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-07-01 15:24:21 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-07-01 15:24:21 +0000 |
commit | 18c23b96d716f33e659e39d337a1516a1f6638cb (patch) | |
tree | 54e438db7870a51d33d0779fa0b78893e1545af6 | |
parent | 08c3f083ce31e5e4ced7792d0cdcdd67512ea998 (diff) |
Added all datatypes to parsers (but they don't work with pugh yet).
NOTE THAT
INTEGER -> INT in param.ccl and interface.ccl
In the param.ccl and interface.ccl you can have one optional cctk_ in
front of each datatype.
I'll be checking in changes for all thorns now ... you will have to
go the realclean thing I would guess after updating
git-svn-id: http://svn.cactuscode.org/flesh/trunk@610 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | lib/sbin/GridFuncStuff.pl | 134 | ||||
-rw-r--r-- | lib/sbin/create_c_stuff.pl | 37 | ||||
-rw-r--r-- | lib/sbin/create_fortran_stuff.pl | 4 | ||||
-rw-r--r-- | lib/sbin/interface_parser.pl | 4 | ||||
-rw-r--r-- | lib/sbin/parameter_parser.pl | 11 |
5 files changed, 167 insertions, 23 deletions
diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index 63466589..b0f204bd 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -311,7 +311,7 @@ sub CreateFortranArgumentDeclarations $suffix .= "_p"; } - if($1 eq "CHAR") + if($1 eq CHAR) { push(@declarations, "CCTK_CHAR $argument$suffix$2"); } @@ -319,17 +319,42 @@ sub CreateFortranArgumentDeclarations { push(@declarations, "CCTK_REAL $argument$suffix$2"); } + elsif ($1 eq REAL4) + { + push(@declarations, "CCTK_REAL4 $argument$suffix$2"); + } + elsif ($1 eq REAL8) + { + push(@declarations, "CCTK_REAL8 $argument$suffix$2"); + } + elsif ($1 eq REAL16) + { + push(@declarations, "CCTK_REAL16 $argument$suffix$2"); + } elsif ($1 eq COMPLEX) { push(@declarations, "CCTK_COMPLEX $argument$suffix$2"); } - elsif ($1 eq INTEGER) + elsif ($1 eq INT) { push(@declarations, "CCTK_INT $argument$suffix$2"); } + elsif ($1 eq INT2) + { + push(@declarations, "CCTK_INT2 $argument$suffix$2"); + } + elsif ($1 eq INT4) + { + push(@declarations, "CCTK_INT4 $argument$suffix$2"); + } + elsif ($1 eq INT8) + { + push(@declarations, "CCTK_INT8 $argument$suffix$2"); + } else { - print STDERR "Unknown argument type $1\n"; + $CST_errors++; + print STDERR "Unknown argument type \"$1\"\n"; } } } @@ -400,19 +425,43 @@ sub CreateCArgumentDeclarations } elsif ($1 eq REAL) { - push(@declarations, "CCTK_REAL *$argument$suffix=(CCTK_REAL *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); } + elsif ($1 eq REAL4) + { + push(@declarations, "CCTK_REAL4 *$argument$suffix=(CCTK_REAL4 *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); + } + elsif ($1 eq REAL8) + { + push(@declarations, "CCTK_REAL8 *$argument$suffix=(CCTK_REAL8 *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); + } + elsif ($1 eq REAL16) + { + push(@declarations, "CCTK_REAL16 *$argument$suffix=(CCTK_REAL16 *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); + } elsif ($1 eq COMPLEX) { push(@declarations, "CCTK_COMPLEX *$argument$suffix=(CCTK_COMPLEX *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); } - elsif ($1 eq INTEGER) + elsif ($1 eq INT) { push(@declarations, "CCTK_INT *$argument$suffix=(CCTK_INT *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); } + elsif ($1 eq INT2) + { + push(@declarations, "CCTK_INT2 *$argument$suffix=(CCTK_INT2 *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); + } + elsif ($1 eq INT4) + { + push(@declarations, "CCTK_INT4 *$argument$suffix=(CCTK_INT4 *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); + } + elsif ($1 eq INT8) + { + push(@declarations, "CCTK_INT8 *$argument$suffix=(CCTK_INT8 *)(cctkGH->data[CCTK_GetVarIndex(\"$3::$argument\")][0]);"); + } else { + $CST_errors++; print STDERR "Unknown argument type $1\n"; } } @@ -628,18 +677,49 @@ sub CreateCArgumentPrototype $prototype .="$sep". "CCTK_REAL *"; $sep = ","; } + elsif ($1 eq REAL4) + { + $prototype .="$sep". "CCTK_REAL4 *"; + $sep = ","; + } + elsif ($1 eq REAL8) + { + $prototype .="$sep". "CCTK_REAL8 *"; + $sep = ","; + } + elsif ($1 eq REAL16) + { + $prototype .="$sep". "CCTK_REAL16 *"; + $sep = ","; + } elsif ($1 eq COMPLEX) { - $prototype .="$sep". "Complex *"; + $prototype .="$sep". "CCTK_COMPLEX *"; + $sep = ","; + } + elsif ($1 eq INT) + { + $prototype .="$sep". "CCTK_INT *"; $sep = ","; } - elsif ($1 eq INTEGER) + elsif ($1 eq INT2) { - $prototype .="$sep". "int *"; + $prototype .="$sep". "CCTK_INT2 *"; + $sep = ","; + } + elsif ($1 eq INT4) + { + $prototype .="$sep". "CCTK_INT4 *"; + $sep = ","; + } + elsif ($1 eq INT8) + { + $prototype .="$sep". "CCTK_INT8 *"; $sep = ","; } else { + $CST_errors++; print STDERR "Unknown argument type $1\n"; } } @@ -711,18 +791,54 @@ sub CreateCArgumentList $arglist .= "$sep"."(CCTK_REAL *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; $sep = ","; } + elsif ($1 eq REAL) + { + $arglist .= "$sep"."(CCTK_REAL *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } + elsif ($1 eq REAL4) + { + $arglist .= "$sep"."(CCTK_REAL4 *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } + elsif ($1 eq REAL8) + { + $arglist .= "$sep"."(CCTK_REAL8 *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } + elsif ($1 eq REAL16) + { + $arglist .= "$sep"."(CCTK_REAL16 *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } elsif ($1 eq COMPLEX) { $arglist .= "$sep"."(CCTK_COMPLEX *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; $sep = ","; } - elsif ($1 eq INTEGER) + elsif ($1 eq INT) { $arglist .= "$sep"."(CCTK_INT *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; $sep = ","; } + elsif ($1 eq INT2) + { + $arglist .= "$sep"."(CCTK_INT2 *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } + elsif ($1 eq INT4) + { + $arglist .= "$sep"."(CCTK_INT4 *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } + elsif ($1 eq INT8) + { + $arglist .= "$sep"."(CCTK_INT8 *)((xGH)->data[CCTKARGNUM_$argument][$level-1])"; + $sep = ","; + } else { + $CST_errors++; print STDERR "Unknown argument type $1\n"; } } diff --git a/lib/sbin/create_c_stuff.pl b/lib/sbin/create_c_stuff.pl index aec9e6c2..9203b4e7 100644 --- a/lib/sbin/create_c_stuff.pl +++ b/lib/sbin/create_c_stuff.pl @@ -196,7 +196,7 @@ sub set_parameter_code { $line = " retval = CCTK_SetKeywordInRangeList(\&($structure.$parameter), value, $n_ranges" ; } - elsif($type eq "INTEGER") + elsif($type eq "INT") { $line = " retval = CCTK_SetIntInRangeList(\&($structure.$parameter),value, $n_ranges" ; } @@ -331,15 +331,42 @@ sub get_c_type_string { $type_string = "char *"; } - elsif($type eq "LOGICAL" || - $type eq "INTEGER") + elsif($type eq "LOGICAL") { $type_string = "int "; + } + elsif($type eq "INT") + { + $type_string = "CCTK_INT "; + } + elsif($type eq "INT2") + { + $type_string = "CCTK_INT2 "; + } + elsif($type eq "INT4") + { + $type_string = "CCTK_INT4 "; + } + elsif($type eq "INT8") + { + $type_string = "CCTK_INT8 "; } elsif($type eq "REAL") { $type_string = "CCTK_REAL "; } + elsif($type eq "REAL4") + { + $type_string = "CCTK_REAL4 "; + } + elsif($type eq "REAL8") + { + $type_string = "CCTK_REAL8 "; + } + elsif($type eq "REAL16") + { + $type_string = "CCTK_REAL16 "; + } else { die("Unknown parameter type '$type'"); @@ -460,7 +487,7 @@ sub order_params push(@string_params, $parameter); } elsif($type eq "LOGICAL" || - $type eq "INTEGER") + $type eq "INT") { push(@int_params, $parameter); } @@ -505,7 +532,7 @@ sub get_parameter_code $line = " *value = $structure.$parameter;\n" ; $line .= " retval = PARAMETER_SENTENCE;" ; } - elsif($type eq "INTEGER") + elsif($type eq "INT") { $line = " *value = \&($structure.$parameter);\n" ; $line .= " retval = PARAMETER_INTEGER;" ; diff --git a/lib/sbin/create_fortran_stuff.pl b/lib/sbin/create_fortran_stuff.pl index c3595d78..dbd3793d 100644 --- a/lib/sbin/create_fortran_stuff.pl +++ b/lib/sbin/create_fortran_stuff.pl @@ -188,9 +188,9 @@ sub get_fortran_type_string $type_string = "CCTK_STRING "; } elsif($type eq "LOGICAL" || - $type eq "INTEGER") + $type eq "INT") { - $type_string = "INTEGER "; + $type_string = "CCTK_INT"; } elsif($type eq "REAL") { diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl index 42793410..47989596 100644 --- a/lib/sbin/interface_parser.pl +++ b/lib/sbin/interface_parser.pl @@ -563,7 +563,7 @@ sub parse_interface_ccl { $block = "\U$1\E"; } - elsif ($line =~ m/^\s*(INTEGER|REAL|CHAR)\s*([a-zA-Z]+[a-zA-Z_0-9]*)\s*(.*)\s*$/i) + elsif ($line =~ m/^\s*(?:CCTK_)?(INT|INT2|INT4|INT8|REAL|REAL4|REAL8|REAL16|CHAR|COMPLEX)\s*([a-zA-Z]+[a-zA-Z_0-9]*)\s*(.*)\s*$/i) { $current_group = "$2"; @@ -711,7 +711,7 @@ sub parse_interface_ccl else { $CST_errors++; - print STDERR "Unknown line $line!!!\n"; + print STDERR "Unknown line $line\n"; } } } diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl index 0e2aa3c5..d40e2380 100644 --- a/lib/sbin/parameter_parser.pl +++ b/lib/sbin/parameter_parser.pl @@ -213,7 +213,7 @@ sub parse_param_ccl $parameter_db{"\U$thorn $block\E variables"} = ""; } } - elsif($line =~ m:(EXTENDS )?\s*(INTEGER|REAL|LOGICAL|KEYWORD|STRING)\s*([a-zA-Z]+[a-zA-Z0-9_]*) \s*(\"[^\"]*\"):i) + elsif($line =~ m:(EXTENDS )?\s*(?\:CCTK_)?(INT|REAL|LOGICAL|KEYWORD|STRING)\s*([a-zA-Z]+[a-zA-Z0-9_]*) \s*(\"[^\"]*\"):i) { # This is a parameter definition. @@ -266,7 +266,7 @@ sub parse_param_ccl # Increment the number of ranges found (ranges) $parameter_db{"\U$thorn $variable\E ranges"}++; # Strip out any spaces in the range for a numeric parameter. - if($type =~ m:INTEGER|REAL:) + if($type =~ m:INT|REAL:) { $new_ranges =~ s/[ \t]+/ /g; } @@ -280,7 +280,7 @@ sub parse_param_ccl $line_number++; } # Give a warning if no range was given and it was needed - if ($parameter_db{"\U$thorn $variable\E ranges"}==0 && $type =~ m:INTEGER|REAL:) + if ($parameter_db{"\U$thorn $variable\E ranges"}==0 && $type =~ m:INT|REAL:) { print STDERR "No range given for $variable in $thorn\n"; $CST_errors++; @@ -291,7 +291,7 @@ sub parse_param_ccl { $default = $1; # print "type is $type, default is $default\n"; - if ($type =~ m:INTEGER|REAL: && $default =~ m:":) + if ($type =~ m:INT|REAL: && $default =~ m:":) { print STDERR "String default given for $type $variable in $thorn\n"; $CST_errors++; @@ -315,7 +315,8 @@ sub parse_param_ccl } else { - print STDERR "Unknown line $line!!!\n"; + $CST_errors++; + print STDERR "Unknown line $line\n"; } } } |