summaryrefslogtreecommitdiff
path: root/lib/sbin/interface_parser.pl
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-02-24 17:31:09 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-02-24 17:31:09 +0000
commit1b62c7f62e4e80831abec3e615ed66d1d5a02219 (patch)
treea2d9577722af159a7de1e759875ea47facd08fe8 /lib/sbin/interface_parser.pl
parent3042fe913f3928e9e561e75d4c63c93baa7c9390 (diff)
Initial implementation of Function Aliasing for thorns.
This is described on a Spec on the web pages at the moment, and will move to the documentation once it is tested and extended a bit more. If you want to have a look at it in action, checkout the thorns TestFunctions1A, TestFunctions1B and TestFunctions2 which will be in AlphaThorns in a few minutes time. At the moment it is only possible to use Function Aliasing for C functions which use and return Cactus data types. You will need to rebuild your configurations once you update, but apart from that these changes shouldn't affect anyone ... if you see any problems please let us know. Gabrielle git-svn-id: http://svn.cactuscode.org/flesh/trunk@2060 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/interface_parser.pl')
-rw-r--r--lib/sbin/interface_parser.pl126
1 files changed, 63 insertions, 63 deletions
diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl
index fcb72696..cc83eeb5 100644
--- a/lib/sbin/interface_parser.pl
+++ b/lib/sbin/interface_parser.pl
@@ -605,7 +605,7 @@ sub parse_interface_ccl
$interface_db{"\U$thorn PRIVATE GROUPS\E"} = "";
$interface_db{"\U$thorn USES HEADER\E"} = "";
$interface_db{"\U$thorn FUNCTIONS\E"} = "";
- $interface_db{"\U$thorn PROVIDES FUNCTION\E"} = "";
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E"} = "";
$interface_db{"\U$thorn USES FUNCTION\E"} = "";
$interface_db{"\U$thorn ARRANGEMENT\E"} = "$arrangement";
@@ -645,6 +645,68 @@ sub parse_interface_ccl
{
$block = "\U$1\E";
}
+ elsif ($line =~ m/^\s*PROVIDES\s*FUNCTION\s*([a-zA-Z_0-9]+)\s*WITH\s*(.+)\s*$/i)
+ {
+ $funcname = $1;
+ $provided_by = $2;
+
+ if($provided_by =~ m/(.*)\s*LANGUAGE\s*(.+)/i)
+ {
+ $provided_by = $1;
+ $provided_by_language = $2;
+ }
+ else
+ {
+ $provided_by_language = "Fortran";
+ }
+
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E"} .= "$funcname ";
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname WITH"} .= "$provided_by ";
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname LANG"} .= "$provided_by_language ";
+
+ }
+ elsif ($line =~ m/^\s*USES\s*FUNCTION\s*([a-zA-Z_0-9]+)\s*$/i)
+ {
+ $funcname = $1;
+ $interface_db{"\U$thorn USES FUNCTION\E"} .= "$funcname ";
+ }
+ elsif ($line =~ m/^\s*([a-zA-Z_0-9]+)\s*FUNCTION\s*([a-zA-Z_0-9]+)\s*(.*)\s*$/i)
+ {
+ $rettype = $1;
+ $funcname = $2;
+ $rest = $3;
+ if($rest =~ m/(.*)\s*PROVIDED-BY\s*(.+)/i)
+ {
+ $funcargs = $1;
+ $provided_by = $2;
+
+ if($provided_by =~ m/(.*)\s*LANGUAGE\s*(.+)/i)
+ {
+ $provided_by = $1;
+ $provided_by_language = $2;
+ }
+ else
+ {
+ $provided_by_language = "Fortran";
+ }
+ }
+ else
+ {
+ $funcargs = $rest;
+ $provided_by = "";
+ }
+
+ $interface_db{"\U$thorn FUNCTIONS\E"} .= "$funcname ";
+ $interface_db{"\U$thorn FUNCTION\E $funcname ARGS"} .= "$funcargs";
+ $interface_db{"\U$thorn FUNCTION\E $funcname RET"} .= "$rettype";
+
+ if($provided_by ne "")
+ {
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E"} .= "$funcname";
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname WITH"} .= "$provided_by";
+ $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname LANG"} .= "$provided_by_language";
+ }
+ }
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 = "$3";
@@ -849,68 +911,6 @@ sub parse_interface_ccl
# print "Adding $header to $4\n";
$interface_db{"\U$thorn ADD HEADER $header TO\E"} = $4;
}
- elsif ($line =~ m/^\s*PROVIDE\s*FUNCTION\s*([a-zA-Z_0-9]+)\s*WITH\s*(.+)\s*$/i)
- {
- $funcname = $1;
- $provided_by = $2;
-
- if($provided_by =~ m/(.*)\s*LANGUAGE\s*(.+)/i)
- {
- $provided_by = $1;
- $provided_by_language = $2;
- }
- else
- {
- $provided_by_language = "Fortran";
- }
-
- $interface_db{"\U$thorn PROVIDES FUNCTION\E"} .= "$funcname";
- $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname WITH"} .= "$provided_by";
- $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname LANG"} .= "$provided_by_language";
-
- }
- elsif ($line =~ m/^\s*USES\s*FUNCTION\s*([a-zA-Z_0-9]+)\s*$/i)
- {
- $funcname = $1;
- $interface_db{"\U$thorn USES FUNCTION\E"} .= "$funcname";
- }
- elsif ($line =~ m/^\s*([a-zA-Z_0-9]+)\s*FUNCTION\s*([a-zA-Z_0-9]+)\s*(.*)\s*$/i)
- {
- $rettype = $1;
- $funcname = $2;
- $rest = $3;
- if($rest =~ m/(.*)\s*PROVIDED-BY\s*(.+)/i)
- {
- $funcargs = $1;
- $provided_by = $2;
-
- if($provided_by =~ m/(.*)\s*LANGUAGE\s*(.+)/i)
- {
- $provided_by = $1;
- $provided_by_language = $2;
- }
- else
- {
- $provided_by_language = "Fortran";
- }
- }
- else
- {
- $funcargs = $rest;
- $provided_by = "";
- }
-
- $interface_db{"\U$thorn FUNCTIONS\E"} .= "$funcname";
- $interface_db{"\U$thorn FUNCTION\E $funcname ARGS"} .= "$funcargs";
- $interface_db{"\U$thorn FUNCTION\E $funcname RET"} .= "$rettype";
-
- if($provided_by ne "")
- {
- $interface_db{"\U$thorn PROVIDES FUNCTION\E"} .= "$funcname";
- $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname WITH"} .= "$provided_by";
- $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname LANG"} .= "$provided_by_language";
- }
- }
else
{
if($line =~ m:\{:)