X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6e0fada8c7781fc70023066302e0915cf91969ae..26a65fe3f06c8a304a1fd022eb685072d6531566:/src/smpi/smpif2c.in diff --git a/src/smpi/smpif2c.in b/src/smpi/smpif2c.in index ce1272a111..67ebfc3814 100755 --- a/src/smpi/smpif2c.in +++ b/src/smpi/smpif2c.in @@ -16,12 +16,12 @@ 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"; print $tmp "#include \n"; - print $tmp "#include \n\n"; - print $tmp "int __attribute__((weak)) __rank(void) {\n static __thread int rank = -1;\n\n if(rank < 0) {\n rank = smpi_global_rank();\n }\n return rank;\n}\n\n"; + print $tmp "#include \n"; while() { chomp; if(/\/\* Common Block Declarations \*\//) { @@ -31,7 +31,7 @@ foreach my $fortran (@ARGV) { if(/^} (.*?);/) { $_ = "}* __attribute__((weak)) $1 = NULL;\n"; } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) { - $_ = "#define $1 $2\[__rank()\]"; + $_ = "#define $1 $2\[smpi_process_index()\]"; if(defined $3) { $_ .= $3; } @@ -43,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"; }