| OLD | NEW |
| 1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
| 2 # This script was originally based on the script of the same name from | 2 # This script was originally based on the script of the same name from |
| 3 # the KDE SDK (by dfaure@kde.org) | 3 # the KDE SDK (by dfaure@kde.org) |
| 4 # | 4 # |
| 5 # This version is | 5 # This version is |
| 6 # Copyright (C) 2007, 2008 Adam D. Barratt | 6 # Copyright (C) 2007, 2008 Adam D. Barratt |
| 7 # Copyright (C) 2012 Francesco Poli | 7 # Copyright (C) 2012 Francesco Poli |
| 8 # | 8 # |
| 9 # This program is free software; you can redistribute it and/or modify | 9 # This program is free software; you can redistribute it and/or modify |
| 10 # it under the terms of the GNU General Public License as published by | 10 # it under the terms of the GNU General Public License as published by |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 print " [Copyright: " . $copyright . "]\n" | 335 print " [Copyright: " . $copyright . "]\n" |
| 336 if $copyright and $opt_copyright; | 336 if $copyright and $opt_copyright; |
| 337 print "\n" if $opt_copyright; | 337 print "\n" if $opt_copyright; |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 sub remove_comments($) { | 341 sub remove_comments($) { |
| 342 $_ = $_[0]; | 342 $_ = $_[0]; |
| 343 # Remove Fortran comments | 343 # Remove Fortran comments |
| 344 s/^[cC] //gm; | 344 s/^[cC] //gm; |
| 345 # Remove .ASM comments |
| 346 s#^;\*?##gm; |
| 347 # Remove .S comments |
| 348 s#^@ ##gm; |
| 349 # Remove new lines |
| 345 tr/\t\r\n/ /; | 350 tr/\t\r\n/ /; |
| 346 # Remove C / C++ comments | 351 # Remove C / C++ comments |
| 347 s#(\*/|/[/*])##g; | 352 s#(\*/|/[/*])##g; |
| 353 # Remove all characters not matching search |
| 348 tr% A-Za-z.,@;0-9\(\)/-%%cd; | 354 tr% A-Za-z.,@;0-9\(\)/-%%cd; |
| 355 # Collapse multiple spaces into single space |
| 349 tr/ //s; | 356 tr/ //s; |
| 350 $_[0] = $_; | 357 $_[0] = $_; |
| 351 } | 358 } |
| 352 | 359 |
| 353 sub parse_copyright($) { | 360 sub parse_copyright($) { |
| 354 my $copyright = ''; | 361 my $copyright = ''; |
| 355 my $match; | 362 my $match; |
| 356 | 363 |
| 357 my $copyright_indicator_regex = ' | 364 my $copyright_indicator_regex = ' |
| 358 (?:copyright # The full word | 365 (?:copyright # The full word |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 return $license; | 662 return $license; |
| 656 } | 663 } |
| 657 | 664 |
| 658 sub fatal($) { | 665 sub fatal($) { |
| 659 my ($pack,$file,$line); | 666 my ($pack,$file,$line); |
| 660 ($pack,$file,$line) = caller(); | 667 ($pack,$file,$line) = caller(); |
| 661 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; | 668 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; |
| 662 $msg =~ s/\n\n$/\n/; | 669 $msg =~ s/\n\n$/\n/; |
| 663 die $msg; | 670 die $msg; |
| 664 } | 671 } |
| OLD | NEW |