X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7f28d0c88e047b142cfc7d5f73c19762cb27c0c5..e9f0018b823e34405847177b25a85d3facc30ae1:/src/smpi/fixsrc.pl?ds=sidebyside diff --git a/src/smpi/fixsrc.pl b/src/smpi/fixsrc.pl index 096c72050d..8844d208c5 100755 --- a/src/smpi/fixsrc.pl +++ b/src/smpi/fixsrc.pl @@ -1,20 +1,29 @@ -#!/usr/bin/perl +#!/usr/bin/env perl + +# Copyright (c) 2011, 2014. The SimGrid Team. +# All rights reserved. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the license (GNU LGPL) which comes with this package. + +# Add include for mandatory header file +print "#include \n"; # FIXME: here we make the assumption that people don't do things like put -# multiple statements after a declaration, but separated by semicolons. It's a -# reasonable assumption for the time being, but technically it could cause -# problems for some code. +# multiple statements on the same line after a declaration, but separated by +# semicolons. It's a reasonable assumption for the time being, but technically +# it could cause problems for some code. + OUTER: while ($line = ) { - if ($line =~ /#include /) { - print "#include \n"; - print "#include \n"; - } elsif ($line =~ /SMPI_VARINIT/) { + if ($line =~ /SMPI_VARINIT/) { do { - chomp $line; - $line =~ s/\s+/ /g; + chomp $line; # kill carriage return + $line =~ s/\s+/ /g; # remove excessive whitespace added by spatch while ($line =~ s/(SMPI_VARINIT[A-Z0-9_]*?\(.*?\))//) { print "$1\n"; } + + # if varinit continues on to next line if ($line =~ /SMPI_VARINIT/) { # should only happen for bad code... if (!($nextline = )) {