Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_context_runall() doesn't take any argument.
[simgrid.git] / src / smpi / fixsrc.pl
1 #!/usr/bin/perl
2
3 # Add include for mandatory header file
4 print "#include <smpi_cocci.h>\n";
5
6 # FIXME: here we make the assumption that people don't do things like put
7 # multiple statements on the same line after a declaration, but separated by
8 # semicolons. It's a reasonable assumption for the time being, but technically
9 # it could cause problems for some code.
10
11 OUTER: while ($line = <STDIN>) {
12     if ($line =~ /SMPI_VARINIT/) {
13         do {
14             chomp $line;         # kill carriage return
15             $line =~ s/\s+/ /g;  # remove excessive whitespace added by spatch
16             while ($line =~ s/(SMPI_VARINIT[A-Z0-9_]*?\(.*?\))//) {
17                 print "$1\n";
18             } 
19
20             # if varinit continues on to next line
21             if ($line =~ /SMPI_VARINIT/) {
22                 # should only happen for bad code...
23                 if (!($nextline = <STDIN>)) {
24                     last OUTER;
25                 }
26                 $line .= $nextline;
27
28             }
29         } while ($line =~ /SMPI_VARINIT/);
30     } else {
31         print $line;
32     }
33 }