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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/perl -w
|
|
2
|
+
# haskell_count - count physical lines of code
|
|
3
|
+
# Strips out {- .. -} and -- comments and counts the rest.
|
|
4
|
+
# Pragmas, {-#...}, are counted as SLOC.
|
|
5
|
+
# BUG: Doesn't handle strings with embedded block comment markers gracefully.
|
|
6
|
+
# In practice, that shouldn't be a problem.
|
|
7
|
+
# Usage: haskell_count [-f file] [list_of_files]
|
|
8
|
+
# file: file with a list of files to count (if "-", read list from stdin)
|
|
9
|
+
# list_of_files: list of files to count
|
|
10
|
+
# -f file or list_of_files can be used, or both
|
|
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
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
$total_sloc = 0;
|
|
39
|
+
|
|
40
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
41
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
42
|
+
# Yes, we have -f
|
|
43
|
+
if ($ARGV[1] eq "-") {
|
|
44
|
+
# The list of files is in STDIN
|
|
45
|
+
while (<STDIN>) {
|
|
46
|
+
chomp ($_);
|
|
47
|
+
&count_file ($_);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
# The list of files is in the file $ARGV[1]
|
|
51
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $ARGV[1]\n";
|
|
52
|
+
while (<FILEWITHLIST>) {
|
|
53
|
+
chomp ($_);
|
|
54
|
+
&count_file ($_);
|
|
55
|
+
}
|
|
56
|
+
close FILEWITHLIST;
|
|
57
|
+
}
|
|
58
|
+
shift @ARGV; shift @ARGV;
|
|
59
|
+
}
|
|
60
|
+
# Process all (remaining) arguments as file names
|
|
61
|
+
while ($file = shift @ARGV) {
|
|
62
|
+
&count_file ($file);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
print "Total:\n";
|
|
66
|
+
print "$total_sloc\n";
|
|
67
|
+
|
|
68
|
+
sub determine_lit_type {
|
|
69
|
+
my ($file) = @_;
|
|
70
|
+
|
|
71
|
+
open (FILE, $file);
|
|
72
|
+
while (<FILE>) {
|
|
73
|
+
if (m/^\\begin{code}/) { close FILE; return 2; }
|
|
74
|
+
if (m/^>\s/) { close FILE; return 1; }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
sub count_file {
|
|
81
|
+
my ($file) = @_;
|
|
82
|
+
my $sloc = 0;
|
|
83
|
+
my $incomment = 0;
|
|
84
|
+
my ($literate, $inlitblock) = (0,0);
|
|
85
|
+
|
|
86
|
+
$literate = 1 if $file =~ /\.lhs$/;
|
|
87
|
+
if($literate) { $literate = determine_lit_type($file) }
|
|
88
|
+
|
|
89
|
+
open (FILE, $file);
|
|
90
|
+
while (<FILE>) {
|
|
91
|
+
if ($literate == 1) {
|
|
92
|
+
if (!s/^>//) { s/.*//; }
|
|
93
|
+
} elsif ($literate == 2) {
|
|
94
|
+
if ($inlitblock) {
|
|
95
|
+
if (m/^\\end{code}/) { s/.*//; $inlitblock = 0; }
|
|
96
|
+
} elsif (!$inlitblock) {
|
|
97
|
+
if (m/^\\begin{code}/) { s/.*//; $inlitblock = 1; }
|
|
98
|
+
else { s/.*//; }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if ($incomment) {
|
|
103
|
+
if (m/\-\}/) { s/^.*?\-\}//; $incomment = 0;}
|
|
104
|
+
else { s/.*//; }
|
|
105
|
+
}
|
|
106
|
+
if (!$incomment) {
|
|
107
|
+
s/--.*//;
|
|
108
|
+
s!{-[^#].*?-}!!g;
|
|
109
|
+
if (m/{-/ && (!m/{-#/)) {
|
|
110
|
+
s/{-.*//;
|
|
111
|
+
$incomment = 1;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (m/\S/) {$sloc++;}
|
|
115
|
+
}
|
|
116
|
+
print "$sloc $file\n";
|
|
117
|
+
if ($incomment) {print "ERROR: ended in comment in $ARGV\n";}
|
|
118
|
+
$total_sloc += $sloc;
|
|
119
|
+
$sloc = 0;
|
|
120
|
+
$incomment = 0;
|
|
121
|
+
close (FILE);
|
|
122
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
# lex_count
|
|
3
|
+
# Usage: lex_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
|
+
# 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
|
+
|
|
31
|
+
$total_sloc = 0;
|
|
32
|
+
|
|
33
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
34
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
35
|
+
# Yes, we have -f
|
|
36
|
+
if ($ARGV[1] eq "-") {
|
|
37
|
+
# The list of files is in STDIN
|
|
38
|
+
while (<STDIN>) {
|
|
39
|
+
chomp ($_);
|
|
40
|
+
&count_file ($_);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
# The list of files is in the file $ARGV[1]
|
|
44
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $ARGV[1]\n";
|
|
45
|
+
while (<FILEWITHLIST>) {
|
|
46
|
+
chomp ($_);
|
|
47
|
+
&count_file ($_);
|
|
48
|
+
}
|
|
49
|
+
close FILEWITHLIST;
|
|
50
|
+
}
|
|
51
|
+
shift @ARGV; shift @ARGV;
|
|
52
|
+
}
|
|
53
|
+
# Process all (remaining) arguments as file names
|
|
54
|
+
while ($file = shift @ARGV) {
|
|
55
|
+
&count_file ($file);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
print "Total:\n";
|
|
59
|
+
print "$total_sloc\n";
|
|
60
|
+
|
|
61
|
+
sub count_file {
|
|
62
|
+
my ($file) = @_;
|
|
63
|
+
my $sloc = 0;
|
|
64
|
+
|
|
65
|
+
$sloc = `lexcount1 < "$file"`;
|
|
66
|
+
chomp($sloc);
|
|
67
|
+
print "$sloc $file\n";
|
|
68
|
+
$total_sloc += $sloc;
|
|
69
|
+
}
|
|
70
|
+
|
|
Binary file
|
|
@@ -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,193 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# On the command line, list the source code directories, e.g.:
|
|
4
|
+
# /usr/src/redhat/BUILD/*
|
|
5
|
+
# This command creates a set of directories paralleling the source code
|
|
6
|
+
# directories, with a file named "filelist" listing all the files.
|
|
7
|
+
|
|
8
|
+
# This script goes through some trouble to turn all relative references
|
|
9
|
+
# into absolute pathnames, to make sure that the intended files
|
|
10
|
+
# are always referenced. Conceivably the current directory isn't the
|
|
11
|
+
# data directory and the parameters given use relative addressing,
|
|
12
|
+
# and we need to fix all that here.
|
|
13
|
+
|
|
14
|
+
# This is part of SLOCCount, a toolsuite that counts
|
|
15
|
+
# source lines of code (SLOC).
|
|
16
|
+
# Copyright (C) 2001-2004 David A. Wheeler.
|
|
17
|
+
#
|
|
18
|
+
# This program is free software; you can redistribute it and/or modify
|
|
19
|
+
# it under the terms of the GNU General Public License as published by
|
|
20
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
21
|
+
# (at your option) any later version.
|
|
22
|
+
#
|
|
23
|
+
# This program is distributed in the hope that it will be useful,
|
|
24
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
+
# GNU General Public License for more details.
|
|
27
|
+
#
|
|
28
|
+
# You should have received a copy of the GNU General Public License
|
|
29
|
+
# along with this program; if not, write to the Free Software
|
|
30
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
31
|
+
#
|
|
32
|
+
# To contact David A. Wheeler, see his website at:
|
|
33
|
+
# http://www.dwheeler.com.
|
|
34
|
+
#
|
|
35
|
+
#
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if [ "$#" -eq 0 ]
|
|
39
|
+
then
|
|
40
|
+
echo "Error: You must provide a list of directories."
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
follow=""
|
|
46
|
+
skip=""
|
|
47
|
+
prefix=""
|
|
48
|
+
startingdir=`pwd`
|
|
49
|
+
datadir=`pwd`
|
|
50
|
+
|
|
51
|
+
while [ "$#" -gt 0 ]
|
|
52
|
+
do
|
|
53
|
+
case "$1"
|
|
54
|
+
in
|
|
55
|
+
--follow) follow="-follow"
|
|
56
|
+
shift;;
|
|
57
|
+
--datadir) shift
|
|
58
|
+
if [ ! -d "$1" ]
|
|
59
|
+
then
|
|
60
|
+
echo "Error: $1 is not a directory"
|
|
61
|
+
exit 1
|
|
62
|
+
fi
|
|
63
|
+
cd "$1"
|
|
64
|
+
datadir=`pwd`
|
|
65
|
+
cd "$startingdir"
|
|
66
|
+
shift;;
|
|
67
|
+
--skip) shift
|
|
68
|
+
skip="$1"
|
|
69
|
+
shift;;
|
|
70
|
+
--prefix) shift
|
|
71
|
+
prefix="$1"
|
|
72
|
+
shift;;
|
|
73
|
+
--) shift; break;;
|
|
74
|
+
--*) echo "Error: unrecognized option $1"
|
|
75
|
+
exit 1
|
|
76
|
+
shift ;;
|
|
77
|
+
*) break;;
|
|
78
|
+
esac
|
|
79
|
+
done
|
|
80
|
+
|
|
81
|
+
# Non-directories will be placed into the "top_dir" data directory:
|
|
82
|
+
toplevel_name="${prefix}top_dir"
|
|
83
|
+
|
|
84
|
+
for possible_dir
|
|
85
|
+
do
|
|
86
|
+
# Reset to starting directory each time, so that relative directory
|
|
87
|
+
# requests will be processed correctly.
|
|
88
|
+
cd "$startingdir"
|
|
89
|
+
|
|
90
|
+
# Translate "." into the name of current directory.
|
|
91
|
+
# We have to handle "." and ".." specially, because we can't place
|
|
92
|
+
# files with these names into the data directory.
|
|
93
|
+
if [ "$possible_dir" = "." ]
|
|
94
|
+
then
|
|
95
|
+
possible_dir=`pwd`
|
|
96
|
+
fi
|
|
97
|
+
if [ "$possible_dir" = ".." ]
|
|
98
|
+
then
|
|
99
|
+
cd ..
|
|
100
|
+
possible_dir=`pwd`
|
|
101
|
+
# Reset current directory.
|
|
102
|
+
cd "$startingdir"
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
base=`basename "$possible_dir"`
|
|
106
|
+
if [ "$base" = "$skip" ]
|
|
107
|
+
then
|
|
108
|
+
continue
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
if [ -d "$possible_dir" ]
|
|
112
|
+
then
|
|
113
|
+
# Set "dir" to real name (if possible_dir is a symlink to another
|
|
114
|
+
# directory, then "dir" and "possible_dir" may have very different values)
|
|
115
|
+
# depending on how "cd" is implemented on your shell.
|
|
116
|
+
cd "$possible_dir"
|
|
117
|
+
dir=`pwd`
|
|
118
|
+
|
|
119
|
+
# The child directory's name is derived from possible_dir, not dir --
|
|
120
|
+
# that way, directories we create will have names based on the supplied
|
|
121
|
+
# name (potentially a link), not the linked-to directory's name.
|
|
122
|
+
# Thus, symlinks can be used to disambiguate names where necessary.
|
|
123
|
+
childname="${prefix}${base}"
|
|
124
|
+
|
|
125
|
+
cd "$datadir"
|
|
126
|
+
if [ -d "$childname" ]
|
|
127
|
+
then
|
|
128
|
+
echo "WARNING! Directory $childname pre-existed when adding $possible_dir"
|
|
129
|
+
else
|
|
130
|
+
mkdir "$childname"
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
echo "Creating filelist for $childname"
|
|
134
|
+
find "$dir" $follow -type f -print > "${childname}/filelist"
|
|
135
|
+
|
|
136
|
+
# If it exists, copy the PROGRAM_LICENSE.
|
|
137
|
+
if [ -s "${dir}/PROGRAM_LICENSE" ]
|
|
138
|
+
then
|
|
139
|
+
cp "${dir}/PROGRAM_LICENSE" "${childname}/PROGRAM_LICENSE"
|
|
140
|
+
fi
|
|
141
|
+
# If it exists, copy the ORIGINAL_SPEC_FILE
|
|
142
|
+
if [ -s "${dir}/ORIGINAL_SPEC_FILE" ]
|
|
143
|
+
then
|
|
144
|
+
cp "${dir}/ORIGINAL_SPEC_FILE" "${childname}/ORIGINAL_SPEC_FILE"
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
# Do some error-checking.
|
|
148
|
+
if [ ! -s "${childname}/filelist" ]
|
|
149
|
+
then
|
|
150
|
+
# This is inefficient, but it doesn't matter - it's only used
|
|
151
|
+
# when we have an empty filelist (which is often an error condition)
|
|
152
|
+
saw_a_file=n
|
|
153
|
+
for x in ls "$dir"
|
|
154
|
+
do
|
|
155
|
+
saw_a_file=y
|
|
156
|
+
break
|
|
157
|
+
done
|
|
158
|
+
case $saw_a_file
|
|
159
|
+
in
|
|
160
|
+
n)
|
|
161
|
+
echo "Warning: directory ${childname} got no files."
|
|
162
|
+
echo "You may need to use the --follow option.";;
|
|
163
|
+
esac
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
elif [ -f "$possible_dir" ]
|
|
167
|
+
then
|
|
168
|
+
# We have a non-directory (regular file, symlink to a file, etc.).
|
|
169
|
+
# We'll just add an absolute path to it into the toplevel_name directory.
|
|
170
|
+
|
|
171
|
+
# First, convert possible_dir into an absolute pathname if necessary:
|
|
172
|
+
pathname="$possible_dir"
|
|
173
|
+
case "$pathname"
|
|
174
|
+
in
|
|
175
|
+
/*) ;; # Already absolute pathname - do nothing.
|
|
176
|
+
*) pathname="${startingdir}/${possible_dir}" ;;
|
|
177
|
+
esac
|
|
178
|
+
|
|
179
|
+
# Add it to the toplevel_name directory (creating the directory if needed)
|
|
180
|
+
cd "$datadir"
|
|
181
|
+
if [ ! -d "$toplevel_name" ]
|
|
182
|
+
then
|
|
183
|
+
echo "Have a non-directory at the top, so creating directory $toplevel_name"
|
|
184
|
+
mkdir "$toplevel_name"
|
|
185
|
+
fi
|
|
186
|
+
echo "Adding $pathname to $toplevel_name"
|
|
187
|
+
echo "$pathname" >> "${toplevel_name}/filelist"
|
|
188
|
+
else
|
|
189
|
+
echo "WARNING!!! Not a file nor a directory (so ignored): $possible_dir"
|
|
190
|
+
fi
|
|
191
|
+
done
|
|
192
|
+
exit 0
|
|
193
|
+
|
|
@@ -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
|
+
|
|
Binary file
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/perl -w
|
|
2
|
+
# modula3_count - count physical lines of code
|
|
3
|
+
# Strips out (* .. *) and counts the rest.
|
|
4
|
+
# Usage: modula3_count [-f file] [list_of_files]
|
|
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
|
+
|
|
9
|
+
$total_sloc = 0;
|
|
10
|
+
|
|
11
|
+
# Do we have "-f" (read list of files from second argument)?
|
|
12
|
+
if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
|
|
13
|
+
# Yes, we have -f
|
|
14
|
+
if ($ARGV[1] eq "-") {
|
|
15
|
+
# The list of files is in STDIN
|
|
16
|
+
while (<STDIN>) {
|
|
17
|
+
chomp ($_);
|
|
18
|
+
&count_file ($_);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
# The list of files is in the file $ARGV[1]
|
|
22
|
+
open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $ARGV[1]\n";
|
|
23
|
+
while (<FILEWITHLIST>) {
|
|
24
|
+
chomp ($_);
|
|
25
|
+
&count_file ($_);
|
|
26
|
+
}
|
|
27
|
+
close FILEWITHLIST;
|
|
28
|
+
}
|
|
29
|
+
shift @ARGV; shift @ARGV;
|
|
30
|
+
}
|
|
31
|
+
# Process all (remaining) arguments as file names
|
|
32
|
+
while ($file = shift @ARGV) {
|
|
33
|
+
&count_file ($file);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
print "Total:\n";
|
|
37
|
+
print "$total_sloc\n";
|
|
38
|
+
|
|
39
|
+
sub count_file {
|
|
40
|
+
my ($file) = @_;
|
|
41
|
+
my $sloc = 0;
|
|
42
|
+
my $incomment = 0;
|
|
43
|
+
|
|
44
|
+
open (FILE, $file);
|
|
45
|
+
while (<FILE>) {
|
|
46
|
+
if ($incomment) {
|
|
47
|
+
if (m/\*\)/) { s/^.*?\*\)//; $incomment = 0;}
|
|
48
|
+
else { s/.*//; }
|
|
49
|
+
}
|
|
50
|
+
if (!$incomment) {
|
|
51
|
+
s!\(\*.*?\*\)!!g;
|
|
52
|
+
if (m/\(\*/) {
|
|
53
|
+
s/\(\*.*//;
|
|
54
|
+
$incomment = 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (m/\S/) {$sloc++;}
|
|
58
|
+
}
|
|
59
|
+
print "$sloc $file\n";
|
|
60
|
+
if ($incomment) {print "ERROR: ended in comment in $file\n";}
|
|
61
|
+
$total_sloc += $sloc;
|
|
62
|
+
$sloc = 0;
|
|
63
|
+
$incomment = 0;
|
|
64
|
+
close (FILE);
|
|
65
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/perl -w
|
|
2
|
+
# objc_count - count physical lines of code
|
|
3
|
+
# Strips out /* .. */ and counts the rest.
|
|
4
|
+
# Usage: objc_count [-f file] [list_of_files]
|
|
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
|
+
|
|
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 $ARGV[1]\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 $incomment = 0;
|
|
66
|
+
|
|
67
|
+
open (FILE, $file);
|
|
68
|
+
while (<FILE>) {
|
|
69
|
+
if ($incomment) {
|
|
70
|
+
if (m/\*\//) { s/^.*?\*\///; $incomment = 0;}
|
|
71
|
+
else { s/.*//; }
|
|
72
|
+
}
|
|
73
|
+
if (!$incomment) {
|
|
74
|
+
# s/\/\*.*?\*\//g;
|
|
75
|
+
s!\/\*.*?\*\/!!g;
|
|
76
|
+
if (m/\/\*/) {
|
|
77
|
+
s/\/\*.*//;
|
|
78
|
+
$incomment = 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (m/\S/) {$sloc++;}
|
|
82
|
+
}
|
|
83
|
+
print "$sloc $file\n";
|
|
84
|
+
if ($incomment) {print "ERROR: ended in comment in $file\n";}
|
|
85
|
+
$total_sloc += $sloc;
|
|
86
|
+
$sloc = 0;
|
|
87
|
+
$incomment = 0;
|
|
88
|
+
close (FILE);
|
|
89
|
+
}
|
|
Binary file
|