[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc2-102-gc5229df

mysql vizuser noreply at mpich.org
Thu Dec 19 09:11:18 CST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  c5229dfad83e61e8c32902b95de594cbb696db51 (commit)
       via  ae36d5dbfe5f926e8d2e1619b8720be351813143 (commit)
       via  80419d6d3b1a658d88886b645654e2297fa28321 (commit)
       via  35a996524a0a58941829118f7eccac76a6ca3dba (commit)
      from  61f260051e6244cf3986e8ee1b90a6cc67672b60 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/c5229dfad83e61e8c32902b95de594cbb696db51

commit c5229dfad83e61e8c32902b95de594cbb696db51
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Wed Dec 18 14:57:47 2013 -0600

    Print dummy arg names defined by MPI to f90 files
    
    When printing Fortran subroutine prototypes to the f90 module files, use dummy argument
    (i.e., C formal argument) names defined by MPI, instead of short names like v0, v1.
    The side-effect is that longer names may make a line exceed the length limit set
    by Fortran. So we also need to properly wrap long lines.
    
    The revise is to support Fortran keyword arguments.
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/src/binding/f90/buildiface b/src/binding/f90/buildiface
index c723b15..6580643 100755
--- a/src/binding/f90/buildiface
+++ b/src/binding/f90/buildiface
@@ -40,6 +40,7 @@ $outfile_prefix = "mpi";
 %CtoFName = ();
 %mpi_routines = ();
 %NeedConstants = ();   # constants needed for declaration, hashed by routine
+my $line_limit = 80; # Max line length
 
 #
 # ToDo: Fortran 90 allows some additional checks not possible in Fortran 77.
@@ -51,7 +52,7 @@ $outfile_prefix = "mpi";
 #
 
 #
-# parmc2f translates the C/C++ names to the Fortran 90 name.  %name% will
+# argtypec2f translates the C/C++ names to the Fortran 90 name.  %name% will
 # be replaced with the argument name in declarations.
 #
 # Some picky compilers want an interface description where Fortran 77
@@ -60,7 +61,7 @@ $outfile_prefix = "mpi";
 #  INTERFACE %nl%SUBROUTINE %name%(<args>)%nl%<type decls>%nl%END SUBROUTINE%nl%END INTERFACE
 # where %nl% is newline/indent.
 #
-%parmc2f = ( 'int' => 'INTEGER',
+%argtypec2f = ( 'int' => 'INTEGER',
          'int[]' => 'INTEGER %name%(*)',
          'int[][3]' => 'INTEGER %name%(3,*)',
          'int*' => 'INTEGER',      # assume output scalar (see array
@@ -120,7 +121,7 @@ $outfile_prefix = "mpi";
          'char*' => 'CHARACTER (LEN=*)',
          'char[]' => 'CHARACTER (LEN=*)',
          'char*[]' => 'CHARACTER (LEN=*) %name%(*)',
-         'char**[]' => 'CHARACTER (LEN=*) %name%(v0,*)',  #special case
+         'char**[]' => 'CHARACTER (LEN=*) %name%(count,*)',  #special case
                 # from Comm_Spawn_multiple
          'MPI_Win' => 'INTEGER',
          'MPI_Win*' => 'INTEGER', # Never an array of win
@@ -387,12 +388,13 @@ foreach $routine (keys(%mpi_routines)) {
         $routine = $CtoFName{$routine};
     }
     $ucname = uc($routine);
-    $args   = $mpi_routines{$routine};
-    @parms  = split(/,/, $args );
+    my @argtypes = split(/,/, $mpi_routines{$routine}[0]);
+    my @argnames = split(/,/, $mpi_routines{$routine}[1]);
 
-    print "$routine\n" if $gDebug;
+    print "Trying to bind $routine\n" if $gDebug;
     # Check for a routine to skip
     if (defined($skip_routines{$routine})) {
+        print "Skipping $routine as required\n" if $gDebug;
         next;
     }
 
@@ -405,19 +407,20 @@ foreach $routine (keys(%mpi_routines)) {
     # As noted above, we don't include the routines with choice arguments
     # in the base module.
 
-    if ($args =~ /void/) {
-        $mpi_choice_routines{$routine} = $args;
+    if ($mpi_routines{$routine}[0] =~ /void/) {
+        $mpi_choice_routines{$routine} = $mpi_routines{$routine}[0];
         print "Skipping $routine because of void argument\n" if $gDebug;
         next;
     }
 
-    print MPIBASEFD "       SUBROUTINE $out_prefix$ucname(";
-    for ($i=0; $i<=$#parms; $i++) {
-        print MPIBASEFD "v$i,";
-    }
-    print MPIBASEFD "ierror)\n";
+    print MPIBASEFD "      SUBROUTINE $out_prefix$ucname";
+    &PrintArgBrace(MPIBASEFD,
+        length("      SUBROUTINE $out_prefix$ucname"),
+        length("      SUBROUTINE  "),
+        $line_limit,
+        @argnames);
     &PrintArgDecls( $routine, 0, "" );
-    print MPIBASEFD "       END SUBROUTINE $out_prefix$ucname\n\n";
+    print MPIBASEFD "      END SUBROUTINE $out_prefix$ucname\n\n";
 }
 
 # Add special routines (e.g., the ones with unusual arguments)
@@ -455,80 +458,97 @@ if ($is_MPI) {
             \@WTIME_DOUBLE_TYPE\@ PMPI_WTICK
         END FUNCTION PMPI_WTICK
 
-        SUBROUTINE MPI_NULL_DELETE_FN(a,b,c,d,e)
-          INTEGER a,b,c,d,e
+        SUBROUTINE MPI_NULL_DELETE_FN(COMM, KEYVAL, ATTRIBUTE_VAL,&
+          EXTRA_STATE, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER COMM, KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
         END SUBROUTINE MPI_NULL_DELETE_FN
 
-        SUBROUTINE MPI_DUP_FN(a,b,c,d,e,f,g)
-          INTEGER a,b,c,d,e,g
-          LOGICAL f
+        SUBROUTINE MPI_DUP_FN(OLDCOMM, KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDCOMM, KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_DUP_FN
 
-        SUBROUTINE MPI_NULL_COPY_FN(a,b,c,d,e,f,g)
-          INTEGER a,b,c,d,e,g
-          LOGICAL f
+        SUBROUTINE MPI_NULL_COPY_FN(OLDCOMM, KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDCOMM, KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_NULL_COPY_FN
 
-        SUBROUTINE MPI_COMM_NULL_DELETE_FN(a,b,c,d,e)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,e
-          INTEGER (KIND=MPI_ADDRESS_KIND) c, d
+        SUBROUTINE MPI_COMM_NULL_DELETE_FN(COMM, COMM_KEYVAL, ATTRIBUTE_VAL,&
+          EXTRA_STATE, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER COMM, COMM_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
         END SUBROUTINE MPI_COMM_NULL_DELETE_FN
 
-        SUBROUTINE MPI_COMM_DUP_FN(a,b,c,d,e,f,g)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,g
-          INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
-          LOGICAL f
+        SUBROUTINE MPI_COMM_DUP_FN(OLDCOMM, COMM_KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDCOMM, COMM_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_COMM_DUP_FN
 
-        SUBROUTINE MPI_COMM_NULL_COPY_FN(a,b,c,d,e,f,g)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,g
-          INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
-          LOGICAL f
+        SUBROUTINE MPI_COMM_NULL_COPY_FN(OLDCOMM, COMM_KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDCOMM, COMM_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_COMM_NULL_COPY_FN
 
-        SUBROUTINE MPI_TYPE_NULL_DELETE_FN(a,b,c,d,e)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,e
-          INTEGER (KIND=MPI_ADDRESS_KIND) c, d
+        SUBROUTINE MPI_TYPE_NULL_DELETE_FN(DATATYPE, TYPE_KEYVAL, ATTRIBUTE_VAL,&
+          EXTRA_STATE, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER DATATYPE, TYPE_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
         END SUBROUTINE MPI_TYPE_NULL_DELETE_FN
 
-        SUBROUTINE MPI_TYPE_DUP_FN(a,b,c,d,e,f,g)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,g
-          INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
-          LOGICAL f
+        SUBROUTINE MPI_TYPE_DUP_FN(OLDTYPE, TYPE_KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDTYPE, TYPE_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_TYPE_DUP_FN
 
-        SUBROUTINE MPI_TYPE_NULL_COPY_FN(a,b,c,d,e,f,g)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,g
-          INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
-          LOGICAL f
+        SUBROUTINE MPI_TYPE_NULL_COPY_FN(OLDTYPE, TYPE_KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDTYPE, TYPE_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_TYPE_NULL_COPY_FN
 
-        SUBROUTINE MPI_WIN_NULL_DELETE_FN(a,b,c,d,e)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,e
-          INTEGER (KIND=MPI_ADDRESS_KIND) c, d
+        SUBROUTINE MPI_WIN_NULL_DELETE_FN(WIN, WIN_KEYVAL, ATTRIBUTE_VAL,&
+          EXTRA_STATE, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER WIN, WIN_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL, EXTRA_STATE
         END SUBROUTINE MPI_WIN_NULL_DELETE_FN
 
-        SUBROUTINE MPI_WIN_DUP_FN(a,b,c,d,e,f,g)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,g
-          INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
-          LOGICAL f
+        SUBROUTINE MPI_WIN_DUP_FN(OLDWIN, WIN_KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDWIN, WIN_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_WIN_DUP_FN
 
-        SUBROUTINE MPI_WIN_NULL_COPY_FN(a,b,c,d,e,f,g)
-          USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
-          INTEGER a,b,g
-          INTEGER (KIND=MPI_ADDRESS_KIND) c,d,e
-          LOGICAL f
+        SUBROUTINE MPI_WIN_NULL_COPY_FN(OLDWIN, WIN_KEYVAL, EXTRA_STATE,&
+          ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR)
+            USE MPI_CONSTANTS,ONLY: MPI_ADDRESS_KIND
+            INTEGER OLDWIN, WIN_KEYVAL, IERROR
+            INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE, ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT
+            LOGICAL FLAG
         END SUBROUTINE MPI_WIN_NULL_COPY_FN
-
 ";
 }
 # Here's where we need to place the interface definitions for the functions
@@ -563,44 +583,45 @@ if ($buildScalarVector) {
     # This is much like the base name (interface) block code
     foreach my $routine (keys(%scalarVectorRoutines)) {
         $ucname = uc($routine);
-        $args   = $mpi_routines{$routine};
-        @parms  = split(/,/, $args );
+        my @argtypes  = split(/,/, $mpi_routines{$routine}[0]);
+        my @argnames  = split(/,/, $mpi_routines{$routine}[1]);
         $svArgs = $scalarVectorRoutines{$routine};
 
         # The scalar version
-        print MPIBASEFD "       SUBROUTINE ${out_prefix}${ucname}_S(";
-        for ($i=0; $i<=$#parms; $i++) {
-            print MPIBASEFD "v$i,";
-        }
-        print MPIBASEFD "ierror)\n";
+        print MPIBASEFD "       SUBROUTINE ${out_prefix}${ucname}_S";
+        &PrintArgBrace(MPIBASEFD,
+            length("       SUBROUTINE ${out_prefix}${ucname}_S"),
+            length("       SUBROUTINE  "),
+            $line_limit,
+            @argnames);
         &PrintArgDecls( $routine, 1, $svArgs );
 
         print MPIBASEFD "       EXTERNAL ${out_prefix}${ucname}\n";
-        print MPIBASEFD "       call ${out_prefix}$ucname(";
-        for ($i=0; $i<=$#parms; $i++) {
-            print MPIBASEFD "v$i,";
-        }
-        print MPIBASEFD "ierror)\n";
-
+        print MPIBASEFD "       call ${out_prefix}$ucname";
+        &PrintArgBrace(MPIBASEFD,
+            length("       call ${out_prefix}$ucname"),
+            length("       call  "),
+            $line_limit,
+            @argnames);
         print MPIBASEFD "       END SUBROUTINE ${out_prefix}${ucname}_S\n\n";
 
         # The vector version
         print MPIBASEFD "       SUBROUTINE ${out_prefix}${ucname}_V(";
-        for ($i=0; $i<=$#parms; $i++) {
-            print MPIBASEFD "v$i,";
-        }
-        print MPIBASEFD "ierror)\n";
+        &PrintArgBrace(MPIBASEFD,
+            length("       SUBROUTINE ${out_prefix}${ucname}_S"),
+            length("       SUBROUTINE  "),
+            $line_limit,
+            @argnames);
         &PrintArgDecls( $routine, 0, "" );
 
         print MPIBASEFD "       EXTERNAL ${out_prefix}${ucname}\n";
-        print MPIBASEFD "       call ${out_prefix}$ucname(";
-        for ($i=0; $i<=$#parms; $i++) {
-            print MPIBASEFD "v$i,";
-        }
-        print MPIBASEFD "ierror)\n";
-
+        print MPIBASEFD "       call ${out_prefix}$ucname";
+        &PrintArgBrace(MPIBASEFD,
+            length("       call ${out_prefix}$ucname"),
+            length("       call  "),
+            $line_limit,
+            @argnames);
         print MPIBASEFD "       END SUBROUTINE ${out_prefix}${ucname}_V\n\n";
-
     }
 }
 
@@ -765,17 +786,18 @@ foreach $routine (keys(%mpi_choice_routines)) {
 # For each choice routine, add the modules
 foreach $routine (keys(%mpi_choice_routines)) {
     $ucname = uc($routine);
-    $args   = $mpi_routines{$routine};
-    @parms  = split(/,/, $args );
+    my @argtypes  = split(/,/, $mpi_routines{$routine}[0]);
+    my @argnames  = split(/,/, $mpi_routines{$routine}[1]);
 
-    print MPIFD "        SUBROUTINE ${out_prefix}${ucname}_T(";
-    for ($i=0; $i<=$#parms; $i++) {
-        print MPIFD "v$i,";
-    }
-    print MPIFD "ierror)\n";
+    print MPIFD "      SUBROUTINE ${out_prefix}${ucname}_T";
+    &PrintArgBrace(MPIFD,
+         length("      SUBROUTINE ${out_prefix}${ucname}_T"),
+         length("      SUBROUTINE  "),
+         $line_limit,
+         @argnames);
 
     if (defined($NeedConstants{$routine})) {
-        print MPIFD "       USE ${out_prefix}CONSTANTS,ONLY:";
+        print MPIFD "      USE ${out_prefix}CONSTANTS,ONLY:";
         $sep = "";
         foreach $name (split(/\s+/,$NeedConstants{$routine})) {
             print MPIFD "$sep$name";
@@ -788,59 +810,60 @@ foreach $routine (keys(%mpi_choice_routines)) {
     # convert %type% to the various types and %dims% to the dimensions,
     # including scalar.
     $nchoice = 0;
-    for ($i=0; $i<=$#parms; $i++) {
-        $parms[$i] =~ s/^const\s//;  # Remove const if present
-        $parm = $parms[$i];
+    for ($i=0; $i<=$#argtypes; $i++) {
+        $argtypes[$i] =~ s/^const\s//;  # Remove const if present
+        $argtype = $argtypes[$i];
         # Check for special args
         $loc = $i+1;
         if (defined($special_args{"$routine-$loc"})) {
-            $parm = $special_args{"$routine-$loc"};
+            $argtype = $special_args{"$routine-$loc"};
         }
 
-        if ($parm =~ /void/) {
+        if ($argtype =~ /void/) {
             # An alternative to this is to have a separate file for
             # routines with 2 choice arguments
             if ($nchoice == 0) {
-                print MPIFD "        <type> v$i<dims>\n";
+                print MPIFD "        <type> $argnames[$i]<dims>\n";
             }
             else {
-                print MPIFD "        <type$nchoice> v$i<dims$nchoice>\n";
+                print MPIFD "        <type$nchoice> $argnames[$i]<dims$nchoice>\n";
             }
             $nchoice ++;
         }
         else {
             # Map the C type to the Fortran type
-            $cparm = $parm;
-            $cparm =~ s/\s+//g;
-            $fparm = $parmc2f{$cparm};
-            if ($fparm eq "") {
-                print STDERR "$routine: No parm type for $cparm ($parm)\n";
+            $cargtype = $argtype;
+            $cargtype =~ s/\s+//g;
+            $fargtype = $argtypec2f{$cargtype};
+            if ($fargtype eq "") {
+                print STDERR "$routine: No Fortran type for $cargtype ($argtype)\n";
             }
-            if ($fparm =~ /%name%/) {
-                $fparm =~ s/%name%/v$i/;
+            if ($fargtype =~ /%name%/) {
+                $fargtype =~ s/%name%/$argnames[$i]/;
                 # In the name case, convert any %nl% to newlines and spaces
-                $fparm =~ s/%nl%/\n       /g;
-                print MPIFD "        $fparm\n";
+                $fargtype =~ s/%nl%/\n       /g;
+                print MPIFD "        $fargtype\n";
             }
             else {
-                print MPIFD "        $fparm v$i\n";
+                print MPIFD "        $fargtype $argnames[$i]\n";
             }
         }
     }
 
-    print MPIFD "        INTEGER ierror\n";
     print MPIFD "        EXTERNAL ${out_prefix}${ucname}\n";
-    print MPIFD "        CALL ${out_prefix}${ucname}(";
-    for ($i=0; $i<=$#parms; $i++) {
-        print MPIFD "v$i,";
-    }
-    print MPIFD "ierror)\n";
-    print MPIFD "        END SUBROUTINE ${out_prefix}${ucname}_T\n\n";
+    print MPIFD "        CALL ${out_prefix}${ucname}";
+    &PrintArgBrace(MPIFD,
+        length("              CALL ${out_prefix}${ucname}"),
+        length("              CALL  "),
+        $line_limit,
+        @argnames);
+
+    print MPIFD "      END SUBROUTINE ${out_prefix}${ucname}_T\n\n";
 }
 
 # The base sizeof's are handled separately now in their own file
 
-print MPIFD "        END MODULE ${ucoutfile_prefix}_t1_s\n";
+print MPIFD "      END MODULE ${ucoutfile_prefix}_t1_s\n";
 close MPIFD;
 &ReplaceIfDifferent( "${outfile_prefix}_t1.f90", "${outfile_prefix}_t1.f90.new" );
 
@@ -1220,13 +1243,49 @@ EOT
 
 }
 
+# Print arguments in a pair of braces and end with a new line.
+# $fd : File handle to print to.
+# $curlen : Length of the current line.
+# $indent : Indention length of the following lines when they exist.
+# $line_length : Maximal length of a line.
+# @argnames : argument names to print out.
+sub PrintArgBrace {
+    my ($fd, $curlen, $indent, $line_length, @argnames) = @_;
+    my $i = 0;
+
+    print $fd "(";
+    $curlen++;
+    foreach my $arg (@argnames) {
+        if ($curlen + length($arg) + 2 > $line_length) { # + 2 for the trailing ',&'
+            $curlen = $indent;
+            print $fd "&\n";
+            print $fd " " x $indent;
+            print $fd "$arg";
+        } else {
+            print $fd "$arg";
+        }
+
+        if ($i++ < $#argnames) {
+            print $fd ",";
+        }
+
+        $curlen += length($arg) + 1;
+    }
+
+    print $fd ")\n";
+}
+
 # Print the declarations for the given routine.
 sub PrintArgDecls {
     my ($routine,$svflag,$svArgs) = @_;
 
     my $ucname = uc($routine);
-    my $args   = $mpi_routines{$routine};
-    my @parms  = split(/,/, $args );
+    my @argtypes = split(/,/, $mpi_routines{$routine}[0]);
+    my @argnames = split(/,/, $mpi_routines{$routine}[1]);
+
+    print "Printing argument delartion for $ucname\n" if $gDebug;
+    print "argtypes = $mpi_routines{$routine}[0]\n" if $gDebug;
+    print "argnames = $mpi_routines{$routine}[1]\n" if $gDebug;
 
     # preload the svargs if requested.  This is used to decide whether
     # an array arg is output as a scalar or a vector
@@ -1246,29 +1305,29 @@ sub PrintArgDecls {
     # MPI_OFFSET_KIND)
     my %use_constants = ();
     my $found_constants = 0;
-    for (my $i=0; $i<=$#parms; $i++) {
-    $parms[$i] =~ s/^const\s+//;  # Remove const if present
-    $parm = $parms[$i];
+    for (my $i=0; $i<=$#argtypes; $i++) {
+    $argtypes[$i] =~ s/^const\s+//;  # Remove const if present
+    my $argtype = $argtypes[$i];
     # Check for special args
     $loc = $i+1;
     if (defined($special_args{"$routine-$loc"})) {
-        $parm = $special_args{"$routine-$loc"};
+        $argtype = $special_args{"$routine-$loc"};
     }
     # Map the C type to the Fortran type
-    $cparm = $parm;
-    $cparm =~ s/\s+//g;
-    $fparm = $parmc2f{$cparm};
+    my $cargtype = $argtype;
+    $cargtype =~ s/\s+//g;
+    my $fargtype = $argtypec2f{$cargtype};
     # Now, does this type contain an MPI constant?
-    if (!defined($fparm)) {
-        print "$cparm value has no matching fortran parm\n";
+    if (!defined($fargtype)) {
+        print "$cargtype value has no matching fortran argtype\n";
     }
-    if ($fparm =~ /(MPI_[A-Z_]*)/) {
+    if ($fargtype =~ /(MPI_[A-Z_]*)/) {
         $use_constants{$1} = 1;
         $found_constants = 1;
     }
     }
     if ($found_constants) {
-        print MPIBASEFD "       USE MPI_CONSTANTS,ONLY:";
+        print MPIBASEFD "           USE MPI_CONSTANTS,ONLY:";
         $sep = "";
         foreach $name (keys(%use_constants)) {
             print MPIBASEFD "$sep$name";
@@ -1279,30 +1338,29 @@ sub PrintArgDecls {
     }
 
     # Output argument types
-    $lastParmType = "<none>";
-    for (my $i=0; $i<=$#parms; $i++) {
-        $parm = $parms[$i];
+    for (my $i=0; $i<=$#argtypes; $i++) {
+        $argtype = $argtypes[$i];
         # Check for special args
         $loc = $i+1;
         if (defined($special_args{"$routine-$loc"})) {
-            $parm = $special_args{"$routine-$loc"};
+            $argtype = $special_args{"$routine-$loc"};
         }
         # Map the C type to the Fortran type
-        $cparm = $parm;
-        $cparm =~ s/\s+//g;
-        $fparm = $parmc2f{$cparm};
-        if ($fparm eq "") {
-            print STDERR "$routine: No parm type for $cparm ($parm)\n";
+        $cargtype = $argtype;
+        $cargtype =~ s/\s+//g;
+        $fargtype = $argtypec2f{$cargtype};
+        if ($fargtype eq "") {
+            print STDERR "$routine: No Fortran type for $cargtype ($argtype)\n";
         }
         # Split out the base type from the name
-        if ($fparm =~ /(\w+.*)\s+(%name\S.*)/) {
-            $parmType = $1;
+        if ($fargtype =~ /(\w+.*)\s+(%name\S.*)/) {
+            $varType = $1;
             $varName  = $2;
             if ($varName =~ /%name%/) {
-            $varName =~ s/%name%/v$i/;
+            $varName =~ s/%name%/$argnames[$i]/;
             }
             $varName =~ s/%nl%/\n       /g;
-            $parmType =~ s/%nl%/\n       /g;
+            $varType =~ s/%nl%/\n       /g;
 
             # Here's where we might change vector to scalar args
             if ($svflag) {
@@ -1317,26 +1375,17 @@ sub PrintArgDecls {
                     }
                     else {
                         print STDERR "Failed to make arg $i in $routine a scalar\n";
+                    }
                 }
             }
-            }
-        }
-        else {
-            $parmType = $fparm;
-            $varName  = "v$i";
-        }
-        if ($parmType ne $lastParmType) {
-            if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
-            print MPIBASEFD "       $parmType $varName";
-            $lastParmType = $parmType;
-        }
-        else {
-            print MPIBASEFD ", $varName";
-        }
-    }
-    if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
+         }
+         else {
+            $varType = $fargtype;
+            $varName = $argnames[$i];
+         }
 
-    print MPIBASEFD "       INTEGER ierror\n";
+         print MPIBASEFD "           $varType $varName\n";
+    }
 }
 
 #

http://git.mpich.org/mpich.git/commitdiff/ae36d5dbfe5f926e8d2e1619b8720be351813143

commit ae36d5dbfe5f926e8d2e1619b8720be351813143
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Wed Dec 18 14:18:14 2013 -0600

    Add indentions, remove white spaces, replace Tabs
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/src/binding/f90/buildiface b/src/binding/f90/buildiface
index 8965956..c723b15 100755
--- a/src/binding/f90/buildiface
+++ b/src/binding/f90/buildiface
@@ -2,14 +2,14 @@
 
 # FIXME:
 # TODO:
-# For MPI-3 (See 17.1.3 for details), need to add (for mpi module; mpi_f08 
+# For MPI-3 (See 17.1.3 for details), need to add (for mpi module; mpi_f08
 # module will require different system entirely):
 # *ALL* functions declared
 #    This will require the use of non-standard, compiler-specific options,
 #    and may require overriding user choices about warning levels and options
 #    in order to handle the choice arguments
 # Provide DERIVED TYPES for MPI_STATUS and all handles (as in the mpi_f08
-#     module).  For all handle types, provide overloads for .EQ., .NE., == 
+#     module).  For all handle types, provide overloads for .EQ., .NE., ==
 #     and /= operators (Partially done)
 # Check on MPI_F_SYNC_REG, mentioned on page 598.
 
@@ -58,206 +58,206 @@ $outfile_prefix = "mpi";
 # was happy with a simple EXTERNAL.  To handle this, the EXTERNAL
 # has a more elaborate form:
 #  INTERFACE %nl%SUBROUTINE %name%(<args>)%nl%<type decls>%nl%END SUBROUTINE%nl%END INTERFACE
-# where %nl% is newline/indent.  
+# where %nl% is newline/indent.
 #
 %parmc2f = ( 'int' => 'INTEGER',
-	     'int[]' => 'INTEGER %name%(*)',
-	     'int[][3]' => 'INTEGER %name%(3,*)',
-	     'int*' => 'INTEGER',      # assume output scalar (see array
-	                               # replacement below)
-	     'bool' => 'LOGICAL',
-	     'bool[]' => 'LOGICAL %name%(*)',
-	     'MPI_Handler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
-	     'MPI_Win_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
-	     'MPI_Comm_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
-	     'MPI_File_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
-	     # These other functions have <choice> (really void*) arguments
-	     # and so an interface spec is very hard to do in Fortran 90.
-	     'MPI_Comm_copy_attr_function*' => 'EXTERNAL',
-	     'MPI_Comm_delete_attr_function*' => 'EXTERNAL',
-	     'MPI_Type_copy_attr_function*' => 'EXTERNAL',
-	     'MPI_Type_delete_attr_function*' => 'EXTERNAL',
-	     'MPI_Win_copy_attr_function*' => 'EXTERNAL',
-	     'MPI_Win_delete_attr_function*' => 'EXTERNAL',
-	     'MPI_Copy_function*' => 'EXTERNAL',
-	     'MPI_Delete_function*' => 'EXTERNAL',
-	     'MPI_User_function*' => 'EXTERNAL',
-	     'MPI_Grequest_query_function*' => 'EXTERNAL',
-	     'MPI_Grequest_free_function*' => 'EXTERNAL',
-	     'MPI_Grequest_cancel_function*' => 'EXTERNAL',
-	     'MPI_Datarep_conversion_function*' => 'EXTERNAL',
-	     'MPI_Datarep_extent_function*' => 'EXTERNAL',
-	     'MPI_Request' => 'INTEGER',
-	     'MPI_Request*' => 'INTEGER',
-	     'MPI_Request[]' => 'INTEGER %name%(*)',
-	     'MPIO_Request' => 'INTEGER',
-	     'MPIO_Request*' => 'INTEGER',
-	     'MPI_Datatype' => 'INTEGER',
-	     'MPI_Datatype*' => 'INTEGER',
-	     'MPI_Datatype[]' => 'INTEGER %name%(*)',
-	     'MPI_Comm' => 'INTEGER',
-	     'MPI_Comm*' => 'INTEGER', # Never an array of comm
-	     'MPI_Group' => 'INTEGER',
-	     'MPI_Group*' => 'INTEGER', # Never an array of groups
-	     'MPI_Errhandler' => 'INTEGER',
-	     'MPI_Errhandler*' => 'INTEGER', # Never an array of errhandlers
-	     'MPI_Op' => 'INTEGER',
-	     'MPI_Op*' => 'INTEGER', # Never an array of ops
-	     'MPI_Message' => 'INTEGER',
-	     'MPI_Message*' => 'INTEGER', # Never an array of messages
-	     'MPI_Status*' => 'INTEGER %name%(MPI_STATUS_SIZE)',
-	     'MPI_Status[]' => 'INTEGER %name%(MPI_STATUS_SIZE,*)',
-	     'MPI_Aint' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
-	     'MPI_Aint*' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
-	     'MPI_Aint[]' => 'INTEGER(KIND=MPI_ADDRESS_KIND) %name%(*)',
-             'MPI_Count' => 'INTEGER(KIND=MPI_COUNT_KIND)',
-             'MPI_Count*' => 'INTEGER(KIND=MPI_COUNT_KIND)',
-	     'MPI_Offset' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
-	     'MPI_Offset*' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
-	     'MPI_Info' => 'INTEGER',
-	     'MPI_Info*' => 'INTEGER', # Never an array of info
-	     'MPI_Info[]' => 'INTEGER %name%(*)',
-	     'char*' => 'CHARACTER (LEN=*)',
-	     'char[]' => 'CHARACTER (LEN=*)',
-	     'char*[]' => 'CHARACTER (LEN=*) %name%(*)',
-	     'char**[]' => 'CHARACTER (LEN=*) %name%(v0,*)',  #special case
-				# from Comm_Spawn_multiple
-	     'MPI_Win' => 'INTEGER',
-	     'MPI_Win*' => 'INTEGER', # Never an array of win
-	     'MPI_File' => 'INTEGER',
-	     'MPI_File*' => 'INTEGER', # Never an array of files
-	     'MPI_Message' => 'INTEGER',
-	     'MPI_Message*' => 'INTEGER', # Never an array of messages
-	     );
+         'int[]' => 'INTEGER %name%(*)',
+         'int[][3]' => 'INTEGER %name%(3,*)',
+         'int*' => 'INTEGER',      # assume output scalar (see array
+                                   # replacement below)
+         'bool' => 'LOGICAL',
+         'bool[]' => 'LOGICAL %name%(*)',
+         'MPI_Handler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
+         'MPI_Win_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
+         'MPI_Comm_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
+         'MPI_File_errhandler_function*' => 'INTERFACE %nl%SUBROUTINE %name%(vv0,vv1)%nl%INTEGER vv0,vv1%nl%END SUBROUTINE%nl%END INTERFACE',
+         # These other functions have <choice> (really void*) arguments
+         # and so an interface spec is very hard to do in Fortran 90.
+         'MPI_Comm_copy_attr_function*' => 'EXTERNAL',
+         'MPI_Comm_delete_attr_function*' => 'EXTERNAL',
+         'MPI_Type_copy_attr_function*' => 'EXTERNAL',
+         'MPI_Type_delete_attr_function*' => 'EXTERNAL',
+         'MPI_Win_copy_attr_function*' => 'EXTERNAL',
+         'MPI_Win_delete_attr_function*' => 'EXTERNAL',
+         'MPI_Copy_function*' => 'EXTERNAL',
+         'MPI_Delete_function*' => 'EXTERNAL',
+         'MPI_User_function*' => 'EXTERNAL',
+         'MPI_Grequest_query_function*' => 'EXTERNAL',
+         'MPI_Grequest_free_function*' => 'EXTERNAL',
+         'MPI_Grequest_cancel_function*' => 'EXTERNAL',
+         'MPI_Datarep_conversion_function*' => 'EXTERNAL',
+         'MPI_Datarep_extent_function*' => 'EXTERNAL',
+         'MPI_Request' => 'INTEGER',
+         'MPI_Request*' => 'INTEGER',
+         'MPI_Request[]' => 'INTEGER %name%(*)',
+         'MPIO_Request' => 'INTEGER',
+         'MPIO_Request*' => 'INTEGER',
+         'MPI_Datatype' => 'INTEGER',
+         'MPI_Datatype*' => 'INTEGER',
+         'MPI_Datatype[]' => 'INTEGER %name%(*)',
+         'MPI_Comm' => 'INTEGER',
+         'MPI_Comm*' => 'INTEGER', # Never an array of comm
+         'MPI_Group' => 'INTEGER',
+         'MPI_Group*' => 'INTEGER', # Never an array of groups
+         'MPI_Errhandler' => 'INTEGER',
+         'MPI_Errhandler*' => 'INTEGER', # Never an array of errhandlers
+         'MPI_Op' => 'INTEGER',
+         'MPI_Op*' => 'INTEGER', # Never an array of ops
+         'MPI_Message' => 'INTEGER',
+         'MPI_Message*' => 'INTEGER', # Never an array of messages
+         'MPI_Status*' => 'INTEGER %name%(MPI_STATUS_SIZE)',
+         'MPI_Status[]' => 'INTEGER %name%(MPI_STATUS_SIZE,*)',
+         'MPI_Aint' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
+         'MPI_Aint*' => 'INTEGER(KIND=MPI_ADDRESS_KIND)',
+         'MPI_Aint[]' => 'INTEGER(KIND=MPI_ADDRESS_KIND) %name%(*)',
+         'MPI_Count' => 'INTEGER(KIND=MPI_COUNT_KIND)',
+         'MPI_Count*' => 'INTEGER(KIND=MPI_COUNT_KIND)',
+         'MPI_Offset' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
+         'MPI_Offset*' => 'INTEGER(KIND=MPI_OFFSET_KIND)',
+         'MPI_Info' => 'INTEGER',
+         'MPI_Info*' => 'INTEGER', # Never an array of info
+         'MPI_Info[]' => 'INTEGER %name%(*)',
+         'char*' => 'CHARACTER (LEN=*)',
+         'char[]' => 'CHARACTER (LEN=*)',
+         'char*[]' => 'CHARACTER (LEN=*) %name%(*)',
+         'char**[]' => 'CHARACTER (LEN=*) %name%(v0,*)',  #special case
+                # from Comm_Spawn_multiple
+         'MPI_Win' => 'INTEGER',
+         'MPI_Win*' => 'INTEGER', # Never an array of win
+         'MPI_File' => 'INTEGER',
+         'MPI_File*' => 'INTEGER', # Never an array of files
+         'MPI_Message' => 'INTEGER',
+         'MPI_Message*' => 'INTEGER', # Never an array of messages
+         );
 
 # special_args provides for handling of arguments that require special
-# features.  The keys are of the form 'Routine-count', with count the 
+# features.  The keys are of the form 'Routine-count', with count the
 # position of the argument, starting from one.
 %special_args = ( 'Testany-2' => 'MPI_Request[]',
-		  'Testany-4' => 'bool',
-		  'Startall-2' => 'MPI_Request[]',
-		  'Testall-2' => 'MPI_Request[]',
-		  'Testall-3' => 'bool',
-		  'Testall-4' => 'MPI_Status[]',
-		  'Testsome-2' => 'MPI_Request[]',
-		  'Testsome-4' => 'int[]',
-		  'Testsome-5' => 'MPI_Status[]',
-		  'Test-2' => 'bool',
-		  'Test_cancelled-2' => 'bool',
-		  'Type_hindexed-2' => 'int[]',
-		  'Type_hindexed-3' => 'int[]',
-		  'Type_indexed-2' => 'int[]',
-		  'Type_indexed-3' => 'int[]',
-		  'Type_hvector-3' => 'int',
-		  'Type_struct-2' => 'int[]',
-		  'Type_struct-3' => 'int[]',
-		  'Type_struct-4' => 'MPI_Datatype[]',
-		  'Type_extent-2' => 'int',
-		  'Type_lb-2' => 'int', 
-		  'Type_ub-2' => 'int',
-		  'Waitall-2' => 'MPI_Request[]',
-		  'Waitall-3' => 'MPI_Status[]',
-		  'Waitany-2' => 'MPI_Request[]',
-		  'Waitsome-2' => 'MPI_Request[]',
-		  'Waitsome-4' => 'int[]',
-		  'Waitsome-5' => 'MPI_Status[]',
-		  'Group_excl-3' => 'int[]',
-		  'Group_incl-3' => 'int[]',
-		  'Group_translate_ranks-3' => 'int[]',
-		  'Group_translate_ranks-5' => 'int[]',
-		  'Cart_coords-4' => 'int[]',
-		  'Cart_create-3' => 'int[]',
-		  'Cart_create-4' => 'bool[]',
-		  'Cart_get-3' => 'int[]',
-		  'Cart_get-5' => 'int[]',
-		  'Cart_get-4' => 'bool[]',
-		  'Cart_map-3' => 'int[]',
-		  'Cart_map-4' => 'bool[]',
-		  'Cart_rank-2' => 'int[]',
-		  'Cart_sub-2' => 'bool[]',
-		  'Dims_create-3' => 'int[]',
-		  'Graph_create-3' => 'int[]',
-		  'Graph_create-4' => 'int[]',
-		  'Graph_create-5' => 'bool',
-		  'Graph_get-4' => 'int[]',
-		  'Graph_get-5' => 'int[]',
-		  'Graph_map-3' => 'int[]',
-		  'Graph_map-4' => 'int[]',
-		  'Graph_neighbors-4' => 'int[]',
-		  'Dist_graph_create-8' => 'bool',
-		  'Dist_graph_create_adjacent-9' => 'bool',
-		  'Dist_graph_neighbors_count-4' => 'bool',
-		  'Allgatherv-5' => 'int[]',
-		  'Allgatherv-6' => 'int[]',
-		  'Alltoallv-2' => 'int[]',
-		  'Alltoallv-3' => 'int[]',
-		  'Alltoallv-6' => 'int[]',
-		  'Alltoallv-7' => 'int[]',
-		  'Alltoallw-2' => 'int[]',
-		  'Alltoallw-3' => 'int[]',
-		  'Alltoallw-6' => 'int[]',
-		  'Alltoallw-7' => 'int[]',
-		  'Gatherv-5' => 'int[]',
-		  'Gatherv-6' => 'int[]',
-		  'Iallgatherv-5' => 'int[]',
-		  'Iallgatherv-6' => 'int[]',
-		  'Ialltoallv-2' => 'int[]',
-		  'Ialltoallv-3' => 'int[]',
-		  'Ialltoallv-6' => 'int[]',
-		  'Ialltoallv-7' => 'int[]',
-		  'Ialltoallw-2' => 'int[]',
-		  'Ialltoallw-3' => 'int[]',
-		  'Ialltoallw-6' => 'int[]',
-		  'Ialltoallw-7' => 'int[]',
-		  'Igatherv-5' => 'int[]',
-		  'Igatherv-6' => 'int[]',
-		  'Ireduce_scatter-3' => 'int[]',
-		  'Iscatterv-2' => 'int[]',
-		  'Iscatterv-3' => 'int[]',
-		  'Reduce_scatter-3' => 'int[]',
-		  'Scatterv-2' => 'int[]',
-		  'Scatterv-3' => 'int[]',
-		  'Iprobe-4' => 'bool',
-		  'Improbe-4' => 'bool',
-		  'Op_create-2' => 'bool',
-		  'Attr_get-4' => 'bool',
-		  'Comm_get_attr-4' => 'bool',
-		  'Type_get_attr-4' => 'bool',
-		  'Win_get_attr-4' => 'bool',
-		  'Comm_test_inter-2' => 'bool',
-		  'Intercomm_merge-2' => 'bool',
-		  'Cart_create-5' => 'bool',
-		  'Initialized-1' => 'bool',		
-		  'Finalized-1' => 'bool',
-		  'Group_range_excl-3' => 'int[][3]',
-		  'Group_range_incl-3' => 'int[][3]',
-		  'Info_get_valuelen-4' => 'bool',
-		  'Is_thread_main-1' => 'bool',
-		  'Type_create_subarray-2' => 'int[]',
-		  'Type_create_subarray-3' => 'int[]',
-		  'Type_create_subarray-4' => 'int[]',
-		  'Request_get_status-2' => 'bool',
-		  'Status_set_cancelled-2' => 'bool',
-		  'Info_get-5' => 'bool',
-		  'Type_create_indexed_block-3' => 'int[]',
-		  'Type_create_darray-4' => 'int[]',
-		  'Type_create_darray-5' => 'int[]',
-		  'Type_create_darray-6' => 'int[]',
-		  'Type_create_darray-7' => 'int[]',
-		  'Type_create_struct-2' => 'int[]',
-		  'Type_create_struct-3' => 'MPI_Aint[]',
-		  'Win_test-2' => 'bool',
-		  'Type_create_hindexed-2' => 'int[]',
-		  'Type_create_hindexed-3' => 'MPI_Aint[]',
-		  'Op_commutative-2' => 'bool',
-		  'File_set_atomicity-2' => 'bool',
-		  'File_get_atomicity-2' => 'bool',
-		);
+          'Testany-4' => 'bool',
+          'Startall-2' => 'MPI_Request[]',
+          'Testall-2' => 'MPI_Request[]',
+          'Testall-3' => 'bool',
+          'Testall-4' => 'MPI_Status[]',
+          'Testsome-2' => 'MPI_Request[]',
+          'Testsome-4' => 'int[]',
+          'Testsome-5' => 'MPI_Status[]',
+          'Test-2' => 'bool',
+          'Test_cancelled-2' => 'bool',
+          'Type_hindexed-2' => 'int[]',
+          'Type_hindexed-3' => 'int[]',
+          'Type_indexed-2' => 'int[]',
+          'Type_indexed-3' => 'int[]',
+          'Type_hvector-3' => 'int',
+          'Type_struct-2' => 'int[]',
+          'Type_struct-3' => 'int[]',
+          'Type_struct-4' => 'MPI_Datatype[]',
+          'Type_extent-2' => 'int',
+          'Type_lb-2' => 'int',
+          'Type_ub-2' => 'int',
+          'Waitall-2' => 'MPI_Request[]',
+          'Waitall-3' => 'MPI_Status[]',
+          'Waitany-2' => 'MPI_Request[]',
+          'Waitsome-2' => 'MPI_Request[]',
+          'Waitsome-4' => 'int[]',
+          'Waitsome-5' => 'MPI_Status[]',
+          'Group_excl-3' => 'int[]',
+          'Group_incl-3' => 'int[]',
+          'Group_translate_ranks-3' => 'int[]',
+          'Group_translate_ranks-5' => 'int[]',
+          'Cart_coords-4' => 'int[]',
+          'Cart_create-3' => 'int[]',
+          'Cart_create-4' => 'bool[]',
+          'Cart_get-3' => 'int[]',
+          'Cart_get-5' => 'int[]',
+          'Cart_get-4' => 'bool[]',
+          'Cart_map-3' => 'int[]',
+          'Cart_map-4' => 'bool[]',
+          'Cart_rank-2' => 'int[]',
+          'Cart_sub-2' => 'bool[]',
+          'Dims_create-3' => 'int[]',
+          'Graph_create-3' => 'int[]',
+          'Graph_create-4' => 'int[]',
+          'Graph_create-5' => 'bool',
+          'Graph_get-4' => 'int[]',
+          'Graph_get-5' => 'int[]',
+          'Graph_map-3' => 'int[]',
+          'Graph_map-4' => 'int[]',
+          'Graph_neighbors-4' => 'int[]',
+          'Dist_graph_create-8' => 'bool',
+          'Dist_graph_create_adjacent-9' => 'bool',
+          'Dist_graph_neighbors_count-4' => 'bool',
+          'Allgatherv-5' => 'int[]',
+          'Allgatherv-6' => 'int[]',
+          'Alltoallv-2' => 'int[]',
+          'Alltoallv-3' => 'int[]',
+          'Alltoallv-6' => 'int[]',
+          'Alltoallv-7' => 'int[]',
+          'Alltoallw-2' => 'int[]',
+          'Alltoallw-3' => 'int[]',
+          'Alltoallw-6' => 'int[]',
+          'Alltoallw-7' => 'int[]',
+          'Gatherv-5' => 'int[]',
+          'Gatherv-6' => 'int[]',
+          'Iallgatherv-5' => 'int[]',
+          'Iallgatherv-6' => 'int[]',
+          'Ialltoallv-2' => 'int[]',
+          'Ialltoallv-3' => 'int[]',
+          'Ialltoallv-6' => 'int[]',
+          'Ialltoallv-7' => 'int[]',
+          'Ialltoallw-2' => 'int[]',
+          'Ialltoallw-3' => 'int[]',
+          'Ialltoallw-6' => 'int[]',
+          'Ialltoallw-7' => 'int[]',
+          'Igatherv-5' => 'int[]',
+          'Igatherv-6' => 'int[]',
+          'Ireduce_scatter-3' => 'int[]',
+          'Iscatterv-2' => 'int[]',
+          'Iscatterv-3' => 'int[]',
+          'Reduce_scatter-3' => 'int[]',
+          'Scatterv-2' => 'int[]',
+          'Scatterv-3' => 'int[]',
+          'Iprobe-4' => 'bool',
+          'Improbe-4' => 'bool',
+          'Op_create-2' => 'bool',
+          'Attr_get-4' => 'bool',
+          'Comm_get_attr-4' => 'bool',
+          'Type_get_attr-4' => 'bool',
+          'Win_get_attr-4' => 'bool',
+          'Comm_test_inter-2' => 'bool',
+          'Intercomm_merge-2' => 'bool',
+          'Cart_create-5' => 'bool',
+          'Initialized-1' => 'bool',
+          'Finalized-1' => 'bool',
+          'Group_range_excl-3' => 'int[][3]',
+          'Group_range_incl-3' => 'int[][3]',
+          'Info_get_valuelen-4' => 'bool',
+          'Is_thread_main-1' => 'bool',
+          'Type_create_subarray-2' => 'int[]',
+          'Type_create_subarray-3' => 'int[]',
+          'Type_create_subarray-4' => 'int[]',
+          'Request_get_status-2' => 'bool',
+          'Status_set_cancelled-2' => 'bool',
+          'Info_get-5' => 'bool',
+          'Type_create_indexed_block-3' => 'int[]',
+          'Type_create_darray-4' => 'int[]',
+          'Type_create_darray-5' => 'int[]',
+          'Type_create_darray-6' => 'int[]',
+          'Type_create_darray-7' => 'int[]',
+          'Type_create_struct-2' => 'int[]',
+          'Type_create_struct-3' => 'MPI_Aint[]',
+          'Win_test-2' => 'bool',
+          'Type_create_hindexed-2' => 'int[]',
+          'Type_create_hindexed-3' => 'MPI_Aint[]',
+          'Op_commutative-2' => 'bool',
+          'File_set_atomicity-2' => 'bool',
+          'File_get_atomicity-2' => 'bool',
+        );
 
 # Some routines must be skipped (custom code is provided for them)
 %skip_routines = ( 'Init' => 1, 'Init_thread' => 1, 'Status_c2f' => 1,
-		   'Status_f2c' => 1, 'Pcontrol' => 1,
-		   );
+           'Status_f2c' => 1, 'Pcontrol' => 1,
+           );
 
 # Some routines *may* be skipped if we don't want to handle the possibility
 # of a scalar or vector argument
@@ -265,23 +265,23 @@ $outfile_prefix = "mpi";
 # For each of these, we need to know which arguments are the "scalar/vector"
 # The value of the hash gives us the answer, indexed from 1
 # (these are not correct yet).
-%scalarVectorRoutines = ( 'Startall' => '2-1', 'Testall' => '2-1:4-1', 
-			  'Testany' => '2-1',
-			  'Testsome' => '2-1:4-1:5-1', 
-			  'Waitall' => '2-1:3-1', 'Waitany' => '2-1',
-			  'Waitsome' => '2-1:4-1:5-1', 
-			  'Dims_create' => '3-2', 
-			  'Cart_rank' => '2', 'Cart_coords' => '4-3', 
-			  'Cart_get' => '3-2:4-2:5-2', 
-			  'Graph_neighbors' => '4-3', 
-			  'Cart_sub' => '2',
-			  'Cart_map' => '3-2:4-2',
-			  'Cart_create' => '3-2:4-2',
-			  'Graph_create' => '3:4',
-			  'Dist_graph_create' => '6',
-			  'Dist_graph_create_adjacent' => '4:7',
-			  'Dist_graph_neighbors' => '4:7',
-			  'Group_translate_ranks' => '3-2:5-2',
+%scalarVectorRoutines = ( 'Startall' => '2-1', 'Testall' => '2-1:4-1',
+              'Testany' => '2-1',
+              'Testsome' => '2-1:4-1:5-1',
+              'Waitall' => '2-1:3-1', 'Waitany' => '2-1',
+              'Waitsome' => '2-1:4-1:5-1',
+              'Dims_create' => '3-2',
+              'Cart_rank' => '2', 'Cart_coords' => '4-3',
+              'Cart_get' => '3-2:4-2:5-2',
+              'Graph_neighbors' => '4-3',
+              'Cart_sub' => '2',
+              'Cart_map' => '3-2:4-2',
+              'Cart_create' => '3-2:4-2',
+              'Graph_create' => '3:4',
+              'Dist_graph_create' => '6',
+              'Dist_graph_create_adjacent' => '4:7',
+              'Dist_graph_neighbors' => '4:7',
+              'Group_translate_ranks' => '3-2:5-2',
 
     );
 
@@ -292,26 +292,26 @@ $build_io = 1;
 # Process any options
 foreach $_ (@ARGV) {
     if (/--?prototype=(.*)/) {
-	$prototype_file = $1;
+    $prototype_file = $1;
     }
     elsif (/--?sv/) {
-	# This obscure argument enables the creation of an interface that
-	# includes the routines that can accept a scalar or a vector
-	# (e.g., a single request or an array of requests) on a single 
-	# type (e.g., an integer).  By default, we leave these out.
-	$buildScalarVector = 1;
+    # This obscure argument enables the creation of an interface that
+    # includes the routines that can accept a scalar or a vector
+    # (e.g., a single request or an array of requests) on a single
+    # type (e.g., an integer).  By default, we leave these out.
+    $buildScalarVector = 1;
     }
     elsif (/deffile=(.*)/) {
-	$definition_file = $1;
-	$is_MPI = 0;
+    $definition_file = $1;
+    $is_MPI = 0;
     }
     elsif (/--?noio/) {
-	$build_io = 0;
+    $build_io = 0;
     }
     elsif (/--?debug/) { $gDebug = 1; }
     else {
-	print STDERR "Unrecognized argument $_\n";
-	exit 2;
+    print STDERR "Unrecognized argument $_\n";
+    exit 2;
     }
 }
 
@@ -323,15 +323,15 @@ if ($definition_file) {
 $ucoutfile_prefix = uc( $outfile_prefix );
 
 #
-# Read the interface file (e.g., mpi.h.in) and file in the various 
+# Read the interface file (e.g., mpi.h.in) and file in the various
 # data structures (they're in global variables)
 &ReadInterface( $prototype_file, $routine_prefix, $routine_pattern, "mpi_routines" );
-if ( -s "../../mpi/romio/include/mpio.h.in" && $build_io) { 
-#    %skipBlocks = ( 'HAVE_MPI_DARRAY_SUBARRAY' => 1, 
-#		   'HAVE_MPI_INFO' => 1,
-#		    'MPICH' => 1 );
+if ( -s "../../mpi/romio/include/mpio.h.in" && $build_io) {
+#    %skipBlocks = ( 'HAVE_MPI_DARRAY_SUBARRAY' => 1,
+#           'HAVE_MPI_INFO' => 1,
+#            'MPICH' => 1 );
     &ReadInterface( "../../mpi/romio/include/mpio.h.in", $routine_prefix,
-	$routine_pattern, "mpi_routines" );
+    $routine_pattern, "mpi_routines" );
 #    %skipBlocks = ();
 }
 if ( $buildMPIX ) {
@@ -339,9 +339,9 @@ if ( $buildMPIX ) {
 }
 
 #
-# For some MPI routines, we need to distinguish between arguments that are 
+# For some MPI routines, we need to distinguish between arguments that are
 # input arrays versus ones that are output scalars.  For those functions,
-# convert input (or output) arrays to [] format.  
+# convert input (or output) arrays to [] format.
 
 # ----------------------------------------------------------------------------
 #
@@ -350,7 +350,7 @@ if ( $buildMPIX ) {
 # Print header
 open (MPIFD, ">${outfile_prefix}.f90.new" ) || die "Could not open ${outfile_prefix}.f90.new\n";
 
-# Was 
+# Was
 #       USE MPI_CONSTANTS,                                               &
 #     &      BASE_MPI_WTIME => MPI_WTIME, BASE_MPI_WTICK => MPI_WTICK
 # but this caused problems with the pg compiler.  Need to understand and fix
@@ -363,28 +363,28 @@ print MPIFD "!     -*- Mode: Fortran; -*-
        USE ${ucoutfile_prefix}_SIZEOFS
        USE ${ucoutfile_prefix}_BASE
        END MODULE $ucoutfile_prefix\n";
-  
+
 close (MPIFD);
 &ReplaceIfDifferent( "${outfile_prefix}.f90", "${outfile_prefix}.f90.new" );
 
 # ----------------------------------------------------------------------------
 # This is the file for the routines that have no "choice" arguments.
-# An example of a choice argument is a "void *buf" input argument to 
+# An example of a choice argument is a "void *buf" input argument to
 # MPI_Send, which allows any buffer address, both numeric and character.
 open ( MPIBASEFD, ">${outfile_prefix}_base.f90.in.new" ) || die "Could not open ${outfile_prefix}_base.f90.in.new\n";
 print MPIBASEFD "!     -*- Mode: Fortran; -*-
 !  (C) 2008 by Argonne National Laboratory.
-!      See COPYRIGHT in top-level directory.       
+!      See COPYRIGHT in top-level directory.
        MODULE ${ucoutfile_prefix}_BASE
        IMPLICIT NONE
 !      This module was created by the script buildiface
        INTERFACE\n";
 
 foreach $routine (keys(%mpi_routines)) {
-    # Permit each package to define a new name for the Fortran version of the 
+    # Permit each package to define a new name for the Fortran version of the
     # routine
     if (defined($CtoFName{$routine})) {
-	$routine = $CtoFName{$routine};
+        $routine = $CtoFName{$routine};
     }
     $ucname = uc($routine);
     $args   = $mpi_routines{$routine};
@@ -393,25 +393,27 @@ foreach $routine (keys(%mpi_routines)) {
     print "$routine\n" if $gDebug;
     # Check for a routine to skip
     if (defined($skip_routines{$routine})) {
-	next;
+        next;
     }
 
     if (defined($scalarVectorRoutines{$routine})) {
-	# These require special processing in any case
-	next;
+        # These require special processing in any case
+        next;
     }
 
     # Check for a void * argument (usually choice)
     # As noted above, we don't include the routines with choice arguments
     # in the base module.
+
     if ($args =~ /void/) {
-	$mpi_choice_routines{$routine} = $args;
-	print "Skipping $routine because of void argument\n" if $gDebug;
-	next;
+        $mpi_choice_routines{$routine} = $args;
+        print "Skipping $routine because of void argument\n" if $gDebug;
+        next;
     }
+
     print MPIBASEFD "       SUBROUTINE $out_prefix$ucname(";
     for ($i=0; $i<=$#parms; $i++) {
-	print MPIBASEFD "v$i,";
+        print MPIBASEFD "v$i,";
     }
     print MPIBASEFD "ierror)\n";
     &PrintArgDecls( $routine, 0, "" );
@@ -425,7 +427,7 @@ foreach $routine (keys(%mpi_routines)) {
 # preferable to DOUBLE PRECISION (in cases where the user is permitted
 # to change the size of these basic types(!)).  This script must produce
 # a standard-conforming file.  The top-level configure (in mpich/configure)
-# will replace DOUBLE PRECISION with REAL*8 if the Fortran compiler 
+# will replace DOUBLE PRECISION with REAL*8 if the Fortran compiler
 # supports REAL*8.
 if ($is_MPI) {
     print MPIBASEFD "
@@ -530,9 +532,9 @@ if ($is_MPI) {
 ";
 }
 # Here's where we need to place the interface definitions for the functions
-# that take vector or scalar arguments (startall, testall/any/some, 
+# that take vector or scalar arguments (startall, testall/any/some,
 # waitall/any/some, group_translate_ranks, etc.)
-# For each such routine, we need to generate two entries.  Here's the 
+# For each such routine, we need to generate two entries.  Here's the
 # example for STARTALL:
 #     subroutine MPI_STARTALL_S(c,r,ierr)
 #     integer c,r,ierr
@@ -550,51 +552,54 @@ print MPIBASEFD "       END INTERFACE\n";
 if ($buildScalarVector) {
     # Create the interface modules
     foreach my $routine (keys(%scalarVectorRoutines)) {
-	$ucname = uc($routine);
-	print MPIBASEFD "       INTERFACE ${out_prefix}$ucname\n";
+    $ucname = uc($routine);
+    print MPIBASEFD "       INTERFACE ${out_prefix}$ucname\n";
         print MPIBASEFD "           MODULE PROCEDURE ${out_prefix}${ucname}_S\n";
         print MPIBASEFD "           MODULE PROCEDURE ${out_prefix}${ucname}_V\n";
-	print MPIBASEFD "       END INTERFACE ! ${out_prefix}$ucname\n\n";
-        
+    print MPIBASEFD "       END INTERFACE ! ${out_prefix}$ucname\n\n";
+
     }
     print MPIBASEFD "\n        CONTAINS\n";
     # This is much like the base name (interface) block code
     foreach my $routine (keys(%scalarVectorRoutines)) {
-	$ucname = uc($routine);
-	$args   = $mpi_routines{$routine};
-	@parms  = split(/,/, $args );
-	$svArgs = $scalarVectorRoutines{$routine};
-	# The scalar version
+        $ucname = uc($routine);
+        $args   = $mpi_routines{$routine};
+        @parms  = split(/,/, $args );
+        $svArgs = $scalarVectorRoutines{$routine};
+
+        # The scalar version
         print MPIBASEFD "       SUBROUTINE ${out_prefix}${ucname}_S(";
         for ($i=0; $i<=$#parms; $i++) {
-	    print MPIBASEFD "v$i,";
+            print MPIBASEFD "v$i,";
         }
         print MPIBASEFD "ierror)\n";
-	&PrintArgDecls( $routine, 1, $svArgs );
-	print MPIBASEFD "       EXTERNAL ${out_prefix}${ucname}\n";
-	print MPIBASEFD "       call ${out_prefix}$ucname(";
+        &PrintArgDecls( $routine, 1, $svArgs );
+
+        print MPIBASEFD "       EXTERNAL ${out_prefix}${ucname}\n";
+        print MPIBASEFD "       call ${out_prefix}$ucname(";
         for ($i=0; $i<=$#parms; $i++) {
-	    print MPIBASEFD "v$i,";
+            print MPIBASEFD "v$i,";
         }
-	print MPIBASEFD "ierror)\n";
+        print MPIBASEFD "ierror)\n";
 
-	print MPIBASEFD "       END SUBROUTINE ${out_prefix}${ucname}_S\n\n";
+        print MPIBASEFD "       END SUBROUTINE ${out_prefix}${ucname}_S\n\n";
 
-	# The vector version
+        # The vector version
         print MPIBASEFD "       SUBROUTINE ${out_prefix}${ucname}_V(";
         for ($i=0; $i<=$#parms; $i++) {
-	    print MPIBASEFD "v$i,";
+            print MPIBASEFD "v$i,";
         }
         print MPIBASEFD "ierror)\n";
-	&PrintArgDecls( $routine, 0, "" );
-	print MPIBASEFD "       EXTERNAL ${out_prefix}${ucname}\n";
-	print MPIBASEFD "       call ${out_prefix}$ucname(";
+        &PrintArgDecls( $routine, 0, "" );
+
+        print MPIBASEFD "       EXTERNAL ${out_prefix}${ucname}\n";
+        print MPIBASEFD "       call ${out_prefix}$ucname(";
         for ($i=0; $i<=$#parms; $i++) {
-	    print MPIBASEFD "v$i,";
+            print MPIBASEFD "v$i,";
         }
-	print MPIBASEFD "ierror)\n";
+        print MPIBASEFD "ierror)\n";
 
-	print MPIBASEFD "       END SUBROUTINE ${out_prefix}${ucname}_V\n\n";
+        print MPIBASEFD "       END SUBROUTINE ${out_prefix}${ucname}_V\n\n";
 
     }
 }
@@ -641,11 +646,11 @@ $PRIVATEVAR = "";
 #$BINDACCESS = ", BIND(C)";
 #$BINDDEF ="";
 # Yet another problem.
-# Because MPI_Count may be longer than a single (Fortran) INTEGER, 
+# Because MPI_Count may be longer than a single (Fortran) INTEGER,
 # alignment restrictions may introduce padding in the structure
 # And one more problem: If a Fortran INTEGER is not the same as a C int,
-# then these are also wrong (see the "fint" option in 
-# src/binding/f77/buildiface 
+# then these are also wrong (see the "fint" option in
+# src/binding/f77/buildiface
 print MPIFD <<EOT;
         TYPE$BINDACCESS :: MPI_Status
            $BINDDEF
@@ -655,11 +660,11 @@ print MPIFD <<EOT;
         END TYPE MPI_Status
 EOT
 
-%handles = ( 'comm' => 'Comm', 'datatype' => 'Datatype', 
-	     'group' => 'Group', 'win' => 'Win', 
-	     'file' => 'File', 'op' => 'Op', 'errhandler' => 'Errhandler',
-	     'request' => 'Request', 'message' => 'Message', 
-	     'info' => 'Info' );
+%handles = ( 'comm' => 'Comm', 'datatype' => 'Datatype',
+         'group' => 'Group', 'win' => 'Win',
+         'file' => 'File', 'op' => 'Op', 'errhandler' => 'Errhandler',
+         'request' => 'Request', 'message' => 'Message',
+         'info' => 'Info' );
 
 foreach $handle (keys(%handles)) {
     $mpitype = $handles{$handle};
@@ -715,10 +720,10 @@ close MPIFD;
 
 #
 # Generate the choice argument routines
-# FIXME: This file is not quite right.  Also note that it is 
-# *input* for yet another step, one that generates particular values 
-# for the types of the choice arguments.  We should consider using 
-# a different extension for this file, such as sed or in, so that 
+# FIXME: This file is not quite right.  Also note that it is
+# *input* for yet another step, one that generates particular values
+# for the types of the choice arguments.  We should consider using
+# a different extension for this file, such as sed or in, so that
 # it is clearly not a ready-to-use Fortran 90 input file.
 # In particular, it needs to be set up so that
 #   <typesize>
@@ -765,18 +770,18 @@ foreach $routine (keys(%mpi_choice_routines)) {
 
     print MPIFD "        SUBROUTINE ${out_prefix}${ucname}_T(";
     for ($i=0; $i<=$#parms; $i++) {
-	print MPIFD "v$i,";
+        print MPIFD "v$i,";
     }
     print MPIFD "ierror)\n";
 
     if (defined($NeedConstants{$routine})) {
-	print MPIFD "       USE ${out_prefix}CONSTANTS,ONLY:";
-	$sep = "";
-	foreach $name (split(/\s+/,$NeedConstants{$routine})) {
-	    print MPIFD "$sep$name";
-	    $sep = ", ";
-	}
-	print MPIFD "\n";
+        print MPIFD "       USE ${out_prefix}CONSTANTS,ONLY:";
+        $sep = "";
+        foreach $name (split(/\s+/,$NeedConstants{$routine})) {
+            print MPIFD "$sep$name";
+            $sep = ", ";
+        }
+        print MPIFD "\n";
     }
 
     # print the arg decls ...
@@ -784,49 +789,50 @@ foreach $routine (keys(%mpi_choice_routines)) {
     # including scalar.
     $nchoice = 0;
     for ($i=0; $i<=$#parms; $i++) {
-	$parms[$i] =~ s/^const\s//;  # Remove const if present
-	$parm = $parms[$i];
-	# Check for special args
-	$loc = $i+1;
-	if (defined($special_args{"$routine-$loc"})) {
-	    $parm = $special_args{"$routine-$loc"};
-	}
-
-	if ($parm =~ /void/) {
-	    # An alternative to this is to have a separate file for
-	    # routines with 2 choice arguments
-	    if ($nchoice == 0) {
-		print MPIFD "        <type> v$i<dims>\n";
-	    }
-	    else {
-		print MPIFD "        <type$nchoice> v$i<dims$nchoice>\n";
-	    }
-	    $nchoice ++;
-	}
-	else {
-	    # Map the C type to the Fortran type
-	    $cparm = $parm;
-	    $cparm =~ s/\s+//g;
-	    $fparm = $parmc2f{$cparm};
-	    if ($fparm eq "") {
-		print STDERR "$routine: No parm type for $cparm ($parm)\n";
-	    }
-	    if ($fparm =~ /%name%/) {
-		$fparm =~ s/%name%/v$i/;
-		# In the name case, convert any %nl% to newlines and spaces
-		$fparm =~ s/%nl%/\n       /g;
-		print MPIFD "        $fparm\n";
-	    }
-	    else {
-		print MPIFD "        $fparm v$i\n";
-	    }
-	}
+        $parms[$i] =~ s/^const\s//;  # Remove const if present
+        $parm = $parms[$i];
+        # Check for special args
+        $loc = $i+1;
+        if (defined($special_args{"$routine-$loc"})) {
+            $parm = $special_args{"$routine-$loc"};
+        }
+
+        if ($parm =~ /void/) {
+            # An alternative to this is to have a separate file for
+            # routines with 2 choice arguments
+            if ($nchoice == 0) {
+                print MPIFD "        <type> v$i<dims>\n";
+            }
+            else {
+                print MPIFD "        <type$nchoice> v$i<dims$nchoice>\n";
+            }
+            $nchoice ++;
+        }
+        else {
+            # Map the C type to the Fortran type
+            $cparm = $parm;
+            $cparm =~ s/\s+//g;
+            $fparm = $parmc2f{$cparm};
+            if ($fparm eq "") {
+                print STDERR "$routine: No parm type for $cparm ($parm)\n";
+            }
+            if ($fparm =~ /%name%/) {
+                $fparm =~ s/%name%/v$i/;
+                # In the name case, convert any %nl% to newlines and spaces
+                $fparm =~ s/%nl%/\n       /g;
+                print MPIFD "        $fparm\n";
+            }
+            else {
+                print MPIFD "        $fparm v$i\n";
+            }
+        }
     }
+
     print MPIFD "        INTEGER ierror\n";
     print MPIFD "        EXTERNAL ${out_prefix}${ucname}\n";
     print MPIFD "        CALL ${out_prefix}${ucname}(";
     for ($i=0; $i<=$#parms; $i++) {
-	print MPIFD "v$i,";
+        print MPIFD "v$i,";
     }
     print MPIFD "ierror)\n";
     print MPIFD "        END SUBROUTINE ${out_prefix}${ucname}_T\n\n";
@@ -878,7 +884,7 @@ if MAINTAINER_MODE
 \$(top_srcdir)/src/binding/f90/Makefile.mk: src/binding/f90/buildiface-stamp
 
 src/binding/f90/buildiface-stamp: \$(top_srcdir)/src/binding/f90/buildiface \$(top_srcdir)/src/include/mpi.h.in
-	( cd \$(top_srcdir)/src/binding/f90 && ./buildiface )
+\t( cd \$(top_srcdir)/src/binding/f90 && ./buildiface )
 endif MAINTAINER_MODE
 
 # variables for custom "silent-rules" for F90 modules
@@ -953,7 +959,7 @@ EOT
 
 print MAKEFD <<EOT;
 # FIXME: We may want to edit the mpif.h to convert Fortran77-specific
-# items (such as an integer*8 used for file offsets) into the 
+# items (such as an integer*8 used for file offsets) into the
 # corresponding Fortran 90 KIND type, to accomodate compilers that
 # reject non-standard features such as integer*8 (such as the Intel
 # Fortran compiler with -std95).
@@ -1014,16 +1020,16 @@ mpi_f90_modules = \\
 modinc_HEADERS = \$(mpi_f90_modules)
 
 # We need a free-format version of mpif.h with no external commands,
-# including no wtime/wtick (removing MPI_WTICK also removes MPI_WTIME, 
+# including no wtime/wtick (removing MPI_WTICK also removes MPI_WTIME,
 # but leave MPI_WTIME_IS_GLOBAL).
-# Also allow REAL*8 or DOUBLE PRECISION for the MPI_WTIME/MPI_WTICK 
+# Also allow REAL*8 or DOUBLE PRECISION for the MPI_WTIME/MPI_WTICK
 # declarations
 src/binding/f90/mpifnoext.h: src/binding/f77/mpif.h
-	rm -f \$@
-	sed -e 's/^C/\\!/g' -e '/EXTERNAL/d' \\
-		-e '/REAL\\*8/d' \\
-		-e '/DOUBLE PRECISION/d' \\
-		-e '/MPI_WTICK/d' src/binding/f77/mpif.h > \$@
+\trm -f \$@
+\tsed -e 's/^C/\\!/g' -e '/EXTERNAL/d' \\
+\t-e '/REAL\\*8/d' \\
+\t-e '/DOUBLE PRECISION/d' \\
+\t-e '/MPI_WTICK/d' src/binding/f77/mpif.h > \$@
 
 CLEANFILES += src/binding/f90/mpifnoext.h
 
@@ -1050,9 +1056,9 @@ print MAKEFD "\n";
 
 # ----------------------------------------------------------------------------
 # FIXME: Add the steps to handle the choice arguments.  They should be
-# selected by configure from a list of possible choices, with an 
-# enable switch used to bypass the checks.  In addition, we need a way to 
-# dynamically create subsets, given a list of routines and types/dimensions 
+# selected by configure from a list of possible choices, with an
+# enable switch used to bypass the checks.  In addition, we need a way to
+# dynamically create subsets, given a list of routines and types/dimensions
 # to include.  This allows users to build precisely tailored Fortran90 modules.
 # ----------------------------------------------------------------------------
 
@@ -1080,12 +1086,12 @@ sub print_line {
     my $count = $_[2];
     my $continue = $_[3];
     my $continue_len = $_[4];
-    
+
     $linelen = length( $line );
     #print "linelen = $linelen, print_line_len = $print_line_len\n";
     if ($print_line_len + $linelen > $count) {
-	print $FD $continue;
-	$print_line_len = $continue_len;
+    print $FD $continue;
+    $print_line_len = $continue_len;
     }
     print $FD $line;
     $print_line_len += $linelen;
@@ -1104,7 +1110,7 @@ sub print_endline {
 # config.status.
 sub createModSteps {
     my ($module, $deps, $srcFile, $use_srcdir) = @_;
-    
+
     # Get a version of the source file with $(FCEXT) instead of .f90
     # as the extension
     my $srcFileWithExt = $srcFile;
@@ -1131,7 +1137,7 @@ sub createModSteps {
 
     # Attempt to deal with Fortran module files in a mostly sane way.  Quick
     # overview for the less Fortran literate:
-    # 
+    #
     # MPICH has four Fortran modules: mpi, mpi_constants, mpi_sizeofs, and
     # mpi_base.  Each module is produced as a side effect of compiling the
     # corresponding .f90 file into a .lo.  The .lo is produced by libtool and is
@@ -1214,7 +1220,7 @@ EOT
 
 }
 
-# Print the declarations for the given routine.  
+# Print the declarations for the given routine.
 sub PrintArgDecls {
     my ($routine,$svflag,$svArgs) = @_;
 
@@ -1222,111 +1228,111 @@ sub PrintArgDecls {
     my $args   = $mpi_routines{$routine};
     my @parms  = split(/,/, $args );
 
-    # preload the svargs if requested.  This is used to decide whether 
+    # preload the svargs if requested.  This is used to decide whether
     # an array arg is output as a scalar or a vector
     my %svargs = ();
     if ($svflag) {
-	for my $val (split(/:/,$svArgs)) {
-	    my $loc = $val;
-	    my $count = "-1";
-	    if ($loc =~ /(\d+)-(\d+)/) {
-		$loc   = $1;
-		$count = $2;
-	    }
-	    $svargs{$loc} = $count;
-	}
+    for my $val (split(/:/,$svArgs)) {
+        my $loc = $val;
+        my $count = "-1";
+        if ($loc =~ /(\d+)-(\d+)/) {
+        $loc   = $1;
+        $count = $2;
+        }
+        $svargs{$loc} = $count;
     }
-    # Determine if we need any constants (e.g., MPI_STATUS_SIZE, 
+    }
+    # Determine if we need any constants (e.g., MPI_STATUS_SIZE,
     # MPI_OFFSET_KIND)
     my %use_constants = ();
     my $found_constants = 0;
     for (my $i=0; $i<=$#parms; $i++) {
-	$parms[$i] =~ s/^const\s+//;  # Remove const if present
-	$parm = $parms[$i];
-	# Check for special args
-	$loc = $i+1;
-	if (defined($special_args{"$routine-$loc"})) {
-	    $parm = $special_args{"$routine-$loc"};
-	}
-	# Map the C type to the Fortran type
-	$cparm = $parm;
-	$cparm =~ s/\s+//g;
-	$fparm = $parmc2f{$cparm};
-	# Now, does this type contain an MPI constant?
-	if (!defined($fparm)) {
-	    print "$cparm value has no matching fortran parm\n";
-	}
-	if ($fparm =~ /(MPI_[A-Z_]*)/) {
-	    $use_constants{$1} = 1;
-	    $found_constants = 1;
-	}
+    $parms[$i] =~ s/^const\s+//;  # Remove const if present
+    $parm = $parms[$i];
+    # Check for special args
+    $loc = $i+1;
+    if (defined($special_args{"$routine-$loc"})) {
+        $parm = $special_args{"$routine-$loc"};
+    }
+    # Map the C type to the Fortran type
+    $cparm = $parm;
+    $cparm =~ s/\s+//g;
+    $fparm = $parmc2f{$cparm};
+    # Now, does this type contain an MPI constant?
+    if (!defined($fparm)) {
+        print "$cparm value has no matching fortran parm\n";
+    }
+    if ($fparm =~ /(MPI_[A-Z_]*)/) {
+        $use_constants{$1} = 1;
+        $found_constants = 1;
+    }
     }
     if ($found_constants) {
-	print MPIBASEFD "       USE MPI_CONSTANTS,ONLY:";
-	$sep = "";
-	foreach $name (keys(%use_constants)) {
-	    print MPIBASEFD "$sep$name";
-	    $sep = ", ";
-	    $NeedConstants{$routine} .= "$name ";
-	}
-	print MPIBASEFD "\n";
+        print MPIBASEFD "       USE MPI_CONSTANTS,ONLY:";
+        $sep = "";
+        foreach $name (keys(%use_constants)) {
+            print MPIBASEFD "$sep$name";
+            $sep = ", ";
+            $NeedConstants{$routine} .= "$name ";
+        }
+        print MPIBASEFD "\n";
     }
 
     # Output argument types
     $lastParmType = "<none>";
     for (my $i=0; $i<=$#parms; $i++) {
-	$parm = $parms[$i];
-	# Check for special args
-	$loc = $i+1;
-	if (defined($special_args{"$routine-$loc"})) {
-	    $parm = $special_args{"$routine-$loc"};
-	}
-	# Map the C type to the Fortran type
-	$cparm = $parm;
-	$cparm =~ s/\s+//g;
-	$fparm = $parmc2f{$cparm};
-	if ($fparm eq "") {
-	    print STDERR "$routine: No parm type for $cparm ($parm)\n";
-	}
-	# Split out the base type from the name
-	if ($fparm =~ /(\w+.*)\s+(%name\S.*)/) {
-	    $parmType = $1;
-	    $varName  = $2;
-	    if ($varName =~ /%name%/) {
-		$varName =~ s/%name%/v$i/;
-	    }
-	    $varName =~ s/%nl%/\n       /g;
-	    $parmType =~ s/%nl%/\n       /g;
-
-	    # Here's where we might change vector to scalar args
-	    if ($svflag) {
-		if (defined($svargs{$loc})) {
-		    # The value is the count arg for the array; later, we
-		    # can make use of that to improve the definitions
-		    if ($varName =~ /,\*/) {
-			$varName =~ s/,\*//;
-		    }
-		    elsif ($varName =~ /\(\*\)/) {
-			$varName =~ s/\(\*\)//;
-		    }
-		    else {
-			print STDERR "Failed to make arg $i in $routine a scalar\n";
-		    }
-		}
-	    }
-	}
-	else {
-	    $parmType = $fparm;
-	    $varName  = "v$i";
-	}
-	if ($parmType ne $lastParmType) {
-	    if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
-	    print MPIBASEFD "       $parmType $varName";
-	    $lastParmType = $parmType;
-	}
-	else {
-	    print MPIBASEFD ", $varName";
-	}
+        $parm = $parms[$i];
+        # Check for special args
+        $loc = $i+1;
+        if (defined($special_args{"$routine-$loc"})) {
+            $parm = $special_args{"$routine-$loc"};
+        }
+        # Map the C type to the Fortran type
+        $cparm = $parm;
+        $cparm =~ s/\s+//g;
+        $fparm = $parmc2f{$cparm};
+        if ($fparm eq "") {
+            print STDERR "$routine: No parm type for $cparm ($parm)\n";
+        }
+        # Split out the base type from the name
+        if ($fparm =~ /(\w+.*)\s+(%name\S.*)/) {
+            $parmType = $1;
+            $varName  = $2;
+            if ($varName =~ /%name%/) {
+            $varName =~ s/%name%/v$i/;
+            }
+            $varName =~ s/%nl%/\n       /g;
+            $parmType =~ s/%nl%/\n       /g;
+
+            # Here's where we might change vector to scalar args
+            if ($svflag) {
+                if (defined($svargs{$loc})) {
+                    # The value is the count arg for the array; later, we
+                    # can make use of that to improve the definitions
+                    if ($varName =~ /,\*/) {
+                        $varName =~ s/,\*//;
+                    }
+                    elsif ($varName =~ /\(\*\)/) {
+                        $varName =~ s/\(\*\)//;
+                    }
+                    else {
+                        print STDERR "Failed to make arg $i in $routine a scalar\n";
+                }
+            }
+            }
+        }
+        else {
+            $parmType = $fparm;
+            $varName  = "v$i";
+        }
+        if ($parmType ne $lastParmType) {
+            if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
+            print MPIBASEFD "       $parmType $varName";
+            $lastParmType = $parmType;
+        }
+        else {
+            print MPIBASEFD ", $varName";
+        }
     }
     if ($lastParmType ne "<none>" ) { print MPIBASEFD "\n"; }
 
@@ -1335,31 +1341,31 @@ sub PrintArgDecls {
 
 #
 # Replace old file with new file only if new file is different
-# Otherwise, remove new filename 
+# Otherwise, remove new filename
 sub ReplaceIfDifferent {
     my ($oldfilename,$newfilename) = @_;
     my $rc = 1;
-    if (-s $oldfilename) { 
-	$rc = system "cmp -s $newfilename $oldfilename";
-	$rc >>= 8;   # Shift right to get exit status
+    if (-s $oldfilename) {
+        $rc = system "cmp -s $newfilename $oldfilename";
+        $rc >>= 8;   # Shift right to get exit status
     }
     if ($rc != 0) {
-	# The files differ.  Replace the old file 
-	# with the new one
-	if (-s $oldfilename) {
-	    print STDERR "Replacing $oldfilename\n";
-	    # If debugging and there is a difference, show that difference
-	    if ($gDebug) { system "diff $newfilename $oldfilename"; }
-
-	    unlink $oldfilename;
-	}
-	else {
-	    print STDERR "Creating $oldfilename\n";
-	}
-	rename $newfilename, $oldfilename || 
-	    die "Could not replace $oldfilename";
+    # The files differ.  Replace the old file
+    # with the new one
+    if (-s $oldfilename) {
+        print STDERR "Replacing $oldfilename\n";
+        # If debugging and there is a difference, show that difference
+        if ($gDebug) { system "diff $newfilename $oldfilename"; }
+
+        unlink $oldfilename;
+    }
+    else {
+        print STDERR "Creating $oldfilename\n";
+    }
+    rename $newfilename, $oldfilename ||
+        die "Could not replace $oldfilename";
     }
     else {
-	unlink $newfilename;
+        unlink $newfilename;
     }
 }

http://git.mpich.org/mpich.git/commitdiff/80419d6d3b1a658d88886b645654e2297fa28321

commit 80419d6d3b1a658d88886b645654e2297fa28321
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Wed Dec 18 14:13:13 2013 -0600

    Make ReadInterface extract both arg types & names
    
    Revised Perl subroutine ReadInterface(), which is used to extract function prototypes
    from a file. Previously, ReadInterface only extracted argument types of C functions.
    With this revise, it also extracts argument names. This is needed to support Fortran
    keyword arguments.
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/src/binding/f90/binding.sub b/src/binding/f90/binding.sub
index 7e534a7..ad4d00f 100755
--- a/src/binding/f90/binding.sub
+++ b/src/binding/f90/binding.sub
@@ -43,7 +43,9 @@ sub ReadInterface {
                 print STDERR "Error in processing comment within interface file $prototype_file in line $origline";
             }
         }
-        print "binding: read $_" if $gDebug;
+
+        # Parse all routines returning an error code
+        print "\nParsing : $_" if $gDebug;
         if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {
             $routine_name = $1;
             $args = $2;
@@ -56,7 +58,7 @@ sub ReadInterface {
             # remove qualifiers from args
             $args =~ s/\s*const\s+//g;
 
-            print "binding: $routine_name ( $args )\n" if $gDebug;
+            print "Found   : $routine_name($args)\n" if $gDebug;
             # Eventually, we'll create a new file here.
             # For C++, we may create similar files by looking up
             # the corresponding routines.
@@ -65,27 +67,32 @@ sub ReadInterface {
                 print STDERR "Duplicate prototypes for $routine_name\n";
                 next;
             }
-            # Clear variables
-            $args = &clean_args( $args );
+            # Seperate argument types and names
+            my ($argtypes, $argnames) = &separate_args_and_append_ierror($args);
             # # Handle special cases
             # my $testname = $routine_name . "_args";
             # if (defined($$testname)) {
             # print "replacing args for $routine_name\n" if $gDebug;
             # $args = $$testname;
             # }
-            $$routine_hash{$routine_name} = $args;
+            $$routine_hash{$routine_name} = [$argtypes, $argnames];
         }
     }
 }
 
 #
-# Look through $args for parameter names (foo\s+name)
-# and remove them
-sub clean_args {
-    my $args = $_[0];
-    my $newargs = "";
-    my $comma = "";
-    for my $parm (split(',',$args)) {
+# Look through $args, separate type and name of each argument. Then group argument
+# types and names separately. In addition, append "int", "ierror" to existing
+# argument types and names respectively.
+# Input: an argument string
+# Output: ($argtypes, $argnames), in which types (names) are delimited by comma.
+sub separate_args_and_append_ierror {
+    my $argtypes = "";
+    my $argnames = "";
+    my $comma = ""; # no comma before the first arg
+    for my $parm (split(',', $_[0])) {
+        my $argtype = "";
+        my $argname = "";
         # Remove any leading or trailing spaces
         $parm =~ s/^\s*//;
         $parm =~ s/\s*$//;
@@ -95,36 +102,51 @@ sub clean_args {
             $qualifier = "const ";
             $parm = $1;
         }
+
+        if ($parm eq "void") { # e.g., MPI_Finalize(void)
+            last;
+        }
+
         # Question: What to do with the qualifier?
         # Handle parameters with parameter names
         # 1. "int foo"
         # 2. "int *foo"
         # 3. "int foo[]"
-        # 4. "int *foo[]"
-        if ( ($parm =~ /^([A-Za-z0-9_]+)\s+[A-Za-z0-9_]+$/) ) {
-            $parm = $1;
+        # 4. "int *foo[]" or "int **foo[]"
+        if ( ($parm =~ /^([A-Za-z0-9_]+)\s+([A-Za-z0-9_]+)$/) ) {
+            $argtype = $1;
+            $argname = $2;
         }
-        elsif ( ($parm =~ /^([A-Za-z0-9_]+\s*\*)\s*[A-Za-z0-9_]+$/) ) {
-            $parm = $1;
+        elsif ( ($parm =~ /^([A-Za-z0-9_]+\s*\*)\s*([A-Za-z0-9_]+)$/) ) {
+            $argtype = $1;
+            $argname = $2;
         }
-        elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s*[A-Za-z0-9_]+(\[.*\])\s*$/) ) {
-            my $basename = $1;
-            my $arrayarg = $2;
-            #if ($arrayarg =~ /\[\s*\]/) { $arrayarg = "*"; }
-            $parm = $basename . $arrayarg;
+        elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s*([A-Za-z0-9_]+)(\[.*\])\s*$/) ) {
+            my $basetype = $1;
+            my $arraytype = $3;
+            #if ($arraytype =~ /\[\s*\]/) { $arraytype = "*"; }
+            $argtype = $basetype . $arraytype;
+            $argname = $2;
         }
-        elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s(\*?\*?)\s*[A-Za-z0-9_]+(\[.*\])\s*$/) ) {
-            my $basename = $1;
-            my $arrayarg = $2 . $3;
-            #if ($arrayarg =~ /\[\s*\]/) { $arrayarg = "*"; }
-            $parm = $basename . $arrayarg;
+        elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s(\*?\*?)\s*([A-Za-z0-9_]+)(\[.*\])\s*$/) ) {
+            my $basetype = $1;
+            my $arraytype = $2 . $4;
+            #if ($arraytype =~ /\[\s*\]/) { $arraytype = "*"; }
+            $argtype = $basetype . $arraytype;
+            $argname = $3;
         }
-        $newargs .= "$comma$parm";
+
+        $argtypes .= "$comma$argtype";
+        $argnames .= "$comma$argname";
         $comma = ",";
     }
-    print "$newargs\n" if $gDebug;
-    $args = $newargs;
-    return $args;
+
+    # Append "int ierror"
+    $argtypes .= "${comma}int";
+    $argnames .= "${comma}ierror";
+    print "argtypes= $argtypes\n" if $gDebug;
+    print "argnames= $argnames\n" if $gDebug;
+    return ($argtypes, $argnames);
 }
 
 # Since this is a required package, indicate that we are successful.

http://git.mpich.org/mpich.git/commitdiff/35a996524a0a58941829118f7eccac76a6ca3dba

commit 35a996524a0a58941829118f7eccac76a6ca3dba
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Wed Dec 18 13:53:40 2013 -0600

    Add indentions, remove white spaces, replace Tabs
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/src/binding/f90/binding.sub b/src/binding/f90/binding.sub
index 89feb62..7e534a7 100755
--- a/src/binding/f90/binding.sub
+++ b/src/binding/f90/binding.sub
@@ -1,12 +1,12 @@
 #! /usr/bin/env perl
 #
 # This file contains common routines for reading a file of function prototypes
-# (such as mpi.h) and extracting the function prototypes.  
+# (such as mpi.h) and extracting the function prototypes.
 
-# 
+#
 # ReadInterface( filename, routineprefix, routinepattern, routinehash )
 # Read file filename, look for routines that have a given prefix and name
-# pattern, and insert that routine into routinehash with value the 
+# pattern, and insert that routine into routinehash with value the
 # arguments of the routine.
 
 #$Finalized_args = "bool";
@@ -17,64 +17,64 @@ sub ReadInterface {
     my $routine_pattern = $_[2];
     my $routine_hash    = $_[3];
     # $debug is a global variable
-    
+
     open( FD, "<$prototype_file" ) || die "Cannot open $prototype_file\n";
 
     # Skip to prototypes
     while (<FD>) {
-	if ( /\/\*\s*Begin Prototypes/ ) { last; }
+        if ( /\/\*\s*Begin Prototypes/ ) { last; }
     }
 
     # Read each one
     while (<FD>) {
-	# Handle the special case of prototypes to ignore
-	if (/\/\*\s*Begin Skip Prototypes/) {
-	    while (<FD>) {
-		if (/\/\*\s*End Skip Prototypes/) { last; }
-	    }
-	}
-	if (/\/\*\s*End Prototypes/) { last; }
-	# Remove any comments
-	$origline = $_;
-	while (/(.*)\/\*(.*?)\*\/(.*)/) {
-	    my $removed = $2;
-	    $_ = $1.$3;
-	    if ($2 =~ /\/\*/) {
-		print STDERR "Error in processing comment within interface file $prototype_file in line $origline";
-	    }
-	}
-	print "binding: read $_" if $gDebug;
-	if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {
-	    $routine_name = $1;
-	    $args = $2;
-	    while (! ($args =~ /;/)) {
-		$args .= <FD>;
-	    }
-	    $args =~ s/MPICH_ATTR[A-Z_]*\([^)]*\)//g;
-	    $args =~ s/\)\s*;//g;
-	    $args =~ s/[\r\n]*//g;
-	    # remove qualifiers from args
-	    $args =~ s/\s*const\s+//g;
-	    
-	    print "binding: $routine_name ( $args )\n" if $gDebug;
-	    # Eventually, we'll create a new file here.  
-	    # For C++, we may create similar files by looking up 
-	    # the corresponding routines.
-	    # Check for duplicates in the list of routines
-	    if (defined($$routine_hash{$routine_name})) {
-		print STDERR "Duplicate prototypes for $routine_name\n";
-		next;
-	    }
-	    # Clear variables
-	    $args = &clean_args( $args );
-#	    # Handle special cases
-#	    my $testname = $routine_name . "_args";
-#	    if (defined($$testname)) {
-#		print "replacing args for $routine_name\n" if $gDebug;
-#		$args = $$testname;
-#	    }
-	    $$routine_hash{$routine_name} = $args;
-	}
+        # Handle the special case of prototypes to ignore
+        if (/\/\*\s*Begin Skip Prototypes/) {
+            while (<FD>) {
+                if (/\/\*\s*End Skip Prototypes/) { last; }
+            }
+        }
+        if (/\/\*\s*End Prototypes/) { last; }
+        # Remove any comments
+        $origline = $_;
+        while (/(.*)\/\*(.*?)\*\/(.*)/) {
+            my $removed = $2;
+            $_ = $1.$3;
+            if ($2 =~ /\/\*/) {
+                print STDERR "Error in processing comment within interface file $prototype_file in line $origline";
+            }
+        }
+        print "binding: read $_" if $gDebug;
+        if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {
+            $routine_name = $1;
+            $args = $2;
+            while (! ($args =~ /;/)) {
+                $args .= <FD>;
+            }
+            $args =~ s/MPICH_ATTR[A-Z_]*\([^)]*\)//g;
+            $args =~ s/\)\s*;//g;
+            $args =~ s/[\r\n]*//g;
+            # remove qualifiers from args
+            $args =~ s/\s*const\s+//g;
+
+            print "binding: $routine_name ( $args )\n" if $gDebug;
+            # Eventually, we'll create a new file here.
+            # For C++, we may create similar files by looking up
+            # the corresponding routines.
+            # Check for duplicates in the list of routines
+            if (defined($$routine_hash{$routine_name})) {
+                print STDERR "Duplicate prototypes for $routine_name\n";
+                next;
+            }
+            # Clear variables
+            $args = &clean_args( $args );
+            # # Handle special cases
+            # my $testname = $routine_name . "_args";
+            # if (defined($$testname)) {
+            # print "replacing args for $routine_name\n" if $gDebug;
+            # $args = $$testname;
+            # }
+            $$routine_hash{$routine_name} = $args;
+        }
     }
 }
 
@@ -86,41 +86,41 @@ sub clean_args {
     my $newargs = "";
     my $comma = "";
     for my $parm (split(',',$args)) {
-	# Remove any leading or trailing spaces
-	$parm =~ s/^\s*//;
-	$parm =~ s/\s*$//;
-	# Remove and remember qualifiers
-	$qualifier = "";
-	if ($parm =~ /^const\s+(.*)/) {
-	    $qualifier = "const ";
-	    $parm = $1;
-	}
-	# Question: What to do with the qualifier?
-	# Handle parameters with parameter names
-	# 1. "int foo"
+        # Remove any leading or trailing spaces
+        $parm =~ s/^\s*//;
+        $parm =~ s/\s*$//;
+        # Remove and remember qualifiers
+        $qualifier = "";
+        if ($parm =~ /^const\s+(.*)/) {
+            $qualifier = "const ";
+            $parm = $1;
+        }
+        # Question: What to do with the qualifier?
+        # Handle parameters with parameter names
+        # 1. "int foo"
         # 2. "int *foo"
         # 3. "int foo[]"
         # 4. "int *foo[]"
-	if ( ($parm =~ /^([A-Za-z0-9_]+)\s+[A-Za-z0-9_]+$/) ) {
-	    $parm = $1;
-	}
-	elsif ( ($parm =~ /^([A-Za-z0-9_]+\s*\*)\s*[A-Za-z0-9_]+$/) ) {
-	    $parm = $1;
-	}
-	elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s*[A-Za-z0-9_]+(\[.*\])\s*$/) ) {
-	    my $basename = $1;
-	    my $arrayarg = $2;
-	    #if ($arrayarg =~ /\[\s*\]/) { $arrayarg = "*"; }
-	    $parm = $basename . $arrayarg;
-	}
-	elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s(\*?\*?)\s*[A-Za-z0-9_]+(\[.*\])\s*$/) ) {
-	    my $basename = $1;
-	    my $arrayarg = $2 . $3;
-	    #if ($arrayarg =~ /\[\s*\]/) { $arrayarg = "*"; }
-	    $parm = $basename . $arrayarg;
-	}
-	$newargs .= "$comma$parm";
-	$comma = ",";
+        if ( ($parm =~ /^([A-Za-z0-9_]+)\s+[A-Za-z0-9_]+$/) ) {
+            $parm = $1;
+        }
+        elsif ( ($parm =~ /^([A-Za-z0-9_]+\s*\*)\s*[A-Za-z0-9_]+$/) ) {
+            $parm = $1;
+        }
+        elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s*[A-Za-z0-9_]+(\[.*\])\s*$/) ) {
+            my $basename = $1;
+            my $arrayarg = $2;
+            #if ($arrayarg =~ /\[\s*\]/) { $arrayarg = "*"; }
+            $parm = $basename . $arrayarg;
+        }
+        elsif ( ($parm =~ /^([A-Za-z0-9_]+)\s(\*?\*?)\s*[A-Za-z0-9_]+(\[.*\])\s*$/) ) {
+            my $basename = $1;
+            my $arrayarg = $2 . $3;
+            #if ($arrayarg =~ /\[\s*\]/) { $arrayarg = "*"; }
+            $parm = $basename . $arrayarg;
+        }
+        $newargs .= "$comma$parm";
+        $comma = ",";
     }
     print "$newargs\n" if $gDebug;
     $args = $newargs;

-----------------------------------------------------------------------

Summary of changes:
 src/binding/f90/binding.sub |  214 +++++----
 src/binding/f90/buildiface  | 1161 ++++++++++++++++++++++--------------------
 2 files changed, 726 insertions(+), 649 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list