3 # Copyright (c) 2013-2014. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
9 # C comment spell checker
10 # For each given source file, print the filename, a colon, and the number
11 # of misspelled words, then a list of misspelled words.
12 # Words contained in the file stopwords.txt are not considered spelling errors.
13 # Copyright 2003, Dan Kegel. Licensed under GPL. See the file ../COPYING for details.
15 sub check_content($) {
18 print POUT "$content\n";
21 $TEMPFILE="/tmp/spell.tmp";
22 $STOPFILE=shift(@ARGV);
24 open(STOPFILE, $STOPFILE) || die "can't open stopword file $STOPFILE";
31 foreach $file (@ARGV) {
32 open (FI, $file) || die $file;
33 $content = join ("", <FI>);
36 open(POUT, "> $TEMPFILE") || die;
37 $content =~ s!//(.+)$!check_content($1)!egm;
38 $content =~ s!/\*(.+?)\*/!check_content($1)!egs;
41 open(PIN, "ispell -d american -l < $TEMPFILE | sort -uf |") || die;
45 if ($stopped{$_} == 0) {
52 print "$file: ".scalar(@badwords)."\n\n";
53 print join(" ",@badwords)."\n\n";