summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid A. Wheeler <dwheeler@dwheeler.com>2013-09-02 18:31:59 -0400
committerDavid A. Wheeler <dwheeler@dwheeler.com>2013-09-02 18:31:59 -0400
commit637c21902df679b68c9f11b88ac8c4de3ee18d22 (patch)
tree0f620e465174154fcce0c15ce09d48e46d859ccf
parent7312fc65c427ec193a5e0b3988bbe77e3f5bfd9f (diff)
downloadsloccount-git-637c21902df679b68c9f11b88ac8c4de3ee18d22.tar.gz
Add support for VBScript
- https://sourceforge.net/p/sloccount/patches/9/
-rwxr-xr-xbreak_filelist1
-rw-r--r--makefile1
-rw-r--r--makefile.orig52
-rw-r--r--vbscript_count78
4 files changed, 121 insertions, 11 deletions
diff --git a/break_filelist b/break_filelist
index a6e6d15..3b10299 100755
--- a/break_filelist
+++ b/break_filelist
@@ -206,6 +206,7 @@ $noisy = 0; # Set to 1 if you want noisy reports.
# ???: .pco is Oracle Cobol
"jsp" => "jsp", # Java server pages
"bas" => "vbasic", "frm" => "vbasic", "cls" => "vbasic", "dsr" => "vbasic",
+ "vbs" => "vbscript", "wsh" => "vbscript",
"js" => "javascript",
);
diff --git a/makefile b/makefile
index cc5b21c..aafb5c0 100644
--- a/makefile
+++ b/makefile
@@ -120,6 +120,7 @@ EXECUTABLES= \
sloccount \
sql_count \
tcl_count \
+ vbscript_count \
$(COMPILED_EXECUTABLES)
MANPAGES=sloccount.1.gz
diff --git a/makefile.orig b/makefile.orig
index e2753d8..cc5b21c 100644
--- a/makefile.orig
+++ b/makefile.orig
@@ -1,10 +1,28 @@
# Makefile for SLOCCount.
-# (C) Copyright David A. Wheeler 2000-2002.
-# Licensed under the GPL; see sloccount.html for license information.
+# This is part of SLOCCount, a toolsuite that counts
+# source lines of code (SLOC).
+# Copyright (C) 2001-2004 David A. Wheeler.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# To contact David A. Wheeler, see his website at:
+# http://www.dwheeler.com.
+
# My thanks to John Clezy, who provided the modifications to this makefile
# to make sloccount work on Windows using Cygwin.
-
# You may need to change the following options to install on your machine:
# Set this for where to store the man pages and executables.
@@ -39,15 +57,15 @@ RPMBUILD=rpmbuild -ba
# From here on, nothing should need changing unless you're
# changing the code itself.
-# To change the version #, change VERSION here, sloccount.spec, and
-# sloccount.html.
+# To change the version #, change VERSION here, sloccount.spec,
+# sloccount, and sloccount.html.
# Note to self: to redistribute, do this:
# make distribute; su; make rpm; (test as desired);
# rpm -e sloccount; ^D; make my_install; send to web site.
NAME=sloccount
-VERSION=2.20
+VERSION=2.26
RPM_VERSION=1
ARCH=i386
VERSIONEDNAME=$(NAME)-$(VERSION)
@@ -63,12 +81,14 @@ COMPILED_EXECUTABLES= \
lexcount1$(EXE_SUFFIX) \
pascal_count$(EXE_SUFFIX) \
php_count$(EXE_SUFFIX) \
- jsp_count$(EXE_SUFFIX)
+ jsp_count$(EXE_SUFFIX) \
+ ml_count$(EXE_SUFFIX)
EXECUTABLES= \
ada_count \
asm_count \
awk_count \
+ vbasic_count \
break_filelist \
cobol_count \
compute_all \
@@ -78,15 +98,16 @@ EXECUTABLES= \
csh_count \
exp_count \
fortran_count \
+ f90_count \
generic_count \
get_sloc \
get_sloc_details \
haskell_count \
+ javascript_count \
lex_count \
lisp_count \
make_filelists \
makefile_count \
- ml_count \
modula3_count \
objc_count \
perl_count \
@@ -129,6 +150,9 @@ jsp_count.c: jsp_count.l driver.c driver.h
jsp_count$(EXE_SUFFIX): jsp_count.c
$(CC) jsp_count.c -o jsp_count$(EXE_SUFFIX)
+ml_count$(EXE_SUFFIX): ml_count.c
+ $(CC) ml_count.c -o ml_count$(EXE_SUFFIX)
+
sloccount.1.gz: sloccount.1
gzip -c sloccount.1 > sloccount.1.gz
@@ -147,7 +171,7 @@ install_programs: all
uninstall_programs:
cd $(INSTALL_DIR) && rm -f $(EXECUTABLES)
-install_man:
+install_man: $(MANPAGES)
$(INSTALL_A_DIR) $(MAN_DIR_MAN1)
$(INSTALL) $(MANPAGES) $(MAN_DIR_MAN1)
@@ -159,7 +183,7 @@ install_docs: install_man
$(INSTALL) $(MYDOCS) $(DOC_DIR)
uninstall_docs:
- cd $(DOC_DIR) && rm -f $(MYDOCS) && rmdir $(DOC_DIR)
+ rm -fr $(DOC_DIR)
install: install_programs install_man install_docs
@@ -205,7 +229,6 @@ my_install: distribute
cp -p TODO $(POSTED_DIR)
cp -p /usr/src/redhat/RPMS/$(ARCH)/$(VERSIONEDNAME)-$(RPM_VERSION)*.rpm $(POSTED_DIR)
cp -p /usr/src/redhat/SRPMS/$(VERSIONEDNAME)-$(RPM_VERSION)*.src.rpm $(POSTED_DIR)
-
rpm: distribute
cp $(VERSIONEDNAME).tar.gz /usr/src/redhat/SOURCES
@@ -219,4 +242,11 @@ rpm: distribute
rpm -ivh /usr/src/redhat/RPMS/$(ARCH)/$(VERSIONEDNAME)-$(RPM_VERSION)*.rpm
echo "Use rpm -e $(NAME) to remove the package"
+test: all
+ @echo "Starting test..."
+ PATH=".:${PATH}" ./sloccount testcode
+ @echo "Ending test."
+
+# Support "make check"
+check: test
diff --git a/vbscript_count b/vbscript_count
new file mode 100644
index 0000000..1d0074b
--- /dev/null
+++ b/vbscript_count
@@ -0,0 +1,78 @@
+#!/usr/bin/perl
+# vbscript_count - count physical lines of code in VBScript or Windows ScriptingHost scripts.
+# Usage: vbscript_count [-f file] [list_of_files]
+# file: file with a list of files to count (if "-", read list from stdin)
+# list_of_files: list of files to count
+# -f file or list_of_files can be used, or both
+
+# This is part of SLOCCount, a toolsuite that counts
+# source lines of code (SLOC).
+# Copyright (C) 2008 Sven Strickroth, email@cs-ware.de.
+# Copyright (C) 2001-2004 David A. Wheeler.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# To contact David A. Wheeler, see his website at:
+# http://www.dwheeler.com.
+#
+#
+
+$total_sloc = 0;
+
+# Do we have "-f" (read list of files from second argument)?
+if (($#ARGV >= 1) && ($ARGV[0] eq "-f")) {
+ # Yes, we have -f
+ if ($ARGV[1] eq "-") {
+ # The list of files is in STDIN
+ while (<STDIN>) {
+ chomp ($_);
+ &count_file ($_);
+ }
+ } else {
+ # The list of files is in the file $ARGV[1]
+ open (FILEWITHLIST, $ARGV[1]) || die "Error: Could not open $ARGV[1]\n";
+ while (<FILEWITHLIST>) {
+ chomp ($_);
+ &count_file ($_);
+ }
+ close FILEWITHLIST;
+ }
+ shift @ARGV; shift @ARGV;
+}
+# Process all (remaining) arguments as file names
+while ($file = shift @ARGV) {
+ &count_file ($file);
+}
+
+print "Total:\n";
+print "$total_sloc\n";
+
+sub count_file {
+ my ($file) = @_;
+ my $sloc = 0;
+
+ open (FILE, $file);
+ while (<FILE>) {
+ s/('|Rem ).*//i; # Delete leading comments.
+ if (m/\S/) {$sloc++;}
+
+ }
+ # Show per-file & total; reset $isinpod per file.
+ print "$sloc $file\n";
+ $total_sloc += $sloc;
+ $sloc = 0;
+ close (FILE);
+}
+