[mpich2-commits] r4056 - in mpich2/trunk/src/binding: cxx f77 f90

gropp at mcs.anl.gov gropp at mcs.anl.gov
Fri Mar 13 10:32:32 CDT 2009


Author: gropp
Date: 2009-03-13 10:32:31 -0500 (Fri, 13 Mar 2009)
New Revision: 4056

Modified:
   mpich2/trunk/src/binding/cxx/buildiface
   mpich2/trunk/src/binding/f77/buildiface
   mpich2/trunk/src/binding/f90/binding.sub
Log:
Enhanced the interface builders to handle multiple comments in a function prototype line

Modified: mpich2/trunk/src/binding/cxx/buildiface
===================================================================
--- mpich2/trunk/src/binding/cxx/buildiface	2009-03-13 15:30:30 UTC (rev 4055)
+++ mpich2/trunk/src/binding/cxx/buildiface	2009-03-13 15:32:31 UTC (rev 4056)
@@ -1380,7 +1380,7 @@
 
 // MPICH_DONT_INCLUDE_STDIO_H is another escape hatch for us, just like
 // MPICH_IGNORE_CXX_SEEK.  If we encounter a wacky environment or user in the
-// wild that doesn't want our workaround and/or the stdio.h header, then we can
+// wild that does not want our workaround and/or the stdio.h header, then we can
 // offer them a way out.
 #ifndef MPICH_DONT_INCLUDE_STDIO_H
 // ensure that we have SEEK_* defined
@@ -3171,6 +3171,14 @@
     #$mpi_routine{name} = args;
     while (<FD>) {
 	if (/\/\*\s*End Prototypes/ ) { last; }
+	$origline = $_;
+	while (/(.*)\/\*(.*?)\*\/(.*)/) {
+	    my $removed = $2;
+	    $_ = $1.$3;
+	    if ($2 =~ /\/\*/) {
+		print STDERR "Error in processing comment within interface file $filename in line $origline";
+	    }
+	}
 	if (/^int\s+MPI_([A-Z][a-z0-9_]*)\s*\((.*)/) {
 	    $routine_name = $1;
 	    $args = $2;
@@ -3934,7 +3942,15 @@
 	print $OUTFD "const $name v$count$array";
     }
     else {
-	print $OUTFD "const $lparm v$count";
+	# Only add if a const is not already present
+	if ($lparm =~ /^\s*const/) {
+	    # No need to add const
+	    print $OUTFD "$lparm v$count";
+	}
+	else {
+	    print $OUTFD "const $lparm v$count";
+	    print "const added to $lparm, argument $count for $routine(class $class)\n" if $debug;
+	}
     }
 }
 # We have to explicitly remove the cast

Modified: mpich2/trunk/src/binding/f77/buildiface
===================================================================
--- mpich2/trunk/src/binding/f77/buildiface	2009-03-13 15:30:30 UTC (rev 4055)
+++ mpich2/trunk/src/binding/f77/buildiface	2009-03-13 15:32:31 UTC (rev 4056)
@@ -3029,6 +3029,8 @@
     $filename = "statusf2c.c";
     open ($OUTFD, ">$filename.new" ) || die "Cannot open $filename.new\n";
     $files[$#files+1] = $filename;
+    # Status_f2c and c2f will need to have const added before the input
+    # argument for MPI 2.2
     print $OUTFD "
 /* -*- Mode: C; c-basic-offset:4 ; -*- */
 /*  
@@ -3228,8 +3230,15 @@
 		&SkipCPPIfdef( FD );
 	    }
 	}
-	# Remove any comments
-	s/\/\*.*\*\///g;
+	# Remove any comments; check for problems
+	$origline = $_;
+	while (/(.*)\/\*(.*?)\*\/(.*)/) {
+	    my $removed = $2;
+	    $_ = $1.$3;
+	    if ($2 =~ /\/\*/) {
+		print STDERR "Error in processing comment within interface file $prototype_file in line $origline";
+	    }
+	}
 
 	if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {
 	    $routine_name = $1;
@@ -3367,8 +3376,15 @@
     # First, find the values that we need
     while (<MPIFD>) {
 	$linecount++;
-	# Remove any comments
-	s/\/\*.*\*\///g;
+	# Remove any comments; check for problems
+	$origline = $_;
+	while (/(.*)\/\*(.*?)\*\/(.*)/) {
+	    my $removed = $2;
+	    $_ = $1.$3;
+	    if ($2 =~ /\/\*/) {
+		print STDERR "Error in processing comment within interface file $prototype_file in line $origline";
+	    }
+	}
 
 	# We should also skip #ifndef xxx, for some xxx.  
 	if (/^#\s*ifndef\s+(\w*)/) {

Modified: mpich2/trunk/src/binding/f90/binding.sub
===================================================================
--- mpich2/trunk/src/binding/f90/binding.sub	2009-03-13 15:30:30 UTC (rev 4055)
+++ mpich2/trunk/src/binding/f90/binding.sub	2009-03-13 15:32:31 UTC (rev 4056)
@@ -28,7 +28,14 @@
     # Read each one
     while (<FD>) {
 	# Remove any comments
-	s/\/\*.*\*\///g;
+	$origline = $_;
+	while (/(.*)\/\*(.*?)\*\/(.*)/) {
+	    my $removed = $2;
+	    $_ = $1.$3;
+	    if ($2 =~ /\/\*/) {
+		print STDERR "Error in processing comment within interface file $prototype_file in line $origline";
+	    }
+	}
 	print $_ if $debug;
 	if (/\/\*\s*End Prototypes/) { last; }
 	if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {



More information about the mpich2-commits mailing list