objective-ci 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/BSD-LICENSE.txt +31 -0
- data/GPL-LICENSE.txt +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +92 -0
- data/Rakefile +24 -0
- data/bin/ada_count +4 -0
- data/bin/asm_count +4 -0
- data/bin/awk_count +4 -0
- data/bin/break_filelist +4 -0
- data/bin/c_count +4 -0
- data/bin/cobol_count +4 -0
- data/bin/compute_all +4 -0
- data/bin/compute_sloc_lang +4 -0
- data/bin/count_extensions +4 -0
- data/bin/count_unknown_ext +4 -0
- data/bin/csh_count +4 -0
- data/bin/exp_count +4 -0
- data/bin/f90_count +4 -0
- data/bin/fortran_count +4 -0
- data/bin/generic_count +4 -0
- data/bin/get_sloc +4 -0
- data/bin/get_sloc_details +4 -0
- data/bin/haskell_count +4 -0
- data/bin/java_count +4 -0
- data/bin/jsp_count +4 -0
- data/bin/lex_count +4 -0
- data/bin/lexcount1 +4 -0
- data/bin/lisp_count +4 -0
- data/bin/make_filelists +4 -0
- data/bin/makefile_count +4 -0
- data/bin/ml_count +4 -0
- data/bin/modula3_count +4 -0
- data/bin/objc_count +4 -0
- data/bin/oclint-0.8 +4 -0
- data/bin/oclint-json-compilation-database +4 -0
- data/bin/oclint-xcodebuild +4 -0
- data/bin/pascal_count +4 -0
- data/bin/perl_count +4 -0
- data/bin/php_count +4 -0
- data/bin/pmd-cpd-objc +7 -0
- data/bin/print_sum +4 -0
- data/bin/python_count +4 -0
- data/bin/ruby_count +4 -0
- data/bin/sed_count +4 -0
- data/bin/sh_count +4 -0
- data/bin/show_filecount +4 -0
- data/bin/sloccount +4 -0
- data/bin/sql_count +4 -0
- data/bin/tcl_count +4 -0
- data/docs/jenkins-setup-violations.png +0 -0
- data/docs/jenkins-setup.jpg +0 -0
- data/externals/oclint/oclint-0.8 +0 -0
- data/externals/oclint/oclint-json-compilation-database +86 -0
- data/externals/oclint/oclint-xcodebuild +216 -0
- data/externals/pmd-cpd/ObjCLanguage-0.0.7-SNAPSHOT.jar +0 -0
- data/externals/pmd-cpd/pmd-4.2.5.jar +0 -0
- data/externals/sloccount/ada_count +27 -0
- data/externals/sloccount/asm_count +166 -0
- data/externals/sloccount/awk_count +27 -0
- data/externals/sloccount/break_filelist +1308 -0
- data/externals/sloccount/c_count +0 -0
- data/externals/sloccount/cobol_count +82 -0
- data/externals/sloccount/compute_all +87 -0
- data/externals/sloccount/compute_sloc_lang +66 -0
- data/externals/sloccount/count_extensions +56 -0
- data/externals/sloccount/count_unknown_ext +32 -0
- data/externals/sloccount/csh_count +27 -0
- data/externals/sloccount/exp_count +27 -0
- data/externals/sloccount/f90_count +81 -0
- data/externals/sloccount/fortran_count +83 -0
- data/externals/sloccount/generic_count +77 -0
- data/externals/sloccount/get_sloc +544 -0
- data/externals/sloccount/get_sloc_details +103 -0
- data/externals/sloccount/haskell_count +122 -0
- data/externals/sloccount/java_count +0 -0
- data/externals/sloccount/jsp_count +0 -0
- data/externals/sloccount/lex_count +70 -0
- data/externals/sloccount/lexcount1 +0 -0
- data/externals/sloccount/lisp_count +27 -0
- data/externals/sloccount/make_filelists +193 -0
- data/externals/sloccount/makefile_count +27 -0
- data/externals/sloccount/ml_count +0 -0
- data/externals/sloccount/modula3_count +65 -0
- data/externals/sloccount/objc_count +89 -0
- data/externals/sloccount/pascal_count +0 -0
- data/externals/sloccount/perl_count +147 -0
- data/externals/sloccount/php_count +0 -0
- data/externals/sloccount/print_sum +40 -0
- data/externals/sloccount/python_count +120 -0
- data/externals/sloccount/ruby_count +27 -0
- data/externals/sloccount/sed_count +27 -0
- data/externals/sloccount/sh_count +27 -0
- data/externals/sloccount/show_filecount +58 -0
- data/externals/sloccount/sloccount +258 -0
- data/externals/sloccount/sql_count +76 -0
- data/externals/sloccount/tcl_count +27 -0
- data/lib/objective-ci.rb +3 -0
- data/lib/objective_ci/ci_tasks.rb +142 -0
- data/lib/objective_ci/version.rb +3 -0
- data/objective-ci.gemspec +26 -0
- metadata +255 -0
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
# cobol_count - count physical lines of code.
|
|
3
|
+
# Usage: cobol_count [-f file] [list_of_files]
|
|
4
|
+
# file: file with a list of files to count (if "-", read list from stdin)
|
|
5
|
+
# list_of_files: list of files to count
|
|
6
|
+
# -f file or list_of_files can be used, or both
|
|
7
|
+
# This is a trivial/naive program for scripts, etc.
|
|
8
|
+
#
|
|
9
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
10
|
+
# source lines of code (SLOC).
|
|
11
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
12
|
+
#
|
|
13
|
+
# This program is free software; you can redistribute it and/or modify
|
|
14
|
+
# it under the terms of the GNU General Public License as published by
|
|
15
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
16
|
+
# (at your option) any later version.
|
|
17
|
+
#
|
|
18
|
+
# This program is distributed in the hope that it will be useful,
|
|
19
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
# GNU General Public License for more details.
|
|
22
|
+
#
|
|
23
|
+
# You should have received a copy of the GNU General Public License
|
|
24
|
+
# along with this program; if not, write to the Free Software
|
|
25
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
26
|
+
#
|
|
27
|
+
# To contact David A. Wheeler, see his website at:
|
|
28
|
+
# http://www.dwheeler.com.
|
|
29
|
+
#
|
|
30
|
+
#
|
|
31
|
+
|
|
32
|
+
$total_sloc = 0;
|
|
33
|
+
|
|
34
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
35
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
36
|
+
# Yes, we have -f
|
|
37
|
+
if ($ARGV[1] eq "-") {
|
|
38
|
+
# The list of files is in STDIN
|
|
39
|
+
while (<STDIN>) {
|
|
40
|
+
chomp ($_);
|
|
41
|
+
&count_file ($_);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
# The list of files is in the file $ARGV[1]
|
|
45
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $filewithlist\n";
|
|
46
|
+
while (<FILEWITHLIST>) {
|
|
47
|
+
chomp ($_);
|
|
48
|
+
&count_file ($_);
|
|
49
|
+
}
|
|
50
|
+
close FILEWITHLIST;
|
|
51
|
+
}
|
|
52
|
+
shift @ARGV; shift @ARGV;
|
|
53
|
+
}
|
|
54
|
+
# Process all (remaining) arguments as file names
|
|
55
|
+
while ($file = shift @ARGV) {
|
|
56
|
+
&count_file ($file);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
print "Total:\n";
|
|
60
|
+
print "$total_sloc\n";
|
|
61
|
+
|
|
62
|
+
sub count_file {
|
|
63
|
+
my ($file) = @_;
|
|
64
|
+
my $sloc = 0;
|
|
65
|
+
my $free_format = 0; # Support "free format" source code.
|
|
66
|
+
|
|
67
|
+
open (FILE, $file);
|
|
68
|
+
while (<FILE>) {
|
|
69
|
+
if (m/^......\$.*SET.*SOURCEFORMAT.*FREE/i) {$free_format = 1;}
|
|
70
|
+
if ($free_format) {
|
|
71
|
+
if (m/^\s*[\*\/]/) { } # Saw a comment.
|
|
72
|
+
elsif (m/\S/) {$sloc++;} # Saw a non-whitespace, it's SLOC.
|
|
73
|
+
} else {
|
|
74
|
+
if (m/^......[\*\/]/) {} # Saw a comment - marked in indicator area.
|
|
75
|
+
elsif (m/^[\*\/]/) {} # Saw a comment.
|
|
76
|
+
elsif (m/^........*\S/) {$sloc++;} # Saw a non-whitespace, it's SLOC.
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
print "$sloc $file\n";
|
|
80
|
+
$total_sloc += $sloc;
|
|
81
|
+
close (FILE);
|
|
82
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Computes filecounts and SLOC counts in the listed data directories
|
|
3
|
+
# if the don't already exist.
|
|
4
|
+
#
|
|
5
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
6
|
+
# source lines of code (SLOC).
|
|
7
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
8
|
+
#
|
|
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
|
|
11
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
12
|
+
# (at your option) any later version.
|
|
13
|
+
#
|
|
14
|
+
# This program is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# GNU General Public License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the GNU General Public License
|
|
20
|
+
# along with this program; if not, write to the Free Software
|
|
21
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22
|
+
#
|
|
23
|
+
# To contact David A. Wheeler, see his website at:
|
|
24
|
+
# http://www.dwheeler.com.
|
|
25
|
+
#
|
|
26
|
+
#
|
|
27
|
+
|
|
28
|
+
if [ "$#" -eq 0 ]
|
|
29
|
+
then
|
|
30
|
+
echo "Error: You must provide a list of directories to examine."
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
starting_dir=`pwd`
|
|
35
|
+
|
|
36
|
+
for dir
|
|
37
|
+
do
|
|
38
|
+
if [ -d "$dir" -a -r "${dir}/filelist" ]
|
|
39
|
+
then
|
|
40
|
+
cd "$dir"
|
|
41
|
+
|
|
42
|
+
if [ ! -r all.filecount ]
|
|
43
|
+
then
|
|
44
|
+
# Create all.filecount and all-physical.sloc; create them in
|
|
45
|
+
# separate files, so that we can safely restart if it stops in the middle:
|
|
46
|
+
> all.filecount.new
|
|
47
|
+
> all-physical.sloc.new
|
|
48
|
+
for listfile in *_list.dat
|
|
49
|
+
do
|
|
50
|
+
language=`echo $listfile | sed -e 's/_list\.dat$//'`
|
|
51
|
+
|
|
52
|
+
# Skip language "*" - this happens if there are NO source
|
|
53
|
+
# files in the given directory.
|
|
54
|
+
if [ "$language" = "*" ]; then
|
|
55
|
+
continue
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Skip language "h" - it's counted in the ansic, cpp, and objc lists.
|
|
59
|
+
if [ "$language" = "h" ]; then
|
|
60
|
+
continue
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
numfiles=`wc -l < $listfile | tr -d " "`
|
|
64
|
+
echo "$language $numfiles" >> all.filecount.new
|
|
65
|
+
|
|
66
|
+
# Ignore certain "languages" when counting SLOC:
|
|
67
|
+
case "$language"
|
|
68
|
+
in
|
|
69
|
+
not) true ;;
|
|
70
|
+
unknown) true ;;
|
|
71
|
+
zero) true ;;
|
|
72
|
+
dup) true ;;
|
|
73
|
+
auto) true ;;
|
|
74
|
+
*)
|
|
75
|
+
numsloc=`compute_sloc_lang $language "." | tr -d " "`
|
|
76
|
+
echo "$language $numsloc" >> all-physical.sloc.new
|
|
77
|
+
;;
|
|
78
|
+
esac
|
|
79
|
+
done
|
|
80
|
+
mv all.filecount.new all.filecount
|
|
81
|
+
mv all-physical.sloc.new all-physical.sloc
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
cd "$starting_dir"
|
|
85
|
+
fi
|
|
86
|
+
done
|
|
87
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Computes sloc in the listed directories.
|
|
3
|
+
# first parameter = language.
|
|
4
|
+
# Creates the "outfile", and prints the total.
|
|
5
|
+
#
|
|
6
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
7
|
+
# source lines of code (SLOC).
|
|
8
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
9
|
+
#
|
|
10
|
+
# This program is free software; you can redistribute it and/or modify
|
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
|
12
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
13
|
+
# (at your option) any later version.
|
|
14
|
+
#
|
|
15
|
+
# This program is distributed in the hope that it will be useful,
|
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
# GNU General Public License for more details.
|
|
19
|
+
#
|
|
20
|
+
# You should have received a copy of the GNU General Public License
|
|
21
|
+
# along with this program; if not, write to the Free Software
|
|
22
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
23
|
+
#
|
|
24
|
+
# To contact David A. Wheeler, see his website at:
|
|
25
|
+
# http://www.dwheeler.com.
|
|
26
|
+
#
|
|
27
|
+
#
|
|
28
|
+
|
|
29
|
+
language="$1"
|
|
30
|
+
shift
|
|
31
|
+
|
|
32
|
+
starting_dir=`pwd`
|
|
33
|
+
|
|
34
|
+
for dir in "$@"
|
|
35
|
+
do
|
|
36
|
+
if [ -d "$dir" -a -r "${dir}/filelist" ]
|
|
37
|
+
then
|
|
38
|
+
cd "$dir"
|
|
39
|
+
|
|
40
|
+
if [ -s ${language}_list.dat ]
|
|
41
|
+
then
|
|
42
|
+
case "$language" in
|
|
43
|
+
ansic) use_c_count="y" ;;
|
|
44
|
+
cpp) use_c_count="y" ;;
|
|
45
|
+
java) use_c_count="y" ;;
|
|
46
|
+
yacc) use_c_count="y" ;;
|
|
47
|
+
cs) use_c_count="y" ;;
|
|
48
|
+
*) use_c_count="n" ;;
|
|
49
|
+
esac
|
|
50
|
+
|
|
51
|
+
case "$use_c_count" in
|
|
52
|
+
y) c_count -f ${language}_list.dat > ${language}_outfile.dat ;;
|
|
53
|
+
*) ${language}_count -f ${language}_list.dat > ${language}_outfile.dat
|
|
54
|
+
;;
|
|
55
|
+
esac
|
|
56
|
+
tail -1 < ${language}_outfile.dat
|
|
57
|
+
|
|
58
|
+
else
|
|
59
|
+
rm -f ${language}_outfile.dat
|
|
60
|
+
echo 0
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
cd "$starting_dir"
|
|
64
|
+
fi
|
|
65
|
+
done
|
|
66
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/perl -w
|
|
2
|
+
|
|
3
|
+
# Read from standard input a list of filenames, and
|
|
4
|
+
# report a sorted list of extensions and filenames
|
|
5
|
+
# (most common ones first).
|
|
6
|
+
|
|
7
|
+
# The format is "name count", where "count" is the number of appearances.
|
|
8
|
+
# "name" usually begins with a "." followed by the name of the extension.
|
|
9
|
+
# In the case where the filename has no extension, the name begins with "/"
|
|
10
|
+
# followed by the entire basename.
|
|
11
|
+
|
|
12
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
13
|
+
# source lines of code (SLOC).
|
|
14
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
15
|
+
#
|
|
16
|
+
# This program is free software; you can redistribute it and/or modify
|
|
17
|
+
# it under the terms of the GNU General Public License as published by
|
|
18
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
19
|
+
# (at your option) any later version.
|
|
20
|
+
#
|
|
21
|
+
# This program is distributed in the hope that it will be useful,
|
|
22
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
23
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
24
|
+
# GNU General Public License for more details.
|
|
25
|
+
#
|
|
26
|
+
# You should have received a copy of the GNU General Public License
|
|
27
|
+
# along with this program; if not, write to the Free Software
|
|
28
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
29
|
+
#
|
|
30
|
+
# To contact David A. Wheeler, see his website at:
|
|
31
|
+
# http://www.dwheeler.com.
|
|
32
|
+
#
|
|
33
|
+
#
|
|
34
|
+
|
|
35
|
+
%extensions = ();
|
|
36
|
+
|
|
37
|
+
while (<>) {
|
|
38
|
+
if (m/\.([^.\/]+)$/) {
|
|
39
|
+
$type = $1;
|
|
40
|
+
chomp($type);
|
|
41
|
+
$type = ".$type";
|
|
42
|
+
if (defined($extensions{$type})) { $extensions{$type}++; }
|
|
43
|
+
else { $extensions{$type} = 1; }
|
|
44
|
+
} elsif (m!/([^/]+)$!) {
|
|
45
|
+
$filename = $1;
|
|
46
|
+
chomp($filename);
|
|
47
|
+
$filename = "/$filename";
|
|
48
|
+
if (defined($extensions{$filename})) { $extensions{$filename}++; }
|
|
49
|
+
else { $extensions{$filename} = 1; }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
foreach $entry (sort {$extensions{$b} <=> $extensions{$a}} keys %extensions) {
|
|
54
|
+
print "${entry} $extensions{$entry}\n";
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# This reports a sorted list of the "unknown" file extensions
|
|
4
|
+
# analyzed by a previous run of SLOCCount, most common first.
|
|
5
|
+
# Use this to make sure that there isn't a common language type
|
|
6
|
+
# that you are NOT counting.
|
|
7
|
+
|
|
8
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
9
|
+
# source lines of code (SLOC).
|
|
10
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
11
|
+
#
|
|
12
|
+
# This program is free software; you can redistribute it and/or modify
|
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
|
14
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
15
|
+
# (at your option) any later version.
|
|
16
|
+
#
|
|
17
|
+
# This program is distributed in the hope that it will be useful,
|
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
# GNU General Public License for more details.
|
|
21
|
+
#
|
|
22
|
+
# You should have received a copy of the GNU General Public License
|
|
23
|
+
# along with this program; if not, write to the Free Software
|
|
24
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
25
|
+
#
|
|
26
|
+
# To contact David A. Wheeler, see his website at:
|
|
27
|
+
# http://www.dwheeler.com.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
find ${HOME}/.slocdata -name 'unknown_list.dat' -exec cat {} \; | \
|
|
31
|
+
count_extensions | less
|
|
32
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
4
|
+
# source lines of code (SLOC).
|
|
5
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
6
|
+
#
|
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
+
# (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
# GNU General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License
|
|
18
|
+
# along with this program; if not, write to the Free Software
|
|
19
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
|
+
#
|
|
21
|
+
# To contact David A. Wheeler, see his website at:
|
|
22
|
+
# http://www.dwheeler.com.
|
|
23
|
+
#
|
|
24
|
+
#
|
|
25
|
+
|
|
26
|
+
generic_count '#' $@
|
|
27
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
4
|
+
# source lines of code (SLOC).
|
|
5
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
6
|
+
#
|
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
+
# (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
# GNU General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License
|
|
18
|
+
# along with this program; if not, write to the Free Software
|
|
19
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
|
+
#
|
|
21
|
+
# To contact David A. Wheeler, see his website at:
|
|
22
|
+
# http://www.dwheeler.com.
|
|
23
|
+
#
|
|
24
|
+
#
|
|
25
|
+
|
|
26
|
+
generic_count '#' $@
|
|
27
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
# f90_count - count physical lines of code in Fortran 90.
|
|
3
|
+
# Usage: f90_count [-f file] [list_of_files]
|
|
4
|
+
# file: file with a list of files to count (if "-", read list from stdin)
|
|
5
|
+
# list_of_files: list of files to count
|
|
6
|
+
# -f file or list_of_files can be used, or both
|
|
7
|
+
|
|
8
|
+
# Ignores comment-only lines (where first nonblank character = !).
|
|
9
|
+
# Lines beginning with !hpf$ or !omp$ are not comments lines.
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
13
|
+
# source lines of code (SLOC).
|
|
14
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
15
|
+
#
|
|
16
|
+
# This program is free software; you can redistribute it and/or modify
|
|
17
|
+
# it under the terms of the GNU General Public License as published by
|
|
18
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
19
|
+
# (at your option) any later version.
|
|
20
|
+
#
|
|
21
|
+
# This program is distributed in the hope that it will be useful,
|
|
22
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
23
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
24
|
+
# GNU General Public License for more details.
|
|
25
|
+
#
|
|
26
|
+
# You should have received a copy of the GNU General Public License
|
|
27
|
+
# along with this program; if not, write to the Free Software
|
|
28
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
29
|
+
#
|
|
30
|
+
# To contact David A. Wheeler, see his website at:
|
|
31
|
+
# http://www.dwheeler.com.
|
|
32
|
+
#
|
|
33
|
+
#
|
|
34
|
+
|
|
35
|
+
$total_sloc = 0;
|
|
36
|
+
|
|
37
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
38
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
39
|
+
# Yes, we have -f
|
|
40
|
+
if ($ARGV[1] eq "-") {
|
|
41
|
+
# The list of files is in STDIN
|
|
42
|
+
while (<STDIN>) {
|
|
43
|
+
chomp ($_);
|
|
44
|
+
&count_file ($_);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
# The list of files is in the file $ARGV[1]
|
|
48
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $ARGV[1]\n";
|
|
49
|
+
while (<FILEWITHLIST>) {
|
|
50
|
+
chomp ($_);
|
|
51
|
+
&count_file ($_);
|
|
52
|
+
}
|
|
53
|
+
close FILEWITHLIST;
|
|
54
|
+
}
|
|
55
|
+
shift @ARGV; shift @ARGV;
|
|
56
|
+
}
|
|
57
|
+
# Process all (remaining) arguments as file names
|
|
58
|
+
while ($file = shift @ARGV) {
|
|
59
|
+
&count_file ($file);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
print "Total:\n";
|
|
63
|
+
print "$total_sloc\n";
|
|
64
|
+
|
|
65
|
+
sub count_file {
|
|
66
|
+
my ($file) = @_;
|
|
67
|
+
my $sloc = 0;
|
|
68
|
+
|
|
69
|
+
open (FILE, $file);
|
|
70
|
+
while (<FILE>) {
|
|
71
|
+
# a comment is m/^\s*!/
|
|
72
|
+
# an empty line is m/^\s*$/
|
|
73
|
+
# a HPF statement is m/^\s*!hpf\$/i
|
|
74
|
+
# an Open MP statement is m/^\s*!omp\$/i
|
|
75
|
+
if (! m/^(\s*!|\s*$)/ || m/^\s*!(hpf|omp)\$/i) {$sloc++;}
|
|
76
|
+
}
|
|
77
|
+
print "$sloc $file\n";
|
|
78
|
+
$total_sloc += $sloc;
|
|
79
|
+
$sloc = 0;
|
|
80
|
+
close (FILE);
|
|
81
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
# fortran_count - count physical lines of code in Fortran 77.
|
|
3
|
+
# Usage: fortran_count [-f file] [list_of_files]
|
|
4
|
+
# file: file with a list of files to count (if "-", read list from stdin)
|
|
5
|
+
# list_of_files: list of files to count
|
|
6
|
+
# -f file or list_of_files can be used, or both
|
|
7
|
+
|
|
8
|
+
# Ignores comment-only lines
|
|
9
|
+
# (where column 1 character = C, c, *, or !,
|
|
10
|
+
# or where a ! is preceded only by white space)
|
|
11
|
+
# Lines beginning with !hpf$ or !omp$ are not comments lines either.
|
|
12
|
+
|
|
13
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
14
|
+
# source lines of code (SLOC).
|
|
15
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
16
|
+
#
|
|
17
|
+
# This program is free software; you can redistribute it and/or modify
|
|
18
|
+
# it under the terms of the GNU General Public License as published by
|
|
19
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
20
|
+
# (at your option) any later version.
|
|
21
|
+
#
|
|
22
|
+
# This program is distributed in the hope that it will be useful,
|
|
23
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25
|
+
# GNU General Public License for more details.
|
|
26
|
+
#
|
|
27
|
+
# You should have received a copy of the GNU General Public License
|
|
28
|
+
# along with this program; if not, write to the Free Software
|
|
29
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
30
|
+
#
|
|
31
|
+
# To contact David A. Wheeler, see his website at:
|
|
32
|
+
# http://www.dwheeler.com.
|
|
33
|
+
#
|
|
34
|
+
#
|
|
35
|
+
|
|
36
|
+
$total_sloc = 0;
|
|
37
|
+
|
|
38
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
39
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
40
|
+
# Yes, we have -f
|
|
41
|
+
if ($ARGV[1] eq "-") {
|
|
42
|
+
# The list of files is in STDIN
|
|
43
|
+
while (<STDIN>) {
|
|
44
|
+
chomp ($_);
|
|
45
|
+
&count_file ($_);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
# The list of files is in the file $ARGV[1]
|
|
49
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $ARGV[1]\n";
|
|
50
|
+
while (<FILEWITHLIST>) {
|
|
51
|
+
chomp ($_);
|
|
52
|
+
&count_file ($_);
|
|
53
|
+
}
|
|
54
|
+
close FILEWITHLIST;
|
|
55
|
+
}
|
|
56
|
+
shift @ARGV; shift @ARGV;
|
|
57
|
+
}
|
|
58
|
+
# Process all (remaining) arguments as file names
|
|
59
|
+
while ($file = shift @ARGV) {
|
|
60
|
+
&count_file ($file);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
print "Total:\n";
|
|
64
|
+
print "$total_sloc\n";
|
|
65
|
+
|
|
66
|
+
sub count_file {
|
|
67
|
+
my ($file) = @_;
|
|
68
|
+
my $sloc = 0;
|
|
69
|
+
|
|
70
|
+
open (FILE, $file);
|
|
71
|
+
while (<FILE>) {
|
|
72
|
+
# a normal comment is m/^[c*!]/i
|
|
73
|
+
# a fancier comment is m/^\s+!/i
|
|
74
|
+
# an empty line is m/^\s*$/i
|
|
75
|
+
# a HPF statement is m/^[c*!]hpf\$/i
|
|
76
|
+
# an Open MP statement is m/^[c*!]omp\$/i
|
|
77
|
+
if (! m/^([c*!]|\s+!|\s*$)/i || m/^[c*!](hpf|omp)\$/i) {$sloc++;}
|
|
78
|
+
}
|
|
79
|
+
print "$sloc $file\n";
|
|
80
|
+
$total_sloc += $sloc;
|
|
81
|
+
$sloc = 0;
|
|
82
|
+
close (FILE);
|
|
83
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
# generic_count - count physical lines of code, given a comment marker.
|
|
3
|
+
# Usage: generic_count commentstart [-f file] [list_of_files]
|
|
4
|
+
# commentstart: string that begins a comment (continuing til end-of-line)
|
|
5
|
+
# file: file with a list of files to count (if "-", read list from stdin)
|
|
6
|
+
# list_of_files: list of files to count
|
|
7
|
+
# -f file or list_of_files can be used, or both
|
|
8
|
+
# This is a trivial/naive program for scripts, etc.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
12
|
+
# source lines of code (SLOC).
|
|
13
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
14
|
+
#
|
|
15
|
+
# This program is free software; you can redistribute it and/or modify
|
|
16
|
+
# it under the terms of the GNU General Public License as published by
|
|
17
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
18
|
+
# (at your option) any later version.
|
|
19
|
+
#
|
|
20
|
+
# This program is distributed in the hope that it will be useful,
|
|
21
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
# GNU General Public License for more details.
|
|
24
|
+
#
|
|
25
|
+
# You should have received a copy of the GNU General Public License
|
|
26
|
+
# along with this program; if not, write to the Free Software
|
|
27
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
28
|
+
#
|
|
29
|
+
# To contact David A. Wheeler, see his website at:
|
|
30
|
+
# http://www.dwheeler.com.
|
|
31
|
+
#
|
|
32
|
+
#
|
|
33
|
+
|
|
34
|
+
$commentstart = shift @ARGV;
|
|
35
|
+
$total_sloc = 0;
|
|
36
|
+
|
|
37
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
38
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
39
|
+
# Yes, we have -f
|
|
40
|
+
if ($ARGV[1] eq "-") {
|
|
41
|
+
# The list of files is in STDIN
|
|
42
|
+
while (<STDIN>) {
|
|
43
|
+
chomp ($_);
|
|
44
|
+
&count_file ($_);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
# The list of files is in the file $ARGV[1]
|
|
48
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $filewithlist\n";
|
|
49
|
+
while (<FILEWITHLIST>) {
|
|
50
|
+
chomp ($_);
|
|
51
|
+
&count_file ($_);
|
|
52
|
+
}
|
|
53
|
+
close FILEWITHLIST;
|
|
54
|
+
}
|
|
55
|
+
shift @ARGV; shift @ARGV;
|
|
56
|
+
}
|
|
57
|
+
# Process all (remaining) arguments as file names
|
|
58
|
+
while ($file = shift @ARGV) {
|
|
59
|
+
&count_file ($file);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
print "Total:\n";
|
|
63
|
+
print "$total_sloc\n";
|
|
64
|
+
|
|
65
|
+
sub count_file {
|
|
66
|
+
my ($file) = @_;
|
|
67
|
+
my $sloc = 0;
|
|
68
|
+
|
|
69
|
+
open (FILE, $file);
|
|
70
|
+
while (<FILE>) {
|
|
71
|
+
s/${commentstart}.*//;
|
|
72
|
+
if (m/\S/) {$sloc++;}
|
|
73
|
+
}
|
|
74
|
+
print "$sloc $file\n";
|
|
75
|
+
$total_sloc += $sloc;
|
|
76
|
+
close (FILE);
|
|
77
|
+
}
|