Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'smpi'
[simgrid.git] / src / smpi / smpif2c.in
index 296ca19..bdcbe86 100755 (executable)
@@ -16,6 +16,7 @@ foreach my $fortran (@ARGV) {
    die "F2C failed\n" if $?;
    open F2C,"<$output";
    my $started = 0;
+   my $cutext = 0;
    print $tmp "#ifndef INTEGER_STAR_8\n";
    print $tmp "#define INTEGER_STAR_8\n";
    print $tmp "#endif\n";
@@ -30,7 +31,7 @@ foreach my $fortran (@ARGV) {
          if(/^} (.*?);/) {
             $_ = "}* __attribute__((weak)) $1 = NULL;\n";
          } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) {
-            $_ = "#define $1 $2\[smpi_global_rank()\]";
+            $_ = "#define $1 $2\[smpi_current_rank\]";
             if(defined $3) {
                $_ .= $3;
             }
@@ -42,6 +43,15 @@ foreach my $fortran (@ARGV) {
       if(/\/\* Table of constant values \*\// || /MAIN__/) {
          $started = 0;
       }
+      if(/extern \/\* Subroutine \*\//) {
+         $cutext = 1;
+      }
+      if($cutext) {
+         if(/;$/) {
+            $cutext = 0;
+         }
+         next;
+      }
       if(/\/* Main program alias \*\/\s*int\s+.*\s*\(\s*\)\s*{(.*)}/) {
          $_ = "int smpi_simulated_main(int argc, char** argv) { smpi_process_init(&argc, &argv); $1 }\n";
       }