X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b7726f2e9e252f8442b008a34bca31716c3b6c6b..95ca0f216e08c8be42e39fb4a487237da7cb3479:/tools/spell/lspell2.pl diff --git a/tools/spell/lspell2.pl b/tools/spell/lspell2.pl new file mode 100644 index 0000000000..25325753be --- /dev/null +++ b/tools/spell/lspell2.pl @@ -0,0 +1,50 @@ +#!/bin/perl + +# C noncomment spell checker +# For each given source file, print the filename, a colon, and the number +# of misspelled words, then a list of misspelled words. +# Words contained in the file stopwords.txt are not considered spelling errors. +# Copyright 2003, Dan Kegel. Licensed under GPL. See the file ../COPYING for details. + +sub check_content($) { + my $content = shift; + $content =~ tr/*/ /; + print POUT "$content\n"; +} + +$TEMPFILE="/tmp/spell.tmp"; +$STOPFILE=shift(@ARGV); + +open(STOPFILE, $STOPFILE) || die "can't open stopword file $STOPFILE"; +while () { + chomp; + $stopped{$_}++; +} +close(STOPFILE); + +foreach $file (@ARGV) { + open (FI, $file) || die $file; + $content = join ("", ); + close (FI); + + open(POUT, "> $TEMPFILE") || die; + $content =~ s!//(.+)$! !gm; + $content =~ s!/\*(.+?)\*/! !gs; + print POUT $content; + close(POUT); + + open(PIN, "ispell -d american -l < $TEMPFILE | sort -uf |") || die; + undef @badwords; + while () { + chomp; + if ($stopped{$_} == 0) { + push(@badwords, $_); + } + } + close(PIN) || die; + + if (@badwords) { + print "$file: ".scalar(@badwords)."\n\n"; + print join(" ",@badwords)."\n\n"; + } +}